Populate bytecodeOffset of definitions created in VarDefinitionHelper

master
Graham 5 years ago
parent b4c1bab1b6
commit 35228e6d63
  1. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java
  2. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java

@ -64,6 +64,10 @@ public class VarExprent extends Exprent {
this.bytecodeOffset = bytecodeOffset;
}
public int getBytecodeOffset() {
return bytecodeOffset;
}
@Override
public VarType getExprType() {
return getVarType();

@ -160,6 +160,7 @@ public class VarDefinitionHelper {
// search for the first assignment to var [index]
int addindex = 0;
int bytecodeOffset = -1;
for (Exprent expr : lst) {
if (setDefinition(expr, index)) {
defset = true;
@ -170,6 +171,7 @@ public class VarDefinitionHelper {
for (Exprent exp : expr.getAllExprents(true)) {
if (exp.type == Exprent.EXPRENT_VAR && ((VarExprent)exp).getIndex() == index) {
foundvar = true;
bytecodeOffset = ((VarExprent) exp).getBytecodeOffset();
break;
}
}
@ -181,7 +183,7 @@ public class VarDefinitionHelper {
}
if (!defset) {
VarExprent var = new VarExprent(index, varproc.getVarType(new VarVersionPair(index.intValue(), 0)), varproc);
VarExprent var = new VarExprent(index, varproc.getVarType(new VarVersionPair(index.intValue(), 0)), varproc, -1, bytecodeOffset);
var.setDefinition(true);
lst.add(addindex, var);

Loading…
Cancel
Save