deps: update acorn-walk to 8.3.5 · nodejs/node@4d411d7
11import * as acorn from "acorn"
2233export type FullWalkerCallback<TState> = (
4-node: acorn.Node,
4+node: acorn.AnyNode,
55state: TState,
66type: string
77) => void
8899export type FullAncestorWalkerCallback<TState> = (
10-node: acorn.Node,
10+node: acorn.AnyNode,
1111state: TState,
12-ancestors: acorn.Node[],
12+ancestors: acorn.AnyNode[],
1313type: string
1414) => void
1515@@ -29,24 +29,24 @@ export type SimpleVisitors<TState> = {
2929}
30303131export type AncestorVisitors<TState> = {
32-[type in acorn.AnyNode["type"]]?: ( node: Extract<acorn.AnyNode, { type: type }>, state: TState, ancestors: acorn.Node[]
32+[type in acorn.AnyNode["type"]]?: ( node: Extract<acorn.AnyNode, { type: type }>, state: TState, ancestors: acorn.AnyNode[]
3333) => void
3434} & {
35-[type in keyof AggregateType]?: (node: AggregateType[type], state: TState, ancestors: acorn.Node[]) => void
35+[type in keyof AggregateType]?: (node: AggregateType[type], state: TState, ancestors: acorn.AnyNode[]) => void
3636}
373738-export type WalkerCallback<TState> = (node: acorn.Node, state: TState) => void
38+export type WalkerCallback<TState> = (node: acorn.AnyNode, state: TState) => void
39394040export type RecursiveVisitors<TState> = {
4141[type in acorn.AnyNode["type"]]?: ( node: Extract<acorn.AnyNode, { type: type }>, state: TState, callback: WalkerCallback<TState>) => void
4242} & {
4343[type in keyof AggregateType]?: (node: AggregateType[type], state: TState, callback: WalkerCallback<TState>) => void
4444}
454546-export type FindPredicate = (type: string, node: acorn.Node) => boolean
46+export type FindPredicate = (type: string, node: acorn.AnyNode) => boolean
47474848export interface Found<TState> {
49-node: acorn.Node,
49+node: acorn.AnyNode,
5050state: TState
5151}
5252@@ -66,10 +66,6 @@ export function simple<TState>(
66666767/**
6868 * does a 'simple' walk over a tree, building up an array of ancestor nodes (including the current node) and passing the array to the callbacks as a third parameter.
69- * @param node
70- * @param visitors
71- * @param base
72- * @param state
7369 */
7470export function ancestor<TState>(
7571node: acorn.Node,
@@ -94,10 +90,6 @@ export function recursive<TState>(
94909591/**
9692 * does a 'full' walk over a tree, calling the {@link callback} with the arguments (node, state, type) for each node
97- * @param node
98- * @param callback
99- * @param base
100- * @param state
10193 */
10294export function full<TState>(
10395node: acorn.Node,
@@ -108,10 +100,6 @@ export function full<TState>(
108100109101/**
110102 * does a 'full' walk over a tree, building up an array of ancestor nodes (including the current node) and passing the array to the callbacks as a third parameter.
111- * @param node
112- * @param callback
113- * @param base
114- * @param state
115103 */
116104export function fullAncestor<TState>(
117105node: acorn.Node,
@@ -122,8 +110,6 @@ export function fullAncestor<TState>(
122110123111/**
124112 * builds a new walker object by using the walker functions in {@link functions} and filling in the missing ones by taking defaults from {@link base}.
125- * @param functions
126- * @param base
127113 */
128114export function make<TState>(
129115functions: RecursiveVisitors<TState>,
@@ -132,33 +118,22 @@ export function make<TState>(
132118133119/**
134120 * tries to locate a node in a tree at the given start and/or end offsets, which satisfies the predicate test. {@link start} and {@link end} can be either `null` (as wildcard) or a `number`. {@link test} may be a string (indicating a node type) or a function that takes (nodeType, node) arguments and returns a boolean indicating whether this node is interesting. {@link base} and {@link state} are optional, and can be used to specify a custom walker. Nodes are tested from inner to outer, so if two nodes match the boundaries, the inner one will be preferred.
135- * @param node
136- * @param start
137- * @param end
138- * @param type
139- * @param base
140- * @param state
141121 */
142122export function findNodeAt<TState>(
143123node: acorn.Node,
144-start: number | undefined,
145-end?: number | undefined,
124+start: number | undefined | null,
125+end?: number | undefined | null,
146126type?: FindPredicate | string,
147127base?: RecursiveVisitors<TState>,
148128state?: TState
149129): Found<TState> | undefined
150130151131/**
152132 * like {@link findNodeAt}, but will match any node that exists 'around' (spanning) the given position.
153- * @param node
154- * @param start
155- * @param type
156- * @param base
157- * @param state
158133 */
159134export function findNodeAround<TState>(
160135node: acorn.Node,
161-start: number | undefined,
136+start: number | undefined | null,
162137type?: FindPredicate | string,
163138base?: RecursiveVisitors<TState>,
164139state?: TState