@yuku-parser/wasm 0.5.36 → 0.5.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/decode.js CHANGED
@@ -203,356 +203,6 @@ _ck("JSXEmptyExpression", []);
203
203
  _ck("JSXText", []);
204
204
  _ck("JSXSpreadChild", ["expression"]);
205
205
  _ck("Hashbang", []);
206
- const SCAN_CHILDREN = [
207
- [2, 2],
208
- [0, 2],
209
- [0, 2, 0, 3, 0, 4, 0, 5],
210
- [0, 2, 0, 3, 0, 4, 0, 5, 0, 6],
211
- [2, 2],
212
- [2, 2],
213
- [2, 2, 0, 3],
214
- [0, 2, 0, 3],
215
- [0, 2, 0, 3],
216
- [0, 2, 0, 3, 0, 4],
217
- [0, 2],
218
- [0, 2],
219
- [0, 2, 0, 3],
220
- [2, 2],
221
- [2, 2],
222
- [0, 2],
223
- [0, 2, 0, 3],
224
- [0, 2, 0, 3],
225
- [0, 2, 2, 3, 0, 4],
226
- [0, 2],
227
- [0, 2, 0, 3, 0, 4],
228
- [0, 2, 2, 3, 0, 4],
229
- [0, 2],
230
- [0, 2],
231
- [0, 2, 0, 3],
232
- [0, 2],
233
- [2, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 1, 8],
234
- [2, 2],
235
- [2, 2, 0, 3, 0, 4],
236
- [2, 2, 0, 3, 0, 4, 0, 5],
237
- [2, 2],
238
- [],
239
- [],
240
- [],
241
- [],
242
- [],
243
- [],
244
- [],
245
- [],
246
- [2, 2, 1, 3],
247
- [],
248
- [],
249
- [],
250
- [2, 4, 0, 5],
251
- [],
252
- [],
253
- [0, 2],
254
- [0, 2, 0, 3, 0, 4],
255
- [0, 2, 2, 3],
256
- [0, 2, 2, 3],
257
- [0, 2, 0, 3, 0, 4, 0, 5],
258
- [0, 2, 0, 3, 0, 4],
259
- [0, 2, 0, 3, 0, 4],
260
- [0, 2, 0, 3],
261
- [0, 2, 0, 3],
262
- [0, 2],
263
- [0, 2],
264
- [0, 2, 0, 3],
265
- [0, 2, 0, 3],
266
- [0, 2],
267
- [0, 2],
268
- [0, 2, 0, 3, 0, 4],
269
- [0, 2, 0, 3],
270
- [],
271
- [],
272
- [2, 2],
273
- [0, 2, 0, 3],
274
- [0, 2],
275
- [0, 2, 0, 3, 2, 4, 0, 5],
276
- [0, 2, 2, 3, 0, 4],
277
- [2, 2, 0, 3, 1, 4, 0, 6],
278
- [2, 2, 0, 3, 1, 4, 0, 6],
279
- [0, 2, 0, 3],
280
- [2, 2],
281
- [0, 2, 0, 3],
282
- [2, 2, 0, 3, 1, 4],
283
- [0, 2, 0, 3],
284
- [0, 2],
285
- [0, 2],
286
- [0, 2, 0, 3],
287
- [0, 2, 2, 3, 0, 4, 1, 5],
288
- [0, 2],
289
- [0, 2, 0, 3, 2, 4],
290
- [0, 2, 0, 3],
291
- [0, 2],
292
- [],
293
- [],
294
- [],
295
- [],
296
- [],
297
- [],
298
- [],
299
- [],
300
- [],
301
- [],
302
- [],
303
- [],
304
- [],
305
- [],
306
- [0, 2, 0, 3],
307
- [0, 2, 0, 3],
308
- [0, 2, 0, 3],
309
- [0, 2, 0, 3, 0, 4, 0, 5],
310
- [0, 2, 0, 3, 0, 4],
311
- [2, 2],
312
- [2, 2],
313
- [0, 2],
314
- [2, 2, 1, 3],
315
- [0, 2],
316
- [0, 2, 0, 3],
317
- [2, 2],
318
- [0, 2, 0, 3],
319
- [0, 2],
320
- [0, 2],
321
- [0, 2],
322
- [0, 2],
323
- [],
324
- [2, 2],
325
- [2, 2],
326
- [0, 2, 0, 3, 0, 4, 0, 5],
327
- [0, 2],
328
- [0, 2],
329
- [0, 2],
330
- [0, 2, 0, 3, 0, 4],
331
- [0, 2, 0, 3, 0, 4],
332
- [0, 2, 0, 3],
333
- [2, 2],
334
- [0, 2, 0, 3, 0, 4, 0, 5],
335
- [0, 2, 0, 3],
336
- [0, 2, 0, 3, 0, 4, 0, 5],
337
- [0, 2, 0, 3, 0, 4],
338
- [0, 2, 0, 3, 0, 4],
339
- [2, 2, 0, 3],
340
- [0, 2, 0, 3, 0, 4],
341
- [0, 2, 0, 3, 2, 4, 0, 5],
342
- [2, 2],
343
- [0, 2, 0, 3],
344
- [0, 2, 0, 3],
345
- [0, 2, 0, 3],
346
- [2, 2],
347
- [0, 2, 0, 3],
348
- [0, 2, 0, 3],
349
- [2, 2],
350
- [0, 2, 0, 3],
351
- [2, 2, 0, 3],
352
- [0, 2],
353
- [0, 2, 0, 3],
354
- [0, 2, 0, 3],
355
- [0, 2, 0, 3],
356
- [0, 2],
357
- [0, 2, 0, 3],
358
- [0, 2],
359
- [0, 2],
360
- [0, 2, 0, 3],
361
- [0, 2],
362
- [0, 2, 2, 3, 0, 4],
363
- [0, 2, 2, 3, 0, 4],
364
- [0, 2],
365
- [0, 2, 2, 3, 0, 4],
366
- [],
367
- [],
368
- [],
369
- [0, 2, 0, 3],
370
- [0, 2, 0, 3],
371
- [0, 2, 0, 3],
372
- [0, 2],
373
- [0, 2],
374
- [],
375
- [],
376
- [0, 2],
377
- ];
378
- const TAG_TYPES = [
379
- "SequenceExpression",
380
- "ParenthesizedExpression",
381
- "ArrowFunctionExpression",
382
- 0,
383
- "BlockStatement",
384
- "BlockStatement",
385
- null,
386
- "BinaryExpression",
387
- "LogicalExpression",
388
- "ConditionalExpression",
389
- "UnaryExpression",
390
- "UpdateExpression",
391
- "AssignmentExpression",
392
- "ArrayExpression",
393
- "ObjectExpression",
394
- "SpreadElement",
395
- "Property",
396
- "MemberExpression",
397
- "CallExpression",
398
- "ChainExpression",
399
- "TaggedTemplateExpression",
400
- "NewExpression",
401
- "AwaitExpression",
402
- "YieldExpression",
403
- "MetaProperty",
404
- "Decorator",
405
- 0,
406
- "ClassBody",
407
- 0,
408
- 0,
409
- "StaticBlock",
410
- "Super",
411
- "Literal",
412
- "Literal",
413
- "Literal",
414
- "Literal",
415
- "Literal",
416
- "ThisExpression",
417
- "Literal",
418
- "TemplateLiteral",
419
- "TemplateElement",
420
- "Identifier",
421
- "PrivateIdentifier",
422
- "Identifier",
423
- "Identifier",
424
- "Identifier",
425
- "ExpressionStatement",
426
- "IfStatement",
427
- "SwitchStatement",
428
- "SwitchCase",
429
- "ForStatement",
430
- "ForInStatement",
431
- "ForOfStatement",
432
- "WhileStatement",
433
- "DoWhileStatement",
434
- "BreakStatement",
435
- "ContinueStatement",
436
- "LabeledStatement",
437
- "WithStatement",
438
- "ReturnStatement",
439
- "ThrowStatement",
440
- "TryStatement",
441
- "CatchClause",
442
- "DebuggerStatement",
443
- "EmptyStatement",
444
- "VariableDeclaration",
445
- "VariableDeclarator",
446
- "ExpressionStatement",
447
- "AssignmentPattern",
448
- "RestElement",
449
- "ArrayPattern",
450
- "ObjectPattern",
451
- "Property",
452
- "Program",
453
- "ImportExpression",
454
- "ImportDeclaration",
455
- "ImportSpecifier",
456
- "ImportDefaultSpecifier",
457
- "ImportNamespaceSpecifier",
458
- "ImportAttribute",
459
- "ExportNamedDeclaration",
460
- "ExportDefaultDeclaration",
461
- "ExportAllDeclaration",
462
- "ExportSpecifier",
463
- "TSTypeAnnotation",
464
- "TSAnyKeyword",
465
- "TSUnknownKeyword",
466
- "TSNeverKeyword",
467
- "TSVoidKeyword",
468
- "TSNullKeyword",
469
- "TSUndefinedKeyword",
470
- "TSStringKeyword",
471
- "TSNumberKeyword",
472
- "TSBigIntKeyword",
473
- "TSBooleanKeyword",
474
- "TSSymbolKeyword",
475
- "TSObjectKeyword",
476
- "TSIntrinsicKeyword",
477
- "TSThisType",
478
- "TSTypeReference",
479
- "TSQualifiedName",
480
- "TSTypeQuery",
481
- "TSImportType",
482
- "TSTypeParameter",
483
- "TSTypeParameterDeclaration",
484
- "TSTypeParameterInstantiation",
485
- "TSLiteralType",
486
- "TSTemplateLiteralType",
487
- "TSArrayType",
488
- "TSIndexedAccessType",
489
- "TSTupleType",
490
- "TSNamedTupleMember",
491
- "TSOptionalType",
492
- "TSRestType",
493
- "TSJSDocNullableType",
494
- "TSJSDocNonNullableType",
495
- "TSJSDocUnknownType",
496
- "TSUnionType",
497
- "TSIntersectionType",
498
- "TSConditionalType",
499
- "TSInferType",
500
- "TSTypeOperator",
501
- "TSParenthesizedType",
502
- "TSFunctionType",
503
- "TSConstructorType",
504
- "TSTypePredicate",
505
- "TSTypeLiteral",
506
- "TSMappedType",
507
- "TSPropertySignature",
508
- "TSMethodSignature",
509
- "TSCallSignatureDeclaration",
510
- "TSConstructSignatureDeclaration",
511
- "TSIndexSignature",
512
- "TSTypeAliasDeclaration",
513
- "TSInterfaceDeclaration",
514
- "TSInterfaceBody",
515
- "TSInterfaceHeritage",
516
- "TSClassImplements",
517
- "TSEnumDeclaration",
518
- "TSEnumBody",
519
- "TSEnumMember",
520
- "TSModuleDeclaration",
521
- "TSModuleBlock",
522
- "TSModuleDeclaration",
523
- "TSParameterProperty",
524
- "Identifier",
525
- "TSAsExpression",
526
- "TSSatisfiesExpression",
527
- "TSTypeAssertion",
528
- "TSNonNullExpression",
529
- "TSInstantiationExpression",
530
- "TSExportAssignment",
531
- "TSNamespaceExportDeclaration",
532
- "TSImportEqualsDeclaration",
533
- "TSExternalModuleReference",
534
- "JSXElement",
535
- "JSXOpeningElement",
536
- "JSXClosingElement",
537
- "JSXFragment",
538
- "JSXOpeningFragment",
539
- "JSXClosingFragment",
540
- "JSXIdentifier",
541
- "JSXNamespacedName",
542
- "JSXMemberExpression",
543
- "JSXAttribute",
544
- "JSXSpreadAttribute",
545
- "JSXExpressionContainer",
546
- "JSXEmptyExpression",
547
- "JSXText",
548
- "JSXSpreadChild",
549
- ];
550
- const TAG_CHOICES = new Map([
551
- [3, ["FunctionDeclaration", "FunctionExpression", "TSDeclareFunction", "TSEmptyBodyFunctionExpression"]],
552
- [26, ["ClassDeclaration", "ClassExpression"]],
553
- [28, ["MethodDefinition", "TSAbstractMethodDefinition"]],
554
- [29, ["PropertyDefinition", "AccessorProperty", "TSAbstractPropertyDefinition", "TSAbstractAccessorProperty"]],
555
- ]);
556
206
  function buildPosMap(src, byteLen, startByte) {
557
207
  const m = new Uint32Array(byteLen - startByte + 1);
558
208
  const len = src.length;
@@ -746,30 +396,31 @@ function decode(buffer, source) {
746
396
  case 4: return { type: "BlockStatement", start, end, body: nodeArr(f1, f0) };
747
397
  case 5: return { type: "BlockStatement", start, end, body: nodeArr(f1, f0) };
748
398
  case 6: return { params: fnParams(i) };
749
- case 7: return { type: "BinaryExpression", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, operator: BINARY_OPS[flags & 31] };
750
- case 8: return { type: "LogicalExpression", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, operator: LOGICAL_OPS[flags & 3] };
751
- case 9: return { type: "ConditionalExpression", start, end, test: f1 !== NULL ? node(f1) : null, consequent: f2 !== NULL ? node(f2) : null, alternate: f3 !== NULL ? node(f3) : null };
752
- case 10: return {
399
+ case 7: return node(f1);
400
+ case 8: return { type: "BinaryExpression", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, operator: BINARY_OPS[flags & 31] };
401
+ case 9: return { type: "LogicalExpression", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, operator: LOGICAL_OPS[flags & 3] };
402
+ case 10: return { type: "ConditionalExpression", start, end, test: f1 !== NULL ? node(f1) : null, consequent: f2 !== NULL ? node(f2) : null, alternate: f3 !== NULL ? node(f3) : null };
403
+ case 11: return {
753
404
  type: "UnaryExpression", start, end,
754
405
  operator: UNARY_OPS[flags & 7], prefix: true,
755
406
  argument: f1 !== NULL ? node(f1) : null,
756
407
  };
757
- case 11: return { type: "UpdateExpression", start, end, argument: f1 !== NULL ? node(f1) : null, operator: UPDATE_OPS[flags & 1], prefix: !!(flags & 2) };
758
- case 12: return { type: "AssignmentExpression", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, operator: ASSIGNMENT_OPS[flags & 15] };
759
- case 13: return { type: "ArrayExpression", start, end, elements: nodeArrHoles(f1, f0) };
760
- case 14: return { type: "ObjectExpression", start, end, properties: nodeArr(f1, f0) };
761
- case 15: return { type: "SpreadElement", start, end, argument: f1 !== NULL ? node(f1) : null };
762
- case 16: { const r = { type: "Property", start, end, key: f1 !== NULL ? node(f1) : null, value: f2 !== NULL ? node(f2) : null, kind: PROPERTY_KINDS[flags & 3], method: !!(flags & 4), shorthand: !!(flags & 8), computed: !!(flags & 16) }; if (_isTs) { r.optional = false; } return r; }
763
- case 17: return { type: "MemberExpression", start, end, object: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null, computed: !!(flags & 1), optional: !!(flags & 2) };
764
- case 18: { const r = { type: "CallExpression", start, end, callee: f1 !== NULL ? node(f1) : null, arguments: nodeArr(f2, f0), optional: !!(flags & 1) }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
765
- case 19: return { type: "ChainExpression", start, end, expression: f1 !== NULL ? node(f1) : null };
766
- case 20: { const r = { type: "TaggedTemplateExpression", start, end, tag: f1 !== NULL ? node(f1) : null, quasi: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
767
- case 21: { const r = { type: "NewExpression", start, end, callee: f1 !== NULL ? node(f1) : null, arguments: nodeArr(f2, f0) }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
768
- case 22: return { type: "AwaitExpression", start, end, argument: f1 !== NULL ? node(f1) : null };
769
- case 23: return { type: "YieldExpression", start, end, argument: f1 !== NULL ? node(f1) : null, delegate: !!(flags & 1) };
770
- case 24: return { type: "MetaProperty", start, end, meta: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null };
771
- case 25: return { type: "Decorator", start, end, expression: f1 !== NULL ? node(f1) : null };
772
- case 26: {
408
+ case 12: return { type: "UpdateExpression", start, end, argument: f1 !== NULL ? node(f1) : null, operator: UPDATE_OPS[flags & 1], prefix: !!(flags & 2) };
409
+ case 13: return { type: "AssignmentExpression", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, operator: ASSIGNMENT_OPS[flags & 15] };
410
+ case 14: return { type: "ArrayExpression", start, end, elements: nodeArrHoles(f1, f0) };
411
+ case 15: return { type: "ObjectExpression", start, end, properties: nodeArr(f1, f0) };
412
+ case 16: return { type: "SpreadElement", start, end, argument: f1 !== NULL ? node(f1) : null };
413
+ case 17: { const r = { type: "Property", start, end, key: f1 !== NULL ? node(f1) : null, value: f2 !== NULL ? node(f2) : null, kind: PROPERTY_KINDS[flags & 3], method: !!(flags & 4), shorthand: !!(flags & 8), computed: !!(flags & 16) }; if (_isTs) { r.optional = false; } return r; }
414
+ case 18: return { type: "MemberExpression", start, end, object: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null, computed: !!(flags & 1), optional: !!(flags & 2) };
415
+ case 19: { const r = { type: "CallExpression", start, end, callee: f1 !== NULL ? node(f1) : null, arguments: nodeArr(f2, f0), optional: !!(flags & 1) }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
416
+ case 20: return { type: "ChainExpression", start, end, expression: f1 !== NULL ? node(f1) : null };
417
+ case 21: { const r = { type: "TaggedTemplateExpression", start, end, tag: f1 !== NULL ? node(f1) : null, quasi: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
418
+ case 22: { const r = { type: "NewExpression", start, end, callee: f1 !== NULL ? node(f1) : null, arguments: nodeArr(f2, f0) }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
419
+ case 23: return { type: "AwaitExpression", start, end, argument: f1 !== NULL ? node(f1) : null };
420
+ case 24: return { type: "YieldExpression", start, end, argument: f1 !== NULL ? node(f1) : null, delegate: !!(flags & 1) };
421
+ case 25: return { type: "MetaProperty", start, end, meta: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null };
422
+ case 26: return { type: "Decorator", start, end, expression: f1 !== NULL ? node(f1) : null };
423
+ case 27: {
773
424
  const r = {
774
425
  type: CLASS_TYPES[flags & 1], start, end,
775
426
  decorators: nodeArr(f1, f0),
@@ -786,8 +437,8 @@ function decode(buffer, source) {
786
437
  }
787
438
  return r;
788
439
  }
789
- case 27: return { type: "ClassBody", start, end, body: nodeArr(f1, f0) };
790
- case 28: {
440
+ case 28: return { type: "ClassBody", start, end, body: nodeArr(f1, f0) };
441
+ case 29: {
791
442
  const r = {
792
443
  type: "MethodDefinition", start, end,
793
444
  decorators: nodeArr(f1, f0),
@@ -804,7 +455,7 @@ function decode(buffer, source) {
804
455
  }
805
456
  return r;
806
457
  }
807
- case 29: {
458
+ case 30: {
808
459
  const _acc = !!(flags & 4);
809
460
  const r = {
810
461
  type: _acc ? "AccessorProperty" : "PropertyDefinition",
@@ -830,13 +481,13 @@ function decode(buffer, source) {
830
481
  }
831
482
  return r;
832
483
  }
833
- case 30: return { type: "StaticBlock", start, end, body: nodeArr(f1, f0) };
834
- case 31: return { type: "Super", start, end };
835
- case 32: return {
484
+ case 31: return { type: "StaticBlock", start, end, body: nodeArr(f1, f0) };
485
+ case 32: return { type: "Super", start, end };
486
+ case 33: return {
836
487
  type: "Literal", start, end,
837
488
  value: str(f1, f2), raw: _src.slice(start, end),
838
489
  };
839
- case 33: {
490
+ case 34: {
840
491
  const r = _src.slice(start, end);
841
492
  const s = r.indexOf("_") === -1 ? r : r.replace(/_/g, "");
842
493
  const v = (flags & 3) === 2 && s[1] !== "o" && s[1] !== "O"
@@ -848,7 +499,7 @@ function decode(buffer, source) {
848
499
  raw: r,
849
500
  };
850
501
  }
851
- case 34: {
502
+ case 35: {
852
503
  const r = _src.slice(start, end);
853
504
  const d = str(f1, f2).replace(/_/g, "");
854
505
  const v = BigInt(d);
@@ -857,16 +508,16 @@ function decode(buffer, source) {
857
508
  value: v, raw: r, bigint: v.toString(),
858
509
  };
859
510
  }
860
- case 35: {
511
+ case 36: {
861
512
  const v = !!(flags & 1);
862
513
  return {
863
514
  type: "Literal", start, end,
864
515
  value: v, raw: v ? "true" : "false",
865
516
  };
866
517
  }
867
- case 36: return { type: "Literal", start, end, value: null, raw: "null" };
868
- case 37: return { type: "ThisExpression", start, end };
869
- case 38: {
518
+ case 37: return { type: "Literal", start, end, value: null, raw: "null" };
519
+ case 38: return { type: "ThisExpression", start, end };
520
+ case 39: {
870
521
  const p = str(f1, f2), fl = str(f3, f4);
871
522
  let v = null;
872
523
  try { v = new RegExp(p, fl); } catch {}
@@ -876,8 +527,8 @@ function decode(buffer, source) {
876
527
  regex: { pattern: p, flags: fl.split("").sort().join("") },
877
528
  };
878
529
  }
879
- case 39: return { type: "TemplateLiteral", start, end, quasis: nodeArr(f1, f0), expressions: nodeArr(f2, f3) };
880
- case 40: {
530
+ case 40: return { type: "TemplateLiteral", start, end, quasis: nodeArr(f1, f0), expressions: nodeArr(f2, f3) };
531
+ case 41: {
881
532
  const raw = _src.slice(start, end).replace(/\r\n?/g, "\n");
882
533
  const tl = !!(flags & 1);
883
534
  const s = _isTs ? start - 1 : start;
@@ -891,39 +542,39 @@ function decode(buffer, source) {
891
542
  tail: tl,
892
543
  };
893
544
  }
894
- case 41: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = []; r.optional = false; r.typeAnnotation = null; } return r; }
895
- case 42: return { type: "PrivateIdentifier", start, end, name: str(f1, f2) };
896
- case 43: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = nodeArr(f3, f0); r.typeAnnotation = f4 !== NULL ? node(f4) : null; r.optional = !!(flags & 1); } return r; }
897
- case 44: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = []; r.optional = false; r.typeAnnotation = null; } return r; }
545
+ case 42: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = []; r.optional = false; r.typeAnnotation = null; } return r; }
546
+ case 43: return { type: "PrivateIdentifier", start, end, name: str(f1, f2) };
547
+ case 44: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = nodeArr(f3, f0); r.typeAnnotation = f4 !== NULL ? node(f4) : null; r.optional = !!(flags & 1); } return r; }
898
548
  case 45: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = []; r.optional = false; r.typeAnnotation = null; } return r; }
899
- case 46: { const r = { type: "ExpressionStatement", start, end, expression: f1 !== NULL ? node(f1) : null }; if (_isTs) { r.directive = null; } return r; }
900
- case 47: return { type: "IfStatement", start, end, test: f1 !== NULL ? node(f1) : null, consequent: f2 !== NULL ? node(f2) : null, alternate: f3 !== NULL ? node(f3) : null };
901
- case 48: return { type: "SwitchStatement", start, end, discriminant: f1 !== NULL ? node(f1) : null, cases: nodeArr(f2, f0) };
902
- case 49: return { type: "SwitchCase", start, end, test: f1 !== NULL ? node(f1) : null, consequent: nodeArr(f2, f0) };
903
- case 50: return { type: "ForStatement", start, end, init: f1 !== NULL ? node(f1) : null, test: f2 !== NULL ? node(f2) : null, update: f3 !== NULL ? node(f3) : null, body: f4 !== NULL ? node(f4) : null };
904
- case 51: return { type: "ForInStatement", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, body: f3 !== NULL ? node(f3) : null };
905
- case 52: return { type: "ForOfStatement", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, body: f3 !== NULL ? node(f3) : null, await: !!(flags & 1) };
906
- case 53: return { type: "WhileStatement", start, end, test: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
907
- case 54: return { type: "DoWhileStatement", start, end, body: f1 !== NULL ? node(f1) : null, test: f2 !== NULL ? node(f2) : null };
908
- case 55: return { type: "BreakStatement", start, end, label: f1 !== NULL ? node(f1) : null };
909
- case 56: return { type: "ContinueStatement", start, end, label: f1 !== NULL ? node(f1) : null };
910
- case 57: return { type: "LabeledStatement", start, end, label: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
911
- case 58: return { type: "WithStatement", start, end, object: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
912
- case 59: return { type: "ReturnStatement", start, end, argument: f1 !== NULL ? node(f1) : null };
913
- case 60: return { type: "ThrowStatement", start, end, argument: f1 !== NULL ? node(f1) : null };
914
- case 61: return { type: "TryStatement", start, end, block: f1 !== NULL ? node(f1) : null, handler: f2 !== NULL ? node(f2) : null, finalizer: f3 !== NULL ? node(f3) : null };
915
- case 62: return { type: "CatchClause", start, end, param: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
916
- case 63: return { type: "DebuggerStatement", start, end };
917
- case 64: return { type: "EmptyStatement", start, end };
918
- case 65: { const r = { type: "VariableDeclaration", start, end, kind: VAR_KINDS[flags & 7], declarations: nodeArr(f1, f0) }; if (_isTs) { r.declare = !!(flags & 8); } return r; }
919
- case 66: { const r = { type: "VariableDeclarator", start, end, id: f1 !== NULL ? node(f1) : null, init: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.definite = !!(flags & 1); } return r; }
920
- case 67: return {
549
+ case 46: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = []; r.optional = false; r.typeAnnotation = null; } return r; }
550
+ case 47: { const r = { type: "ExpressionStatement", start, end, expression: f1 !== NULL ? node(f1) : null }; if (_isTs) { r.directive = null; } return r; }
551
+ case 48: return { type: "IfStatement", start, end, test: f1 !== NULL ? node(f1) : null, consequent: f2 !== NULL ? node(f2) : null, alternate: f3 !== NULL ? node(f3) : null };
552
+ case 49: return { type: "SwitchStatement", start, end, discriminant: f1 !== NULL ? node(f1) : null, cases: nodeArr(f2, f0) };
553
+ case 50: return { type: "SwitchCase", start, end, test: f1 !== NULL ? node(f1) : null, consequent: nodeArr(f2, f0) };
554
+ case 51: return { type: "ForStatement", start, end, init: f1 !== NULL ? node(f1) : null, test: f2 !== NULL ? node(f2) : null, update: f3 !== NULL ? node(f3) : null, body: f4 !== NULL ? node(f4) : null };
555
+ case 52: return { type: "ForInStatement", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, body: f3 !== NULL ? node(f3) : null };
556
+ case 53: return { type: "ForOfStatement", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, body: f3 !== NULL ? node(f3) : null, await: !!(flags & 1) };
557
+ case 54: return { type: "WhileStatement", start, end, test: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
558
+ case 55: return { type: "DoWhileStatement", start, end, body: f1 !== NULL ? node(f1) : null, test: f2 !== NULL ? node(f2) : null };
559
+ case 56: return { type: "BreakStatement", start, end, label: f1 !== NULL ? node(f1) : null };
560
+ case 57: return { type: "ContinueStatement", start, end, label: f1 !== NULL ? node(f1) : null };
561
+ case 58: return { type: "LabeledStatement", start, end, label: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
562
+ case 59: return { type: "WithStatement", start, end, object: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
563
+ case 60: return { type: "ReturnStatement", start, end, argument: f1 !== NULL ? node(f1) : null };
564
+ case 61: return { type: "ThrowStatement", start, end, argument: f1 !== NULL ? node(f1) : null };
565
+ case 62: return { type: "TryStatement", start, end, block: f1 !== NULL ? node(f1) : null, handler: f2 !== NULL ? node(f2) : null, finalizer: f3 !== NULL ? node(f3) : null };
566
+ case 63: return { type: "CatchClause", start, end, param: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
567
+ case 64: return { type: "DebuggerStatement", start, end };
568
+ case 65: return { type: "EmptyStatement", start, end };
569
+ case 66: { const r = { type: "VariableDeclaration", start, end, kind: VAR_KINDS[flags & 7], declarations: nodeArr(f1, f0) }; if (_isTs) { r.declare = !!(flags & 8); } return r; }
570
+ case 67: { const r = { type: "VariableDeclarator", start, end, id: f1 !== NULL ? node(f1) : null, init: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.definite = !!(flags & 1); } return r; }
571
+ case 68: return {
921
572
  type: "ExpressionStatement", start, end,
922
573
  expression: node(f1), directive: str(f2, f3),
923
574
  };
924
- case 68: { const r = { type: "AssignmentPattern", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.decorators = nodeArr(f3, f0); r.typeAnnotation = f4 !== NULL ? node(f4) : null; r.optional = !!(flags & 1); } return r; }
925
- case 69: { const r = { type: "RestElement", start, end, argument: f1 !== NULL ? node(f1) : null }; if (_isTs) { r.decorators = nodeArr(f2, f0); r.typeAnnotation = f3 !== NULL ? node(f3) : null; r.optional = !!(flags & 1); r.value = null; } return r; }
926
- case 70: {
575
+ case 69: { const r = { type: "AssignmentPattern", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.decorators = nodeArr(f3, f0); r.typeAnnotation = f4 !== NULL ? node(f4) : null; r.optional = !!(flags & 1); } return r; }
576
+ case 70: { const r = { type: "RestElement", start, end, argument: f1 !== NULL ? node(f1) : null }; if (_isTs) { r.decorators = nodeArr(f2, f0); r.typeAnnotation = f3 !== NULL ? node(f3) : null; r.optional = !!(flags & 1); r.value = null; } return r; }
577
+ case 71: {
927
578
  const el = nodeArrHoles(f1, f0);
928
579
  if (f2 !== NULL) el.push(node(f2));
929
580
  const r = { type: "ArrayPattern", start, end, elements: el };
@@ -934,7 +585,7 @@ function decode(buffer, source) {
934
585
  }
935
586
  return r;
936
587
  }
937
- case 71: {
588
+ case 72: {
938
589
  const pr = nodeArr(f1, f0);
939
590
  if (f2 !== NULL) pr.push(node(f2));
940
591
  const r = { type: "ObjectPattern", start, end, properties: pr };
@@ -945,7 +596,7 @@ function decode(buffer, source) {
945
596
  }
946
597
  return r;
947
598
  }
948
- case 72: {
599
+ case 73: {
949
600
  const r = {
950
601
  type: "Property", start, end,
951
602
  kind: "init",
@@ -954,7 +605,7 @@ function decode(buffer, source) {
954
605
  shorthand: !!(flags & 1),
955
606
  computed: !!(flags & 2),
956
607
  }; if (_isTs) { r.optional = false; } return r; }
957
- case 73: return {
608
+ case 74: return {
958
609
  type: "Program", start, end,
959
610
  sourceType: (flags & 1) ? "module" : "script",
960
611
  hashbang: (flags & 2) ? {
@@ -964,71 +615,71 @@ function decode(buffer, source) {
964
615
  } : null,
965
616
  body: nodeArr(f1, f0),
966
617
  };
967
- case 74: return { type: "ImportExpression", start, end, source: f1 !== NULL ? node(f1) : null, options: f2 !== NULL ? node(f2) : null, phase: (flags & 1) ? ["source", "defer"][(flags >> 1) & 1] : null };
968
- case 75: { const r = { type: "ImportDeclaration", start, end, specifiers: nodeArr(f1, f0), source: f2 !== NULL ? node(f2) : null, attributes: nodeArr(f3, f4), phase: (flags & 1) ? ["source", "defer"][(flags >> 1) & 1] : null }; if (_isTs) { r.importKind = IMPORT_EXPORT_KINDS[(flags >> 2) & 1]; } return r; }
969
- case 76: { const r = { type: "ImportSpecifier", start, end, imported: f1 !== NULL ? node(f1) : null, local: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.importKind = IMPORT_EXPORT_KINDS[flags & 1]; } return r; }
970
- case 77: return { type: "ImportDefaultSpecifier", start, end, local: f1 !== NULL ? node(f1) : null };
971
- case 78: return { type: "ImportNamespaceSpecifier", start, end, local: f1 !== NULL ? node(f1) : null };
972
- case 79: return { type: "ImportAttribute", start, end, key: f1 !== NULL ? node(f1) : null, value: f2 !== NULL ? node(f2) : null };
973
- case 80: { const r = { type: "ExportNamedDeclaration", start, end, declaration: f1 !== NULL ? node(f1) : null, specifiers: nodeArr(f2, f0), source: f3 !== NULL ? node(f3) : null, attributes: nodeArr(f4, f5) }; if (_isTs) { r.exportKind = IMPORT_EXPORT_KINDS[flags & 1]; } return r; }
974
- case 81: { const r = { type: "ExportDefaultDeclaration", start, end, declaration: f1 !== NULL ? node(f1) : null }; if (_isTs) { r.exportKind = "value"; } return r; }
975
- case 82: { const r = { type: "ExportAllDeclaration", start, end, exported: f1 !== NULL ? node(f1) : null, source: f2 !== NULL ? node(f2) : null, attributes: nodeArr(f3, f0) }; if (_isTs) { r.exportKind = IMPORT_EXPORT_KINDS[flags & 1]; } return r; }
976
- case 83: { const r = { type: "ExportSpecifier", start, end, local: f1 !== NULL ? node(f1) : null, exported: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.exportKind = IMPORT_EXPORT_KINDS[flags & 1]; } return r; }
977
- case 84: return { type: "TSTypeAnnotation", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
978
- case 85: return { type: "TSAnyKeyword", start, end };
979
- case 86: return { type: "TSUnknownKeyword", start, end };
980
- case 87: return { type: "TSNeverKeyword", start, end };
981
- case 88: return { type: "TSVoidKeyword", start, end };
982
- case 89: return { type: "TSNullKeyword", start, end };
983
- case 90: return { type: "TSUndefinedKeyword", start, end };
984
- case 91: return { type: "TSStringKeyword", start, end };
985
- case 92: return { type: "TSNumberKeyword", start, end };
986
- case 93: return { type: "TSBigIntKeyword", start, end };
987
- case 94: return { type: "TSBooleanKeyword", start, end };
988
- case 95: return { type: "TSSymbolKeyword", start, end };
989
- case 96: return { type: "TSObjectKeyword", start, end };
990
- case 97: return { type: "TSIntrinsicKeyword", start, end };
991
- case 98: return { type: "TSThisType", start, end };
992
- case 99: return { type: "TSTypeReference", start, end, typeName: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
993
- case 100: return { type: "TSQualifiedName", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null };
994
- case 101: return { type: "TSTypeQuery", start, end, exprName: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
995
- case 102: return { type: "TSImportType", start, end, source: f1 !== NULL ? node(f1) : null, options: f2 !== NULL ? node(f2) : null, qualifier: f3 !== NULL ? node(f3) : null, typeArguments: f4 !== NULL ? node(f4) : null };
996
- case 103: return { type: "TSTypeParameter", start, end, name: f1 !== NULL ? node(f1) : null, constraint: f2 !== NULL ? node(f2) : null, default: f3 !== NULL ? node(f3) : null, in: !!(flags & 1), out: !!(flags & 2), const: !!(flags & 4) };
997
- case 104: return { type: "TSTypeParameterDeclaration", start, end, params: nodeArr(f1, f0) };
998
- case 105: return { type: "TSTypeParameterInstantiation", start, end, params: nodeArr(f1, f0) };
999
- case 106: return { type: "TSLiteralType", start, end, literal: f1 !== NULL ? node(f1) : null };
1000
- case 107: return { type: "TSTemplateLiteralType", start, end, quasis: nodeArr(f1, f0), types: nodeArr(f2, f3) };
1001
- case 108: return { type: "TSArrayType", start, end, elementType: f1 !== NULL ? node(f1) : null };
1002
- case 109: return { type: "TSIndexedAccessType", start, end, objectType: f1 !== NULL ? node(f1) : null, indexType: f2 !== NULL ? node(f2) : null };
1003
- case 110: return { type: "TSTupleType", start, end, elementTypes: nodeArr(f1, f0) };
1004
- case 111: return { type: "TSNamedTupleMember", start, end, label: f1 !== NULL ? node(f1) : null, elementType: f2 !== NULL ? node(f2) : null, optional: !!(flags & 1) };
1005
- case 112: return { type: "TSOptionalType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
1006
- case 113: return { type: "TSRestType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
1007
- case 114: return { type: "TSJSDocNullableType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null, postfix: !!(flags & 1) };
1008
- case 115: return { type: "TSJSDocNonNullableType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null, postfix: !!(flags & 1) };
1009
- case 116: return { type: "TSJSDocUnknownType", start, end };
1010
- case 117: return { type: "TSUnionType", start, end, types: nodeArr(f1, f0) };
1011
- case 118: return { type: "TSIntersectionType", start, end, types: nodeArr(f1, f0) };
1012
- case 119: return { type: "TSConditionalType", start, end, checkType: f1 !== NULL ? node(f1) : null, extendsType: f2 !== NULL ? node(f2) : null, trueType: f3 !== NULL ? node(f3) : null, falseType: f4 !== NULL ? node(f4) : null };
1013
- case 120: return { type: "TSInferType", start, end, typeParameter: f1 !== NULL ? node(f1) : null };
1014
- case 121: return { type: "TSTypeOperator", start, end, operator: TS_TYPE_OPERATORS[flags & 3], typeAnnotation: f1 !== NULL ? node(f1) : null };
1015
- case 122: return { type: "TSParenthesizedType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
1016
- case 123: return {
618
+ case 75: return { type: "ImportExpression", start, end, source: f1 !== NULL ? node(f1) : null, options: f2 !== NULL ? node(f2) : null, phase: (flags & 1) ? ["source", "defer"][(flags >> 1) & 1] : null };
619
+ case 76: { const r = { type: "ImportDeclaration", start, end, specifiers: nodeArr(f1, f0), source: f2 !== NULL ? node(f2) : null, attributes: nodeArr(f3, f4), phase: (flags & 1) ? ["source", "defer"][(flags >> 1) & 1] : null }; if (_isTs) { r.importKind = IMPORT_EXPORT_KINDS[(flags >> 2) & 1]; } return r; }
620
+ case 77: { const r = { type: "ImportSpecifier", start, end, imported: f1 !== NULL ? node(f1) : null, local: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.importKind = IMPORT_EXPORT_KINDS[flags & 1]; } return r; }
621
+ case 78: return { type: "ImportDefaultSpecifier", start, end, local: f1 !== NULL ? node(f1) : null };
622
+ case 79: return { type: "ImportNamespaceSpecifier", start, end, local: f1 !== NULL ? node(f1) : null };
623
+ case 80: return { type: "ImportAttribute", start, end, key: f1 !== NULL ? node(f1) : null, value: f2 !== NULL ? node(f2) : null };
624
+ case 81: { const r = { type: "ExportNamedDeclaration", start, end, declaration: f1 !== NULL ? node(f1) : null, specifiers: nodeArr(f2, f0), source: f3 !== NULL ? node(f3) : null, attributes: nodeArr(f4, f5) }; if (_isTs) { r.exportKind = IMPORT_EXPORT_KINDS[flags & 1]; } return r; }
625
+ case 82: { const r = { type: "ExportDefaultDeclaration", start, end, declaration: f1 !== NULL ? node(f1) : null }; if (_isTs) { r.exportKind = "value"; } return r; }
626
+ case 83: { const r = { type: "ExportAllDeclaration", start, end, exported: f1 !== NULL ? node(f1) : null, source: f2 !== NULL ? node(f2) : null, attributes: nodeArr(f3, f0) }; if (_isTs) { r.exportKind = IMPORT_EXPORT_KINDS[flags & 1]; } return r; }
627
+ case 84: { const r = { type: "ExportSpecifier", start, end, local: f1 !== NULL ? node(f1) : null, exported: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.exportKind = IMPORT_EXPORT_KINDS[flags & 1]; } return r; }
628
+ case 85: return { type: "TSTypeAnnotation", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
629
+ case 86: return { type: "TSAnyKeyword", start, end };
630
+ case 87: return { type: "TSUnknownKeyword", start, end };
631
+ case 88: return { type: "TSNeverKeyword", start, end };
632
+ case 89: return { type: "TSVoidKeyword", start, end };
633
+ case 90: return { type: "TSNullKeyword", start, end };
634
+ case 91: return { type: "TSUndefinedKeyword", start, end };
635
+ case 92: return { type: "TSStringKeyword", start, end };
636
+ case 93: return { type: "TSNumberKeyword", start, end };
637
+ case 94: return { type: "TSBigIntKeyword", start, end };
638
+ case 95: return { type: "TSBooleanKeyword", start, end };
639
+ case 96: return { type: "TSSymbolKeyword", start, end };
640
+ case 97: return { type: "TSObjectKeyword", start, end };
641
+ case 98: return { type: "TSIntrinsicKeyword", start, end };
642
+ case 99: return { type: "TSThisType", start, end };
643
+ case 100: return { type: "TSTypeReference", start, end, typeName: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
644
+ case 101: return { type: "TSQualifiedName", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null };
645
+ case 102: return { type: "TSTypeQuery", start, end, exprName: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
646
+ case 103: return { type: "TSImportType", start, end, source: f1 !== NULL ? node(f1) : null, options: f2 !== NULL ? node(f2) : null, qualifier: f3 !== NULL ? node(f3) : null, typeArguments: f4 !== NULL ? node(f4) : null };
647
+ case 104: return { type: "TSTypeParameter", start, end, name: f1 !== NULL ? node(f1) : null, constraint: f2 !== NULL ? node(f2) : null, default: f3 !== NULL ? node(f3) : null, in: !!(flags & 1), out: !!(flags & 2), const: !!(flags & 4) };
648
+ case 105: return { type: "TSTypeParameterDeclaration", start, end, params: nodeArr(f1, f0) };
649
+ case 106: return { type: "TSTypeParameterInstantiation", start, end, params: nodeArr(f1, f0) };
650
+ case 107: return { type: "TSLiteralType", start, end, literal: f1 !== NULL ? node(f1) : null };
651
+ case 108: return { type: "TSTemplateLiteralType", start, end, quasis: nodeArr(f1, f0), types: nodeArr(f2, f3) };
652
+ case 109: return { type: "TSArrayType", start, end, elementType: f1 !== NULL ? node(f1) : null };
653
+ case 110: return { type: "TSIndexedAccessType", start, end, objectType: f1 !== NULL ? node(f1) : null, indexType: f2 !== NULL ? node(f2) : null };
654
+ case 111: return { type: "TSTupleType", start, end, elementTypes: nodeArr(f1, f0) };
655
+ case 112: return { type: "TSNamedTupleMember", start, end, label: f1 !== NULL ? node(f1) : null, elementType: f2 !== NULL ? node(f2) : null, optional: !!(flags & 1) };
656
+ case 113: return { type: "TSOptionalType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
657
+ case 114: return { type: "TSRestType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
658
+ case 115: return { type: "TSJSDocNullableType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null, postfix: !!(flags & 1) };
659
+ case 116: return { type: "TSJSDocNonNullableType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null, postfix: !!(flags & 1) };
660
+ case 117: return { type: "TSJSDocUnknownType", start, end };
661
+ case 118: return { type: "TSUnionType", start, end, types: nodeArr(f1, f0) };
662
+ case 119: return { type: "TSIntersectionType", start, end, types: nodeArr(f1, f0) };
663
+ case 120: return { type: "TSConditionalType", start, end, checkType: f1 !== NULL ? node(f1) : null, extendsType: f2 !== NULL ? node(f2) : null, trueType: f3 !== NULL ? node(f3) : null, falseType: f4 !== NULL ? node(f4) : null };
664
+ case 121: return { type: "TSInferType", start, end, typeParameter: f1 !== NULL ? node(f1) : null };
665
+ case 122: return { type: "TSTypeOperator", start, end, operator: TS_TYPE_OPERATORS[flags & 3], typeAnnotation: f1 !== NULL ? node(f1) : null };
666
+ case 123: return { type: "TSParenthesizedType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
667
+ case 124: return {
1017
668
  type: "TSFunctionType", start, end,
1018
669
  typeParameters: f1 !== NULL ? node(f1) : null,
1019
670
  params: f2 !== NULL ? fnParams(f2) : [],
1020
671
  returnType: f3 !== NULL ? node(f3) : null,
1021
672
  };
1022
- case 124: return {
673
+ case 125: return {
1023
674
  type: "TSConstructorType", start, end,
1024
675
  abstract: !!(flags & 1),
1025
676
  typeParameters: f1 !== NULL ? node(f1) : null,
1026
677
  params: f2 !== NULL ? fnParams(f2) : [],
1027
678
  returnType: f3 !== NULL ? node(f3) : null,
1028
679
  };
1029
- case 125: return { type: "TSTypePredicate", start, end, parameterName: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null, asserts: !!(flags & 1) };
1030
- case 126: return { type: "TSTypeLiteral", start, end, members: nodeArr(f1, f0) };
1031
- case 127: return {
680
+ case 126: return { type: "TSTypePredicate", start, end, parameterName: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null, asserts: !!(flags & 1) };
681
+ case 127: return { type: "TSTypeLiteral", start, end, members: nodeArr(f1, f0) };
682
+ case 128: return {
1032
683
  type: "TSMappedType", start, end,
1033
684
  key: node(f1),
1034
685
  constraint: node(f2),
@@ -1037,8 +688,8 @@ function decode(buffer, source) {
1037
688
  optional: TS_MAPPED_OPTIONAL[(flags >> 0) & 3],
1038
689
  readonly: TS_MAPPED_READONLY[(flags >> 2) & 3],
1039
690
  };
1040
- case 128: { const r = { type: "TSPropertySignature", start, end, key: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null, computed: !!(flags & 1), optional: !!(flags & 2), readonly: !!(flags & 4) }; if (_isTs) { r.accessibility = null; r.static = false; } return r; }
1041
- case 129: return {
691
+ case 129: { const r = { type: "TSPropertySignature", start, end, key: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null, computed: !!(flags & 1), optional: !!(flags & 2), readonly: !!(flags & 4) }; if (_isTs) { r.accessibility = null; r.static = false; } return r; }
692
+ case 130: return {
1042
693
  type: "TSMethodSignature", start, end,
1043
694
  key: node(f1),
1044
695
  computed: !!(flags & 4),
@@ -1049,28 +700,28 @@ function decode(buffer, source) {
1049
700
  returnType: f4 !== NULL ? node(f4) : null,
1050
701
  accessibility: null, readonly: false, static: false,
1051
702
  };
1052
- case 130: return {
703
+ case 131: return {
1053
704
  type: "TSCallSignatureDeclaration", start, end,
1054
705
  typeParameters: f1 !== NULL ? node(f1) : null,
1055
706
  params: f2 !== NULL ? fnParams(f2) : [],
1056
707
  returnType: f3 !== NULL ? node(f3) : null,
1057
708
  };
1058
- case 131: return {
709
+ case 132: return {
1059
710
  type: "TSConstructSignatureDeclaration", start, end,
1060
711
  typeParameters: f1 !== NULL ? node(f1) : null,
1061
712
  params: f2 !== NULL ? fnParams(f2) : [],
1062
713
  returnType: f3 !== NULL ? node(f3) : null,
1063
714
  };
1064
- case 132: { const r = { type: "TSIndexSignature", start, end, parameters: nodeArr(f1, f0), typeAnnotation: f2 !== NULL ? node(f2) : null, readonly: !!(flags & 1) }; if (_isTs) { r.static = !!(flags & 2); r.accessibility = null; } return r; }
1065
- case 133: return { type: "TSTypeAliasDeclaration", start, end, id: f1 !== NULL ? node(f1) : null, typeParameters: f2 !== NULL ? node(f2) : null, typeAnnotation: f3 !== NULL ? node(f3) : null, declare: !!(flags & 1) };
1066
- case 134: return { type: "TSInterfaceDeclaration", start, end, id: f1 !== NULL ? node(f1) : null, typeParameters: f2 !== NULL ? node(f2) : null, extends: nodeArr(f3, f0), body: f4 !== NULL ? node(f4) : null, declare: !!(flags & 1) };
1067
- case 135: return { type: "TSInterfaceBody", start, end, body: nodeArr(f1, f0) };
1068
- case 136: return { type: "TSInterfaceHeritage", start, end, expression: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
1069
- case 137: return { type: "TSClassImplements", start, end, expression: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
1070
- case 138: return { type: "TSEnumDeclaration", start, end, id: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null, const: !!(flags & 1), declare: !!(flags & 2) };
1071
- case 139: return { type: "TSEnumBody", start, end, members: nodeArr(f1, f0) };
1072
- case 140: return { type: "TSEnumMember", start, end, id: f1 !== NULL ? node(f1) : null, initializer: f2 !== NULL ? node(f2) : null, computed: !!(flags & 1) };
1073
- case 141: {
715
+ case 133: { const r = { type: "TSIndexSignature", start, end, parameters: nodeArr(f1, f0), typeAnnotation: f2 !== NULL ? node(f2) : null, readonly: !!(flags & 1) }; if (_isTs) { r.static = !!(flags & 2); r.accessibility = null; } return r; }
716
+ case 134: return { type: "TSTypeAliasDeclaration", start, end, id: f1 !== NULL ? node(f1) : null, typeParameters: f2 !== NULL ? node(f2) : null, typeAnnotation: f3 !== NULL ? node(f3) : null, declare: !!(flags & 1) };
717
+ case 135: return { type: "TSInterfaceDeclaration", start, end, id: f1 !== NULL ? node(f1) : null, typeParameters: f2 !== NULL ? node(f2) : null, extends: nodeArr(f3, f0), body: f4 !== NULL ? node(f4) : null, declare: !!(flags & 1) };
718
+ case 136: return { type: "TSInterfaceBody", start, end, body: nodeArr(f1, f0) };
719
+ case 137: return { type: "TSInterfaceHeritage", start, end, expression: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
720
+ case 138: return { type: "TSClassImplements", start, end, expression: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
721
+ case 139: return { type: "TSEnumDeclaration", start, end, id: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null, const: !!(flags & 1), declare: !!(flags & 2) };
722
+ case 140: return { type: "TSEnumBody", start, end, members: nodeArr(f1, f0) };
723
+ case 141: return { type: "TSEnumMember", start, end, id: f1 !== NULL ? node(f1) : null, initializer: f2 !== NULL ? node(f2) : null, computed: !!(flags & 1) };
724
+ case 142: {
1074
725
  const r = {
1075
726
  type: "TSModuleDeclaration", start, end,
1076
727
  id: node(f1),
@@ -1081,48 +732,48 @@ function decode(buffer, source) {
1081
732
  if (f2 !== NULL) r.body = node(f2);
1082
733
  return r;
1083
734
  }
1084
- case 142: return { type: "TSModuleBlock", start, end, body: nodeArr(f1, f0) };
1085
- case 143: return {
735
+ case 143: return { type: "TSModuleBlock", start, end, body: nodeArr(f1, f0) };
736
+ case 144: return {
1086
737
  type: "TSModuleDeclaration", start, end,
1087
738
  id: node(f1), body: node(f2),
1088
739
  kind: "global",
1089
740
  declare: !!(flags & 1),
1090
741
  global: true,
1091
742
  };
1092
- case 144: { const r = { type: "TSParameterProperty", start, end, decorators: nodeArr(f1, f0), parameter: f2 !== NULL ? node(f2) : null, override: !!(flags & 1), readonly: !!(flags & 2), accessibility: ACCESSIBILITY[(flags >> 2) & 3] }; if (_isTs) { r.static = false; } return r; }
1093
- case 145: return {
743
+ case 145: { const r = { type: "TSParameterProperty", start, end, decorators: nodeArr(f1, f0), parameter: f2 !== NULL ? node(f2) : null, override: !!(flags & 1), readonly: !!(flags & 2), accessibility: ACCESSIBILITY[(flags >> 2) & 3] }; if (_isTs) { r.static = false; } return r; }
744
+ case 146: return {
1094
745
  type: "Identifier", start, end,
1095
746
  decorators: [],
1096
747
  name: "this", optional: false,
1097
748
  typeAnnotation: f1 !== NULL ? node(f1) : null,
1098
749
  };
1099
- case 146: return { type: "TSAsExpression", start, end, expression: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null };
1100
- case 147: return { type: "TSSatisfiesExpression", start, end, expression: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null };
1101
- case 148: return { type: "TSTypeAssertion", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null, expression: f2 !== NULL ? node(f2) : null };
1102
- case 149: return { type: "TSNonNullExpression", start, end, expression: f1 !== NULL ? node(f1) : null };
1103
- case 150: return { type: "TSInstantiationExpression", start, end, expression: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
1104
- case 151: return { type: "TSExportAssignment", start, end, expression: f1 !== NULL ? node(f1) : null };
1105
- case 152: return { type: "TSNamespaceExportDeclaration", start, end, id: f1 !== NULL ? node(f1) : null };
1106
- case 153: return { type: "TSImportEqualsDeclaration", start, end, id: f1 !== NULL ? node(f1) : null, moduleReference: f2 !== NULL ? node(f2) : null, importKind: IMPORT_EXPORT_KINDS[flags & 1] };
1107
- case 154: return { type: "TSExternalModuleReference", start, end, expression: f1 !== NULL ? node(f1) : null };
1108
- case 155: return { type: "JSXElement", start, end, openingElement: f1 !== NULL ? node(f1) : null, children: nodeArr(f2, f0), closingElement: f3 !== NULL ? node(f3) : null };
1109
- case 156: { const r = { type: "JSXOpeningElement", start, end, name: f1 !== NULL ? node(f1) : null, attributes: nodeArr(f2, f0), selfClosing: !!(flags & 1) }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
1110
- case 157: return { type: "JSXClosingElement", start, end, name: f1 !== NULL ? node(f1) : null };
1111
- case 158: return { type: "JSXFragment", start, end, openingFragment: f1 !== NULL ? node(f1) : null, children: nodeArr(f2, f0), closingFragment: f3 !== NULL ? node(f3) : null };
1112
- case 159: return { type: "JSXOpeningFragment", start, end };
1113
- case 160: return { type: "JSXClosingFragment", start, end };
1114
- case 161: return { type: "JSXIdentifier", start, end, name: str(f1, f2) };
1115
- case 162: return { type: "JSXNamespacedName", start, end, namespace: f1 !== NULL ? node(f1) : null, name: f2 !== NULL ? node(f2) : null };
1116
- case 163: return { type: "JSXMemberExpression", start, end, object: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null };
1117
- case 164: return { type: "JSXAttribute", start, end, name: f1 !== NULL ? node(f1) : null, value: f2 !== NULL ? node(f2) : null };
1118
- case 165: return { type: "JSXSpreadAttribute", start, end, argument: f1 !== NULL ? node(f1) : null };
1119
- case 166: return { type: "JSXExpressionContainer", start, end, expression: f1 !== NULL ? node(f1) : null };
1120
- case 167: return { type: "JSXEmptyExpression", start, end };
1121
- case 168: {
750
+ case 147: return { type: "TSAsExpression", start, end, expression: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null };
751
+ case 148: return { type: "TSSatisfiesExpression", start, end, expression: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null };
752
+ case 149: return { type: "TSTypeAssertion", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null, expression: f2 !== NULL ? node(f2) : null };
753
+ case 150: return { type: "TSNonNullExpression", start, end, expression: f1 !== NULL ? node(f1) : null };
754
+ case 151: return { type: "TSInstantiationExpression", start, end, expression: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
755
+ case 152: return { type: "TSExportAssignment", start, end, expression: f1 !== NULL ? node(f1) : null };
756
+ case 153: return { type: "TSNamespaceExportDeclaration", start, end, id: f1 !== NULL ? node(f1) : null };
757
+ case 154: return { type: "TSImportEqualsDeclaration", start, end, id: f1 !== NULL ? node(f1) : null, moduleReference: f2 !== NULL ? node(f2) : null, importKind: IMPORT_EXPORT_KINDS[flags & 1] };
758
+ case 155: return { type: "TSExternalModuleReference", start, end, expression: f1 !== NULL ? node(f1) : null };
759
+ case 156: return { type: "JSXElement", start, end, openingElement: f1 !== NULL ? node(f1) : null, children: nodeArr(f2, f0), closingElement: f3 !== NULL ? node(f3) : null };
760
+ case 157: { const r = { type: "JSXOpeningElement", start, end, name: f1 !== NULL ? node(f1) : null, attributes: nodeArr(f2, f0), selfClosing: !!(flags & 1) }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
761
+ case 158: return { type: "JSXClosingElement", start, end, name: f1 !== NULL ? node(f1) : null };
762
+ case 159: return { type: "JSXFragment", start, end, openingFragment: f1 !== NULL ? node(f1) : null, children: nodeArr(f2, f0), closingFragment: f3 !== NULL ? node(f3) : null };
763
+ case 160: return { type: "JSXOpeningFragment", start, end };
764
+ case 161: return { type: "JSXClosingFragment", start, end };
765
+ case 162: return { type: "JSXIdentifier", start, end, name: str(f1, f2) };
766
+ case 163: return { type: "JSXNamespacedName", start, end, namespace: f1 !== NULL ? node(f1) : null, name: f2 !== NULL ? node(f2) : null };
767
+ case 164: return { type: "JSXMemberExpression", start, end, object: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null };
768
+ case 165: return { type: "JSXAttribute", start, end, name: f1 !== NULL ? node(f1) : null, value: f2 !== NULL ? node(f2) : null };
769
+ case 166: return { type: "JSXSpreadAttribute", start, end, argument: f1 !== NULL ? node(f1) : null };
770
+ case 167: return { type: "JSXExpressionContainer", start, end, expression: f1 !== NULL ? node(f1) : null };
771
+ case 168: return { type: "JSXEmptyExpression", start, end };
772
+ case 169: {
1122
773
  const t = str(f1, f2);
1123
774
  return { type: "JSXText", start, end, value: t, raw: t };
1124
775
  }
1125
- case 169: return { type: "JSXSpreadChild", start, end, expression: f1 !== NULL ? node(f1) : null };
776
+ case 170: return { type: "JSXSpreadChild", start, end, expression: f1 !== NULL ? node(f1) : null };
1126
777
  }
1127
778
  }
1128
779
  const node = _attached ? nodeWithComments : _decode;
@@ -1195,104 +846,6 @@ function decode(buffer, source) {
1195
846
  }
1196
847
  return out;
1197
848
  }
1198
- function _scanType(tag, flags) {
1199
- switch (tag) {
1200
- case 3: return FUNCTION_TYPES[flags & 3];
1201
- case 26: return CLASS_TYPES[flags & 1];
1202
- case 28:
1203
- return _isTs && (flags & 64)
1204
- ? "TSAbstractMethodDefinition"
1205
- : "MethodDefinition";
1206
- default: {
1207
- const acc = (flags & 4) !== 0;
1208
- if (_isTs && (flags & 256)) {
1209
- return acc ? "TSAbstractAccessorProperty" : "TSAbstractPropertyDefinition";
1210
- }
1211
- return acc ? "AccessorProperty" : "PropertyDefinition";
1212
- }
1213
- }
1214
- }
1215
- function scan(visitors) {
1216
- const handlers = new Map();
1217
- let every = null;
1218
- for (const k of Object.keys(visitors)) {
1219
- const v = visitors[k];
1220
- if (typeof v !== "function") continue;
1221
- if (k === "enter") every = v;
1222
- else handlers.set(k, v);
1223
- }
1224
- const wanted = new Array(TAG_TYPES.length).fill(null);
1225
- for (let t = 0; t < TAG_TYPES.length; t++) {
1226
- const tt = TAG_TYPES[t];
1227
- if (tt === null) continue;
1228
- if (tt === 0) {
1229
- for (const c of TAG_CHOICES.get(t)) {
1230
- if (handlers.has(c)) { wanted[t] = 0; break; }
1231
- }
1232
- } else {
1233
- const h = handlers.get(tt);
1234
- if (h !== undefined) wanted[t] = h;
1235
- }
1236
- }
1237
- let stopFlag = false, skipFlag = false;
1238
- let curIndex = 0, curO = 0, curTag = 0;
1239
- const cursor = {
1240
- get index() { return curIndex; },
1241
- get type() {
1242
- const t = TAG_TYPES[curTag];
1243
- return t !== 0 ? t : _scanType(curTag, _u8[curO + 2] | (_u8[curO + 3] << 8));
1244
- },
1245
- get start() { return startOf(curIndex); },
1246
- get end() { return endOf(curIndex); },
1247
- node() { return node(curIndex); },
1248
- skip() { skipFlag = true; },
1249
- stop() { stopFlag = true; },
1250
- };
1251
- (function visit(i) {
1252
- const o = _nodesOff + i * 48;
1253
- const tag = _u8[o];
1254
- let h = wanted[tag];
1255
- if (h !== null || every !== null) {
1256
- curIndex = i; curO = o; curTag = tag;
1257
- if (h === 0) {
1258
- h = handlers.get(_scanType(tag, _u8[o + 2] | (_u8[o + 3] << 8))) ?? null;
1259
- }
1260
- if (every !== null && TAG_TYPES[tag] !== null) {
1261
- every(cursor);
1262
- if (stopFlag) return;
1263
- }
1264
- if (h !== null) {
1265
- h(cursor);
1266
- if (stopFlag) return;
1267
- }
1268
- if (skipFlag) { skipFlag = false; return; }
1269
- }
1270
- const ops = SCAN_CHILDREN[tag];
1271
- const b = o >> 2;
1272
- for (let p = 0; p < ops.length; p += 2) {
1273
- const slot = ops[p + 1];
1274
- if (ops[p] === 0) {
1275
- const c = _u32[b + slot];
1276
- if (c !== NULL) {
1277
- visit(c);
1278
- if (stopFlag) return;
1279
- }
1280
- } else {
1281
- const s = _u32[b + slot];
1282
- const len = ops[p] === 1
1283
- ? _u32[b + slot + 1]
1284
- : _u8[o + 4] | (_u8[o + 5] << 8);
1285
- for (let j = 0; j < len; j++) {
1286
- const c = _u32[_extraBase + s + j];
1287
- if (c !== NULL) {
1288
- visit(c);
1289
- if (stopFlag) return;
1290
- }
1291
- }
1292
- }
1293
- }
1294
- })(progIdx);
1295
- }
1296
849
  let _program, _lineStarts, _diagnostics, _comments;
1297
850
  function _getLineStarts() {
1298
851
  if (_lineStarts === undefined) _lineStarts = _decodeLineStarts();
@@ -1322,7 +875,6 @@ function decode(buffer, source) {
1322
875
  }
1323
876
  return { line: lo, column: offset - ls[lo - 1] };
1324
877
  },
1325
- scan,
1326
878
  };
1327
879
  }
1328
880
  export { decode, CHILD_KEYS };
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // yuku-parser's public type surface. The AST, diagnostic, and traversal type
2
2
  // model lives in @yuku-toolchain/types and is re-exported here for backward
3
- // compatibility; this file adds only the parser's own parse/walk/scan API.
3
+ // compatibility; this file adds only the parser's own parse/walk API.
4
4
 
5
5
  import type {
6
6
  Comment,
@@ -9,7 +9,6 @@ import type {
9
9
  NodeOfType,
10
10
  NodeType,
11
11
  Program,
12
- ScanCursor,
13
12
  SourceLang,
14
13
  SourceLocation,
15
14
  SourceType,
@@ -82,14 +81,6 @@ interface ParseResult {
82
81
  * 1-based, columns are 0-based, matching ESTree's `loc` convention.
83
82
  */
84
83
  locOf(offset: number): SourceLocation;
85
- /**
86
- * Readonly buffer scan: visits the parsed node records directly,
87
- * dispatching only to registered types, without materializing AST
88
- * objects. Many times faster than {@link walk} for sparse queries;
89
- * call {@link ScanCursor.node} to materialize the matched node on
90
- * demand. The synthesized `Hashbang` node is not visited.
91
- */
92
- scan(visitors: ScanVisitors): void;
93
84
  }
94
85
 
95
86
  /**
@@ -127,19 +118,6 @@ type Visitors<S = unknown> = {
127
118
  */
128
119
  export function walk<T extends Node, S = unknown>(root: T, visitors: Visitors<S>, state?: S): T;
129
120
 
130
- // Scanning
131
-
132
- /**
133
- * Scan handlers keyed by node `type`, plus the universal `enter` which
134
- * runs for every node. Scanning is readonly: to mutate, find with
135
- * {@link ParseResult.scan} and change with {@link walk}.
136
- */
137
- type ScanVisitors = {
138
- [K in NodeType]?: (cursor: ScanCursor<NodeOfType<K>>) => void;
139
- } & {
140
- enter?: (cursor: ScanCursor) => void;
141
- };
142
-
143
121
  /**
144
122
  * Resolves a {@link SourceLang} from a file path's extension.
145
123
  *
@@ -159,4 +137,4 @@ export function langFromPath(path: string): SourceLang;
159
137
  */
160
138
  export function sourceTypeFromPath(path: string): SourceType;
161
139
 
162
- export type { ParseOptions, ParseResult, Visitors, WalkHandler, WalkHooks, ScanVisitors };
140
+ export type { ParseOptions, ParseResult, Visitors, WalkHandler, WalkHooks };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuku-parser/wasm",
3
- "version": "0.5.36",
3
+ "version": "0.5.37",
4
4
  "description": "High-performance JavaScript/TypeScript parser, compiled to WebAssembly",
5
5
  "license": "MIT",
6
6
  "repository": {
package/yuku-parser.wasm CHANGED
Binary file