Commit 653bb2ac authored by Skylot's avatar Skylot

fix: hide first argument instead remove for constructor in inner class

parent cbdc2496
......@@ -262,6 +262,7 @@ public class ClassGen {
code.newLine().addMultiLine(Utils.getStackTrace(e));
code.newLine().add("*/");
code.setIndent(savedIndent);
mth.addError("Method generation error: " + e.getMessage(), e);
}
}
}
......
......@@ -116,6 +116,8 @@ public class MethodGen {
} else {
mth.addComment("JADX WARN: Incorrect number of args for enum constructor: " + args.size() + " (expected >= 2)");
}
} else if (mth.contains(AFlag.SKIP_FIRST_ARG)) {
args = args.subList(1, args.size());
}
addMethodArguments(code, args);
code.add(')');
......
......@@ -82,12 +82,7 @@ public class SSAVar extends AttrNode {
}
public void removeUse(RegisterArg arg) {
for (int i = 0, useListSize = useList.size(); i < useListSize; i++) {
if (useList.get(i) == arg) {
useList.remove(i);
break;
}
}
useList.removeIf(registerArg -> registerArg == arg);
}
public void setUsedInPhi(@Nullable PhiInsn usedInPhi) {
......
......@@ -248,9 +248,8 @@ public class MethodNode extends LineAttrNode implements ILoadable, ICodeNode {
return argsList;
}
public RegisterArg removeFirstArgument() {
public void skipFirstArgument() {
this.add(AFlag.SKIP_FIRST_ARG);
return argsList.remove(0);
}
@Nullable
......
......@@ -120,7 +120,7 @@ public class ClassModifier extends AbstractVisitor {
if (!fieldInfo.equals(field.getFieldInfo()) || !putInsn.getArg(0).equals(arg)) {
return false;
}
mth.removeFirstArgument();
mth.skipFirstArgument();
InstructionRemover.remove(mth, block, insn);
// other arg usage -> wrap with IGET insn
if (arg.getSVar().getUseCount() != 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment