Place @Pc annotations on the same line as variable declarations

This is much more readable than placing them on a separate line.

Signed-off-by: Graham <gpe@openrs2.dev>
bzip2
Graham 5 years ago
parent 7650470143
commit b9c707782c
  1. 7
      deob-ast/src/main/java/dev/openrs2/deob/ast/AstDeobfuscator.kt

@ -79,7 +79,7 @@ class AstDeobfuscator(private val modules: List<Path>) {
}
for (root in roots) {
root.printer = Function(printer::print)
root.printer = Function<CompilationUnit, String>(printer::print).andThen(::stripNewlineAfterPcAnnotation)
root.saveAll()
}
}
@ -102,5 +102,10 @@ class AstDeobfuscator(private val modules: List<Path>) {
GlTransformer(),
EncloseTransformer()
)
private val PC_ANNOTATION_REGEX = Regex("@Pc\\(([0-9]+)\\)\\s+")
private fun stripNewlineAfterPcAnnotation(s: String): String {
return s.replace(PC_ANNOTATION_REGEX, "@Pc($1) ")
}
}
}

Loading…
Cancel
Save