public final class CallDelegateNode extends CallNode
Important: Do not use outside of Soy code (treat as superpackage-private).
| Constructor and Description |
|---|
CallDelegateNode(int id,
SourceLocation location,
String delCalleeName,
List<CommandTagAttribute> attributes,
ErrorReporter errorReporter) |
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(int index,
N child)
Adds the given child at the given index (shifting existing children if necessary).
|
void |
addChild(N child)
Adds the given child.
|
void |
addChildren(int index,
List<? extends N> children)
Adds the given children at the given index (shifting existing children if necessary).
|
void |
addChildren(List<? extends N> children)
Adds the given children.
|
boolean |
allowEmptyDefault()
Returns whether this delegate call defaults to empty string if there's no active impl.
|
void |
appendSourceStringForChildren(StringBuilder sb)
Appends the source strings for all the children to the given StringBuilder.
|
void |
clearChildren()
Clears the list of children.
|
CallDelegateNode |
copy(CopyState copyState)
Copies this node.
|
N |
getChild(int index)
Gets the child at the given index.
|
int |
getChildIndex(Node child)
Finds the index of the given child.
|
List<N> |
getChildren()
Gets the list of children.
|
String |
getCommandName()
Returns the Soy command name.
|
String |
getCommandText()
Returns the command text (may be the empty string).
|
String |
getDelCalleeName()
Returns the name of the delegate template being called.
|
ExprRootNode |
getDelCalleeVariantExpr()
Returns the variant expression for the delegate being called, or null if it's a string.
|
com.google.common.collect.ImmutableList<ExprRootNode> |
getExprList()
Returns the list of expressions in this node.
|
SoyNode.Kind |
getKind()
Returns this node's kind (corresponding to this node's specific type).
|
com.google.common.collect.ImmutableList<TemplateParam> |
getParamsToRuntimeCheck(TemplateNode callee)
Returns the subset of
params of the callee that require runtime
type checking when this node is being rendered. |
protected String |
getTagString(boolean selfEnding) |
int |
numChildren()
Gets the number of children.
|
void |
removeChild(int index)
Removes the child at the given index.
|
void |
removeChild(N child)
Removes the given child.
|
void |
replaceChild(int index,
N newChild)
Replaces the child at the given index with the given new child.
|
void |
replaceChild(N currChild,
N newChild)
Replaces the given current child with the given new child.
|
void |
setDelCalleeName(String delCalleeName)
Do not call this method outside the contextual autoescaper.
|
void |
setParamsToRuntimeCheck(com.google.common.collect.ImmutableMap<TemplateDelegateNode,com.google.common.collect.ImmutableList<TemplateParam>> paramsToRuntimeCheck)
Sets the params that require runtime type checking for each possible delegate target.
|
genBasePhName, genSamenessKey, getDataExpr, getEscapingDirectives, getIsPcData, getParent, getTagString, getUserSuppliedPhExample, getUserSuppliedPhName, isPassingAllData, isPassingData, setEscapingDirectives, setIsPcData, toSourceStringgetId, 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, replaceChildpublic CallDelegateNode(int id,
SourceLocation location,
String delCalleeName,
List<CommandTagAttribute> attributes,
ErrorReporter errorReporter)
public SoyNode.Kind getKind()
SoyNodepublic String getDelCalleeName()
public void setDelCalleeName(String delCalleeName)
@Nullable public ExprRootNode getDelCalleeVariantExpr()
public void setParamsToRuntimeCheck(com.google.common.collect.ImmutableMap<TemplateDelegateNode,com.google.common.collect.ImmutableList<TemplateParam>> paramsToRuntimeCheck)
public com.google.common.collect.ImmutableList<TemplateParam> getParamsToRuntimeCheck(TemplateNode callee)
CallNodeparams of the callee that require runtime
type checking when this node is being rendered.getParamsToRuntimeCheck in class CallNodepublic boolean allowEmptyDefault()
public String getCommandText()
SoyNode.CommandNodegetCommandText in interface SoyNode.CommandNodepublic com.google.common.collect.ImmutableList<ExprRootNode> getExprList()
SoyNode.ExprHolderNodegetExprList in interface SoyNode.ExprHolderNodegetExprList in class CallNodepublic CallDelegateNode copy(CopyState copyState)
NodeAll 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
public int numChildren()
ParentNodenumChildren in interface ParentNode<N extends SoyNode>public N getChild(int index)
ParentNodegetChild in interface ParentNode<N extends SoyNode>index - The index of the child to get.public int getChildIndex(Node child)
ParentNodegetChildIndex in interface ParentNode<N extends SoyNode>child - The child to find the index of.public List<N> getChildren()
ParentNodeNote: The returned list may not be a copy. Please do not modify the list directly. Instead, use the other methods in this class that are intended for modifying children. Also, if you're iterating over the children list as you're modifying it, then you should first make a copy of the children list to iterate over, in order to avoid ConcurrentModificationException.
getChildren in interface ParentNode<N extends SoyNode>public void addChild(N child)
ParentNodeaddChild in interface ParentNode<N extends SoyNode>child - The child to add.public void addChild(int index,
N child)
ParentNodeaddChild in interface ParentNode<N extends SoyNode>index - The index to add the child at.child - The child to add.public void removeChild(int index)
ParentNoderemoveChild in interface ParentNode<N extends SoyNode>index - The index of the child to remove.public void removeChild(N child)
ParentNoderemoveChild in interface ParentNode<N extends SoyNode>child - The child to remove.public void replaceChild(int index,
N newChild)
ParentNodereplaceChild in interface ParentNode<N extends SoyNode>index - The index of the child to replace.newChild - The new child.public void replaceChild(N currChild,
N newChild)
ParentNodereplaceChild in interface ParentNode<N extends SoyNode>currChild - The current child to be replaced.newChild - The new child.public void clearChildren()
ParentNodeclearChildren in interface ParentNode<N extends SoyNode>public void addChildren(List<? extends N> children)
ParentNodeaddChildren in interface ParentNode<N extends SoyNode>children - The children to add.public void addChildren(int index,
List<? extends N> children)
ParentNodeaddChildren in interface ParentNode<N extends SoyNode>index - The index to add the children at.children - The children to add.public void appendSourceStringForChildren(StringBuilder sb)
ParentNodeappendSourceStringForChildren in interface ParentNode<N extends SoyNode>sb - The StringBuilder to which to append the children's source strings.public String getCommandName()
SoyNode.CommandNodegetCommandName in interface SoyNode.CommandNodeprotected final String getTagString(boolean selfEnding)