Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
@ASTTest allows checking the state of the AST at one phase, but sometimes it would be nice to do the same at various phases. It would be nice to check that if "phase" is absent, then it means run at all phases.
An example:
import groovy.transform.ASTTest import groovy.transform.CompileStatic import groovy.transform.Immutable import org.codehaus.groovy.ast.ClassNode import org.codehaus.groovy.control.CompilePhase @ASTTest(value={ println "Compile phase: $compilePhase" ClassNode cn = node System.err.println "Global AST xforms: ${compilationUnit.ASTTransformationsContext.globalTransformNames}" CompilePhase.values().each { def transforms = cn.getTransforms(it) if (transforms) { System.err.println "Ast xforms for phase $it:" transforms.each { map -> System.err.println(map) } } } }) @CompileStatic @Immutable class Foo { }