Skip to content

Node

Supertype of every document node.

Nodes form a tree rooted at Root, reached through Unit.nodes. The four intermediate supertypes -- Declaration, Param, Block, and Reference -- group the concrete kinds by what they carry, so a consumer can match on the level it cares about.

Fields

doc @ (Span | nil)

The span of the comment block documenting the node, or nil where none attaches.

Every node answers, rather than only the kinds that can be documented: which of them those are is the compiler's determination, and a consumer that has to know it in advance gains nothing.

parent @ (NodeId | nil)

The ID of the enclosing node, or nil for Root.

span @ (Span | nil)

The span the node covers in the source, or nil for a prelude node, which has no source text.