Package: org.codehaus.groovy.ast

## [Java] Class TransformingCodeVisitor

- org.codehaus.groovy.ast.TransformingCodeVisitor

-     public class TransformingCodeVisitor
      extends CodeVisitorSupport

  Code visitor that combines depth-first traversal with expression transformation, delegating both to an underlying ClassCodeExpressionTransformer.

  This visitor implements a two-phase approach for each statement and expression:

  1. Depth-first traversal via the parent CodeVisitorSupport class visits child nodes
  2. Expression transformation via the ClassCodeExpressionTransformer processes the node

  This pattern enables both traversal and transformation in a single pass. The transformer receives fully-traversed nodes, allowing it to operate on complete subtrees or apply post-processing transformations after children are visited.

  Typical usage involves creating a subclass of ClassCodeExpressionTransformer and passing it to this visitor:

         ClassCodeExpressionTransformer transformer = new MyTransformer(...);
         TransformingCodeVisitor visitor = new TransformingCodeVisitor(transformer);
         node.visit(visitor);

  See Also:
    for base traversal implementation
    for transformation implementation

- - ### Constructor Summary

    Constructors
    Constructor and description
    `TransformingCodeVisitor(ClassCodeExpressionTransformer trn)` Creates a new transforming visitor with the given transformer.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `visitArgumentlistExpression(ArgumentListExpression ale)`
    `` | `public void` | `visitArrayExpression(ArrayExpression expression)`
    `` | `public void` | `visitAssertStatement(AssertStatement statement)`
    `` | `public void` | `visitAttributeExpression(AttributeExpression expression)`
    `` | `public void` | `visitBinaryExpression(BinaryExpression expression)`
    `` | `public void` | `visitBitwiseNegationExpression(BitwiseNegationExpression expression)`
    `` | `public void` | `visitBlockStatement(BlockStatement block)` Visits a BlockStatement, performing depth-first traversal followed by transformer processing.
    `` | `public void` | `visitBooleanExpression(BooleanExpression expression)`
    `` | `public void` | `visitBreakStatement(BreakStatement statement)`
    `` | `public void` | `visitBytecodeExpression(BytecodeExpression cle)`
    `` | `public void` | `visitCaseStatement(CaseStatement statement)`
    `` | `public void` | `visitCastExpression(CastExpression expression)`
    `` | `public void` | `visitCatchStatement(CatchStatement statement)`
    `` | `public void` | `visitClassExpression(ClassExpression expression)`
    `` | `public void` | `visitClosureExpression(ClosureExpression expression)`
    `` | `public void` | `visitClosureListExpression(ClosureListExpression cle)`
    `` | `public void` | `visitConstantExpression(ConstantExpression expression)`
    `` | `public void` | `visitContinueStatement(ContinueStatement statement)`
    `` | `public void` | `visitDeclarationExpression(DeclarationExpression expression)`
    `` | `public void` | `visitDoWhileLoop(DoWhileStatement loop)`
    `` | `public void` | `visitExpressionStatement(ExpressionStatement statement)`
    `` | `public void` | `visitFieldExpression(FieldExpression expression)`
    `` | `public void` | `visitForLoop(ForStatement forLoop)`
    `` | `public void` | `visitGStringExpression(GStringExpression expression)`
    `` | `public void` | `visitIfElse(IfStatement ifElse)`
    `` | `public void` | `visitListExpression(ListExpression expression)`
    `` | `public void` | `visitMapEntryExpression(MapEntryExpression expression)`
    `` | `public void` | `visitMapExpression(MapExpression expression)`
    `` | `public void` | `visitMethodPointerExpression(MethodPointerExpression expression)`
    `` | `public void` | `visitNotExpression(NotExpression expression)`
    `` | `public void` | `visitPostfixExpression(PostfixExpression expression)`
    `` | `public void` | `visitPrefixExpression(PrefixExpression expression)`
    `` | `public void` | `visitPropertyExpression(PropertyExpression expression)`
    `` | `public void` | `visitRangeExpression(RangeExpression expression)`
    `` | `public void` | `visitReturnStatement(ReturnStatement statement)`
    `` | `public void` | `visitShortTernaryExpression(ElvisOperatorExpression expression)`
    `` | `public void` | `visitSpreadExpression(SpreadExpression expression)`
    `` | `public void` | `visitSpreadMapExpression(SpreadMapExpression expression)`
    `` | `public void` | `visitStaticMethodCallExpression(StaticMethodCallExpression call)`
    `` | `public void` | `visitSwitch(SwitchStatement statement)`
    `` | `public void` | `visitSynchronizedStatement(SynchronizedStatement statement)`
    `` | `public void` | `visitTernaryExpression(TernaryExpression expression)`
    `` | `public void` | `visitThrowStatement(ThrowStatement statement)`
    `` | `public void` | `visitTryCatchFinally(TryCatchStatement statement)`
    `` | `public void` | `visitTupleExpression(TupleExpression expression)`
    `` | `public void` | `visitUnaryMinusExpression(UnaryMinusExpression expression)`
    `` | `public void` | `visitUnaryPlusExpression(UnaryPlusExpression expression)`
    `` | `public void` | `visitVariableExpression(VariableExpression expression)`
    `` | `public void` | `visitWhileLoop(WhileStatement loop)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class CodeVisitorSupport` | `afterSwitchCaseStatementsVisited, 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 TransformingCodeVisitor(ClassCodeExpressionTransformer trn)

      Creates a new transforming visitor with the given transformer.

      Parameters:
        `trn` - the ClassCodeExpressionTransformer to apply after traversing each node; must not be null

  - ### Method Detail

    - #### public void visitArgumentlistExpression(ArgumentListExpression ale)

    - #### public void visitArrayExpression(ArrayExpression expression)

    - #### public void visitAssertStatement(AssertStatement statement)

    - #### public void visitAttributeExpression(AttributeExpression expression)

    - #### public void visitBinaryExpression(BinaryExpression expression)

    - #### public void visitBitwiseNegationExpression(BitwiseNegationExpression expression)

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

      Visits a BlockStatement, performing depth-first traversal followed by transformer processing.

      Parameters:
        `block` - the block statement to visit and transform

    - #### public void visitBooleanExpression(BooleanExpression expression)

    - #### public void visitBreakStatement(BreakStatement statement)

    - #### public void visitBytecodeExpression(BytecodeExpression cle)

    - #### public void visitCaseStatement(CaseStatement statement)

    - #### public void visitCastExpression(CastExpression expression)

    - #### public void visitCatchStatement(CatchStatement statement)

    - #### public void visitClassExpression(ClassExpression expression)

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

    - #### public void visitClosureListExpression(ClosureListExpression cle)

    - #### public void visitConstantExpression(ConstantExpression expression)

    - #### public void visitContinueStatement(ContinueStatement statement)

    - #### public void visitDeclarationExpression(DeclarationExpression expression)

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

    - #### public void visitExpressionStatement(ExpressionStatement statement)

    - #### public void visitFieldExpression(FieldExpression expression)

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

    - #### public void visitGStringExpression(GStringExpression expression)

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

    - #### public void visitListExpression(ListExpression expression)

    - #### public void visitMapEntryExpression(MapEntryExpression expression)

    - #### public void visitMapExpression(MapExpression expression)

    - #### public void visitMethodPointerExpression(MethodPointerExpression expression)

    - #### public void visitNotExpression(NotExpression expression)

    - #### public void visitPostfixExpression(PostfixExpression expression)

    - #### public void visitPrefixExpression(PrefixExpression expression)

    - #### public void visitPropertyExpression(PropertyExpression expression)

    - #### public void visitRangeExpression(RangeExpression expression)

    - #### public void visitReturnStatement(ReturnStatement statement)

    - #### public void visitShortTernaryExpression(ElvisOperatorExpression expression)

    - #### public void visitSpreadExpression(SpreadExpression expression)

    - #### public void visitSpreadMapExpression(SpreadMapExpression expression)

    - #### public void visitStaticMethodCallExpression(StaticMethodCallExpression call)

    - #### public void visitSwitch(SwitchStatement statement)

    - #### public void visitSynchronizedStatement(SynchronizedStatement statement)

    - #### public void visitTernaryExpression(TernaryExpression expression)

    - #### public void visitThrowStatement(ThrowStatement statement)

    - #### public void visitTryCatchFinally(TryCatchStatement statement)

    - #### public void visitTupleExpression(TupleExpression expression)

    - #### public void visitUnaryMinusExpression(UnaryMinusExpression expression)

    - #### public void visitUnaryPlusExpression(UnaryPlusExpression expression)

    - #### public void visitVariableExpression(VariableExpression expression)

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