Package org.codehaus.groovy.classgen.asm
Class ExpressionAsVariableSlot
java.lang.Object
org.codehaus.groovy.ast.ASTNode
org.codehaus.groovy.ast.AnnotatedNode
org.codehaus.groovy.ast.expr.Expression
org.codehaus.groovy.classgen.BytecodeExpression
org.codehaus.groovy.classgen.asm.ExpressionAsVariableSlot
- All Implemented Interfaces:
GroovydocHolder<AnnotatedNode>,NodeMetaDataHandler
Helper class that takes an Expression and if visited will load it normally,
storing the result in a helper variable, which then can be requested after
the visit is completed. A copy of the variable will stay on the stack.
Subsequent visits will load the stored value instead of visiting the
expression again
-
Field Summary
Fields inherited from class org.codehaus.groovy.classgen.BytecodeExpression
NOPFields inherited from class org.codehaus.groovy.ast.expr.Expression
EMPTY_ARRAYFields inherited from interface groovy.lang.groovydoc.GroovydocHolder
DOC_COMMENT -
Constructor Summary
ConstructorsConstructorDescriptionExpressionAsVariableSlot(WriterController controller, Expression expression) Creates an expression that stores an expression result in a temporary variable.ExpressionAsVariableSlot(WriterController controller, Expression expression, String name) Creates an expression that stores an expression result in a temporary variable. -
Method Summary
Methods inherited from class org.codehaus.groovy.classgen.BytecodeExpression
transformExpression, visitMethods inherited from class org.codehaus.groovy.ast.expr.Expression
getType, setType, transformExpressions, transformExpressionsMethods inherited from class org.codehaus.groovy.ast.AnnotatedNode
addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSyntheticMethods inherited from class org.codehaus.groovy.ast.ASTNode
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler
copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, newMetaDataMap, putNodeMetaData, removeNodeMetaData, setNodeMetaData
-
Constructor Details
-
ExpressionAsVariableSlot
Creates an expression that stores an expression result in a temporary variable.- Parameters:
controller- the writer controllerexpression- the expression to evaluate and storename- the name for the temporary variable
-
ExpressionAsVariableSlot
Creates an expression that stores an expression result in a temporary variable.- Parameters:
controller- the writer controllerexpression- the expression to evaluate and store
-
-
Method Details
-
visit
public void visit(org.objectweb.asm.MethodVisitor mv) Emits bytecode instructions using the provided method visitor.- Specified by:
visitin classBytecodeExpression- Parameters:
mv- the ASM method visitor to generate bytecode
-
getIndex
public int getIndex()returns the index of the bytecode variable -
getText
Returns a human-readable text representation of this AST node. Used for debugging and error messages. Default implementation returns a message indicating the representation is not yet implemented for this node type.- Overrides:
getTextin classBytecodeExpression- Returns:
- text representation of this node, or placeholder for unimplemented types
-