com.google.dart.compiler.backend.js.ast
Class JsFor

java.lang.Object
  extended by HasMetadata
      extended by com.google.dart.compiler.backend.js.ast.SourceInfoAwareJsNode
          extended by com.google.dart.compiler.backend.js.ast.JsFor
All Implemented Interfaces:
JsNode, JsStatement

public class JsFor
extends SourceInfoAwareJsNode
implements JsStatement

A for statement. If specified at all, the initializer part is either a declaration of one or more variables, in which case getInitVars() is used, or an expression, in which case getInitExpression() is used. In the latter case, the comma operator is often used to create a compound expression.

Note that any of the parts of the for loop header can be null, although the body will never be null.


Constructor Summary
JsFor(JsExpression initExpression, JsExpression condition, JsExpression incrementExpression)
           
JsFor(JsExpression initExpression, JsExpression condition, JsExpression incrementExpression, JsStatement body)
           
JsFor(JsVars initVars, JsExpression condition, JsExpression incrementExpression)
           
JsFor(JsVars initVars, JsExpression condition, JsExpression incrementExpression, JsStatement body)
           
 
Method Summary
 void accept(JsVisitor v)
          Causes this object to have the visitor visit itself and its children.
 void acceptChildren(JsVisitor visitor)
           
 JsFor deepCopy()
           
 JsStatement getBody()
           
 JsExpression getCondition()
           
 JsExpression getIncrementExpression()
           
 JsExpression getInitExpression()
           
 JsVars getInitVars()
           
 void setBody(JsStatement body)
           
 java.lang.String toString()
           
 void traverse(JsVisitorWithContext v, JsContext ctx)
          Causes this object to have the visitor visit itself and its children.
protected
<T extends HasMetadata>
T
withMetadataFrom(T other)
           
 
Methods inherited from class com.google.dart.compiler.backend.js.ast.SourceInfoAwareJsNode
getSource, setSource, source
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.dart.compiler.backend.js.ast.JsNode
getSource, setSource, source
 

Constructor Detail

JsFor

public JsFor(JsVars initVars,
             JsExpression condition,
             JsExpression incrementExpression)

JsFor

public JsFor(JsVars initVars,
             JsExpression condition,
             JsExpression incrementExpression,
             JsStatement body)

JsFor

public JsFor(JsExpression initExpression,
             JsExpression condition,
             JsExpression incrementExpression)

JsFor

public JsFor(JsExpression initExpression,
             JsExpression condition,
             JsExpression incrementExpression,
             JsStatement body)
Method Detail

getBody

public JsStatement getBody()

getCondition

public JsExpression getCondition()

getIncrementExpression

public JsExpression getIncrementExpression()

getInitExpression

public JsExpression getInitExpression()

getInitVars

public JsVars getInitVars()

setBody

public void setBody(JsStatement body)

accept

public void accept(JsVisitor v)
Description copied from interface: JsNode
Causes this object to have the visitor visit itself and its children.

Specified by:
accept in interface JsNode
Parameters:
v - the visitor that should traverse this node

acceptChildren

public void acceptChildren(JsVisitor visitor)
Specified by:
acceptChildren in interface JsNode
Overrides:
acceptChildren in class SourceInfoAwareJsNode

traverse

public void traverse(JsVisitorWithContext v,
                     JsContext ctx)
Description copied from interface: JsNode
Causes this object to have the visitor visit itself and its children.

Specified by:
traverse in interface JsNode
Parameters:
v - the visitor that should traverse this node
ctx - the context of an existing traversal

deepCopy

@NotNull
public JsFor deepCopy()
Specified by:
deepCopy in interface JsNode
Specified by:
deepCopy in interface JsStatement

toString

public java.lang.String toString()

withMetadataFrom

protected <T extends HasMetadata> T withMetadataFrom(T other)