Package org.spockframework.compiler
Class StatementReplacingVisitorSupport
- java.lang.Object
-
- org.codehaus.groovy.ast.CodeVisitorSupport
-
- org.codehaus.groovy.ast.ClassCodeVisitorSupport
-
- org.spockframework.compiler.StatementReplacingVisitorSupport
-
- All Implemented Interfaces:
org.codehaus.groovy.ast.GroovyClassVisitor
,org.codehaus.groovy.ast.GroovyCodeVisitor
- Direct Known Subclasses:
AbstractDeepBlockRewriter
,ExpressionReplacingVisitorSupport
public abstract class StatementReplacingVisitorSupport extends org.codehaus.groovy.ast.ClassCodeVisitorSupport
Adds the ability to replace statements.- Author:
- Peter Niederwieser
-
-
Constructor Summary
Constructors Constructor Description StatementReplacingVisitorSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.codehaus.groovy.control.SourceUnit
getSourceUnit()
org.codehaus.groovy.ast.stmt.Statement
replace(org.codehaus.groovy.ast.stmt.Statement stat)
Visits the specified statement.protected <T extends org.codehaus.groovy.ast.stmt.Statement>
voidreplaceAll(java.util.List<T> stats)
Visits the statements in the specified mutable list.protected void
replaceVisitedStatementWith(org.codehaus.groovy.ast.stmt.Statement other)
Replaces the currently visited statement with the specified statement.void
visitBlockStatement(org.codehaus.groovy.ast.stmt.BlockStatement stat)
void
visitCaseStatement(org.codehaus.groovy.ast.stmt.CaseStatement stat)
void
visitCatchStatement(org.codehaus.groovy.ast.stmt.CatchStatement stat)
void
visitDoWhileLoop(org.codehaus.groovy.ast.stmt.DoWhileStatement stat)
void
visitForLoop(org.codehaus.groovy.ast.stmt.ForStatement stat)
void
visitIfElse(org.codehaus.groovy.ast.stmt.IfStatement stat)
void
visitSwitch(org.codehaus.groovy.ast.stmt.SwitchStatement stat)
void
visitSynchronizedStatement(org.codehaus.groovy.ast.stmt.SynchronizedStatement stat)
void
visitTryCatchFinally(org.codehaus.groovy.ast.stmt.TryCatchStatement stat)
void
visitWhileLoop(org.codehaus.groovy.ast.stmt.WhileStatement stat)
-
Methods inherited from class org.codehaus.groovy.ast.ClassCodeVisitorSupport
addError, visitAnnotations, visitAssertStatement, visitBreakStatement, visitClass, visitClassCodeContainer, visitConstructor, visitConstructorOrMethod, visitContinueStatement, visitDeclarationExpression, visitExpressionStatement, visitField, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitProperty, visitReturnStatement, visitStatement, visitThrowStatement
-
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
-
-
-
-
Method Detail
-
replace
public org.codehaus.groovy.ast.stmt.Statement replace(org.codehaus.groovy.ast.stmt.Statement stat)
Visits the specified statement. If the statement's visit method calls replaceVisitedMethodWith(), the statement will be replaced.
-
replaceAll
protected <T extends org.codehaus.groovy.ast.stmt.Statement> void replaceAll(java.util.List<T> stats)
Visits the statements in the specified mutable list. If a statement's visit method calls replaceVisitedMethodWith(), the statement will be replaced.
-
replaceVisitedStatementWith
protected void replaceVisitedStatementWith(org.codehaus.groovy.ast.stmt.Statement other)
Replaces the currently visited statement with the specified statement.
-
visitBlockStatement
public void visitBlockStatement(org.codehaus.groovy.ast.stmt.BlockStatement stat)
- Specified by:
visitBlockStatement
in interfaceorg.codehaus.groovy.ast.GroovyCodeVisitor
- Overrides:
visitBlockStatement
in classorg.codehaus.groovy.ast.ClassCodeVisitorSupport
-
visitForLoop
public void visitForLoop(org.codehaus.groovy.ast.stmt.ForStatement stat)
- Specified by:
visitForLoop
in interfaceorg.codehaus.groovy.ast.GroovyCodeVisitor
- Overrides:
visitForLoop
in classorg.codehaus.groovy.ast.ClassCodeVisitorSupport
-
visitWhileLoop
public void visitWhileLoop(org.codehaus.groovy.ast.stmt.WhileStatement stat)
- Specified by:
visitWhileLoop
in interfaceorg.codehaus.groovy.ast.GroovyCodeVisitor
- Overrides:
visitWhileLoop
in classorg.codehaus.groovy.ast.ClassCodeVisitorSupport
-
visitDoWhileLoop
public void visitDoWhileLoop(org.codehaus.groovy.ast.stmt.DoWhileStatement stat)
- Specified by:
visitDoWhileLoop
in interfaceorg.codehaus.groovy.ast.GroovyCodeVisitor
- Overrides:
visitDoWhileLoop
in classorg.codehaus.groovy.ast.ClassCodeVisitorSupport
-
visitIfElse
public void visitIfElse(org.codehaus.groovy.ast.stmt.IfStatement stat)
- Specified by:
visitIfElse
in interfaceorg.codehaus.groovy.ast.GroovyCodeVisitor
- Overrides:
visitIfElse
in classorg.codehaus.groovy.ast.ClassCodeVisitorSupport
-
visitTryCatchFinally
public void visitTryCatchFinally(org.codehaus.groovy.ast.stmt.TryCatchStatement stat)
- Specified by:
visitTryCatchFinally
in interfaceorg.codehaus.groovy.ast.GroovyCodeVisitor
- Overrides:
visitTryCatchFinally
in classorg.codehaus.groovy.ast.ClassCodeVisitorSupport
-
visitSwitch
public void visitSwitch(org.codehaus.groovy.ast.stmt.SwitchStatement stat)
- Specified by:
visitSwitch
in interfaceorg.codehaus.groovy.ast.GroovyCodeVisitor
- Overrides:
visitSwitch
in classorg.codehaus.groovy.ast.ClassCodeVisitorSupport
-
visitCaseStatement
public void visitCaseStatement(org.codehaus.groovy.ast.stmt.CaseStatement stat)
- Specified by:
visitCaseStatement
in interfaceorg.codehaus.groovy.ast.GroovyCodeVisitor
- Overrides:
visitCaseStatement
in classorg.codehaus.groovy.ast.ClassCodeVisitorSupport
-
visitSynchronizedStatement
public void visitSynchronizedStatement(org.codehaus.groovy.ast.stmt.SynchronizedStatement stat)
- Specified by:
visitSynchronizedStatement
in interfaceorg.codehaus.groovy.ast.GroovyCodeVisitor
- Overrides:
visitSynchronizedStatement
in classorg.codehaus.groovy.ast.ClassCodeVisitorSupport
-
visitCatchStatement
public void visitCatchStatement(org.codehaus.groovy.ast.stmt.CatchStatement stat)
- Specified by:
visitCatchStatement
in interfaceorg.codehaus.groovy.ast.GroovyCodeVisitor
- Overrides:
visitCatchStatement
in classorg.codehaus.groovy.ast.ClassCodeVisitorSupport
-
getSourceUnit
protected org.codehaus.groovy.control.SourceUnit getSourceUnit()
- Specified by:
getSourceUnit
in classorg.codehaus.groovy.ast.ClassCodeVisitorSupport
-
-