Package org.codehaus.groovy.control
Class ResolveVisitor
- java.lang.Object
-
- org.codehaus.groovy.ast.CodeVisitorSupport
-
- org.codehaus.groovy.ast.ClassCodeVisitorSupport
-
- org.codehaus.groovy.ast.ClassCodeExpressionTransformer
-
- org.codehaus.groovy.control.ResolveVisitor
-
- All Implemented Interfaces:
ExpressionTransformer
,GroovyClassVisitor
,GroovyCodeVisitor
,ErrorCollecting
- Direct Known Subclasses:
JavaAwareResolveVisitor
public class ResolveVisitor extends ClassCodeExpressionTransformer
Visitor to resolve Types and convert VariableExpression to ClassExpressions if needed. The ResolveVisitor will try to find the Class for a ClassExpression and prints an error if it fails to do so. Constructions like C[], foo as C, (C) foo will force creation of a ClassExpression for CNote: the method to start the resolving is startResolving(ClassNode, SourceUnit).
-
-
Field Summary
Fields Modifier and Type Field Description static String[]
DEFAULT_IMPORTS
static String[]
EMPTY_STRING_ARRAY
static String
QUESTION_MARK
-
Constructor Summary
Constructors Constructor Description ResolveVisitor(CompilationUnit cu)
-
Method Summary
-
Methods inherited from class org.codehaus.groovy.ast.ClassCodeExpressionTransformer
visitAssertStatement, visitCaseStatement, visitDoWhileLoop, visitExpressionStatement, visitIfElse, visitReturnStatement, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitWhileLoop
-
Methods inherited from class org.codehaus.groovy.ast.ClassCodeVisitorSupport
addError, visitBreakStatement, visitClassCodeContainer, visitConstructor, visitContinueStatement, visitDeclarationExpression, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitStatement, visitTryCatchFinally
-
Methods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport
visitArgumentlistExpression, visitArrayExpression, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitCastExpression, visitClassExpression, visitClosureExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitEmptyStatement, visitFieldExpression, visitGStringExpression, visitListExpression, visitListOfExpressions, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitTernaryExpression, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression
-
-
-
-
Field Detail
-
DEFAULT_IMPORTS
public static final String[] DEFAULT_IMPORTS
-
QUESTION_MARK
public static final String QUESTION_MARK
- See Also:
- Constant Field Values
-
EMPTY_STRING_ARRAY
public static final String[] EMPTY_STRING_ARRAY
-
-
Constructor Detail
-
ResolveVisitor
public ResolveVisitor(CompilationUnit cu)
-
-
Method Detail
-
startResolving
public void startResolving(ClassNode node, SourceUnit source)
-
visitConstructorOrMethod
protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor)
- Overrides:
visitConstructorOrMethod
in classClassCodeExpressionTransformer
-
visitField
public void visitField(FieldNode node)
Description copied from interface:GroovyClassVisitor
Visit a FieldNode.- Specified by:
visitField
in interfaceGroovyClassVisitor
- Overrides:
visitField
in classClassCodeExpressionTransformer
-
visitProperty
public void visitProperty(PropertyNode node)
Description copied from interface:GroovyClassVisitor
Visit a PropertyNode.- Specified by:
visitProperty
in interfaceGroovyClassVisitor
- Overrides:
visitProperty
in classClassCodeExpressionTransformer
-
transform
public Expression transform(Expression exp)
Description copied from interface:ExpressionTransformer
Transforms the given expression into another expression- Specified by:
transform
in interfaceExpressionTransformer
- Overrides:
transform
in classClassCodeExpressionTransformer
-
transformPropertyExpression
protected Expression transformPropertyExpression(PropertyExpression pe)
-
transformVariableExpression
protected Expression transformVariableExpression(VariableExpression ve)
-
transformBinaryExpression
protected Expression transformBinaryExpression(BinaryExpression be)
-
transformClosureExpression
protected Expression transformClosureExpression(ClosureExpression ce)
-
transformConstructorCallExpression
protected Expression transformConstructorCallExpression(ConstructorCallExpression cce)
-
transformMethodCallExpression
protected Expression transformMethodCallExpression(MethodCallExpression mce)
-
transformDeclarationExpression
protected Expression transformDeclarationExpression(DeclarationExpression de)
-
transformAnnotationConstantExpression
protected Expression transformAnnotationConstantExpression(AnnotationConstantExpression ace)
-
visitAnnotations
public void visitAnnotations(AnnotatedNode node)
- Overrides:
visitAnnotations
in classClassCodeExpressionTransformer
-
visitClass
public void visitClass(ClassNode node)
Description copied from interface:GroovyClassVisitor
Visit a ClassNode.- Specified by:
visitClass
in interfaceGroovyClassVisitor
- Overrides:
visitClass
in classClassCodeVisitorSupport
-
visitCatchStatement
public void visitCatchStatement(CatchStatement cs)
- Specified by:
visitCatchStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitCatchStatement
in classClassCodeVisitorSupport
-
visitForLoop
public void visitForLoop(ForStatement forLoop)
- Specified by:
visitForLoop
in interfaceGroovyCodeVisitor
- Overrides:
visitForLoop
in classClassCodeExpressionTransformer
-
visitBlockStatement
public void visitBlockStatement(BlockStatement block)
- Specified by:
visitBlockStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitBlockStatement
in classClassCodeVisitorSupport
-
getSourceUnit
protected SourceUnit getSourceUnit()
- Specified by:
getSourceUnit
in classClassCodeVisitorSupport
-
setClassNodeResolver
public void setClassNodeResolver(ClassNodeResolver classNodeResolver)
-
-