com.google.caja.parser.js
Class CaseStmt
java.lang.Object
com.google.caja.parser.AbstractParseTreeNode
com.google.caja.parser.js.AbstractStatement
com.google.caja.parser.js.SwitchCase
com.google.caja.parser.js.CaseStmt
- All Implemented Interfaces:
- JsonMLCompatible, Statement, MutableParseTreeNode, ParseTreeNode, MessagePart, Renderable, java.lang.Cloneable
public final class CaseStmt
- extends SwitchCase
Encapsulates a value and the code to execute when the switch block is
reached with that value.
When multiple cases are seen adjacent as in:case FOO:
case BAR:
each is a separate CaseStmt
but the FOO case has a body which is
a Noop
.
- Author:
- mikesamuel@gmail.com
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 |
caseValue
private Expression caseValue
body
private Block body
CaseStmt
@ParseTreeNode.ReflectiveCtor
public CaseStmt(FilePosition pos,
java.lang.Void value,
java.util.List<? extends ParseTreeNode> children)
- Parameters:
value
- unused. This ctor is provided for reflection.
CaseStmt
public CaseStmt(FilePosition pos,
Expression caseValue,
Block body)
getCaseValue
public Expression getCaseValue()
getBody
public Block getBody()
- Specified by:
getBody
in class SwitchCase
renderHead
protected void renderHead(RenderContext rc)
- Specified by:
renderHead
in class SwitchCase
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
getValue
public java.lang.Object getValue()
- Specified by:
getValue
in interface ParseTreeNode
- Specified by:
getValue
in class AbstractParseTreeNode
- Returns:
- null or a value with subclass specific meaning which encapsulates
all parsed state separate from the children.
toJsonML
public com.google.javascript.jscomp.jsonml.JsonML toJsonML()
- Description copied from interface:
JsonMLCompatible
- Creates a
JsonML representation of this AST.
Copyright (C) 2008 Google Inc.
Licensed under the Apache License, Version 2.0