@@ -32,7 +32,7 @@ const handle = zwitch('nestingOperator', {
32
32
/** @type {Handler } */
33
33
export const nest = handle
34
34
35
- // Shouldn’t be invoked , parser gives correct data.
35
+ // Shouldn’t be called , parser gives correct data.
36
36
/* c8 ignore next 6 */
37
37
/**
38
38
* @param {{[x: string]: unknown, type: string} } query
@@ -93,7 +93,7 @@ function child(query, node, _1, _2, state) {
93
93
if ( ! parent ( node ) ) return
94
94
if ( node . children . length === 0 ) return
95
95
96
- new WalkIterator ( query , node , state ) . each ( ) . done ( )
96
+ new WalkIterator ( query , node , state ) . each ( undefined , undefined ) . done ( )
97
97
}
98
98
99
99
/** @type {Handler } */
@@ -111,7 +111,7 @@ function adjacentSibling(query, _, index, parent, state) {
111
111
new WalkIterator ( query , parent , state )
112
112
. prefillTypeIndex ( 0 , ++ index )
113
113
. each ( index , ++ index )
114
- . prefillTypeIndex ( index )
114
+ . prefillTypeIndex ( index , undefined )
115
115
. done ( )
116
116
}
117
117
@@ -129,7 +129,7 @@ function generalSibling(query, _, index, parent, state) {
129
129
130
130
new WalkIterator ( query , parent , state )
131
131
. prefillTypeIndex ( 0 , ++ index )
132
- . each ( index )
132
+ . each ( index , undefined )
133
133
. done ( )
134
134
}
135
135
@@ -148,15 +148,15 @@ class WalkIterator {
148
148
this . parent = parent
149
149
/** @type {SelectState } */
150
150
this . state = state
151
- /** @type {TypeIndex| undefined } */
151
+ /** @type {TypeIndex | undefined } */
152
152
this . typeIndex = state . index ? new TypeIndex ( ) : undefined
153
- /** @type {Array. <Function> } */
153
+ /** @type {Array<Function> } */
154
154
this . delayed = [ ]
155
155
}
156
156
157
157
/**
158
- * @param {number|null| undefined } [x]
159
- * @param {number|null| undefined } [y]
158
+ * @param {number | undefined } x
159
+ * @param {number | undefined } y
160
160
* @returns {this }
161
161
*/
162
162
prefillTypeIndex ( x , y ) {
@@ -173,8 +173,8 @@ class WalkIterator {
173
173
}
174
174
175
175
/**
176
- * @param {number|null| undefined } [x]
177
- * @param {number|null| undefined } [y]
176
+ * @param {number | undefined } x
177
+ * @param {number | undefined } y
178
178
* @returns {this }
179
179
*/
180
180
each ( x , y ) {
@@ -246,21 +246,21 @@ class WalkIterator {
246
246
}
247
247
248
248
/**
249
- * @param {number|null| undefined } [ start]
250
- * @param {number|null| undefined } [ end]
249
+ * @param {number | undefined } start
250
+ * @param {number | undefined } end
251
251
* @returns {[number, number] }
252
252
*/
253
253
defaults ( start , end ) {
254
- if ( start === null || start === undefined || start < 0 ) start = 0
255
- if ( end === null || end === undefined || end > this . parent . children . length )
254
+ if ( start === undefined || start < 0 ) start = 0
255
+ if ( end === undefined || end > this . parent . children . length )
256
256
end = this . parent . children . length
257
257
return [ start , end ]
258
258
}
259
259
}
260
260
261
261
class TypeIndex {
262
262
constructor ( ) {
263
- /** @type {Object. <string, number> } */
263
+ /** @type {Record <string, number> } */
264
264
this . counts = { }
265
265
/** @type {number } */
266
266
this . nodes = 0
@@ -283,7 +283,7 @@ class TypeIndex {
283
283
284
284
/**
285
285
* @param {Node } node
286
- * @returns {number| undefined }
286
+ * @returns {number | undefined }
287
287
*/
288
288
count ( node ) {
289
289
return this . counts [ node . type ]
0 commit comments