public final class DestructuringAssignment extends GoloAssignment<DestructuringAssignment>
For instance:
let a, b = [1, 2]
Modifier and Type | Method and Description |
---|---|
void |
accept(GoloIrVisitor visitor)
Accept the visitor.
|
static DestructuringAssignment |
create()
Creates a uninitialized destructuring assignment.
|
static DestructuringAssignment |
destruct(java.lang.Object expr)
Create a destructuring assignment.
|
LocalReference[] |
getReferences()
Returns the references contained in this element.
|
int |
getReferencesCount()
Returns the number of references contained in this element.
|
boolean |
isConstant()
Checks if this assignment is constant.
|
boolean |
isVarargs()
Checks if this destructuring is a varargs one.
|
protected DestructuringAssignment |
self() |
DestructuringAssignment |
to(java.lang.Object... refs)
Defines the references to which assign the expression.
|
java.lang.String |
toString() |
DestructuringAssignment |
varargs()
Defines this destructuring as a varargs one.
|
DestructuringAssignment |
varargs(boolean varargs)
Defines if this destructuring is a varargs one.
|
DestructuringAssignment |
variable()
Makes this assignment variable.
|
void |
walk(GoloIrVisitor visitor)
Walk the visitor through this node children.
|
as, children, declaring, declaring, expression, getDeclaringReferences, isDeclaring, replaceElement
of
ancestor, 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
public static DestructuringAssignment destruct(java.lang.Object expr)
Typical usage:
destruct(tuple(1, 2)).to("a", "b").declaring(true)
creates
let a, b = [1, 2]
expr
- the expression to destructureGoloAssignment.as(Object)
public static DestructuringAssignment create()
protected DestructuringAssignment self()
self
in class GoloElement<DestructuringAssignment>
public boolean isVarargs()
varargs(boolean)
public DestructuringAssignment varargs(boolean varargs)
For instance:
let a, b... = list[1, 2, 3, 4]
This is a builder method.
public DestructuringAssignment varargs()
Same as varargs(true)
.
public DestructuringAssignment variable()
variable
in class GoloAssignment<DestructuringAssignment>
LocalReference.variable()
public boolean isConstant()
isConstant
in class GoloAssignment<DestructuringAssignment>
LocalReference.isConstant()
public LocalReference[] getReferences()
public int getReferencesCount()
public DestructuringAssignment to(java.lang.Object... refs)
GoloAssignment
This is a builder method.
For instance, code like:
foo = 42
can be generated by:
assign(constant(42)).to(localRef("foo"))
or using implicit conversions:
assign(42).to("foo")
to
in class GoloAssignment<DestructuringAssignment>
refs
- the LocalReference
s to assign topublic java.lang.String toString()
toString
in class java.lang.Object
public 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<DestructuringAssignment>
public void walk(GoloIrVisitor visitor)
walk
in class GoloElement<DestructuringAssignment>