public final class GlobalNode extends AbstractExprNode
Important: Do not use outside of Soy code (treat as superpackage-private).
| Modifier and Type | Class and Description |
|---|---|
static interface |
GlobalNode.ResolutionCallback
Simple callback interface for hooking into globals resolution.
|
ExprNode.Kind, ExprNode.OperatorNode, ExprNode.ParentExprNode, ExprNode.PrimitiveNode| Constructor and Description |
|---|
GlobalNode(String name,
SourceLocation sourceLocation) |
| Modifier and Type | Method and Description |
|---|---|
GlobalNode |
copy(CopyState copyState)
See
Node.copy(CopyState) for a description of the copy contract. |
static GlobalNode |
error(SourceLocation location) |
ExprNode.Kind |
getKind()
Gets this node's kind (corresponding to this node's specific type).
|
String |
getName()
Returns the name of the global.
|
SoyType |
getType()
Gets the data type of this node.
|
ExprNode.PrimitiveNode |
getValue() |
boolean |
isResolved() |
void |
onResolve(GlobalNode.ResolutionCallback callback)
Registers a callback that is invoked when this global is resolved to its actual value.
|
void |
resolve(SoyType soyType,
ExprNode.PrimitiveNode value) |
boolean |
shouldSuppressUnknownGlobalErrors()
Returns true if 'unknown global' errors should not be reported for this node.
|
void |
suppressUnknownGlobalErrors()
Call this method to suppress unknown global errors for this node.
|
String |
toSourceString()
Builds a Soy source string that could be the source for this node.
|
getParent, getSourceLocationcouldHaveSyntaxVersionAtLeast, equals, getNearestAncestor, getSyntaxVersionUpperBound, hasAncestor, hashCode, maybeSetSyntaxVersionUpperBound, setParent, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSyntaxVersionUpperBound, hasAncestor, maybeSetSyntaxVersionUpperBound, setParentpublic GlobalNode(String name, SourceLocation sourceLocation)
name - The name of the global.sourceLocation - The node's source location.public static GlobalNode error(SourceLocation location)
public ExprNode.Kind getKind()
ExprNodepublic SoyType getType()
ExprNodepublic void resolve(SoyType soyType, ExprNode.PrimitiveNode value)
public void onResolve(GlobalNode.ResolutionCallback callback)
NOTE: there is no guarantee that this will ever be called.
public boolean isResolved()
public ExprNode.PrimitiveNode getValue()
public String getName()
public void suppressUnknownGlobalErrors()
public boolean shouldSuppressUnknownGlobalErrors()
public String toSourceString()
NodeNote: Some nodes do not have a direct mapping to Soy source (such as nodes created during some optimization passes). Thus this method may not always be supported.
public GlobalNode copy(CopyState copyState)
ExprNodeNode.copy(CopyState) for a description of the copy contract.