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; this.bytecodeOffset = bytecodeOffset;
} }
public int getBytecodeOffset() {
return bytecodeOffset;
}
@Override @Override
public VarType getExprType() { public VarType getExprType() {
return getVarType(); return getVarType();

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

Loading…
Cancel
Save