Class LiteralNode.ArrayLiteralNode
java.lang.Object
com.oracle.js.parser.ir.Node
com.oracle.js.parser.ir.Expression
com.oracle.js.parser.ir.LiteralNode<Expression[]>
com.oracle.js.parser.ir.LiteralNode.ArrayLiteralNode
- All Implemented Interfaces:
LexicalContextNode, Cloneable
- Enclosing class:
LiteralNode<T>
public static final class LiteralNode.ArrayLiteralNode
extends LiteralNode<Expression[]>
implements LexicalContextNode
Array literal node class.
-
Nested Class Summary
Nested classes/interfaces inherited from class LiteralNode
LiteralNode.ArrayLiteralNode, LiteralNode.PrimitiveLiteralNode<T> -
Field Summary
Fields inherited from class LiteralNode
value -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedArrayLiteralNode(long token, int finish, Expression[] value) ConstructorprotectedArrayLiteralNode(long token, int finish, Expression[] value, boolean hasSpread, boolean hasTrailingComma) Constructor -
Method Summary
Modifier and TypeMethodDescriptionaccept(LexicalContext lc, NodeVisitor<? extends LexicalContext> visitor) Accept function for the node given a lexical context.<R> Raccept(LexicalContext lc, TranslatorNodeVisitor<? extends LexicalContext, R> visitor) accept(NodeVisitor<? extends LexicalContext> visitor) Assist in IR navigation.<R> Raccept(TranslatorNodeVisitor<? extends LexicalContext, R> visitor) Provides a means to navigate the IR.Returns a list of array element expressions.booleanbooleanbooleanisArray()Test if the value is an arrayvoidtoString(StringBuilder sb, boolean printType) Print logic that decides whether to show the optimistic type or not - for example it should not be printed after just parse, when it hasn't been computed, or has been set to a trivially provable valueMethods inherited from class LiteralNode
getObject, getString, getValue, isString, newInstance, newInstance, newInstance, newInstance, newInstance, newInstance, newInstance, newInstance, newInstanceMethods inherited from class Expression
getFinish, getFinishWithoutParens, getStart, getStartWithoutParens, isAlwaysFalse, isAlwaysTrue, isParenthesized, isSelfModifying, makeParenthesizedMethods inherited from class Node
clone, equals, getSourceOrder, getToken, hashCode, isAssignment, isLoop, isTokenType, tokenType, toString, toString
-
Constructor Details
-
ArrayLiteralNode
Constructor- Parameters:
token- tokenfinish- finishvalue- array literal value, a Node array
-
ArrayLiteralNode
protected ArrayLiteralNode(long token, int finish, Expression[] value, boolean hasSpread, boolean hasTrailingComma) Constructor- Parameters:
token- tokenfinish- finishvalue- array literal value, a Node arrayhasSpread- true if the array has a spread elementhasTrailingComma- true if the array literal has a comma after the last element
-
-
Method Details
-
isArray
public boolean isArray()Description copied from class:LiteralNodeTest if the value is an array- Overrides:
isArrayin classLiteralNode<Expression[]>- Returns:
- True if value is an array
-
hasSpread
public boolean hasSpread() -
hasTrailingComma
public boolean hasTrailingComma() -
getElementExpressions
Returns a list of array element expressions. Note that empty array elements manifest themselves as null.- Overrides:
getElementExpressionsin classLiteralNode<Expression[]>- Returns:
- a list of array element expressions.
-
accept
Description copied from class:LiteralNodeAssist in IR navigation.- Specified by:
acceptin interfaceLexicalContextNode- Overrides:
acceptin classLiteralNode<Expression[]>- Parameters:
visitor- IR navigating visitor.- Returns:
- node the node or its replacement after visitation, null if no further visitations are required
-
accept
Description copied from class:NodeProvides a means to navigate the IR.- Specified by:
acceptin interfaceLexicalContextNode- Overrides:
acceptin classLiteralNode<Expression[]>- Parameters:
visitor- Node visitor.- Returns:
- node the node or its replacement after visitation, null if no further visitations are required
-
accept
Description copied from interface:LexicalContextNodeAccept function for the node given a lexical context. It must be prepared to replace itself if present in the lexical context- Specified by:
acceptin interfaceLexicalContextNode- Parameters:
lc- lexical contextvisitor- node visitor- Returns:
- new node or same node depending on state change
-
accept
- Specified by:
acceptin interfaceLexicalContextNode
-
toString
Description copied from class:NodePrint logic that decides whether to show the optimistic type or not - for example it should not be printed after just parse, when it hasn't been computed, or has been set to a trivially provable value- Overrides:
toStringin classLiteralNode<Expression[]>- Parameters:
sb- string builderprintType- print type?
-