Package: org.codehaus.groovy.transform.tailrec

## [Groovy] Class VariableExpressionReplacer

- org.codehaus.groovy.transform.tailrec.VariableExpressionReplacer

- Tool for replacing VariableExpression instances in an AST by other VariableExpression instances. Regardless of a real change taking place in nested expressions, all considered expression (trees) will be replaced. This could be optimized to accelerate compilation. Within

  TailRecursive:
    it is used - to swap the access of method args with the access to iteration variables - to swap the access of iteration variables with the access of temp vars

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `private Closure` | `replaceWith`
    `private Closure` | `when`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `VariableExpressionReplacer ()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `replaceIn(ASTNode root)`
    `` | `void` | `visitAssertStatement(AssertStatement statement)`
    `` | `void` | `visitBinaryExpression(BinaryExpression expression)` It's the only Expression type in which replacing is considered.
    `` | `void` | `visitCaseStatement(CaseStatement statement)`
    `` | `void` | `visitDoWhileLoop(DoWhileStatement loop)`
    `` | `void` | `visitExpressionStatement(ExpressionStatement statement)`
    `` | `void` | `visitForLoop(ForStatement forLoop)`
    `` | `void` | `visitIfElse(IfStatement ifElse)`
    `` | `void` | `visitReturnStatement(ReturnStatement statement)`
    `` | `void` | `visitSwitch(SwitchStatement statement)`
    `` | `void` | `visitSynchronizedStatement(SynchronizedStatement statement)`
    `` | `void` | `visitThrowStatement(ThrowStatement statement)`
    `` | `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`

- - ### Property Detail

    - #### private Closure replaceWith

    - #### private Closure when

  - ### Constructor Detail

    - #### VariableExpressionReplacer()

  - ### Method Detail

    - #### void replaceIn(ASTNode root)

    - #### void visitAssertStatement(AssertStatement statement)

    - #### void visitBinaryExpression(BinaryExpression expression)

      It's the only Expression type in which replacing is considered. That's an abuse of the class, but I couldn't think of a better way.

    - #### void visitCaseStatement(CaseStatement statement)

    - #### void visitDoWhileLoop(DoWhileStatement loop)

    - #### void visitExpressionStatement(ExpressionStatement statement)

    - #### void visitForLoop(ForStatement forLoop)

    - #### void visitIfElse(IfStatement ifElse)

    - #### void visitReturnStatement(ReturnStatement statement)

    - #### void visitSwitch(SwitchStatement statement)

    - #### void visitSynchronizedStatement(SynchronizedStatement statement)

    - #### void visitThrowStatement(ThrowStatement statement)

    - #### void visitWhileLoop(WhileStatement loop)