|
|
@ -59,20 +59,26 @@ class AstDeobfuscator(private val modules: List<Path>) { |
|
|
|
|
|
|
|
|
|
|
|
val printer = PrettyPrinter(printerConfig) |
|
|
|
val printer = PrettyPrinter(printerConfig) |
|
|
|
|
|
|
|
|
|
|
|
for (module in modules) { |
|
|
|
val roots = modules.map { SourceRoot(it, config) } |
|
|
|
val root = SourceRoot(module, config) |
|
|
|
val units = mutableMapOf<String, CompilationUnit>() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (root in roots) { |
|
|
|
val results = root.tryToParseParallelized() |
|
|
|
val results = root.tryToParseParallelized() |
|
|
|
for (result in results) { |
|
|
|
for (result in results) { |
|
|
|
require(result.isSuccessful) { result } |
|
|
|
require(result.isSuccessful) { result } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (unit in root.compilationUnits) { |
|
|
|
for (unit in root.compilationUnits) { |
|
|
|
for (transformer in TRANSFORMERS) { |
|
|
|
val name = unit.primaryType.orElseThrow().fullyQualifiedName.orElseThrow() |
|
|
|
transformer.transform(unit) |
|
|
|
units[name] = unit |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (transformer in TRANSFORMERS) { |
|
|
|
|
|
|
|
transformer.transform(units) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (root in roots) { |
|
|
|
root.printer = Function<CompilationUnit, String>(printer::print) |
|
|
|
root.printer = Function<CompilationUnit, String>(printer::print) |
|
|
|
root.saveAll() |
|
|
|
root.saveAll() |
|
|
|
} |
|
|
|
} |
|
|
|