StatementReplacer (Groovy 4.0.15)

Package: org.codehaus.groovy.transform.tailrec

## [Java] Class StatementReplacer

- org.codehaus.groovy.transform.tailrec.StatementReplacer

-     public class StatementReplacer
      extends CodeVisitorSupport

  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

    Constructors
    Constructor and description
    `StatementReplacer(Closure<Boolean> when, Closure<Statement> replaceWith)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public int` | `getClosureLevel()`
    `` | `public Closure<Statement>` | `getReplaceWith()`
    `` | `public Closure<Boolean>` | `getWhen()`
    `` | `public void` | `replaceIn(ASTNode root)`
    `` | `public void` | `setClosureLevel(int closureLevel)`
    `` | `public void` | `setReplaceWith(Closure<Statement> replaceWith)`
    `` | `public void` | `setWhen(Closure<Boolean> when)`
    `` | `public void` | `visitBlockStatement(BlockStatement block)`
    `` | `public void` | `visitClosureExpression(ClosureExpression expression)`
    `` | `public void` | `visitDoWhileLoop(DoWhileStatement loop)`
    `` | `public void` | `visitForLoop(ForStatement forLoop)`
    `` | `public void` | `visitIfElse(IfStatement ifElse)`
    `` | `public void` | `visitWhileLoop(WhileStatement loop)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class CodeVisitorSupport` | `afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAssertStatement, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBlockStatement, visitBooleanExpression, visitBreakStatement, visitBytecodeExpression, visitCaseStatement, visitCastExpression, visitCatchStatement, visitClassExpression, visitClosureExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitEmptyStatement, visitExpressionStatement, visitFieldExpression, visitForLoop, visitGStringExpression, visitIfElse, 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, visitWhileLoop`

- - ### Constructor Detail

    - #### public StatementReplacer(Closure<Boolean> when, Closure<Statement> replaceWith)

  - ### Method Detail

    - #### public int getClosureLevel()

    - #### public Closure<Statement> getReplaceWith()

    - #### public Closure<Boolean> getWhen()

    - #### public void replaceIn(ASTNode root)

    - #### public void setClosureLevel(int closureLevel)

    - #### public void setReplaceWith(Closure<Statement> replaceWith)

    - #### public void setWhen(Closure<Boolean> when)

    - #### public void visitBlockStatement(BlockStatement block)

    - #### public void visitClosureExpression(ClosureExpression expression)

    - #### public void visitDoWhileLoop(DoWhileStatement loop)

    - #### public void visitForLoop(ForStatement forLoop)

    - #### public void visitIfElse(IfStatement ifElse)

    - #### public void visitWhileLoop(WhileStatement loop)