Groovy Documentation

## org.codehaus.groovy.classgen.asm
[Java] Class OperandStack

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

    public class OperandStack
    extends java.lang.Object

Constructor Summary
`OperandStack(WriterController wc)`

Method Summary
`ClassNode` | `box()`
`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.
`void` | `doAsType(ClassNode targetType)`
`void` | `doGroovyCast(ClassNode targetType)`
`void` | `doGroovyCast(Variable v)`
`void` | `dup()`
`int` | `getStackLength()`
`ClassNode` | `getTopOperand()`
`org.objectweb.asm.Label` | `jump(int ifIns)`
`void` | `jump(int ifIns, org.objectweb.asm.Label label)` duplicate top element
`void` | `load(ClassNode type, int idx)`
`void` | `loadOrStoreVariable(BytecodeVariable variable, boolean useReferenceDirectly)`
`void` | `pop()` remove operand stack top element using bytecode pop
`void` | `popDownTo(int elements)`
`void` | `push(ClassNode type)` swap two top level operands
`void` | `pushBool(boolean inclusive)`
`void` | `pushConstant(ConstantExpression expression)`
`void` | `pushDynamicName(Expression name)`
`void` | `remove(int amount)` Remove amount elements from the operand stack, without using pop.
`void` | `replace(ClassNode type)` replace top level element with new element of given type
`void` | `replace(ClassNode type, int n)`
`void` | `storeVar(BytecodeVariable variable)`
`void` | `swap()`
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Constructor Detail

### OperandStack

    public OperandStack(WriterController wc)

Method Detail

### box

    public ClassNode box()

### castToBool

    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

### doAsType

    public void doAsType(ClassNode targetType)

### doGroovyCast

    public void doGroovyCast(ClassNode targetType)

### doGroovyCast

    public void doGroovyCast(Variable v)

### dup

    public void dup()

### getStackLength

    public int getStackLength()

### getTopOperand

    public ClassNode getTopOperand()

### jump

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

### jump

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

  duplicate top element

### load

    public void load(ClassNode type, int idx)

### loadOrStoreVariable

    public void loadOrStoreVariable(BytecodeVariable variable, boolean useReferenceDirectly)

### pop

    public void pop()

  remove operand stack top element using bytecode pop

### popDownTo

    public void popDownTo(int elements)

### push

    public void push(ClassNode type)

  swap two top level operands

### pushBool

    public void pushBool(boolean inclusive)

### pushConstant

    public void pushConstant(ConstantExpression expression)

### pushDynamicName

    public void pushDynamicName(Expression name)

### remove

    public void remove(int amount)

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

### replace

    public void replace(ClassNode type)

  replace top level element with new element of given type

### replace

    public void replace(ClassNode type, int n)

### storeVar

    public void storeVar(BytecodeVariable variable)

### swap

    public void swap()

### toString

    public java.lang.String toString()

Groovy Documentation