com.adamcornett.cminus.tree
Class VarTree
java.lang.Object
org.antlr.runtime.tree.BaseTree
org.antlr.runtime.tree.CommonTree
com.adamcornett.cminus.tree.CMTree
com.adamcornett.cminus.tree.ExprNode
com.adamcornett.cminus.tree.VarTree
- All Implemented Interfaces:
- ScopeNode, SymbolNode, TypeNode, org.antlr.runtime.tree.Tree
- Direct Known Subclasses:
- ParamTree
public class VarTree
- extends ExprNode
- implements ScopeNode, SymbolNode
A node that represents a variable (symbol)
- Author:
- Adam Cornett
| Fields inherited from class com.adamcornett.cminus.tree.CMTree |
log |
| Fields inherited from class org.antlr.runtime.tree.CommonTree |
childIndex, parent, startIndex, stopIndex, token |
| Fields inherited from class org.antlr.runtime.tree.BaseTree |
children |
| Fields inherited from interface org.antlr.runtime.tree.Tree |
INVALID_NODE |
|
Constructor Summary |
VarTree(org.antlr.runtime.Token payload)
|
| Methods inherited from class org.antlr.runtime.tree.CommonTree |
dupNode, getCharPositionInLine, getChildIndex, getLine, getParent, getText, getToken, getTokenStartIndex, getTokenStopIndex, getType, isNil, setChildIndex, setParent, setTokenStartIndex, setTokenStopIndex, setUnknownTokenBoundaries, toString |
| Methods inherited from class org.antlr.runtime.tree.BaseTree |
addChild, addChildren, createChildrenList, deleteChild, freshenParentAndChildIndexes, freshenParentAndChildIndexes, getAncestor, getAncestors, getChild, getChildCount, getChildren, getFirstChildWithType, hasAncestor, replaceChildren, sanityCheckParentAndChildIndexes, sanityCheckParentAndChildIndexes, setChild, toStringTree |
sym
private Symbol sym
- The associated symbol from the
SymbolTable
IDNode
protected CMTree IDNode
- The identifier node
scope
protected final Scope scope
- The scope which the symbol is defined in.
VarTree
public VarTree(org.antlr.runtime.Token payload)
emitCode
public void emitCode(ClassGenerator classGenerator)
- Overrides:
emitCode in class CMTree
getRequiredStack
public int getRequiredStack()
- Overrides:
getRequiredStack in class CMTree
getReturnType
public Type getReturnType()
- Specified by:
getReturnType in interface TypeNode
getScope
public Scope getScope()
- Specified by:
getScope in interface ScopeNode
getScopeNumber
public int getScopeNumber()
- Specified by:
getScopeNumber in interface ScopeNode
getSymbol
public Symbol getSymbol()
- Specified by:
getSymbol in interface SymbolNode
isArray
public boolean isArray()
pushIndex
public void pushIndex(ClassGenerator cg)
setReturnType
public void setReturnType(Type t)
- Specified by:
setReturnType in interface TypeNode
setScope
public void setScope(Scope s)
- Specified by:
setScope in interface ScopeNode
setSymbol
public void setSymbol(Symbol s)
- Specified by:
setSymbol in interface SymbolNode
initSymbol
protected void initSymbol()