import { Node } from "../model/model"; declare module '../model/model' { interface Node { /** * A generator that walks over the whole AST starting from this node, depth-first. */ walk(): Generator; /** * @return nodes the sequence of nodes from the parent all the way up to the root node. * For this to work, the nodes' parents must have been set. */ walkAncestors(): Generator; /** * A generator that walks over the whole AST starting from the children of this node. * @param walker a function that generates a sequence of nodes. By default, this is the depth-first * "walk" function. * For post-order traversal, use "walkLeavesFirst". */ walkDescendants(walker?: typeof walk): Generator; /** * A generator that walks over the direct children of this node. */ walkChildren(): Generator; /** * 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. * * @return ancestor the nearest ancestor of this node that is of type `type`. */ findAncestorOfType(type: any): Node | undefined; } } /** * A generator that walks the whole AST starting from the provided node, depth-first. * @param node the starting node. */ export declare function walk(node: Node): Generator; /** * @return nodes the sequence of nodes from the parent all the way up to the root node. * For this to work, the nodes' parents must have been set. */ export declare function walkAncestors(node?: Node): Generator; /** * A generator that walks the whole AST starting from the children of the given node. * @param node the starting node (excluded from the walk). * @param walker a function that generates a sequence of nodes. By default this is the depth-first "walk" function. * For post-order traversal, use "walkLeavesFirst". */ export declare function walkDescendants(node: Node, walker?: typeof walk): Generator; /** * @return all direct children of this node. */ export declare function walkChildren(node: Node): Generator; /** * 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. * * @return ancestor the nearest ancestor of this node that is of type `type`. */ export declare function findAncestorOfType(node: Node | undefined, type: any): Node | undefined;