org.spockframework.compiler
Class SpecRewriter

java.lang.Object
  extended by org.spockframework.compiler.AbstractSpecVisitor
      extended by 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
SpecRewriter(AstNodeCache nodeCache, SourceLookup lookup, ErrorReporter errorReporter)
           
 
Method Summary
 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.VariableExpression getMockControllerRef()
           
 java.lang.String getSourceText(org.codehaus.groovy.ast.ASTNode node)
           
 void visitAnyBlock(Block block)
           
 void visitCleanupBlock(CleanupBlock block)
           
 void visitExpectBlock(ExpectBlock block)
           
 void visitField(Field field)
           
 void visitMethod(Method method)
           
 void visitMethodAgain(Method method)
           
 void visitSpec(Spec spec)
           
 void visitSpecAgain(Spec spec)
           
 void visitThenBlock(ThenBlock block)
           
 
Methods inherited from class org.spockframework.compiler.AbstractSpecVisitor
visitAnonymousBlock, visitSetupBlock, visitWhenBlock, visitWhereBlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpecRewriter

public SpecRewriter(AstNodeCache nodeCache,
                    SourceLookup lookup,
                    ErrorReporter errorReporter)
Method Detail

visitSpec

public void visitSpec(Spec spec)
Specified by:
visitSpec in interface ISpecVisitor
Overrides:
visitSpec in class AbstractSpecVisitor

visitSpecAgain

public void visitSpecAgain(Spec spec)
                    throws java.lang.Exception
Specified by:
visitSpecAgain in interface ISpecVisitor
Overrides:
visitSpecAgain in class AbstractSpecVisitor
Throws:
java.lang.Exception

visitField

public void visitField(Field field)
Specified by:
visitField in interface ISpecVisitor
Overrides:
visitField in class AbstractSpecVisitor

visitMethod

public void visitMethod(Method method)
Specified by:
visitMethod in interface ISpecVisitor
Overrides:
visitMethod in class AbstractSpecVisitor

visitMethodAgain

public void visitMethodAgain(Method method)
Specified by:
visitMethodAgain in interface ISpecVisitor
Overrides:
visitMethodAgain in class AbstractSpecVisitor

visitAnyBlock

public void visitAnyBlock(Block block)
Specified by:
visitAnyBlock in interface ISpecVisitor
Overrides:
visitAnyBlock in class AbstractSpecVisitor

visitExpectBlock

public void visitExpectBlock(ExpectBlock block)
Specified by:
visitExpectBlock in interface ISpecVisitor
Overrides:
visitExpectBlock in class AbstractSpecVisitor

visitThenBlock

public void visitThenBlock(ThenBlock block)
Specified by:
visitThenBlock in interface ISpecVisitor
Overrides:
visitThenBlock in class AbstractSpecVisitor

visitCleanupBlock

public void visitCleanupBlock(CleanupBlock block)
Specified by:
visitCleanupBlock in interface ISpecVisitor
Overrides:
visitCleanupBlock in class AbstractSpecVisitor

getCurrentSpec

public Spec getCurrentSpec()
Specified by:
getCurrentSpec in interface IRewriteResources

getCurrentMethod

public Method getCurrentMethod()
Specified by:
getCurrentMethod in interface IRewriteResources

getCurrentBlock

public Block getCurrentBlock()
Specified by:
getCurrentBlock in interface IRewriteResources

defineValueRecorder

public void defineValueRecorder(java.util.List<org.codehaus.groovy.ast.stmt.Statement> stats)
Specified by:
defineValueRecorder in interface IRewriteResources

captureOldValue

public org.codehaus.groovy.ast.expr.VariableExpression captureOldValue(org.codehaus.groovy.ast.expr.Expression oldValue)
Specified by:
captureOldValue in interface IRewriteResources

getMockControllerRef

public org.codehaus.groovy.ast.expr.VariableExpression getMockControllerRef()
Specified by:
getMockControllerRef in interface IRewriteResources

getAstNodeCache

public AstNodeCache getAstNodeCache()
Specified by:
getAstNodeCache in interface IRewriteResources

getSourceText

public java.lang.String getSourceText(org.codehaus.groovy.ast.ASTNode node)
Specified by:
getSourceText in interface IRewriteResources

getErrorReporter

public ErrorReporter getErrorReporter()
Specified by:
getErrorReporter in interface IRewriteResources


Copyright © 2013. All rights reserved