jltools.ext.jl.ast
Class If_c

java.lang.Object
  |
  +--jltools.ext.jl.ast.Node_c
        |
        +--jltools.ext.jl.ast.Stmt_c
              |
              +--jltools.ext.jl.ast.If_c
All Implemented Interfaces:
java.lang.Cloneable, Copy, If, Node, java.io.Serializable, Stmt

public class If_c
extends Stmt_c
implements If

An immutable representation of a Java language if statement. Contains an expression whose value is tested, a ``then'' statement (consequent), and optionally an ``else'' statement (alternate).

See Also:
Serialized Form

Inner classes inherited from class jltools.ext.jl.ast.Node_c
Node_c.StringCodeWriter
 
Field Summary
protected  Stmt alternative
           
protected  Expr cond
           
protected  Stmt consequent
           
 
Fields inherited from class jltools.ext.jl.ast.Node_c
ext, position
 
Constructor Summary
If_c(Ext ext, Position pos, Expr cond, Stmt consequent, Stmt alternative)
           
 
Method Summary
 Stmt alternative()
          Get the alternative of the statement.
 If alternative(Stmt alternative)
          Set the alternative of the statement.
 Expr cond()
          Get the conditional of the statement.
 If cond(Expr cond)
          Set the conditional of the statement.
 Stmt consequent()
          Get the consequent of the statement.
 If consequent(Stmt consequent)
          Set the consequent of the statement.
protected  If_c reconstruct(Expr cond, Stmt consequent, Stmt alternative)
          Reconstruct the statement.
 java.lang.String toString()
           
 void translate_(CodeWriter w, Translator tr)
          Write the statement to an output file.
 Node typeCheck_(TypeChecker tc)
          Type check the statement.
 Node visitChildren(NodeVisitor v)
          Visit the children of the statement.
 
Methods inherited from class jltools.ext.jl.ast.Node_c
buildTypes_, buildTypes, buildTypesOverride_, buildTypesOverride, copy, disambiguate_, disambiguate, disambiguateOverride_, disambiguateOverride, disambiguateTypes_, disambiguateTypes, disambiguateTypesOverride_, disambiguateTypesOverride, dump, enterScope, exceptionCheck_, exceptionCheck, exceptionCheckOverride_, exceptionCheckOverride, ext, ext, foldConstants_, foldConstants, foldConstantsOverride_, foldConstantsOverride, leaveScope, position, position, reconstructTypes_, reconstructTypes, translate, translateBlock, translateSubstmt, typeCheck, typeCheckOverride_, typeCheckOverride, visit, visitList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jltools.ast.Node
buildTypes_, buildTypesOverride_, copy, disambiguate_, disambiguateOverride_, disambiguateTypes_, disambiguateTypesOverride_, dump, enterScope, exceptionCheck_, exceptionCheckOverride_, ext, ext, foldConstants_, foldConstantsOverride_, leaveScope, position, position, reconstructTypes_, typeCheckOverride_, visit
 

Field Detail

cond

protected Expr cond

consequent

protected Stmt consequent

alternative

protected Stmt alternative
Constructor Detail

If_c

public If_c(Ext ext,
            Position pos,
            Expr cond,
            Stmt consequent,
            Stmt alternative)
Method Detail

cond

public Expr cond()
Get the conditional of the statement.
Specified by:
cond in interface If

cond

public If cond(Expr cond)
Set the conditional of the statement.
Specified by:
cond in interface If

consequent

public Stmt consequent()
Get the consequent of the statement.
Specified by:
consequent in interface If

consequent

public If consequent(Stmt consequent)
Set the consequent of the statement.
Specified by:
consequent in interface If

alternative

public Stmt alternative()
Get the alternative of the statement.
Specified by:
alternative in interface If

alternative

public If alternative(Stmt alternative)
Set the alternative of the statement.
Specified by:
alternative in interface If

reconstruct

protected If_c reconstruct(Expr cond,
                           Stmt consequent,
                           Stmt alternative)
Reconstruct the statement.

visitChildren

public Node visitChildren(NodeVisitor v)
Visit the children of the statement.
Specified by:
visitChildren in interface Node
Overrides:
visitChildren in class Node_c

typeCheck_

public Node typeCheck_(TypeChecker tc)
                throws SemanticException
Type check the statement.
Specified by:
typeCheck_ in interface Node
Overrides:
typeCheck_ in class Node_c

toString

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

translate_

public void translate_(CodeWriter w,
                       Translator tr)
Write the statement to an output file.
Specified by:
translate_ in interface Node
Overrides:
translate_ in class Node_c
Following copied from interface: jltools.ast.Node
Parameters:
w - The code writer to which to write.
tr - The translation pass. This is not a visitor.