Package org.codehaus.groovy.classgen.asm
Class BytecodeVariable
java.lang.Object
org.codehaus.groovy.classgen.asm.BytecodeVariable
Represents compile time variable metadata while compiling a method.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BytecodeVariableSentinel metadata for the implicitsuperreceiver.static final BytecodeVariableSentinel metadata for the implicitthisreceiver. -
Constructor Summary
ConstructorsConstructorDescriptionBytecodeVariable(int index, ClassNode type, String name, int prevCurrent) Creates bytecode metadata for a local variable slot. -
Method Summary
Modifier and TypeMethodDescriptionorg.objectweb.asm.LabelintgetIndex()getName()intorg.objectweb.asm.LabelgetType()booleanbooleanisHolder()voidsetDynamicTyped(boolean dynamicTyped) Marks whether the variable should be treated as dynamically typed.voidsetEndLabel(org.objectweb.asm.Label endLabel) Sets the end label used for local-variable table metadata.voidsetHolder(boolean holder) Marks whether this variable must be stored through a holder object.voidsetStartLabel(org.objectweb.asm.Label startLabel) Sets the start label used for local-variable table metadata.voidUpdates the tracked variable type.toString()
-
Field Details
-
THIS_VARIABLE
Sentinel metadata for the implicitthisreceiver. -
SUPER_VARIABLE
Sentinel metadata for the implicitsuperreceiver.
-
-
Constructor Details
-
BytecodeVariable
Creates bytecode metadata for a local variable slot.- Parameters:
index- the JVM local-variable indextype- the variable typename- the variable nameprevCurrent- the previous current-variable index
-
-
Method Details
-
getIndex
public int getIndex()- Returns:
- the stack index for this variable
-
getName
- Returns:
- the source-level variable name
-
getType
- Returns:
- the variable type
-
setType
Updates the tracked variable type.- Parameters:
type- the new variable type
-
getPrevIndex
public int getPrevIndex()- Returns:
- the previous current-variable index
-
isDynamicTyped
public boolean isDynamicTyped()- Returns:
- whether the variable uses dynamic typing
-
setDynamicTyped
public void setDynamicTyped(boolean dynamicTyped) Marks whether the variable should be treated as dynamically typed.- Parameters:
dynamicTyped-trueif the variable is dynamically typed
-
isHolder
public boolean isHolder()- Returns:
- is this local variable shared in other scopes (and so must use a ValueHolder)
-
setHolder
public void setHolder(boolean holder) Marks whether this variable must be stored through a holder object.- Parameters:
holder-trueif the variable is closure-shared
-
getStartLabel
public org.objectweb.asm.Label getStartLabel()- Returns:
- the start label used for local-variable table metadata
-
setStartLabel
public void setStartLabel(org.objectweb.asm.Label startLabel) Sets the start label used for local-variable table metadata.- Parameters:
startLabel- the starting label
-
getEndLabel
public org.objectweb.asm.Label getEndLabel()- Returns:
- the end label used for local-variable table metadata
-
setEndLabel
public void setEndLabel(org.objectweb.asm.Label endLabel) Sets the end label used for local-variable table metadata.- Parameters:
endLabel- the ending label
-
toString
-