org.norecess.citkit.tir.expressions
Class LetETIR

java.lang.Object
  extended by org.norecess.citkit.tir.expressions.LetETIR
All Implemented Interfaces:
ILetETIR, ExpressionTIR, HobbesTIR

public class LetETIR
extends java.lang.Object
implements ILetETIR

The TIR for a let expression. A let expression is used to declared new variables in a new scope. The list of DeclarationTIRs should be a list of variables, types, and functions declared in one new scope.

If using an ExpressionTIRVisitor to process a LetETIR, it is useful to implement DeclarationTIRVisitor to process the declarations for the new scope.

Author:
Jeremy D. Frens

Constructor Summary
LetETIR(IPosition position, java.util.List<? extends DeclarationTIR> declarations, ExpressionTIR body)
          Constructs a let expression.
LetETIR(java.util.List<? extends DeclarationTIR> declarations, ExpressionTIR body)
          Basic constructor.
 
Method Summary
<T> T
accept(ExpressionTIRVisitor<T> visitor)
          Implements the visitor pattern with ExpressionTIRVisitor.
 boolean equals(java.lang.Object o)
           
 ExpressionTIR getBody()
          Returns the body of the let expression.
 java.util.List<? extends DeclarationTIR> getDeclarations()
          Returns the declarations of the let expression.
 IPosition getPosition()
          Retrieves the position of the code that generated the TIR.
 HobbesType getType()
          Retrieves the type of the expression.
 SymbolTable<HobbesType> getTypeTable()
           
 int hashCode()
           
 void setTypeTable(SymbolTable<HobbesType> typeTable)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LetETIR

public LetETIR(IPosition position,
               java.util.List<? extends DeclarationTIR> declarations,
               ExpressionTIR body)
Constructs a let expression.

Parameters:
position - the position of the let expression in the source code.
declarations - the declarations of the let expression.
body - the body of the let expression.

LetETIR

public LetETIR(java.util.List<? extends DeclarationTIR> declarations,
               ExpressionTIR body)
Basic constructor.

Parameters:
declarations - the declarations.
body - the body.
Method Detail

getBody

public ExpressionTIR getBody()
Returns the body of the let expression.

Specified by:
getBody in interface ILetETIR
Returns:
the body of the let expression.

getDeclarations

public java.util.List<? extends DeclarationTIR> getDeclarations()
Returns the declarations of the let expression.

Specified by:
getDeclarations in interface ILetETIR
Returns:
the declarations of the let expression.

getTypeTable

public SymbolTable<HobbesType> getTypeTable()

setTypeTable

public void setTypeTable(SymbolTable<HobbesType> typeTable)

getType

public HobbesType getType()
Description copied from interface: ExpressionTIR
Retrieves the type of the expression.

Specified by:
getType in interface ExpressionTIR
Returns:
the type of the code.

accept

public <T> T accept(ExpressionTIRVisitor<T> visitor)
Description copied from interface: ExpressionTIR
Implements the visitor pattern with ExpressionTIRVisitor.

Specified by:
accept in interface ExpressionTIR
Parameters:
visitor - the visitor object.
Returns:
the result of visiting the AST with the visitor.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getPosition

public IPosition getPosition()
Retrieves the position of the code that generated the TIR.

Specified by:
getPosition in interface HobbesTIR
Returns:
the position of the code in the source code.