Split transformMethod into {pre,post}TransformMethod

bzip2
Graham 5 years ago
parent 145ed6b1ee
commit d20e3997b4
  1. 10
      asm/src/main/java/dev/openrs2/asm/transform/Transformer.java
  2. 2
      deob/src/main/java/dev/openrs2/deob/transform/OriginalNameTransformer.java

@ -26,11 +26,13 @@ public abstract class Transformer {
}
for (var method : clazz.methods) {
changed |= transformMethod(classPath, library, clazz, method);
changed |= preTransformMethod(classPath, library, clazz, method);
if ((method.access & (Opcodes.ACC_NATIVE | Opcodes.ACC_ABSTRACT)) == 0) {
changed |= transformCode(classPath, library, clazz, method);
}
changed |= postTransformMethod(classPath, library, clazz, method);
}
}
}
@ -56,7 +58,7 @@ public abstract class Transformer {
return false;
}
protected boolean transformMethod(ClassPath classPath, Library library, ClassNode clazz, MethodNode method) throws AnalyzerException {
protected boolean preTransformMethod(ClassPath classPath, Library library, ClassNode clazz, MethodNode method) throws AnalyzerException {
return false;
}
@ -64,6 +66,10 @@ public abstract class Transformer {
return false;
}
protected boolean postTransformMethod(ClassPath classPath, Library library, ClassNode clazz, MethodNode method) throws AnalyzerException {
return false;
}
protected void postPass(ClassPath classPath) throws AnalyzerException {
/* empty */
}

@ -61,7 +61,7 @@ public final class OriginalNameTransformer extends Transformer {
@SuppressWarnings("unchecked")
@Override
public boolean transformMethod(ClassPath classPath, Library library, ClassNode clazz, MethodNode method) {
public boolean preTransformMethod(ClassPath classPath, Library library, ClassNode clazz, MethodNode method) {
if (method.name.equals("<init>") || method.name.equals("<clinit>")) {
return false;
}

Loading…
Cancel
Save