public class AstHelper
extends Object
Helping to create a few standard AST constructs
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static ExpressionStatement |
createVariableAlias(String aliasName, ClassNode variableType, String variableName)Creates an alias variable that references another variable. |
|
public static ExpressionStatement |
createVariableDefinition(String variableName, ClassNode variableType, Expression value)Creates a local variable declaration for the supplied value. |
|
public static ExpressionStatement |
createVariableDefinition(String variableName, ClassNode variableType, Expression value, boolean variableShouldBeFinal)Creates a local variable declaration for the supplied value. |
|
public static VariableExpression |
createVariableReference(Map<String, ?> variableSpec)Creates a variable reference from a name/type specification map. |
|
public static Statement |
recurByThrowStatement()This statement will throw exception which will be caught and redirected to jump to surrounding while loop's start label Also works from within Closures but is a tiny bit slower |
|
public static Statement |
recurStatement()This statement should make the code jump to surrounding while loop's start label Does not work from within Closures |
Creates an alias variable that references another variable.
aliasName - the alias variable namevariableType - the alias variable typevariableName - the referenced variable nameCreates a local variable declaration for the supplied value.
variableName - the declared variable namevariableType - the declared variable typevalue - the initial value expressionCreates a local variable declaration for the supplied value.
variableName - the declared variable namevariableType - the declared variable typevalue - the initial value expressionvariableShouldBeFinal - whether the declared variable should be finalCreates a variable reference from a name/type specification map.
variableSpec - a map containing name and type entriesThis statement will throw exception which will be caught and redirected to jump to surrounding while loop's start label Also works from within Closures but is a tiny bit slower
This statement should make the code jump to surrounding while loop's start label Does not work from within Closures