|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.adamcornett.cminus.Function
public class Function
A function to be stored in the function table.
| Field Summary | |
|---|---|
private List<TokenLocation> |
calls
A list of calls of this function. |
private org.antlr.runtime.Token |
ID
The token representing the name/ID of this function. |
private SymbolTable |
localSymbols
The SymbolTable for this function.NOTE: Due to the nested scoping of functions, this symbol table only contains the function parameters, the local variables are declared in a child scope that is started with the CompoundStatement that represents the body of the function. |
private String |
name
The name of the function. |
private SortedSet<Symbol> |
params
The list of symbols that make up the function's parameters. |
private Type |
type
The return type of the function. |
| Constructor Summary | |
|---|---|
Function(org.antlr.runtime.Token token,
CMinusParser.type_specifier_return t)
Create a new function |
|
Function(org.antlr.runtime.Token token,
Type returnType)
Create a new function |
|
| Method Summary | |
|---|---|
void |
addCall(TokenLocation tokenLocation)
Record a call to this function. |
void |
addParam(Symbol s)
Add a parameter to this function |
void |
addSymbol(Symbol s)
Add a symbol to the local symbol table. |
String |
getDefPos()
Get the location where this function was defined. |
String |
getName()
Get the name of the function. |
SortedSet<Symbol> |
getParams()
|
Type |
getReturnType()
|
String |
getSignature()
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private final List<TokenLocation> calls
private final org.antlr.runtime.Token ID
private final SymbolTable localSymbols
SymbolTable for this function.
private final String name
private final SortedSet<Symbol> params
private final Type type
| Constructor Detail |
|---|
public Function(org.antlr.runtime.Token token,
CMinusParser.type_specifier_return t)
token - The token representing the ID of this functiont - The return type of this function.
public Function(org.antlr.runtime.Token token,
Type returnType)
token - The token representing the ID of this functiont - The return type of this function.| Method Detail |
|---|
public void addCall(TokenLocation tokenLocation)
tokenLocation - The location of the call.public void addParam(Symbol s)
s - They symbol representing the parameter.public void addSymbol(Symbol s)
s - The symbol to be added.public String getDefPos()
public String getName()
public Type getReturnType()
public String getSignature()
public String toString()
toString in class Objectpublic SortedSet<Symbol> getParams()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||