do not process vars if there were errors in the method

master
Egor.Ushakov 8 years ago
parent 7041accfe9
commit 0b442fc64b
  1. 52
      src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java

@ -158,31 +158,33 @@ public class ClassWrapper {
methods.addWithKey(methodWrapper, InterpreterUtil.makeUniqueKey(mt.getName(), mt.getDescriptor())); methods.addWithKey(methodWrapper, InterpreterUtil.makeUniqueKey(mt.getName(), mt.getDescriptor()));
// rename vars so that no one has the same name as a field if (!isError) {
varProc.refreshVarNames(new VarNamesCollector(setFieldNames)); // rename vars so that no one has the same name as a field
varProc.refreshVarNames(new VarNamesCollector(setFieldNames));
// if debug information present and should be used
if (DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_VAR_NAMES)) { // if debug information present and should be used
StructLocalVariableTableAttribute attr = mt.getLocalVariableAttr(); if (DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_VAR_NAMES)) {
if (attr != null) { StructLocalVariableTableAttribute attr = mt.getLocalVariableAttr();
// only param names here if (attr != null) {
varProc.setDebugVarNames(attr.getMapParamNames()); // only param names here
varProc.setDebugVarNames(attr.getMapParamNames());
// the rest is here
methodWrapper.getOrBuildGraph().iterateExprents(exprent -> { // the rest is here
List<Exprent> lst = exprent.getAllExprents(true); methodWrapper.getOrBuildGraph().iterateExprents(exprent -> {
lst.add(exprent); List<Exprent> lst = exprent.getAllExprents(true);
lst.stream() lst.add(exprent);
.filter(e -> e.type == Exprent.EXPRENT_VAR) lst.stream()
.forEach(e -> { .filter(e -> e.type == Exprent.EXPRENT_VAR)
VarExprent varExprent = (VarExprent)e; .forEach(e -> {
String name = varExprent.getDebugName(mt); VarExprent varExprent = (VarExprent)e;
if (name != null) { String name = varExprent.getDebugName(mt);
varProc.setVarName(varExprent.getVarVersionPair(), name); if (name != null) {
} varProc.setVarName(varExprent.getVarVersionPair(), name);
}); }
return 0; });
}); return 0;
});
}
} }
} }

Loading…
Cancel
Save