Package org.apache.groovy.ast.builder
Class AstBuilderTransformation
java.lang.Object
org.codehaus.groovy.ast.MethodCallTransformation
org.apache.groovy.ast.builder.AstBuilderTransformation
- All Implemented Interfaces:
ASTTransformation
Transformation to capture ASTBuilder from code statements.
The AstBuilder "from code" approach is used with a single Closure parameter. This transformation converts the ClosureExpression back into source code and rewrites the AST so that the "from string" builder is invoked on the source. In order for this to work, the closure source must be given a goto label. It is the "from string" approach's responsibility to remove the BlockStatement created by the label.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected GroovyCodeVisitorgetTransformer(ASTNode[] nodes, SourceUnit sourceUnit) Creates the visitor that rewritesAstBuilderclosure invocations into string-based builder calls.Methods inherited from class org.codehaus.groovy.ast.MethodCallTransformation
visit
-
Constructor Details
-
AstBuilderTransformation
public AstBuilderTransformation()
-
-
Method Details
-
getTransformer
Creates the visitor that rewritesAstBuilderclosure invocations into string-based builder calls.- Specified by:
getTransformerin classMethodCallTransformation- Parameters:
nodes- the AST nodes being transformedsourceUnit- the source unit currently under compilation- Returns:
- the visitor that performs the rewrite
-