refactor: rename method collectArgsWithoutLoading into collectArgNodes in MethodNode (#2142)
This commit is contained in:
@@ -253,7 +253,7 @@ public class MethodNode extends NotificationAttrNode implements IMethodDetails,
|
||||
return mthInfo.getReturnType().equals(ArgType.VOID);
|
||||
}
|
||||
|
||||
public List<VarNode> collectArgsWithoutLoading() {
|
||||
public List<VarNode> collectArgNodes() {
|
||||
ICodeInfo codeInfo = getTopParentClass().getCode();
|
||||
int mthDefPos = getDefPosition();
|
||||
int lineEndPos = CodeUtils.getLineEndForPos(codeInfo.getCodeStr(), mthDefPos);
|
||||
|
||||
@@ -85,7 +85,7 @@ public final class FridaAction extends JNodeAction {
|
||||
} else {
|
||||
overload = "";
|
||||
}
|
||||
List<String> argNames = mth.collectArgsWithoutLoading().stream()
|
||||
List<String> argNames = mth.collectArgNodes().stream()
|
||||
.map(VarNode::getName).collect(Collectors.toList());
|
||||
String args = String.join(", ", argNames);
|
||||
String logArgs;
|
||||
|
||||
+1
-1
@@ -213,7 +213,7 @@ public class MappingExporter {
|
||||
}
|
||||
// Method args
|
||||
int lvtIndex = mth.getAccessFlags().isStatic() ? 0 : 1;
|
||||
List<VarNode> args = mth.collectArgsWithoutLoading();
|
||||
List<VarNode> args = mth.collectArgNodes();
|
||||
for (VarNode arg : args) {
|
||||
Integer lvIndex = DalvikToJavaBytecodeUtils.getMethodArgLvIndex(arg);
|
||||
if (lvIndex == null) {
|
||||
|
||||
+3
-3
@@ -22,7 +22,7 @@ public class DalvikToJavaBytecodeUtils {
|
||||
if (lvIndex != null) {
|
||||
return lvIndex;
|
||||
}
|
||||
List<VarNode> args = mth.collectArgsWithoutLoading();
|
||||
List<VarNode> args = mth.collectArgNodes();
|
||||
for (VarNode arg : args) {
|
||||
lvIndex = arg.getReg() - args.get(0).getReg() + (mth.getAccessFlags().isStatic() ? 0 : 1);
|
||||
if (arg.equals(methodArg)) {
|
||||
@@ -53,7 +53,7 @@ public class DalvikToJavaBytecodeUtils {
|
||||
return lvIndex;
|
||||
}
|
||||
Integer lastArgLvIndex = mth.getAccessFlags().isStatic() ? -1 : 0;
|
||||
List<VarNode> args = mth.collectArgsWithoutLoading();
|
||||
List<VarNode> args = mth.collectArgNodes();
|
||||
if (!args.isEmpty()) {
|
||||
lastArgLvIndex = getMethodArgLvIndex(args.get(args.size() - 1));
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class DalvikToJavaBytecodeUtils {
|
||||
public static Integer getMethodArgLvtIndex(VarNode methodArg) {
|
||||
MethodNode mth = methodArg.getMth();
|
||||
int lvtIndex = mth.getAccessFlags().isStatic() ? 0 : 1;
|
||||
List<VarNode> args = mth.collectArgsWithoutLoading();
|
||||
List<VarNode> args = mth.collectArgNodes();
|
||||
for (VarNode arg : args) {
|
||||
if (arg.equals(methodArg)) {
|
||||
return lvtIndex;
|
||||
|
||||
@@ -60,7 +60,7 @@ fun generateMethodSnippet(mthNode: MethodNode): String {
|
||||
""
|
||||
}
|
||||
val shortClassName = mthNode.parentClass.name
|
||||
val argNames = mthNode.collectArgsWithoutLoading().map { a -> a.name }
|
||||
val argNames = mthNode.collectArgNodes().map { a -> a.name }
|
||||
val args = argNames.joinToString(separator = ", ")
|
||||
val logArgs = if (argNames.isNotEmpty()) {
|
||||
argNames.joinToString(separator = " + ', ' + ", prefix = " + ', ' + ") { p -> "'$p: ' + $p" }
|
||||
|
||||
Reference in New Issue
Block a user