public final class NamedArgument extends ExpressionStatement<NamedArgument>
Represents nodes such as:
foo(b=42, a=bar("answer"))
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object[] |
__$$_destruct(int number,
boolean substruct,
java.lang.Object[] toSkip)
New style destructuring helper.
|
void |
accept(GoloIrVisitor visitor)
Accept the visitor.
|
java.util.List<GoloElement<?>> |
children()
Returns a list of all the direct children of this node.
|
ExpressionStatement<?> |
expression() |
java.lang.String |
getName() |
boolean |
hasLocalDeclarations()
Checks if this expression has local variable declarations.
|
static NamedArgument |
of(java.lang.String name,
java.lang.Object value) |
protected void |
replaceElement(GoloElement<?> original,
GoloElement<?> newElement)
Replace a child.
|
protected NamedArgument |
self() |
NamedArgument |
with(java.lang.Object a)
Defines a variable declaration (assignment) local to this expression.
|
call, clearDeclarations, declarations, ofancestor, ancestor, ancestorOfType, cantConvert, cantReplace, cantReplace, children, children, descendants, descendants, descendants, documentation, documentation, doesNotContain, enclosingModule, getLocalReferenceTable, hasParent, hasPosition, inheritedMetadata, makeParentOf, metadata, metadata, next, next, next, ofAST, parent, positionInSourceCode, positionInSourceCode, previous, previous, previous, replaceInParentBy, walkpublic static NamedArgument of(java.lang.String name, java.lang.Object value)
protected NamedArgument self()
self in class GoloElement<NamedArgument>public java.lang.String getName()
public ExpressionStatement<?> expression()
public java.lang.Object[] __$$_destruct(int number, boolean substruct, java.lang.Object[] toSkip)
The destructuring must be to exactly two values. No remainer syntax is allowed.
The destructured values are the named and the expression.
number - number of variable that will be affected.substruct - whether the destructuring is complete or should contains a sub structure.toSkip - a boolean array indicating the elements to skip.public NamedArgument with(java.lang.Object a)
Always throws an exception since NamedArgument can't have a local declaration.
with in class ExpressionStatement<NamedArgument>public boolean hasLocalDeclarations()
ExpressionStatementhasLocalDeclarations in class ExpressionStatement<NamedArgument>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<NamedArgument>public java.util.List<GoloElement<?>> children()
children in class GoloElement<NamedArgument>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<NamedArgument>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)