@@ -32,7 +32,7 @@ const handle = zwitch('nestingOperator', {
3232/** @type {Handler } */
3333export const nest = handle
3434
35- // Shouldn’t be invoked , parser gives correct data.
35+ // Shouldn’t be called , parser gives correct data.
3636/* c8 ignore next 6 */
3737/**
3838 * @param {{[x: string]: unknown, type: string} } query
@@ -93,7 +93,7 @@ function child(query, node, _1, _2, state) {
9393 if ( ! parent ( node ) ) return
9494 if ( node . children . length === 0 ) return
9595
96- new WalkIterator ( query , node , state ) . each ( ) . done ( )
96+ new WalkIterator ( query , node , state ) . each ( undefined , undefined ) . done ( )
9797}
9898
9999/** @type {Handler } */
@@ -111,7 +111,7 @@ function adjacentSibling(query, _, index, parent, state) {
111111 new WalkIterator ( query , parent , state )
112112 . prefillTypeIndex ( 0 , ++ index )
113113 . each ( index , ++ index )
114- . prefillTypeIndex ( index )
114+ . prefillTypeIndex ( index , undefined )
115115 . done ( )
116116}
117117
@@ -129,7 +129,7 @@ function generalSibling(query, _, index, parent, state) {
129129
130130 new WalkIterator ( query , parent , state )
131131 . prefillTypeIndex ( 0 , ++ index )
132- . each ( index )
132+ . each ( index , undefined )
133133 . done ( )
134134}
135135
@@ -148,15 +148,15 @@ class WalkIterator {
148148 this . parent = parent
149149 /** @type {SelectState } */
150150 this . state = state
151- /** @type {TypeIndex| undefined } */
151+ /** @type {TypeIndex | undefined } */
152152 this . typeIndex = state . index ? new TypeIndex ( ) : undefined
153- /** @type {Array. <Function> } */
153+ /** @type {Array<Function> } */
154154 this . delayed = [ ]
155155 }
156156
157157 /**
158- * @param {number|null| undefined } [x]
159- * @param {number|null| undefined } [y]
158+ * @param {number | undefined } x
159+ * @param {number | undefined } y
160160 * @returns {this }
161161 */
162162 prefillTypeIndex ( x , y ) {
@@ -173,8 +173,8 @@ class WalkIterator {
173173 }
174174
175175 /**
176- * @param {number|null| undefined } [x]
177- * @param {number|null| undefined } [y]
176+ * @param {number | undefined } x
177+ * @param {number | undefined } y
178178 * @returns {this }
179179 */
180180 each ( x , y ) {
@@ -246,21 +246,21 @@ class WalkIterator {
246246 }
247247
248248 /**
249- * @param {number|null| undefined } [ start]
250- * @param {number|null| undefined } [ end]
249+ * @param {number | undefined } start
250+ * @param {number | undefined } end
251251 * @returns {[number, number] }
252252 */
253253 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 )
256256 end = this . parent . children . length
257257 return [ start , end ]
258258 }
259259}
260260
261261class TypeIndex {
262262 constructor ( ) {
263- /** @type {Object. <string, number> } */
263+ /** @type {Record <string, number> } */
264264 this . counts = { }
265265 /** @type {number } */
266266 this . nodes = 0
@@ -283,7 +283,7 @@ class TypeIndex {
283283
284284 /**
285285 * @param {Node } node
286- * @returns {number| undefined }
286+ * @returns {number | undefined }
287287 */
288288 count ( node ) {
289289 return this . counts [ node . type ]
0 commit comments