public final class ForeachNonemptyNode extends AbstractParentSoyNode<SoyNode.StandaloneNode> implements SoyNode.ConditionalBlockNode, SoyNode.LoopNode, SoyNode.LocalVarBlockNode
Important: Do not use outside of Soy code (treat as superpackage-private).
SPACES| Constructor and Description |
|---|
ForeachNonemptyNode(int id,
String varName,
SourceLocation sourceLocation) |
| Modifier and Type | Method and Description |
|---|---|
ForeachNonemptyNode |
copy(CopyState copyState)
Copies this node.
|
ExprRootNode |
getExpr()
Returns the expression we're iterating over.
|
String |
getExprText()
Returns the text of the expression we're iterating over.
|
int |
getForeachNodeId() |
SoyNode.Kind |
getKind()
Returns this node's kind (corresponding to this node's specific type).
|
ForeachNode |
getParent()
Gets this node's parent.
|
LoopVar |
getVar()
Returns the variable definition.
|
String |
getVarName()
Returns the name of this node's local variable (without the preceding '$').
|
String |
toSourceString()
Builds a Soy source string that could be the source for this node.
|
addChild, addChild, addChildren, addChildren, appendSourceStringForChildren, clearChildren, getChild, getChildIndex, getChildren, numChildren, removeChild, removeChild, replaceChild, replaceChildgetId, getSourceLocation, setId, toStringcouldHaveSyntaxVersionAtLeast, equals, getNearestAncestor, getSyntaxVersionUpperBound, hasAncestor, hashCode, maybeSetSyntaxVersionUpperBound, setParentclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddChild, addChild, addChildren, addChildren, appendSourceStringForChildren, clearChildren, getChild, getChildIndex, getChildren, numChildren, removeChild, removeChild, replaceChild, replaceChildcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSourceLocation, getSyntaxVersionUpperBound, hasAncestor, maybeSetSyntaxVersionUpperBound, setParentpublic ForeachNonemptyNode(int id,
String varName,
SourceLocation sourceLocation)
id - The id for this node.varName - The variable name of the loop index variablesourceLocation - The node's source location.public SoyNode.Kind getKind()
SoyNodepublic int getForeachNodeId()
public final LoopVar getVar()
SoyNode.LocalVarNodegetVar in interface SoyNode.LocalVarNodepublic final String getVarName()
SoyNode.LocalVarNodegetVarName in interface SoyNode.LocalVarNodepublic String getExprText()
public ExprRootNode getExpr()
public String toSourceString()
NodetoSourceString in interface Nodepublic ForeachNode getParent()
Nodepublic ForeachNonemptyNode copy(CopyState copyState)
SoyNodeAll copy() overrides should follow this contract:
{@literal @}Override public T copy(CopyState copyState) {
return new T(this, copyState);
}
TODO(lukes): The usecases for a copy method are few and far between. Making the AST nodes immutable (or at least unmodifiable) would be preferable to maintaining our copy() methods.
Don't clone nodes unless you know what you're doing. The Soy AST is not actually a tree (it contains back edges from variables to their definitions), and naively copying nodes can result in pointers into stale ASTs
The copied nodes will have the same ids as the original nodes. If you need to copy a
subtree with new ids assigned to the copied nodes, use SoytreeUtils.cloneWithNewIds(T, com.google.template.soy.base.internal.IdGenerator).