Package org.spockframework.compiler
Class SpecRewriter
- java.lang.Object
-
- org.spockframework.compiler.AbstractSpecVisitor
-
- org.spockframework.compiler.SpecRewriter
-
- All Implemented Interfaces:
IRewriteResources
,ISpecVisitor
public class SpecRewriter extends AbstractSpecVisitor implements IRewriteResources
A Spec visitor responsible for most of the rewriting of a Spec's AST.- Author:
- Peter Niederwieser
-
-
Constructor Summary
Constructors Constructor Description SpecRewriter(AstNodeCache nodeCache, SourceLookup lookup, ErrorReporter errorReporter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.codehaus.groovy.ast.expr.VariableExpression
captureOldValue(org.codehaus.groovy.ast.expr.Expression oldValue)
void
defineValueRecorder(java.util.List<org.codehaus.groovy.ast.stmt.Statement> stats)
AstNodeCache
getAstNodeCache()
Block
getCurrentBlock()
Method
getCurrentMethod()
Spec
getCurrentSpec()
ErrorReporter
getErrorReporter()
org.codehaus.groovy.ast.expr.MethodCallExpression
getMockInvocationMatcher()
org.codehaus.groovy.ast.expr.MethodCallExpression
getSharedInstance()
java.lang.String
getSourceText(org.codehaus.groovy.ast.ASTNode node)
org.codehaus.groovy.ast.expr.MethodCallExpression
getSpecificationContext()
org.codehaus.groovy.ast.expr.MethodCallExpression
setThrownException(org.codehaus.groovy.ast.expr.Expression value)
void
visitAnyBlock(Block block)
void
visitCleanupBlock(CleanupBlock block)
void
visitField(Field field)
void
visitMethod(Method method)
void
visitMethodAgain(Method method)
void
visitSpec(Spec spec)
void
visitThenBlock(ThenBlock block)
-
Methods inherited from class org.spockframework.compiler.AbstractSpecVisitor
visitAnonymousBlock, visitExpectBlock, visitSetupBlock, visitSpecAgain, visitWhenBlock, visitWhereBlock
-
-
-
-
Constructor Detail
-
SpecRewriter
public SpecRewriter(AstNodeCache nodeCache, SourceLookup lookup, ErrorReporter errorReporter)
-
-
Method Detail
-
visitSpec
public void visitSpec(Spec spec)
- Specified by:
visitSpec
in interfaceISpecVisitor
- Overrides:
visitSpec
in classAbstractSpecVisitor
-
visitField
public void visitField(Field field)
- Specified by:
visitField
in interfaceISpecVisitor
- Overrides:
visitField
in classAbstractSpecVisitor
-
visitMethod
public void visitMethod(Method method)
- Specified by:
visitMethod
in interfaceISpecVisitor
- Overrides:
visitMethod
in classAbstractSpecVisitor
-
visitMethodAgain
public void visitMethodAgain(Method method)
- Specified by:
visitMethodAgain
in interfaceISpecVisitor
- Overrides:
visitMethodAgain
in classAbstractSpecVisitor
-
visitAnyBlock
public void visitAnyBlock(Block block)
- Specified by:
visitAnyBlock
in interfaceISpecVisitor
- Overrides:
visitAnyBlock
in classAbstractSpecVisitor
-
visitThenBlock
public void visitThenBlock(ThenBlock block)
- Specified by:
visitThenBlock
in interfaceISpecVisitor
- Overrides:
visitThenBlock
in classAbstractSpecVisitor
-
visitCleanupBlock
public void visitCleanupBlock(CleanupBlock block)
- Specified by:
visitCleanupBlock
in interfaceISpecVisitor
- Overrides:
visitCleanupBlock
in classAbstractSpecVisitor
-
getCurrentSpec
public Spec getCurrentSpec()
- Specified by:
getCurrentSpec
in interfaceIRewriteResources
-
getCurrentMethod
public Method getCurrentMethod()
- Specified by:
getCurrentMethod
in interfaceIRewriteResources
-
getCurrentBlock
public Block getCurrentBlock()
- Specified by:
getCurrentBlock
in interfaceIRewriteResources
-
defineValueRecorder
public void defineValueRecorder(java.util.List<org.codehaus.groovy.ast.stmt.Statement> stats)
- Specified by:
defineValueRecorder
in interfaceIRewriteResources
-
captureOldValue
public org.codehaus.groovy.ast.expr.VariableExpression captureOldValue(org.codehaus.groovy.ast.expr.Expression oldValue)
- Specified by:
captureOldValue
in interfaceIRewriteResources
-
getSpecificationContext
public org.codehaus.groovy.ast.expr.MethodCallExpression getSpecificationContext()
-
getMockInvocationMatcher
public org.codehaus.groovy.ast.expr.MethodCallExpression getMockInvocationMatcher()
- Specified by:
getMockInvocationMatcher
in interfaceIRewriteResources
-
setThrownException
public org.codehaus.groovy.ast.expr.MethodCallExpression setThrownException(org.codehaus.groovy.ast.expr.Expression value)
-
getSharedInstance
public org.codehaus.groovy.ast.expr.MethodCallExpression getSharedInstance()
-
getAstNodeCache
public AstNodeCache getAstNodeCache()
- Specified by:
getAstNodeCache
in interfaceIRewriteResources
-
getSourceText
public java.lang.String getSourceText(org.codehaus.groovy.ast.ASTNode node)
- Specified by:
getSourceText
in interfaceIRewriteResources
-
getErrorReporter
public ErrorReporter getErrorReporter()
- Specified by:
getErrorReporter
in interfaceIRewriteResources
-
-