|
Groovy 2.2.0 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.ast.CodeVisitorSupport org.codehaus.groovy.ast.ClassCodeVisitorSupport org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor org.codehaus.groovy.transform.sc.StaticCompilationVisitor
public class StaticCompilationVisitor extends StaticTypeCheckingVisitor
This visitor is responsible for amending the AST with static compilation metadata or transform the AST so that a class or a method can be statically compiled. It may also throw errors specific to static compilation which are not considered as an error at the type check pass. For example, usage of spread operator is not allowed in statically compiled portions of code, while it may be statically checked. Static compilation relies on static type checking, which explains why this visitor extends the type checker visitor.
Field Summary | |
---|---|
static MethodNode |
ARRAYLIST_ADD_METHOD
|
static ClassNode |
ARRAYLIST_CLASSNODE
|
static MethodNode |
ARRAYLIST_CONSTRUCTOR
|
Constructor Summary | |
StaticCompilationVisitor(SourceUnit unit, ClassNode node)
|
Method Summary | |
---|---|
protected boolean
|
existsProperty(PropertyExpression pexp, boolean checkForReadOnly, ClassCodeVisitorSupport visitor)
|
protected MethodNode
|
findMethodOrFail(Expression expr, ClassNode receiver, String name, ClassNode... args)
|
protected ClassNode[]
|
getTypeCheckingAnnotations()
|
static boolean
|
isStaticallyCompiled(AnnotatedNode node)
|
void
|
visitClass(ClassNode node)
|
void
|
visitConstructorCallExpression(ConstructorCallExpression call)
|
void
|
visitForLoop(ForStatement forLoop)
|
void
|
visitMethod(MethodNode node)
|
void
|
visitMethodCallExpression(MethodCallExpression call)
|
void
|
visitSpreadExpression(SpreadExpression expression)
|
Field Detail |
---|
public static final MethodNode ARRAYLIST_ADD_METHOD
public static final ClassNode ARRAYLIST_CLASSNODE
public static final MethodNode ARRAYLIST_CONSTRUCTOR
Constructor Detail |
---|
public StaticCompilationVisitor(SourceUnit unit, ClassNode node)
Method Detail |
---|
@Overridefinal ReferencerType = new Reference (objectExpressionType); protected boolean existsProperty(PropertyExpression pexp, boolean checkForReadOnly, ClassCodeVisitorSupport visitor)
@Overrideexpr.putNodeMetaData(BINARY_EXP_TARGET, new Object[] {methodNode, name}); protected MethodNode findMethodOrFail(Expression expr, ClassNode receiver, String name, ClassNode... args)
@Override protected ClassNode[] getTypeCheckingAnnotations()
public static boolean isStaticallyCompiled(AnnotatedNode node)
@Override public void visitClass(ClassNode node)
@Override public void visitConstructorCallExpression(ConstructorCallExpression call)
@Overrideif (!(collectionExpression instanceof ClosureListExpression)) { public void visitForLoop(ForStatement forLoop)
@Override public void visitMethod(MethodNode node)
@Override public void visitMethodCallExpression(MethodCallExpression call)
@Override public void visitSpreadExpression(SpreadExpression expression)
Copyright © 2003-2013 The Codehaus. All rights reserved.