Class ContextualClassCodeVisitor
java.lang.Object
org.codehaus.groovy.ast.CodeVisitorSupport
org.codehaus.groovy.ast.ClassCodeVisitorSupport
org.codehaus.groovy.macro.matcher.ContextualClassCodeVisitor
- All Implemented Interfaces:
GroovyClassVisitor
,GroovyCodeVisitor
,ErrorCollecting
public abstract class ContextualClassCodeVisitor extends ClassCodeVisitorSupport
A class code visitor which is capable of remembering the context of the current
visit. This makes it easier for subclasses to perform context-dependent transformations,
where for example it is necessary to check the parent nodes of an AST node before
performing some operations.
- Since:
- 2.5.0
-
Constructor Summary
Constructors Constructor Description ContextualClassCodeVisitor()
-
Method Summary
Methods inherited from class org.codehaus.groovy.ast.ClassCodeVisitorSupport
addError, getSourceUnit, visitAnnotation, visitAnnotations, visitClassCodeContainer, visitConstructor, visitDeclarationExpression, visitMethod, visitObjectInitializerStatements, visitStatement
Methods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport
afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitLambdaExpression, visitMethodReferenceExpression
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
-
Constructor Details
-
ContextualClassCodeVisitor
public ContextualClassCodeVisitor()
-
-
Method Details
-
getTreeContext
-
getLastContext
-
pushContext
-
popContext
-
pushContext
-
visitClass
Description copied from interface:GroovyClassVisitor
Visit a ClassNode.- Specified by:
visitClass
in interfaceGroovyClassVisitor
- Overrides:
visitClass
in classClassCodeVisitorSupport
-
visitPackage
- Overrides:
visitPackage
in classClassCodeVisitorSupport
-
visitImports
- Overrides:
visitImports
in classClassCodeVisitorSupport
-
visitConstructorOrMethod
- Overrides:
visitConstructorOrMethod
in classClassCodeVisitorSupport
-
visitField
Description copied from interface:GroovyClassVisitor
Visit a FieldNode.- Specified by:
visitField
in interfaceGroovyClassVisitor
- Overrides:
visitField
in classClassCodeVisitorSupport
-
visitProperty
Description copied from interface:GroovyClassVisitor
Visit a PropertyNode.- Specified by:
visitProperty
in interfaceGroovyClassVisitor
- Overrides:
visitProperty
in classClassCodeVisitorSupport
-
visitMethodCallExpression
- Specified by:
visitMethodCallExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitMethodCallExpression
in classCodeVisitorSupport
-
visitStaticMethodCallExpression
- Specified by:
visitStaticMethodCallExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitStaticMethodCallExpression
in classCodeVisitorSupport
-
visitConstructorCallExpression
- Specified by:
visitConstructorCallExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitConstructorCallExpression
in classCodeVisitorSupport
-
visitBinaryExpression
- Specified by:
visitBinaryExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitBinaryExpression
in classCodeVisitorSupport
-
visitTernaryExpression
- Specified by:
visitTernaryExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitTernaryExpression
in classCodeVisitorSupport
-
visitShortTernaryExpression
- Specified by:
visitShortTernaryExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitShortTernaryExpression
in classCodeVisitorSupport
-
visitPostfixExpression
- Specified by:
visitPostfixExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitPostfixExpression
in classCodeVisitorSupport
-
visitPrefixExpression
- Specified by:
visitPrefixExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitPrefixExpression
in classCodeVisitorSupport
-
visitBooleanExpression
- Specified by:
visitBooleanExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitBooleanExpression
in classCodeVisitorSupport
-
visitNotExpression
- Specified by:
visitNotExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitNotExpression
in classCodeVisitorSupport
-
visitClosureExpression
- Specified by:
visitClosureExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitClosureExpression
in classCodeVisitorSupport
-
visitTupleExpression
- Specified by:
visitTupleExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitTupleExpression
in classCodeVisitorSupport
-
visitListExpression
- Specified by:
visitListExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitListExpression
in classCodeVisitorSupport
-
visitArrayExpression
- Specified by:
visitArrayExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitArrayExpression
in classCodeVisitorSupport
-
visitMapExpression
- Specified by:
visitMapExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitMapExpression
in classCodeVisitorSupport
-
visitMapEntryExpression
- Specified by:
visitMapEntryExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitMapEntryExpression
in classCodeVisitorSupport
-
visitRangeExpression
- Specified by:
visitRangeExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitRangeExpression
in classCodeVisitorSupport
-
visitSpreadExpression
- Specified by:
visitSpreadExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitSpreadExpression
in classCodeVisitorSupport
-
visitSpreadMapExpression
- Specified by:
visitSpreadMapExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitSpreadMapExpression
in classCodeVisitorSupport
-
visitMethodPointerExpression
- Specified by:
visitMethodPointerExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitMethodPointerExpression
in classCodeVisitorSupport
-
visitUnaryMinusExpression
- Specified by:
visitUnaryMinusExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitUnaryMinusExpression
in classCodeVisitorSupport
-
visitUnaryPlusExpression
- Specified by:
visitUnaryPlusExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitUnaryPlusExpression
in classCodeVisitorSupport
-
visitBitwiseNegationExpression
- Specified by:
visitBitwiseNegationExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitBitwiseNegationExpression
in classCodeVisitorSupport
-
visitCastExpression
- Specified by:
visitCastExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitCastExpression
in classCodeVisitorSupport
-
visitConstantExpression
- Specified by:
visitConstantExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitConstantExpression
in classCodeVisitorSupport
-
visitClassExpression
- Specified by:
visitClassExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitClassExpression
in classCodeVisitorSupport
-
visitVariableExpression
- Specified by:
visitVariableExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitVariableExpression
in classCodeVisitorSupport
-
visitPropertyExpression
- Specified by:
visitPropertyExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitPropertyExpression
in classCodeVisitorSupport
-
visitAttributeExpression
- Specified by:
visitAttributeExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitAttributeExpression
in classCodeVisitorSupport
-
visitFieldExpression
- Specified by:
visitFieldExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitFieldExpression
in classCodeVisitorSupport
-
visitGStringExpression
- Specified by:
visitGStringExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitGStringExpression
in classCodeVisitorSupport
-
visitClosureListExpression
- Specified by:
visitClosureListExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitClosureListExpression
in classCodeVisitorSupport
-
visitBytecodeExpression
- Specified by:
visitBytecodeExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitBytecodeExpression
in classCodeVisitorSupport
-
visitAssertStatement
- Specified by:
visitAssertStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitAssertStatement
in classClassCodeVisitorSupport
-
visitBlockStatement
- Specified by:
visitBlockStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitBlockStatement
in classClassCodeVisitorSupport
-
visitBreakStatement
- Specified by:
visitBreakStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitBreakStatement
in classClassCodeVisitorSupport
-
visitCaseStatement
- Specified by:
visitCaseStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitCaseStatement
in classClassCodeVisitorSupport
-
visitCatchStatement
- Specified by:
visitCatchStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitCatchStatement
in classClassCodeVisitorSupport
-
visitContinueStatement
- Specified by:
visitContinueStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitContinueStatement
in classClassCodeVisitorSupport
-
visitDoWhileLoop
- Specified by:
visitDoWhileLoop
in interfaceGroovyCodeVisitor
- Overrides:
visitDoWhileLoop
in classClassCodeVisitorSupport
-
visitExpressionStatement
- Specified by:
visitExpressionStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitExpressionStatement
in classClassCodeVisitorSupport
-
visitForLoop
- Specified by:
visitForLoop
in interfaceGroovyCodeVisitor
- Overrides:
visitForLoop
in classClassCodeVisitorSupport
-
visitIfElse
- Specified by:
visitIfElse
in interfaceGroovyCodeVisitor
- Overrides:
visitIfElse
in classClassCodeVisitorSupport
-
visitReturnStatement
- Specified by:
visitReturnStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitReturnStatement
in classClassCodeVisitorSupport
-
visitSwitch
- Specified by:
visitSwitch
in interfaceGroovyCodeVisitor
- Overrides:
visitSwitch
in classClassCodeVisitorSupport
-
visitSynchronizedStatement
- Specified by:
visitSynchronizedStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitSynchronizedStatement
in classClassCodeVisitorSupport
-
visitThrowStatement
- Specified by:
visitThrowStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitThrowStatement
in classClassCodeVisitorSupport
-
visitTryCatchFinally
- Specified by:
visitTryCatchFinally
in interfaceGroovyCodeVisitor
- Overrides:
visitTryCatchFinally
in classClassCodeVisitorSupport
-
visitWhileLoop
- Specified by:
visitWhileLoop
in interfaceGroovyCodeVisitor
- Overrides:
visitWhileLoop
in classClassCodeVisitorSupport
-
visitEmptyStatement
- Specified by:
visitEmptyStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitEmptyStatement
in classCodeVisitorSupport
-
getTreePath
-
pathMatches
-
pathUpTo
-
pathUpTo
-
pathUpTo
public java.util.List<TreeContext> pathUpTo(java.lang.Class<ASTNode> node, ASTNodePredicate predicate) -
matchByClass
-