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
public class StaticCompilationTransformer extends ClassCodeExpressionTransformer
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
Fields Modifier and Type Field Description protected static ClassNode
BYTECODE_ADAPTER_CLASS
protected static java.util.Map<java.lang.Integer,MethodNode>
BYTECODE_BINARY_ADAPTERS
-
Constructor Summary
Constructors Constructor Description StaticCompilationTransformer(SourceUnit unit, StaticTypeCheckingVisitor visitor)
-
Method Summary
Modifier and Type Method Description ClassNode
getClassNode()
protected SourceUnit
getSourceUnit()
StaticTypesTypeChooser
getTypeChooser()
Expression
transform(Expression expr)
Transforms the given expression into another expressionvoid
visitClass(ClassNode node)
Visit a ClassNode.void
visitClassCodeContainer(Statement code)
protected void
visitConstructorOrMethod(MethodNode node, boolean isConstructor)
Methods inherited from class org.codehaus.groovy.ast.ClassCodeExpressionTransformer
setSourcePosition, visitAnnotation, visitAssertStatement, visitCaseStatement, visitDoWhileLoop, visitExpressionStatement, visitField, visitForLoop, visitIfElse, visitProperty, visitReturnStatement, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitWhileLoop
Methods inherited from class org.codehaus.groovy.ast.ClassCodeVisitorSupport
addError, visitAnnotations, visitBlockStatement, visitBreakStatement, visitCatchStatement, visitConstructor, visitContinueStatement, visitDeclarationExpression, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitStatement, visitTryCatchFinally
Methods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport
afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitCastExpression, visitClassExpression, visitClosureExpression, 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
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 interface:ExpressionTransformer
Transforms the given expression into another expression- 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
-