@CompileStatic class VariableExpressionReplacer extends CodeVisitorSupport
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
Type | Name and description |
---|---|
Closure<VariableExpression> |
replaceWith |
Closure<Boolean> |
when |
Constructor and description |
---|
VariableExpressionReplacer
() |
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) |
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.
Copyright © 2003-2020 The Apache Software Foundation. All rights reserved.