Package: org.codehaus.groovy.classgen.asm

## [Java] Class OperandStack

- org.codehaus.groovy.classgen.asm.OperandStack

-     public class OperandStack
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and description
    `OperandStack(WriterController controller)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public ClassNode` | `box()`
    `` | `public void` | `castToBool(int mark, boolean emptyDefault)` ensure last marked parameter on the stack is a primitive boolean if mark==stack size, we assume an empty expression or statement.
    `` | `public void` | `doAsType(ClassNode targetType)`
    `` | `public void` | `doGroovyCast(ClassNode targetType)` do Groovy cast for top level element
    `` | `public void` | `doGroovyCast(Variable v)`
    `` | `public void` | `dup()` duplicate top element
    `` | `public int` | `getStackLength()`
    `` | `public ClassNode` | `getTopOperand()`
    `` | `public org.objectweb.asm.Label` | `jump(int ifIns)`
    `` | `public void` | `jump(int ifIns, org.objectweb.asm.Label label)`
    `` | `public void` | `load(ClassNode type, int idx)`
    `` | `public void` | `loadOrStoreVariable(BytecodeVariable variable, boolean useReferenceDirectly)`
    `` | `public void` | `pop()` remove operand stack top element using bytecode pop
    `` | `public void` | `popDownTo(int elements)`
    `` | `public void` | `push(ClassNode type)` push operand on stack
    `` | `public void` | `pushBool(boolean value)`
    `` | `public void` | `pushConstant(ConstantExpression expression)` load the constant on the operand stack.
    `` | `public void` | `pushDynamicName(Expression name)`
    `` | `public void` | `remove(int amount)` Remove amount elements from the operand stack, without using pop.
    `` | `public void` | `replace(ClassNode type)` replace top level element with new element of given type
    `` | `public void` | `replace(ClassNode type, int n)` replace n top level elements with new element of given type
    `` | `public void` | `storeVar(BytecodeVariable variable)`
    `` | `public void` | `swap()` swap two top level operands
    `` | `public String` | `toString()`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### public OperandStack(WriterController controller)

  - ### Method Detail

    - #### public ClassNode box()

    - #### public void castToBool(int mark, boolean emptyDefault)

      ensure last marked parameter on the stack is a primitive boolean if mark==stack size, we assume an empty expression or statement. was used and we will use the value given in emptyDefault as boolean if mark==stack.size()-1 the top element will be cast to boolean using Groovy truth. In other cases we throw a GroovyBugError

    - #### public void doAsType(ClassNode targetType)

    - #### public void doGroovyCast(ClassNode targetType)

      do Groovy cast for top level element

    - #### public void doGroovyCast(Variable v)

    - #### public void dup()

      duplicate top element

    - #### public int getStackLength()

    - #### public ClassNode getTopOperand()

    - #### public org.objectweb.asm.Label jump(int ifIns)

    - #### public void jump(int ifIns, org.objectweb.asm.Label label)

    - #### public void load(ClassNode type, int idx)

    - #### public void loadOrStoreVariable(BytecodeVariable variable, boolean useReferenceDirectly)

    - #### public void pop()

      remove operand stack top element using bytecode pop

    - #### public void popDownTo(int elements)

    - #### public void push(ClassNode type)

      push operand on stack

    - #### public void pushBool(boolean value)

    - #### public void pushConstant(ConstantExpression expression)

      load the constant on the operand stack.

    - #### public void pushDynamicName(Expression name)

    - #### public void remove(int amount)

      Remove amount elements from the operand stack, without using pop. For example after a method invocation

    - #### public void replace(ClassNode type)

      replace top level element with new element of given type

    - #### public void replace(ClassNode type, int n)

      replace n top level elements with new element of given type

    - #### public void storeVar(BytecodeVariable variable)

    - #### public void swap()

      swap two top level operands

    - #### @Override
      public String toString()