public final class NamedAugmentation extends GoloElement<NamedAugmentation> implements FunctionContainer, ToplevelGoloElement
Modifier and Type | Method and Description |
---|---|
void |
accept(GoloIrVisitor visitor)
Accept the visitor.
|
NamedAugmentation |
add(java.lang.Object... elts)
Adds the elements to this augmentation.
|
void |
addFunction(GoloFunction func)
Adds a function to this container.
|
void |
addMacroInvocation(MacroInvocation macroCall)
Adds a macro invocation to this container.
|
java.util.List<GoloElement<?>> |
children()
Returns a list of all the direct children of this node.
|
java.util.List<GoloFunction> |
getFunctions() |
java.lang.String |
getName() |
PackageAndClass |
getPackageAndClass() |
boolean |
hasFunctions() |
static NamedAugmentation |
of(java.lang.Object name)
Creates a named augmentation.
|
protected void |
replaceElement(GoloElement<?> original,
GoloElement<?> newElement)
Replace a child.
|
protected NamedAugmentation |
self() |
ancestor, 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, walk
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addElement, addFunctions, getFunction, iterator
public static NamedAugmentation of(java.lang.Object name)
name
- the name of the augmentation (compatible with PackageAndClass.of(Object)
)public java.lang.String getName()
public PackageAndClass getPackageAndClass()
getPackageAndClass
in interface FunctionContainer
protected NamedAugmentation self()
self
in class GoloElement<NamedAugmentation>
public java.util.List<GoloFunction> getFunctions()
getFunctions
in interface FunctionContainer
public void addFunction(GoloFunction func)
addFunction
in interface FunctionContainer
public void addMacroInvocation(MacroInvocation macroCall)
The macro is supposed to return a GoloFunction
when expanded.
addMacroInvocation
in interface FunctionContainer
public boolean hasFunctions()
hasFunctions
in interface FunctionContainer
public NamedAugmentation add(java.lang.Object... elts)
This is a builder method.
FunctionContainer.addElement(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<NamedAugmentation>
public java.util.List<GoloElement<?>> children()
children
in class GoloElement<NamedAugmentation>
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<NamedAugmentation>
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)