Abstract
Optional
positionOverride: PositionOptional
destinationOptional
originOptional
Abstract
parentOptional
parseProtected
Optional
positionAbstract
nodeTests whether the given position is contained in the interval represented by this object.
Optional
position: Positionthe position
Protected
doProtected
doProtected
doProtected
doFinds the first node that satisfies a condition among this node's descendants.
the function expressing the condition that the node must satisfy.
Optional
walker: ((node) => Generator<Node>)the function that generates the nodes to operate on in the desired sequence. By default, this is a depth-first traversal that includes the node on which find() has been called.
the first node in the AST for which the predicate is true. Returns undefined if none are found.
Note that the type is not strictly forced to be a subclass of Node. This is intended to support
interfaces like Statement
or Expression
. However, being an ancestor the returned
value is guaranteed to be a Node, as only Node instances can be part of the hierarchy.
ancestor the nearest ancestor of this node that is of type type
.
the position where to search for nodes
Optional
selfContained: booleanwhether the starting node position contains the positions of all its children. If true no further search will be performed in subtrees where the root node falls outside the given position. If false (default) the research will cover all nodes from the starting node to the leaves.
the node most closely containing the given [position]. undefined
if none is found.
searchByPosition
Abstract
getRest
...path: string[]Abstract
getOptional
name: string | symbolAbstract
getAbstract
getAbstract
getOptional
parent: NodeAbstract
isAbstract
isAbstract
isAbstract
isTests whether the given position overlaps the interval represented by this object.
Optional
position: Positionthe position
Replace the current Node with another Node
Error - if this.parent === undefined
the position where to search for nodes
Optional
selfContained: booleanwhether the starting node position contains the positions of all its children. If true: no further search will be performed in subtrees where the root node falls outside the given position.
all nodes containing the given [position] using depth-first search. Empty list if none are found.
A generator that walks over the whole AST starting from the children of this node.
Optional
walker: ((node) => Generator<Node>)a function that generates a sequence of nodes. By default, this is the depth-first "walk" function. For post-order traversal, use "walkLeavesFirst".
Optional
origin: OriginOptional
parent: NodeOptional
parseTree: null | ParseTreeOptional
source: SourceGenerated using TypeDoc
The Abstract Syntax Tree will be constituted by instances of Node.
It implements Origin as it could be the source of a AST-to-AST transformation, so the node itself can be the Origin of another node.