VariableExpressionReplacer (groovy 2.4.3 API)
Date: 2015-03-23

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
  Authors:
    Johannes Link

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `Closure<VariableExpression>` | `replaceWith`
    `Closure<Boolean>` | `when`

  - ### Methods Summary

    Methods
    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` | `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, visitListExpression, visitListOfExpressions, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitReturnStatement, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitSwitch, visitSynchronizedStatement, visitTernaryExpression, visitThrowStatement, visitTryCatchFinally, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression, visitWhileLoop`
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Property Detail

    - #### Closure<VariableExpression> replaceWith

    - #### Closure<Boolean> when

  - ### 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)