|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.norecess.citkit.tir.declarations.FunctionDTIR
public class FunctionDTIR
The TIR for a function or procedure declaration. A function returns a value; a procedure does not.
The parameters of a function are represented as a list of FieldTIR
s.
This slightly abuses the name since there's no implied order in a record of
fields, but parameters are determined solely on their order.
Constructor Summary | |
---|---|
FunctionDTIR(IPosition position,
java.lang.String name,
java.util.List<IFieldTIR> parameters,
ExpressionTIR body)
Constructs a procedure declaration. |
|
FunctionDTIR(IPosition position,
java.lang.String name,
java.util.List<IFieldTIR> parameters,
INameTTIR result,
ExpressionTIR body)
Constructs a function declaration. |
|
FunctionDTIR(java.lang.String name,
java.util.List<IFieldTIR> parameters,
ExpressionTIR body)
Basic constructor for a procedure. |
|
FunctionDTIR(java.lang.String name,
java.util.List<IFieldTIR> parameters,
INameTTIR result,
ExpressionTIR body)
Basic constructor for a function. |
Method Summary | ||
---|---|---|
|
accept(DeclarationTIRVisitor<T> visitor)
Implements the visitor pattern with DeclarationTIRVisitor . |
|
boolean |
equals(java.lang.Object o)
|
|
ExpressionTIR |
getBody()
Returns the body of the function. |
|
java.lang.String |
getName()
Returns the name of the function. |
|
java.util.List<IFieldTIR> |
getParameters()
Returns the parameters of the function. |
|
IPosition |
getPosition()
Retrieves the position of the code that generated the TIR. |
|
INameTTIR |
getResult()
Returns the type of the returned value. |
|
int |
hashCode()
|
|
boolean |
isFunction()
Indicates if this TIR represents a function (i.e., there is a return type). |
|
boolean |
isProcedure()
Indicates if this TIR represents a procedure (i.e., there's no return type). |
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FunctionDTIR(IPosition position, java.lang.String name, java.util.List<IFieldTIR> parameters, INameTTIR result, ExpressionTIR body)
position
- the position of the function declaration in the source code.name
- the name of the function.parameters
- the parameters of the function.result
- the type of the returned value (possibly null).body
- the body of the function.public FunctionDTIR(java.lang.String name, java.util.List<IFieldTIR> parameters, INameTTIR result, ExpressionTIR body)
name
- the name of the function.parameters
- the parameters of the function.result
- the return type of the function.body
- the body of the function.public FunctionDTIR(IPosition position, java.lang.String name, java.util.List<IFieldTIR> parameters, ExpressionTIR body)
position
- the position of the procedur declaration in the source code.name
- the name of the procedure.parameters
- the parameters of the procedure.body
- the body of the procedure.public FunctionDTIR(java.lang.String name, java.util.List<IFieldTIR> parameters, ExpressionTIR body)
name
- the name of the procedure.parameters
- the parameters of the procedure.body
- the body of the procedure.Method Detail |
---|
public IPosition getPosition()
DeclarationTIR
getPosition
in interface DeclarationTIR
getPosition
in interface HobbesTIR
public ExpressionTIR getBody()
getBody
in interface IFunctionDTIR
public java.lang.String getName()
getName
in interface IFunctionDTIR
public java.util.List<IFieldTIR> getParameters()
getParameters
in interface IFunctionDTIR
public INameTTIR getResult()
getResult
in interface IFunctionDTIR
public <T> T accept(DeclarationTIRVisitor<T> visitor)
DeclarationTIR
DeclarationTIRVisitor
.
accept
in interface DeclarationTIR
visitor
- the visitor object.
public boolean isProcedure()
isProcedure
in interface IFunctionDTIR
public boolean isFunction()
isFunction
in interface IFunctionDTIR
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |