Skip to content

Commit

Permalink
fixing #44
Browse files Browse the repository at this point in the history
  • Loading branch information
phtcosta committed Dec 2, 2021
1 parent 70886e9 commit 505dc7d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/main/java/lang/jimple/internal/Decompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,14 @@ private void visitMethod(MethodNode mn) {

boolean isStatic = methodModifiers.contains(Modifier.Static());

Map<LocalVariableNode, LocalVariableDeclaration> localVariables = visitLocalVariables(isStatic,
methodFormalArgs.size(), mn.localVariables);
Map<LocalVariableNode, LocalVariableDeclaration> localVariables = visitLocalVariables(isStatic, mn.localVariables);

List<LocalVariableDeclaration> decls = new ArrayList<>();
List<Statement> stmts = new ArrayList<>();
List<CatchClause> catchClauses = visitTryCatchBlocks(mn.tryCatchBlocks);

InstructionSetVisitor insVisitor = new InstructionSetVisitor(Opcodes.ASM5, localVariables, catchClauses);

//insVisitor.initFormalArgs(isStatic, this.type, localVariables.isEmpty(), methodFormalArgs);
insVisitor.initFormalArgs(isStatic, this.type, localVariables.isEmpty(), methodFormalArgs, mn.localVariables);

mn.instructions.accept(insVisitor);
Expand Down Expand Up @@ -255,9 +253,7 @@ public FieldVisitor visitField(int access, String name, String descriptor, Strin
return super.visitField(access, name, descriptor, signature, value);
}

//TODO remove: int formals ... not used
private Map<LocalVariableNode, LocalVariableDeclaration> visitLocalVariables(boolean isStatic, int formals,
List<LocalVariableNode> nodes) {
private Map<LocalVariableNode, LocalVariableDeclaration> visitLocalVariables(boolean isStatic, List<LocalVariableNode> nodes) {
Map<LocalVariableNode, LocalVariableDeclaration> localVariables = new HashMap<>();

int idx = 1;
Expand Down Expand Up @@ -1719,7 +1715,6 @@ public void initFormalArgs(boolean staticMethod, Type classType, boolean emptyLo

int idx = 0;
for (Type t : formals) {
//TODO da um erro estranho no teste TestDecompiler.decompileAndroidClass() se nao tiver a segunda condicao
if(keepOriginalVarNames && idx < localVariableNodes.size()) {
String name = (!staticMethod) ? localVariableNodes.get(idx+1).name : localVariableNodes.get(idx).name;
env.instructions.add(Statement.identity(name, LOCAL_PARAMETER_PREFIX + idx, t));
Expand Down

0 comments on commit 505dc7d

Please sign in to comment.