interface ParentInformation {
    id: NodeId;
    index: number;
    nesting: number;
    parent: undefined | NodeId;
    role: RoleInParent;
    [key: string]: unknown;
}

Hierarchy (View Summary)

Indexable

  • [key: string]: unknown

Hierarchy-Diagram

UML class diagram of ParentInformation

Properties

id: NodeId

uniquely identifies an AST-Node

index: number

0-based index of the child in the parent (code semantics, e.g., for an if-then-else, the condition will be 0, the then-case will be 1, ...)

The index is adaptive, that means that if the name of an argument exists, it will have index 0, and the value will have index 1. But if the argument is unnamed, its value will get the index 0 instead.

nesting: number

The nesting of the node in the AST

The root node has a nesting of 0, nested function calls, loops etc. will increase the nesting

parent: undefined | NodeId

Links to the parent node, using an id so that the AST stays serializable