Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
We can use AstStringCompiler to construct AST in Java code, it will be especially useful when we want to implement AST transformations in groovy core and generate complicated bytecode. For example,
AsmClassGenerator acg = controller.getAcg(); // Using text block in Java 13(preview) new AstStringCompiler().compile(""" if ('a' == x) { ... } else { ... } """).get(0).visit(acg);
So we do not have to contruct AST with util methods of GeneralUtils any more.