public final class VarRefNode extends AbstractExprNode
ExprNode.ConstantNode, ExprNode.Kind, ExprNode.OperatorNode, ExprNode.ParentExprNode, ExprNode.PrimitiveNode| Modifier and Type | Field and Description |
|---|---|
static VarRefNode |
ERROR |
SPACES| Constructor and Description |
|---|
VarRefNode(String name,
SourceLocation sourceLocation,
boolean injected,
boolean nullSafeInjected,
VarDefn defn) |
| Modifier and Type | Method and Description |
|---|---|
VarRefNode |
clone()
Copies this node.
|
boolean |
equals(Object other) |
VarDefn |
getDefnDecl() |
ExprNode.Kind |
getKind()
Gets this node's kind (corresponding to this node's specific type).
|
String |
getName()
Returns the name of the variable.
|
SoyType |
getType()
Gets the data type of this node.
|
int |
hashCode() |
boolean |
isInjected()
Returns Whether this is an injected parameter reference.
|
Boolean |
isLocalVar()
Returns whether this is a local variable reference.
|
boolean |
isNullSafeInjected()
Returns whether this a null-safe access to an injected parameter.
|
Boolean |
isPossibleParam()
Returns whether this might be a local variable reference.
|
void |
setDefn(VarDefn defn) |
void |
setSubstituteType(SoyType type)
Override the type of the variable when used in this context.
|
String |
toSourceString()
Builds a Soy source string that could be the source for this node.
|
getParent, getSourceLocationcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSyntaxVersionBound, hasAncestor, maybeSetSyntaxVersionBound, setParent, toString, toTreeStringfinalize, getClass, notify, notifyAll, wait, wait, waitcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSyntaxVersionBound, hasAncestor, maybeSetSyntaxVersionBound, setParent, toTreeStringpublic static final VarRefNode ERROR
public VarRefNode(String name, SourceLocation sourceLocation, boolean injected, boolean nullSafeInjected, @Nullable VarDefn defn)
name - The name of the variable.sourceLocation - The node's source location.injected - Whether this is an injected variable.nullSafeInjected - Whether this a null-safe access to an injected parameter.defn - (optional) The variable declaration for this variable.public ExprNode.Kind getKind()
ExprNodepublic SoyType getType()
ExprNodepublic String getName()
public boolean isInjected()
public boolean isNullSafeInjected()
public void setDefn(VarDefn defn)
defn - the varDecl to setpublic VarDefn getDefnDecl()
public Boolean isLocalVar()
public Boolean isPossibleParam()
public void setSubstituteType(SoyType type)
type - The overridden type value.public String toSourceString()
Nodepublic VarRefNode clone()
NodeAll clone() overrides should follow this contract:
{@literal @}Override public T clone() {
return new T(this);
}
NOTE: this means we do not ultimately delegate to Object.clone(), ever.
TODO(lukes): The usecases for a clone method are few and far between. Making the AST nodes immutable (or at least unmodifiable) would be preferable to maintaining our clone() methods.