Abstract superclass of all AST nodes.
Note that nodes are not
Identifiable: as they are immutable,
the identity of a particular instance is meaningless.
You can attach additional information to individual AST nodes using typed keys.
Two sets of methods are available for this;
remove() offer more type safety and information,
delete() can be slightly faster.
getObject()retrieve a piece of attached information,
set()store a piece of attached information, and
delete()discard a piece of attached information.
// toplevel shared Key<Token> tokensKey = ScopedKey<Token>(`module my.parser`, "tokens"); // in the parser node.put(tokensKey, tokens); // somewhere else assert (exists tokens = node.get(tokensKey)); // tokens has type Token
The child nodes of this node.
An additional field for any extra data that an application may want to attach to a node.
In other words, this field is not typesafe, only allows for a single object to be attached, and offers no protection against multiple modules each attempting to register information here, overwriting each other’s information.
To mitigate the last point, it is extremely strongly recommended that this field only be used by applications, never by libraries. There should only be one application at runtime, so this application would be in a position to know that it is exclusively accessing this field on any given node. Libraries on the other hand have no such guarantee, since they might be used together with other libraries without knowing whether those use this field.
It is emphasized again that you should not use this field unless you absolutely need the performance benefit it brings.
A developer-friendly string representing the instance.
At the moment, this is a Ceylon expression (created by
|Attributes inherited from: |
Copies this node’s additional information to the
Removes the additional information attached to
this node using the given
Returns the additional information attached to this node
using the given
If you don’t care about the previously attached information,
you might want to use
Transform this node with the given
If you have a
Visit this node with the given
|Methods inherited from: |