Class BytecodeVariable

java.lang.Object
org.codehaus.groovy.classgen.asm.BytecodeVariable

public class BytecodeVariable extends Object
Represents compile time variable metadata while compiling a method.
  • Field Details

    • THIS_VARIABLE

      public static final BytecodeVariable THIS_VARIABLE
      Sentinel metadata for the implicit this receiver.
    • SUPER_VARIABLE

      public static final BytecodeVariable SUPER_VARIABLE
      Sentinel metadata for the implicit super receiver.
  • Constructor Details

    • BytecodeVariable

      public BytecodeVariable(int index, ClassNode type, String name, int prevCurrent)
      Creates bytecode metadata for a local variable slot.
      Parameters:
      index - the JVM local-variable index
      type - the variable type
      name - the variable name
      prevCurrent - the previous current-variable index
  • Method Details

    • getIndex

      public int getIndex()
      Returns:
      the stack index for this variable
    • getName

      public String getName()
      Returns:
      the source-level variable name
    • getType

      public ClassNode getType()
      Returns:
      the variable type
    • setType

      public void setType(ClassNode type)
      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 - true if 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 - true if 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

      public String toString()
      Overrides:
      toString in class Object