mirror of
https://github.com/revanced/smali.git
synced 2025-05-08 10:24:31 +02:00
Refactor the writeParameters method a bit
- Accepts a method instead of the parameter list directly - Uses the correct pN register values for non-static vs. static methods - Adds a space after the # for the type comment
This commit is contained in:
parent
db4316ef6d
commit
c3a3ee3799
@ -113,7 +113,7 @@ public class MethodDefinition {
|
||||
writer.write('\n');
|
||||
|
||||
writer.indent(4);
|
||||
writeParameters(writer, method.getParameters());
|
||||
writeParameters(writer, method);
|
||||
AnnotationFormatter.writeTo(writer, method.getAnnotations());
|
||||
writer.deindent(4);
|
||||
writer.write(".end method\n");
|
||||
@ -150,7 +150,7 @@ public class MethodDefinition {
|
||||
writer.printSignedIntAsDec(methodImpl.getRegisterCount());
|
||||
}
|
||||
writer.write('\n');
|
||||
writeParameters(writer, method.getParameters());
|
||||
writeParameters(writer, method);
|
||||
|
||||
if (registerFormatter == null) {
|
||||
registerFormatter = new RegisterFormatter(methodImpl.getRegisterCount(), parameterRegisterCount);
|
||||
@ -202,10 +202,10 @@ public class MethodDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
private static void writeParameters(IndentingWriter writer,
|
||||
List<? extends MethodParameter> parameters) throws IOException {
|
||||
int registerNumber = 0;
|
||||
for (MethodParameter parameter: parameters) {
|
||||
private static void writeParameters(IndentingWriter writer, Method method) throws IOException {
|
||||
boolean isStatic = AccessFlags.STATIC.isSet(method.getAccessFlags());
|
||||
int registerNumber = isStatic?0:1;
|
||||
for (MethodParameter parameter: method.getParameters()) {
|
||||
String parameterType = parameter.getType();
|
||||
String parameterName = parameter.getName();
|
||||
List<? extends Annotation> annotations = parameter.getAnnotations();
|
||||
|
Loading…
x
Reference in New Issue
Block a user