|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.classgen.asm.CompileStack
public class CompileStack extends java.lang.Object
This class is a helper for AsmClassGenerator. It manages different aspects of the code of a code block like handling labels, defining variables, and scopes. After a MethodNode is visited clear should be called, for initialization the method init should be used.
Some Notes:
Nested Class Summary | |
---|---|
static class |
CompileStack.BlockRecorder
|
protected static class |
CompileStack.LabelRange
|
Method Summary | |
---|---|
java.lang.Object
|
CompileStack(WriterController wc)
|
void
|
addExceptionBlock(org.objectweb.asm.Label start, org.objectweb.asm.Label end, org.objectweb.asm.Label goal, java.lang.String sig)
initializes this class for a MethodNode. |
void
|
applyBlockRecorder()
|
void
|
applyFinallyBlocks(org.objectweb.asm.Label label, boolean isBreakLabel)
|
void
|
clear()
|
boolean
|
containsVariable(java.lang.String name)
Returns the label for the given name |
org.objectweb.asm.Label
|
createLocalLabel(java.lang.String name)
|
int
|
defineTemporaryVariable(Variable var, boolean store)
|
int
|
defineTemporaryVariable(java.lang.String name, boolean store)
|
int
|
defineTemporaryVariable(java.lang.String name, ClassNode node, boolean store)
Clears the state of the class. |
BytecodeVariable
|
defineVariable(Variable v, boolean initFromStack)
@param name the name of the variable of interest |
BytecodeVariable
|
defineVariable(Variable v, ClassNode variableType, boolean initFromStack)
|
org.objectweb.asm.Label
|
getBreakLabel()
|
org.objectweb.asm.Label
|
getContinueLabel()
|
org.objectweb.asm.Label
|
getLabel(java.lang.String name)
|
org.objectweb.asm.Label
|
getNamedBreakLabel(java.lang.String name)
|
org.objectweb.asm.Label
|
getNamedContinueLabel(java.lang.String name)
|
VariableScope
|
getScope()
|
BytecodeVariable
|
getVariable(java.lang.String variableName)
|
BytecodeVariable
|
getVariable(java.lang.String variableName, boolean mustExist)
creates a temporary variable. |
boolean
|
hasBlockRecorder()
|
void
|
init(VariableScope el, Parameter[] parameters)
Causes the statestack to add an element and sets the given scope as new current variable scope. |
boolean
|
isImplicitThis()
|
boolean
|
isInSpecialConstructorCall()
|
boolean
|
isLHS()
|
void
|
pop()
|
void
|
popBlockRecorderVisit(CompileStack.BlockRecorder finallyBlock)
|
void
|
popImplicitThis()
|
void
|
popLHS()
|
void
|
pushBlockRecorder(CompileStack.BlockRecorder recorder)
|
void
|
pushBlockRecorderVisit(CompileStack.BlockRecorder finallyBlock)
|
void
|
pushBooleanExpression()
|
void
|
pushImplicitThis(boolean implicitThis)
|
void
|
pushInSpecialConstructorCall()
|
void
|
pushLHS(boolean lhs)
|
void
|
pushLoop(VariableScope el, java.lang.String labelName)
Used for |
void
|
pushLoop(java.lang.String labelName)
|
void
|
pushState()
|
org.objectweb.asm.Label
|
pushSwitch()
|
void
|
pushVariableScope(VariableScope el)
Should be called when decending into a loop that does not define a scope. |
void
|
removeVar(int tempIndex)
|
void
|
writeExceptionTable(CompileStack.BlockRecorder block, org.objectweb.asm.Label goal, java.lang.String sig)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), 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() |
Method Detail |
---|
public java.lang.Object CompileStack(WriterController wc)
public void addExceptionBlock(org.objectweb.asm.Label start, org.objectweb.asm.Label end, org.objectweb.asm.Label goal, java.lang.String sig)
public void applyBlockRecorder()
public void applyFinallyBlocks(org.objectweb.asm.Label label, boolean isBreakLabel)
public void clear()
public boolean containsVariable(java.lang.String name)
public org.objectweb.asm.Label createLocalLabel(java.lang.String name)
public int defineTemporaryVariable(Variable var, boolean store)
public int defineTemporaryVariable(java.lang.String name, boolean store)
public int defineTemporaryVariable(java.lang.String name, ClassNode node, boolean store)
public BytecodeVariable defineVariable(Variable v, boolean initFromStack)
name
- the name of the variable of interest
public BytecodeVariable defineVariable(Variable v, ClassNode variableType, boolean initFromStack)
public org.objectweb.asm.Label getBreakLabel()
public org.objectweb.asm.Label getContinueLabel()
public org.objectweb.asm.Label getLabel(java.lang.String name)
public org.objectweb.asm.Label getNamedBreakLabel(java.lang.String name)
public org.objectweb.asm.Label getNamedContinueLabel(java.lang.String name)
public VariableScope getScope()
public BytecodeVariable getVariable(java.lang.String variableName)
public BytecodeVariable getVariable(java.lang.String variableName, boolean mustExist)
name
- defines type and namestore
- defines if the toplevel argument of the stack should be stored
public boolean hasBlockRecorder()
public void init(VariableScope el, Parameter[] parameters)
public boolean isImplicitThis()
public boolean isInSpecialConstructorCall()
public boolean isLHS()
public void pop()
public void popBlockRecorderVisit(CompileStack.BlockRecorder finallyBlock)
public void popImplicitThis()
public void popLHS()
public void pushBlockRecorder(CompileStack.BlockRecorder recorder)
public void pushBlockRecorderVisit(CompileStack.BlockRecorder finallyBlock)
public void pushBooleanExpression()
public void pushImplicitThis(boolean implicitThis)
public void pushInSpecialConstructorCall()
public void pushLHS(boolean lhs)
public void pushLoop(VariableScope el, java.lang.String labelName)
break foo
inside a loop to end the
execution of the marked loop. This method will return the
break label of the loop if there is one found for the name.
If not, the current break label is returned.
public void pushLoop(java.lang.String labelName)
public void pushState()
public org.objectweb.asm.Label pushSwitch()
public void pushVariableScope(VariableScope el)
public void removeVar(int tempIndex)
public void writeExceptionTable(CompileStack.BlockRecorder block, org.objectweb.asm.Label goal, java.lang.String sig)
Groovy Documentation