|
Groovy Documentation | |||||||
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
|
Fields inherited from class StaticTypeCheckingVisitor | |
---|---|
CLOSURE_CALL_NO_ARG, CLOSURE_CALL_ONE_ARG, CLOSURE_CALL_VARGS |
Constructor Summary | |
StaticCompilationVisitor(SourceUnit unit, ClassNode node, TypeCheckerPluginFactory pluginFactory)
|
Method Summary | |
---|---|
protected boolean
|
existsProperty(PropertyExpression pexp, boolean checkForReadOnly, ClassCodeVisitorSupport visitor)
|
protected MethodNode
|
findMethodOrFail(Expression expr, ClassNode receiver, java.lang.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, TypeCheckerPluginFactory pluginFactory)
Method Detail |
---|
if (StaticTypeCheckingSupport.implementsInterfaceOrIsSubclassOf(objectExpressionType, ClassHelper.LIST_TYPE)) { protected boolean existsProperty(PropertyExpression pexp, boolean checkForReadOnly, ClassCodeVisitorSupport visitor)
return methodNode; protected MethodNode findMethodOrFail(Expression expr, ClassNode receiver, java.lang.String name, ClassNode... args)
@Override protected ClassNode[] getTypeCheckingAnnotations()
public static boolean isStaticallyCompiled(AnnotatedNode node)
@Override public void visitClass(ClassNode node)
if (target==null && call.getLineNumber()>0) { public void visitConstructorCallExpression(ConstructorCallExpression call)
ClassNode componentType = inferLoopElementType(collectionType); public void visitForLoop(ForStatement forLoop)
@Override public void visitMethod(MethodNode node)
public void visitMethodCallExpression(MethodCallExpression call)
} public void visitSpreadExpression(SpreadExpression expression)
Groovy Documentation