jltools.ext.jl.ast
Class For_c

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

public class For_c
extends Stmt_c
implements For

An immutable representation of a Java language for statement. Contains a statement to be executed and an expression to be tested indicating whether to reexecute the statement.

See Also:
Serialized Form

Inner classes inherited from class jltools.ext.jl.ast.Node_c
Node_c.StringCodeWriter
 
Field Summary
protected  Stmt body
           
protected  Expr cond
           
protected  java.util.List inits
           
protected  java.util.List iters
           
 
Fields inherited from class jltools.ext.jl.ast.Node_c
ext, position
 
Constructor Summary
For_c(Ext ext, Position pos, java.util.List inits, Expr cond, java.util.List iters, Stmt body)
           
 
Method Summary
 Stmt body()
          Loop body
 For body(Stmt body)
          Set the body of the statement.
 Expr cond()
          Loop condition
 For cond(Expr cond)
          Set the conditional of the statement.
 void enterScope(Context c)
          Adjust the environment on entering the scope of the method.
 java.util.List inits()
          List of initialization statements
 For inits(java.util.List inits)
          Set the inits of the statement.
 java.util.List iters()
          List of iterator expressions.
 For iters(java.util.List iters)
          Set the iterator expressions of the statement.
 void leaveScope(Context c)
          Adjust the environment on leaving the scope of the method.
protected  For_c reconstruct(java.util.List inits, Expr cond, java.util.List iters, Stmt body)
          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, exceptionCheck_, exceptionCheck, exceptionCheckOverride_, exceptionCheckOverride, ext, ext, foldConstants_, foldConstants, foldConstantsOverride_, foldConstantsOverride, 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, exceptionCheck_, exceptionCheckOverride_, ext, ext, foldConstants_, foldConstantsOverride_, position, position, reconstructTypes_, typeCheckOverride_, visit
 

Field Detail

inits

protected java.util.List inits

cond

protected Expr cond

iters

protected java.util.List iters

body

protected Stmt body
Constructor Detail

For_c

public For_c(Ext ext,
             Position pos,
             java.util.List inits,
             Expr cond,
             java.util.List iters,
             Stmt body)
Method Detail

inits

public java.util.List inits()
List of initialization statements
Specified by:
inits in interface For

inits

public For inits(java.util.List inits)
Set the inits of the statement.
Specified by:
inits in interface For

cond

public Expr cond()
Loop condition
Specified by:
cond in interface For

cond

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

iters

public java.util.List iters()
List of iterator expressions.
Specified by:
iters in interface For

iters

public For iters(java.util.List iters)
Set the iterator expressions of the statement.
Specified by:
iters in interface For

body

public Stmt body()
Loop body
Specified by:
body in interface For

body

public For body(Stmt body)
Set the body of the statement.
Specified by:
body in interface For

reconstruct

protected For_c reconstruct(java.util.List inits,
                            Expr cond,
                            java.util.List iters,
                            Stmt body)
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

enterScope

public void enterScope(Context c)
Description copied from interface: Node
Adjust the environment on entering the scope of the method.
Specified by:
enterScope in interface Node
Overrides:
enterScope in class Node_c

leaveScope

public void leaveScope(Context c)
Description copied from interface: Node
Adjust the environment on leaving the scope of the method.
Specified by:
leaveScope in interface Node
Overrides:
leaveScope 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

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.

toString

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