Add {pre,post}Pass methods to Transformer

master
Graham 5 years ago
parent a4c6c4774a
commit fc95d5086c
  1. 22
      asm/src/main/java/dev/openrs2/asm/transform/Transformer.java

@ -15,6 +15,7 @@ public abstract class Transformer {
do { do {
changed = false; changed = false;
prePass(classPath);
for (var library : classPath.getLibraries()) { for (var library : classPath.getLibraries()) {
for (var clazz : library) { for (var clazz : library) {
changed |= transformClass(clazz); changed |= transformClass(clazz);
@ -32,32 +33,41 @@ public abstract class Transformer {
} }
} }
} }
postPass(classPath);
} while (changed); } while (changed);
postTransform(classPath); postTransform(classPath);
} }
public void preTransform(ClassPath classPath) throws AnalyzerException { protected void preTransform(ClassPath classPath) throws AnalyzerException {
/* empty */ /* empty */
} }
public boolean transformClass(ClassNode clazz) throws AnalyzerException { protected void prePass(ClassPath classPath) throws AnalyzerException {
/* empty */
}
protected boolean transformClass(ClassNode clazz) throws AnalyzerException {
return false; return false;
} }
public boolean transformField(ClassNode clazz, FieldNode field) throws AnalyzerException { protected boolean transformField(ClassNode clazz, FieldNode field) throws AnalyzerException {
return false; return false;
} }
public boolean transformMethod(ClassNode clazz, MethodNode method) throws AnalyzerException { protected boolean transformMethod(ClassNode clazz, MethodNode method) throws AnalyzerException {
return false; return false;
} }
public boolean transformCode(ClassNode clazz, MethodNode method) throws AnalyzerException { protected boolean transformCode(ClassNode clazz, MethodNode method) throws AnalyzerException {
return false; return false;
} }
public void postTransform(ClassPath classPath) throws AnalyzerException { protected void postPass(ClassPath classPath) throws AnalyzerException {
/* empty */
}
protected void postTransform(ClassPath classPath) throws AnalyzerException {
/* empty */ /* empty */
} }
} }

Loading…
Cancel
Save