From 505dc7d0d41903bda7944216424196836d486b6a Mon Sep 17 00:00:00 2001 From: Pedro Costa Date: Thu, 2 Dec 2021 09:10:20 -0300 Subject: [PATCH] fixing #44 --- src/main/java/lang/jimple/internal/Decompiler.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/lang/jimple/internal/Decompiler.java b/src/main/java/lang/jimple/internal/Decompiler.java index ebd56776..33dfd15d 100644 --- a/src/main/java/lang/jimple/internal/Decompiler.java +++ b/src/main/java/lang/jimple/internal/Decompiler.java @@ -209,8 +209,7 @@ private void visitMethod(MethodNode mn) { boolean isStatic = methodModifiers.contains(Modifier.Static()); - Map localVariables = visitLocalVariables(isStatic, - methodFormalArgs.size(), mn.localVariables); + Map localVariables = visitLocalVariables(isStatic, mn.localVariables); List decls = new ArrayList<>(); List stmts = new ArrayList<>(); @@ -218,7 +217,6 @@ private void visitMethod(MethodNode mn) { 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); @@ -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 visitLocalVariables(boolean isStatic, int formals, - List nodes) { + private Map visitLocalVariables(boolean isStatic, List nodes) { Map localVariables = new HashMap<>(); int idx = 1; @@ -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));