public final class ItemAccessNode extends DataAccessNode
ExprNode.ConstantNode, ExprNode.Kind, ExprNode.OperatorNode, ExprNode.ParentExprNode, ExprNode.PrimitiveNodeisNullSafeSPACES| Constructor and Description |
|---|
ItemAccessNode(ExprNode base,
ExprNode key,
boolean isNullSafe,
boolean isDotSyntax) |
| Modifier and Type | Method and Description |
|---|---|
ItemAccessNode |
clone()
Copies this node.
|
boolean |
equals(Object other) |
ExprNode |
getKeyExprChild()
Returns the key expression.
|
ExprNode.Kind |
getKind()
Gets this node's kind (corresponding to this node's specific type).
|
String |
getSourceStringSuffix()
Returns the source string for the part of the expression that accesses
the item - in other words, not including the base expression.
|
int |
hashCode() |
getBaseExprChild, isNullSafe, toSourceStringaddChild, addChild, addChildren, addChildren, appendSourceStringForChildren, appendTreeStringForChildren, clearChildren, getChild, getChildIndex, getChildren, getType, numChildren, removeChild, removeChild, replaceChild, replaceChild, setType, toTreeStringgetParent, getSourceLocationcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSyntaxVersionBound, hasAncestor, maybeSetSyntaxVersionBound, setParent, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSourceLocation, getSyntaxVersionBound, hasAncestor, maybeSetSyntaxVersionBound, setParentpublic ItemAccessNode(ExprNode base, ExprNode key, boolean isNullSafe, boolean isDotSyntax)
base - The base expression, that is a reference to the object
containing the item.key - An expression representing either an array index or a map
key.isNullSafe - If true, checks during evaluation whether the base expression is null
and returns null instead of causing an invalid dereference.isDotSyntax - If true, this node represents an expression of the form
$foo.0, that is an integer after the dot.public ExprNode.Kind getKind()
ExprNodepublic ExprNode getKeyExprChild()
public String getSourceStringSuffix()
getSourceStringSuffix in class DataAccessNodepublic ItemAccessNode 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.