Skip to content

Commit

Permalink
Migrate to .param syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
ThexXTURBOXx committed Aug 9, 2021
1 parent 8bf6149 commit 9f1e5d8
Showing 1 changed file with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ public void baksmaliMethod(DexMethodNode m, Out out) {
buff.append(".method ");
Method method = m.method;
appendAccess(m.access, buff);
int register = (m.access & ACC_STATIC) != 0 ? 0 : 1;
buff.append(escapeId(method.getName())).append(escapeMethodDesc(method));
out.s(buff.toString());
out.push();
Expand Down Expand Up @@ -470,18 +471,22 @@ public void baksmaliMethod(DexMethodNode m, Out out) {
String type = method.getParameterTypes()[i];
String debugName = parameterNames == null ? null : i < parameterNames.size() ? parameterNames.get(i) : null;
if (debugName != null) {
out.s(".parameter \"" + escapeId(debugName) + "\" # " + type);
out.s(".param p" + register++ + ", \"" + escapeId(debugName) + "\" # " + type);
} else {
out.s(".parameter # " + type);
out.s(".param p" + register++ + " # " + type);
}

if (isWideType(type)) {
register++;
}

List<DexAnnotationNode> ps = m.parameterAnns == null ? null : m.parameterAnns[i];
if (ps != null && ps.size() != 0) {
if (ps != null && !ps.isEmpty()) {
out.push();
dumpAnns(ps, out);
out.pop();
out.s(".end parameter");
out.s(".end param");
}
// FIXME support '.param' REGISTER, STRING
}

if (m.codeNode != null) {
Expand All @@ -492,6 +497,13 @@ public void baksmaliMethod(DexMethodNode m, Out out) {
out.s(".end method");
}

private static boolean isWideType(String type) {
if (type == null || type.isEmpty())
return false;
char c = type.charAt(0);
return c == 'J' || c == 'D';
}

public void baksmaliCode(DexMethodNode methodNode, DexCodeNode codeNode, Out out) {

final List<DexLabel> allLabel = new ArrayList<>();
Expand Down

0 comments on commit 9f1e5d8

Please sign in to comment.