com.google.caja.parser.js
Class ForLoop

java.lang.Object
  extended by com.google.caja.parser.AbstractParseTreeNode
      extended by com.google.caja.parser.js.AbstractStatement
          extended by com.google.caja.parser.js.LabeledStatement
              extended by com.google.caja.parser.js.Loop
                  extended by com.google.caja.parser.js.ForLoop
All Implemented Interfaces:
JsonMLCompatible, NestedScope, Statement, MutableParseTreeNode, ParseTreeNode, MessagePart, Renderable, java.lang.Cloneable

public final class ForLoop
extends Loop
implements NestedScope

Author:
mikesamuel@gmail.com

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.google.caja.parser.ParseTreeNode
ParseTreeNode.ReflectiveCtor
 
Nested classes/interfaces inherited from interface com.google.caja.reporting.MessagePart
MessagePart.Factory
 
Nested classes/interfaces inherited from interface com.google.caja.parser.js.JsonMLCompatible
JsonMLCompatible.JsonMLBuilder
 
Nested classes/interfaces inherited from interface com.google.caja.parser.MutableParseTreeNode
MutableParseTreeNode.Mutation
 
Field Summary
private  Statement body
           
private  Expression condition
           
private  Statement increment
           
private  Statement initializer
           
 
Fields inherited from interface com.google.caja.parser.ParseTreeNode
TAINTED
 
Constructor Summary
ForLoop(FilePosition pos, java.lang.String value, java.util.List<? extends ParseTreeNode> children)
           
ForLoop(FilePosition pos, java.lang.String label, Statement initializer, Expression cond, Statement increment, Statement body)
           
 
Method Summary
protected  void childrenChanged()
          Called to perform consistency checks on the child list after changes have been made.
 Statement getBody()
           
 Expression getCondition()
           
 Statement getIncrement()
           
 Statement getInitializer()
           
 boolean hasHangingConditional()
          True if the rendered form of the statement would consume more tokens if parsed followed by the tokens "else" and ";".
 void render(RenderContext rc)
          Output the textual form to r.getOut().
 com.google.javascript.jscomp.jsonml.JsonML toJsonML()
          Creates a JsonML representation of this AST.
 
Methods inherited from class com.google.caja.parser.js.Loop
isTargetForContinue
 
Methods inherited from class com.google.caja.parser.js.LabeledStatement
breaks, continues, getLabel, getRenderedLabel, getValue, wrapIfLabelled
 
Methods inherited from class com.google.caja.parser.js.AbstractStatement
isTerminal, makeRenderer, renderBlock
 
Methods inherited from class com.google.caja.parser.AbstractParseTreeNode
acceptPostOrder, acceptPreOrder, appendChild, children, childrenAs, childrenPart, clone, createMutation, equals, format, formatSelf, formatTree, formatTree, getAttributes, getComments, getFilePosition, hashCode, insertBefore, removeChild, replaceChild, setComments, setFilePosition, toString, toStringDeep, toStringDeep
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.caja.parser.ParseTreeNode
acceptPostOrder, acceptPreOrder, children, clone, formatTree, getAttributes, getComments, getFilePosition
 
Methods inherited from interface com.google.caja.reporting.MessagePart
format
 

Field Detail

initializer

private Statement initializer

condition

private Expression condition

increment

private Statement increment

body

private Statement body
Constructor Detail

ForLoop

@ParseTreeNode.ReflectiveCtor
public ForLoop(FilePosition pos,
                                            java.lang.String value,
                                            java.util.List<? extends ParseTreeNode> children)

ForLoop

public ForLoop(FilePosition pos,
               java.lang.String label,
               Statement initializer,
               Expression cond,
               Statement increment,
               Statement body)
Method Detail

childrenChanged

protected void childrenChanged()
Description copied from class: AbstractParseTreeNode
Called to perform consistency checks on the child list after changes have been made. This can be overridden to do additional checks by subclasses, and to update derived state, but all subclasses must chain to super after performing their own checks.

This method may throw any RuntimeException on an invalid child. TODO(mikesamuel): maybe reliably throw an exception type, that includes information about the troublesome node.

Overrides:
childrenChanged in class AbstractParseTreeNode

getCondition

public Expression getCondition()
Specified by:
getCondition in class Loop

getBody

public Statement getBody()
Specified by:
getBody in class Loop

getInitializer

public Statement getInitializer()

getIncrement

public Statement getIncrement()

render

public void render(RenderContext rc)
Description copied from interface: Renderable
Output the textual form to r.getOut().

Specified by:
render in interface Renderable

hasHangingConditional

public boolean hasHangingConditional()
Description copied from interface: Statement
True if the rendered form of the statement would consume more tokens if parsed followed by the tokens "else" and ";".

Specified by:
hasHangingConditional in interface Statement

toJsonML

public com.google.javascript.jscomp.jsonml.JsonML toJsonML()
Description copied from interface: JsonMLCompatible
Creates a JsonML representation of this AST.

Specified by:
toJsonML in interface JsonMLCompatible


Copyright (C) 2008 Google Inc.
Licensed under the Apache License, Version 2.0