Class StaticCompilationTransformer
java.lang.Object
org.codehaus.groovy.ast.CodeVisitorSupport
org.codehaus.groovy.ast.ClassCodeVisitorSupport
org.codehaus.groovy.ast.ClassCodeExpressionTransformer
org.codehaus.groovy.transform.sc.transformers.StaticCompilationTransformer
- All Implemented Interfaces:
ExpressionTransformer
,GroovyClassVisitor
,GroovyCodeVisitor
,ErrorCollecting
Some expressions use symbols as aliases to method calls (<<, +=, ...). In static compilation,
if such a method call is found, we transform the original binary expression into a method
call expression so that the call gets statically compiled.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final ClassNode
protected static final Map<Integer,
MethodNode> -
Constructor Summary
ConstructorDescriptionStaticCompilationTransformer
(SourceUnit unit, StaticTypeCheckingVisitor visitor) -
Method Summary
Modifier and TypeMethodDescriptionprotected SourceUnit
transform
(Expression expr) NOTE: This method does not visit Expressions within Closures, for performance and historical reasons.void
visitClass
(ClassNode node) Visit a ClassNode.void
protected void
visitConstructorOrMethod
(MethodNode node, boolean isConstructor) Methods inherited from class org.codehaus.groovy.ast.ClassCodeExpressionTransformer
setSourcePosition, visitAnnotation, visitAssertStatement, visitCaseStatement, visitClosureExpression, visitDoWhileLoop, visitExpressionStatement, visitField, visitForLoop, visitIfElse, visitProperty, visitReturnStatement, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitWhileLoop
Methods inherited from class org.codehaus.groovy.ast.ClassCodeVisitorSupport
addError, visitAnnotations, visitAnnotations, visitBlockStatement, visitBreakStatement, visitCatchStatement, visitConstructor, visitContinueStatement, visitDeclarationExpression, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitStatement, visitTryCatchFinally
Methods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport
afterSwitchCaseStatementsVisited, afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitCastExpression, visitClassExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitEmptyStatement, visitFieldExpression, visitGStringExpression, visitLambdaExpression, visitListExpression, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitMethodReferenceExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitTernaryExpression, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.codehaus.groovy.ast.GroovyCodeVisitor
visit, visit, visitEmptyExpression, visitListOfExpressions
-
Field Details
-
BYTECODE_ADAPTER_CLASS
-
BYTECODE_BINARY_ADAPTERS
-
-
Constructor Details
-
StaticCompilationTransformer
-
-
Method Details
-
getSourceUnit
- Specified by:
getSourceUnit
in classClassCodeVisitorSupport
-
getTypeChooser
-
getClassNode
-
visitClassCodeContainer
- Overrides:
visitClassCodeContainer
in classClassCodeVisitorSupport
-
transform
Description copied from class:ClassCodeExpressionTransformer
NOTE: This method does not visit Expressions within Closures, for performance and historical reasons. If you want those Expressions to be visited, you can do this:public class YourTransformer extends ClassCodeExpressionTransformer { ... @Override public Expression transform(final Expression expr) { if (expr instanceof ClosureExpression) { expr.visit(this); return expr; } // ... } }
- Specified by:
transform
in interfaceExpressionTransformer
- Overrides:
transform
in classClassCodeExpressionTransformer
-
visitClass
Description copied from interface:GroovyClassVisitor
Visit a ClassNode.- Specified by:
visitClass
in interfaceGroovyClassVisitor
- Overrides:
visitClass
in classClassCodeVisitorSupport
-
visitConstructorOrMethod
- Overrides:
visitConstructorOrMethod
in classClassCodeExpressionTransformer
-