From 35228e6d63199278ddc7bb2a4b933d9afe80afd8 Mon Sep 17 00:00:00 2001 From: Graham Date: Fri, 13 Mar 2020 22:03:13 +0000 Subject: [PATCH] Populate bytecodeOffset of definitions created in VarDefinitionHelper --- .../java/decompiler/modules/decompiler/exps/VarExprent.java | 4 ++++ .../modules/decompiler/vars/VarDefinitionHelper.java | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java index d14029c..665b5d1 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java @@ -64,6 +64,10 @@ public class VarExprent extends Exprent { this.bytecodeOffset = bytecodeOffset; } + public int getBytecodeOffset() { + return bytecodeOffset; + } + @Override public VarType getExprType() { return getVarType(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java index 0402097..8bb27e3 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java @@ -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);