public final class CollectionLiteral extends ExpressionStatement<CollectionLiteral>
For instance code such as:
list[1, 2, 3]
CollectionLiteral.Type| Modifier and Type | Class and Description |
|---|---|
static class |
CollectionLiteral.Type |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(GoloIrVisitor visitor)
Accept the visitor.
|
CollectionLiteral |
add(java.lang.Object expression)
Adds an expression to the collection.
|
java.util.List<GoloElement<?>> |
children()
Returns a list of all the direct children of this node.
|
static CollectionLiteral |
create(java.lang.Object type,
java.lang.Object... values)
Creates a collection literal of the given type.
|
java.util.List<ExpressionStatement<?>> |
getExpressions() |
CollectionLiteral.Type |
getType() |
protected void |
replaceElement(GoloElement<?> original,
GoloElement<?> newElement)
Replace a child.
|
protected CollectionLiteral |
self() |
java.lang.String |
toString() |
call, clearDeclarations, declarations, hasLocalDeclarations, of, withancestor, ancestor, ancestorOfType, cantConvert, cantReplace, cantReplace, children, children, descendants, descendants, descendants, documentation, documentation, doesNotContain, enclosingModule, getLocalReferenceTable, hasParent, hasPosition, makeParentOf, metadata, metadata, next, next, next, ofAST, parent, positionInSourceCode, positionInSourceCode, previous, previous, previous, replaceInParentBy, walkpublic static CollectionLiteral create(java.lang.Object type, java.lang.Object... values)
For instance:
collection(CollectionLiteral.Type.array, constant(1), constant(2), constant(3))
creates
array[1, 2, 3]
type - the typevalues - expressions to add to the collectionprotected CollectionLiteral self()
self in class GoloElement<CollectionLiteral>public CollectionLiteral add(java.lang.Object expression)
expression - the expression to add.public CollectionLiteral.Type getType()
public java.util.List<ExpressionStatement<?>> getExpressions()
public java.lang.String toString()
toString in class java.lang.Objectpublic void accept(GoloIrVisitor visitor)
This method should only call the visitor visitXXXX method.
The children of this node will be visited by the
GoloElement.walk(GoloIrVisitor) method.
accept in class GoloElement<CollectionLiteral>public java.util.List<GoloElement<?>> children()
children in class GoloElement<CollectionLiteral>protected void replaceElement(GoloElement<?> original, GoloElement<?> newElement)
Replace original with newElement if original is a child of this node
and type matches.
replaceElement in class GoloElement<CollectionLiteral>original - the original value to replace. Must be a child of this nodenewElement - the element to replace with. Type must match.GoloElement.cantReplace(),
GoloElement.cantReplace(GoloElement, GoloElement),
GoloElement.doesNotContain(GoloElement),
GoloElement.cantConvert(String, Object)