Logo Xantham

Node Module

The escape hatch, and the operations that hold for every node whatever its tag.

Functions and values

Function or value Description

Node.children node

Full Usage: Node.children node

Parameters:
Returns: Node<AnyNode> seq
Type parameters: 'Tag (requires :> Xantham.TypeScript.Wire.AnyNode)

The node's direct children, in blob order, untagged.

node : Node<'Tag>
Returns: Node<AnyNode> seq

Node.descendants node

Full Usage: Node.descendants node

Parameters:
Returns: Node<AnyNode> seq
Type parameters: 'Tag (requires :> Xantham.TypeScript.Wire.AnyNode)

Every node under this one, untagged. Narrow with a view.

node : Node<'Tag>
Returns: Node<AnyNode> seq

Node.file node

Full Usage: Node.file node

Parameters:
Returns: SourceFile
Type parameters: 'Tag (requires :> Xantham.TypeScript.Wire.AnyNode)

The decoded file the node belongs to.

node : Node<'Tag>
Returns: SourceFile

Node.index node

Full Usage: Node.index node

Parameters:
Returns: int
Type parameters: 'Tag (requires :> Xantham.TypeScript.Wire.AnyNode)

The raw node index, for dropping down to `Ast` and `AstNode`.

node : Node<'Tag>
Returns: int

Node.ofIndex file index

Full Usage: Node.ofIndex file index

Parameters:
Returns: Node<'Tag>
Type parameters: 'Tag (requires :> Xantham.TypeScript.Wire.AnyNode)

Tags a raw node index. The index is not checked against the tag - `ofIndex` is the door back in from a raw walk, and the caller is asserting what it found.

file : SourceFile
index : int
Returns: Node<'Tag>

Node.parent node

Full Usage: Node.parent node

Parameters:
Returns: Node<AnyNode> voption
Type parameters: 'Tag (requires :> Xantham.TypeScript.Wire.AnyNode)

The node's parent, or `ValueNone` at the root.

node : Node<'Tag>
Returns: Node<AnyNode> voption

Node.retag node

Full Usage: Node.retag node

Parameters:
    node : Node<'From>

Returns: Node<'To>
Type parameters: 'From, 'To (requires :> Xantham.TypeScript.Wire.AnyNode and :> Xantham.TypeScript.Wire.AnyNode)

Re-tags a node without checking it. The generated views and widenings are the intended callers; it cannot produce an invalid node, only a wrong claim about one.

node : Node<'From>
Returns: Node<'To>

Node.root file

Full Usage: Node.root file

Parameters:
Returns: Node<SourceFile>

The file's root node.

file : SourceFile
Returns: Node<SourceFile>

Node.sameAs other node

Full Usage: Node.sameAs other node

Parameters:
    other : Node<'Other>
    node : Node<'Tag>

Returns: bool
Type parameters: 'Other, 'Tag (requires :> Xantham.TypeScript.Wire.AnyNode and :> Xantham.TypeScript.Wire.AnyNode)

True when both refer to the same node of the same file, whatever their tags.

other : Node<'Other>
node : Node<'Tag>
Returns: bool

Type something to start searching.