Class StatementReplacer
java.lang.Object
org.codehaus.groovy.ast.CodeVisitorSupport
org.codehaus.groovy.transform.tailrec.StatementReplacer
- All Implemented Interfaces:
GroovyCodeVisitor
Tool for replacing Statement objects in an AST by other Statement instances.
Within @TailRecursive it is used to swap ReturnStatements with looping back to RECUR label
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getWhen()
void
void
setClosureLevel
(int closureLevel) void
setReplaceWith
(Closure<Statement> replaceWith) void
void
void
visitClosureExpression
(ClosureExpression expression) void
void
visitForLoop
(ForStatement forLoop) void
visitIfElse
(IfStatement ifElse) void
visitWhileLoop
(WhileStatement loop) Methods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport
afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAssertStatement, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBreakStatement, visitBytecodeExpression, visitCaseStatement, visitCastExpression, visitCatchStatement, visitClassExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitContinueStatement, visitDeclarationExpression, visitEmptyStatement, visitExpressionStatement, visitFieldExpression, visitGStringExpression, visitLambdaExpression, visitListExpression, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitMethodReferenceExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitReturnStatement, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitSwitch, visitSynchronizedStatement, visitTernaryExpression, visitThrowStatement, visitTryCatchFinally, 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
visit, visit, visitEmptyExpression, visitListOfExpressions
-
Constructor Details
-
StatementReplacer
-
-
Method Details
-
replaceIn
-
visitClosureExpression
- Specified by:
visitClosureExpression
in interfaceGroovyCodeVisitor
- Overrides:
visitClosureExpression
in classCodeVisitorSupport
-
visitBlockStatement
- Specified by:
visitBlockStatement
in interfaceGroovyCodeVisitor
- Overrides:
visitBlockStatement
in classCodeVisitorSupport
-
visitIfElse
- Specified by:
visitIfElse
in interfaceGroovyCodeVisitor
- Overrides:
visitIfElse
in classCodeVisitorSupport
-
visitForLoop
- Specified by:
visitForLoop
in interfaceGroovyCodeVisitor
- Overrides:
visitForLoop
in classCodeVisitorSupport
-
visitWhileLoop
- Specified by:
visitWhileLoop
in interfaceGroovyCodeVisitor
- Overrides:
visitWhileLoop
in classCodeVisitorSupport
-
visitDoWhileLoop
- Specified by:
visitDoWhileLoop
in interfaceGroovyCodeVisitor
- Overrides:
visitDoWhileLoop
in classCodeVisitorSupport
-
getWhen
-
setWhen
-
getReplaceWith
-
setReplaceWith
-
getClosureLevel
public int getClosureLevel() -
setClosureLevel
public void setClosureLevel(int closureLevel)
-