@danielx/civet 0.6.18 → 0.6.19

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/dist/main.js CHANGED
@@ -156,15 +156,8 @@ var require_lib = __commonJS({
156
156
  }
157
157
  }
158
158
  function arrayElementHasTrailingComma(elementNode) {
159
- const { children } = elementNode, { length } = children;
160
- const lastChild = children[length - 1];
161
- if (lastChild) {
162
- const l2 = lastChild.length;
163
- if (lastChild[l2 - 1]?.token === ",") {
164
- return true;
165
- }
166
- }
167
- return false;
159
+ const lastChild = elementNode.children.at(-1);
160
+ return lastChild && lastChild[lastChild.length - 1]?.token === ",";
168
161
  }
169
162
  var assert = {
170
163
  equal(a, b, msg) {
@@ -591,7 +584,15 @@ var require_lib = __commonJS({
591
584
  case "EmptyStatement":
592
585
  case "ReturnStatement":
593
586
  case "ThrowStatement":
587
+ return;
594
588
  case "Declaration":
589
+ exp.children.push(["", [
590
+ ";",
591
+ ref,
592
+ ".push(",
593
+ patternAsValue(exp.bindings.at(-1).pattern),
594
+ ")"
595
+ ]]);
595
596
  return;
596
597
  case "ForStatement":
597
598
  case "IterationStatement":
@@ -844,6 +845,39 @@ var require_lib = __commonJS({
844
845
  const indent = expressions[index][0];
845
846
  expressions.splice(index, 0, [indent, dec, ";"]);
846
847
  }
848
+ function patternAsValue(pattern) {
849
+ switch (pattern.type) {
850
+ case "ArrayBindingPattern": {
851
+ const children = [...pattern.children];
852
+ const index = children.indexOf(pattern.elements);
853
+ if (index < 0)
854
+ throw new Error("failed to find elements in ArrayBindingPattern");
855
+ children[index] = pattern.elements.map((el) => {
856
+ const [ws, e, delim] = el.children;
857
+ return { ...el, children: [ws, patternAsValue(e), delim] };
858
+ });
859
+ return { ...pattern, children };
860
+ }
861
+ case "ObjectBindingPattern": {
862
+ const children = [...pattern.children];
863
+ const index = children.indexOf(pattern.properties);
864
+ if (index < 0)
865
+ throw new Error("failed to find properties in ArrayBindingPattern");
866
+ children[index] = pattern.properties.map(patternAsValue);
867
+ return { ...pattern, children };
868
+ }
869
+ case "Identifier":
870
+ case "BindingProperty": {
871
+ const children = [pattern.name, pattern.delim];
872
+ if (isWhitespaceOrEmpty(pattern.children[0])) {
873
+ children.unshift(pattern.children[0]);
874
+ }
875
+ return { ...pattern, children };
876
+ }
877
+ default:
878
+ return pattern;
879
+ }
880
+ }
847
881
  function insertReturn(node) {
848
882
  if (!node)
849
883
  return;
@@ -885,7 +919,12 @@ var require_lib = __commonJS({
885
919
  case "EmptyStatement":
886
920
  case "ReturnStatement":
887
921
  case "ThrowStatement":
922
+ return;
888
923
  case "Declaration":
924
+ exp.children.push(["", {
925
+ type: "ReturnStatement",
926
+ children: [";return ", patternAsValue(exp.bindings.at(-1).pattern)]
927
+ }]);
889
928
  return;
890
929
  case "ForStatement":
891
930
  case "IterationStatement":
@@ -1300,72 +1339,59 @@ var require_lib = __commonJS({
1300
1339
  children: [s, parts, e]
1301
1340
  };
1302
1341
  }
1303
- function processConstAssignmentDeclaration(c, id, suffix, ws, ca, e) {
1304
- c = {
1305
- ...c,
1342
+ function processAssignmentDeclaration(decl, id, suffix, ws, assign, e) {
1343
+ decl = {
1344
+ ...decl,
1306
1345
  $loc: {
1307
- pos: ca.$loc.pos - 1,
1308
- length: ca.$loc.length + 1
1346
+ pos: assign.$loc.pos - 1,
1347
+ length: assign.$loc.length + 1
1309
1348
  }
1310
1349
  };
1311
- let exp;
1312
- if (e.type === "FunctionExpression") {
1313
- exp = e;
1314
- } else {
1315
- exp = e[1];
1316
- }
1317
- if (exp?.children?.[0]?.token?.match(/^\s+$/))
1318
- exp.children.shift();
1319
- if (id.type === "Identifier" && exp?.type === "FunctionExpression" && !exp.id) {
1320
- const i = exp.children.findIndex((c2) => c2?.token === "function") + 1;
1321
- exp = {
1322
- ...exp,
1323
- children: [...exp.children.slice(0, i), " ", id, suffix, ws, ...exp.children.slice(i)]
1324
- };
1325
- return {
1326
- type: "Declaration",
1327
- children: [exp],
1328
- names: id.names
1329
- };
1350
+ if (decl.token.startsWith("const")) {
1351
+ let exp;
1352
+ if (e.type === "FunctionExpression") {
1353
+ exp = e;
1354
+ } else {
1355
+ exp = e[1];
1356
+ }
1357
+ if (exp?.children?.[0]?.token?.match(/^\s+$/))
1358
+ exp.children.shift();
1359
+ if (id.type === "Identifier" && exp?.type === "FunctionExpression" && !exp.id) {
1360
+ const i = exp.children.findIndex((c) => c?.token === "function") + 1;
1361
+ exp = {
1362
+ ...exp,
1363
+ children: [...exp.children.slice(0, i), " ", id, suffix, ws, ...exp.children.slice(i)]
1364
+ };
1365
+ return {
1366
+ type: "Declaration",
1367
+ decl,
1368
+ children: [exp],
1369
+ names: id.names
1370
+ };
1371
+ }
1330
1372
  }
1331
1373
  let [splices, thisAssignments] = gatherBindingCode(id);
1332
1374
  splices = splices.map((s) => [", ", s]);
1333
1375
  thisAssignments = thisAssignments.map((a) => ["", a, ";"]);
1334
- const binding = [c, id, suffix, ...ws];
1335
- const initializer = [ca, e];
1336
- const children = [binding, initializer];
1337
- return {
1338
- type: "Declaration",
1339
- names: id.names,
1340
- children,
1341
- binding,
1376
+ const initializer = [ws, assign, e];
1377
+ const binding = {
1378
+ type: "Binding",
1379
+ pattern: id,
1342
1380
  initializer,
1343
1381
  splices,
1344
- thisAssignments
1345
- };
1346
- }
1347
- function processLetAssignmentDeclaration(l, id, suffix, ws, la, e) {
1348
- l = {
1349
- ...l,
1350
- $loc: {
1351
- pos: la.$loc.pos - 1,
1352
- length: la.$loc.length + 1
1353
- }
1382
+ suffix,
1383
+ thisAssignments,
1384
+ children: [id, suffix, initializer]
1354
1385
  };
1355
- let [splices, thisAssignments] = gatherBindingCode(id);
1356
- splices = splices.map((s) => [", ", s]);
1357
- thisAssignments = thisAssignments.map((a) => ["", a, ";"]);
1358
- const binding = [l, id, suffix, ...ws];
1359
- const initializer = [la, e];
1360
- const children = [binding, initializer];
1386
+ const children = [decl, binding];
1361
1387
  return {
1362
1388
  type: "Declaration",
1363
1389
  names: id.names,
1364
- children,
1365
- binding,
1366
- initializer,
1390
+ decl,
1391
+ bindings: [binding],
1367
1392
  splices,
1368
- thisAssignments
1393
+ thisAssignments,
1394
+ children
1369
1395
  };
1370
1396
  }
1371
1397
  function implicitFunctionBlock(f) {
@@ -1576,9 +1602,9 @@ var require_lib = __commonJS({
1576
1602
  const subRef = [ref, "[", i.toString(), "]"];
1577
1603
  getPatternConditions(e, subRef, conditions);
1578
1604
  });
1579
- const postRest = pattern.children.find((c) => c?.blockPrefix);
1580
- if (postRest) {
1581
- const postElements = postRest.blockPrefix.children[1], { length: postLength } = postElements;
1605
+ const { blockPrefix } = pattern;
1606
+ if (blockPrefix) {
1607
+ const postElements = blockPrefix.children[1], { length: postLength } = postElements;
1582
1608
  postElements.forEach(({ children: [, e] }, i) => {
1583
1609
  const subRef = [ref, "[", ref, ".length - ", (postLength + i).toString(), "]"];
1584
1610
  getPatternConditions(e, subRef, conditions);
@@ -1665,15 +1691,15 @@ var require_lib = __commonJS({
1665
1691
  if (el.type === "BindingRestElement") {
1666
1692
  return ["", el, void 0];
1667
1693
  }
1668
- const { children: [ws, e, sep] } = el;
1694
+ const { children: [ws, e, delim] } = el;
1669
1695
  switch (e.type) {
1670
1696
  case "Literal":
1671
1697
  case "RegularExpressionLiteral":
1672
1698
  case "StringLiteral":
1673
1699
  case "PinPattern":
1674
- return sep;
1700
+ return delim;
1675
1701
  default:
1676
- return [ws, nonMatcherBindings(e), sep];
1702
+ return [ws, nonMatcherBindings(e), delim];
1677
1703
  }
1678
1704
  });
1679
1705
  }
@@ -1683,13 +1709,12 @@ var require_lib = __commonJS({
1683
1709
  case "BindingProperty": {
1684
1710
  const { children, name, value } = p;
1685
1711
  const [ws] = children;
1686
- const sep = children[children.length - 1];
1687
1712
  switch (value && value.type) {
1688
1713
  case "ArrayBindingPattern":
1689
1714
  case "ObjectBindingPattern":
1690
1715
  return {
1691
1716
  ...p,
1692
- children: [ws, name, ": ", nonMatcherBindings(value)]
1717
+ children: [ws, name, ": ", nonMatcherBindings(value), p.delim]
1693
1718
  };
1694
1719
  case "Identifier":
1695
1720
  return p;
@@ -1699,7 +1724,7 @@ var require_lib = __commonJS({
1699
1724
  default:
1700
1725
  return {
1701
1726
  ...p,
1702
- children: [ws, name, sep]
1727
+ children: [ws, name, p.delim]
1703
1728
  };
1704
1729
  }
1705
1730
  }
@@ -2369,9 +2394,20 @@ var require_lib = __commonJS({
2369
2394
  let rest = props[restIndex];
2370
2395
  props = props.slice(0, restIndex);
2371
2396
  if (after.length) {
2372
- const [restDelim] = rest.children.slice(-1), lastAfterProp = after[after.length - 1], lastAfterChildren = lastAfterProp.children, [lastDelim] = lastAfterChildren.slice(-1);
2373
- rest = { ...rest, children: [...rest.children.slice(0, -1), lastDelim] };
2374
- after = [...after.slice(0, -1), { ...lastAfterProp, children: [...lastAfterChildren.slice(0, -1), restDelim] }];
2397
+ const { delim: restDelim } = rest, lastAfterProp = after[after.length - 1], { delim: lastDelim, children: lastAfterChildren } = lastAfterProp;
2398
+ rest = {
2399
+ ...rest,
2400
+ delim: lastDelim,
2401
+ children: [...rest.children.slice(0, -1), lastDelim]
2402
+ };
2403
+ after = [
2404
+ ...after.slice(0, -1),
2405
+ {
2406
+ ...lastAfterProp,
2407
+ delim: restDelim,
2408
+ children: [...lastAfterChildren.slice(0, -1), restDelim]
2409
+ }
2410
+ ];
2375
2411
  }
2376
2412
  const children = [...props, ...after, rest];
2377
2413
  return {
@@ -2551,8 +2587,7 @@ var require_lib = __commonJS({
2551
2587
  processBinaryOpExpression,
2552
2588
  processCallMemberExpression,
2553
2589
  processCoffeeInterpolation,
2554
- processConstAssignmentDeclaration,
2555
- processLetAssignmentDeclaration,
2590
+ processAssignmentDeclaration,
2556
2591
  processParams,
2557
2592
  processProgram,
2558
2593
  processReturnValue,
@@ -3093,7 +3128,6 @@ ${input.slice(result.pos)}
3093
3128
  BindingProperty,
3094
3129
  BindingRestProperty,
3095
3130
  NestedBindingElements,
3096
- NestedBindingElement,
3097
3131
  BindingElement,
3098
3132
  BindingRestElement,
3099
3133
  EmptyBindingPattern,
@@ -3315,7 +3349,6 @@ ${input.slice(result.pos)}
3315
3349
  Initializer,
3316
3350
  VariableStatement,
3317
3351
  VariableDeclarationList,
3318
- VariableDeclaration,
3319
3352
  NumericLiteral,
3320
3353
  NumericLiteralKind,
3321
3354
  DecimalBigIntegerLiteral,
@@ -7341,7 +7374,7 @@ ${input.slice(result.pos)}
7341
7374
  var c = $3;
7342
7375
  return {
7343
7376
  type: "ObjectBindingPattern",
7344
- children: $0,
7377
+ children: [$1, $2, c.children, $4, $5],
7345
7378
  names: c.names,
7346
7379
  properties: c.children
7347
7380
  };
@@ -7402,6 +7435,7 @@ ${input.slice(result.pos)}
7402
7435
  return props.map(([prop, delim]) => {
7403
7436
  return {
7404
7437
  ...prop,
7438
+ delim,
7405
7439
  children: [...prop.children, delim]
7406
7440
  };
7407
7441
  });
@@ -7431,11 +7465,10 @@ ${input.slice(result.pos)}
7431
7465
  var ArrayBindingPattern$0 = $TS($S($E(_), OpenBracket, ArrayBindingPatternContent, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
7432
7466
  var c = $3;
7433
7467
  return {
7468
+ ...c,
7434
7469
  type: "ArrayBindingPattern",
7435
- children: $0,
7436
- names: c.names,
7437
7470
  elements: c.children,
7438
- length: c.length
7471
+ children: [$1, $2, c.children, $4, $5]
7439
7472
  };
7440
7473
  });
7441
7474
  function ArrayBindingPattern(state) {
@@ -7521,14 +7554,14 @@ ${input.slice(result.pos)}
7521
7554
  }
7522
7555
  }
7523
7556
  var NestedBindingElementList$0 = $TS($S(Nested, BindingElementList), function($skip, $loc, $0, $1, $2) {
7524
- var ws = $1;
7557
+ var indent = $1;
7525
7558
  var elements = $2;
7526
7559
  return elements.map((element, i) => {
7527
7560
  if (i > 0)
7528
7561
  return element;
7529
7562
  return {
7530
7563
  ...element,
7531
- children: [ws, ...element.children]
7564
+ children: [indent, ...element.children.slice(1)]
7532
7565
  };
7533
7566
  });
7534
7567
  });
@@ -7643,13 +7676,13 @@ ${input.slice(result.pos)}
7643
7676
  var BindingProperty$1 = $TS($S($E(_), PropertyName, $E(_), Colon, $E(_), $C(BindingIdentifier, BindingPattern), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
7644
7677
  var name = $2;
7645
7678
  var value = $6;
7646
- var init = $7;
7679
+ var initializer = $7;
7647
7680
  return {
7648
7681
  type: "BindingProperty",
7649
7682
  children: $0,
7650
7683
  name,
7651
7684
  value,
7652
- init,
7685
+ initializer,
7653
7686
  names: value.names
7654
7687
  };
7655
7688
  });
@@ -7657,14 +7690,14 @@ ${input.slice(result.pos)}
7657
7690
  var ws = $1;
7658
7691
  var pin = $2;
7659
7692
  var binding = $3;
7660
- var init = $4;
7693
+ var initializer = $4;
7661
7694
  if (binding.type === "AtBinding") {
7662
7695
  return {
7663
7696
  type: "AtBindingProperty",
7664
7697
  children: $0,
7665
7698
  binding,
7666
7699
  ref: binding.ref,
7667
- init,
7700
+ initializer,
7668
7701
  names: []
7669
7702
  };
7670
7703
  }
@@ -7684,7 +7717,7 @@ ${input.slice(result.pos)}
7684
7717
  children: $0,
7685
7718
  name: binding,
7686
7719
  value: void 0,
7687
- init,
7720
+ initializer,
7688
7721
  names: binding.names,
7689
7722
  identifier: binding
7690
7723
  };
@@ -7781,36 +7814,6 @@ ${input.slice(result.pos)}
7781
7814
  return result;
7782
7815
  }
7783
7816
  }
7784
- var NestedBindingElement$0 = $TS($S(Nested, BindingElement), function($skip, $loc, $0, $1, $2) {
7785
- var indent = $1;
7786
- var element = $2;
7787
- return {
7788
- ...element,
7789
- children: [indent, ...element.children]
7790
- };
7791
- });
7792
- function NestedBindingElement(state) {
7793
- let eventData;
7794
- if (state.events) {
7795
- const result = state.events.enter?.("NestedBindingElement", state);
7796
- if (result) {
7797
- if (result.cache)
7798
- return result.cache;
7799
- eventData = result.data;
7800
- }
7801
- }
7802
- if (state.tokenize) {
7803
- const result = $TOKEN("NestedBindingElement", state, NestedBindingElement$0(state));
7804
- if (state.events)
7805
- state.events.exit?.("NestedBindingElement", state, result, eventData);
7806
- return result;
7807
- } else {
7808
- const result = NestedBindingElement$0(state);
7809
- if (state.events)
7810
- state.events.exit?.("NestedBindingElement", state, result, eventData);
7811
- return result;
7812
- }
7813
- }
7814
7817
  var BindingElement$0 = BindingRestElement;
7815
7818
  var BindingElement$1 = $TS($S($E(_), $C(BindingIdentifier, BindingPattern), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
7816
7819
  var ws = $1;
@@ -7819,6 +7822,7 @@ ${input.slice(result.pos)}
7819
7822
  if (binding.children) {
7820
7823
  binding = {
7821
7824
  ...binding,
7825
+ initializer,
7822
7826
  children: [...binding.children, initializer]
7823
7827
  };
7824
7828
  }
@@ -7864,7 +7868,7 @@ ${input.slice(result.pos)}
7864
7868
  var binding = $3;
7865
7869
  return {
7866
7870
  type: "BindingRestElement",
7867
- children: [...ws || [], dots, binding],
7871
+ children: [ws, [dots, binding]],
7868
7872
  binding,
7869
7873
  name: binding.name,
7870
7874
  names: binding.names,
@@ -13475,17 +13479,19 @@ ${input.slice(result.pos)}
13475
13479
  type: "Ref",
13476
13480
  base: "ref"
13477
13481
  };
13478
- const { binding, initializer, splices, thisAssignments } = dec;
13482
+ const { decl, bindings } = dec;
13483
+ const binding = bindings[0];
13484
+ const { pattern, suffix, initializer, splices, thisAssignments } = binding;
13479
13485
  const initCondition = {
13480
13486
  type: "AssignmentExpression",
13481
- children: [ref, " ", initializer],
13487
+ children: [ref, initializer],
13482
13488
  hoistDec: {
13483
13489
  type: "Declaration",
13484
- children: ["let ", ref],
13490
+ children: ["let ", ref, suffix],
13485
13491
  names: []
13486
13492
  },
13487
13493
  blockPrefix: [
13488
- ["", [binding, "= ", ref, ...splices], ";"],
13494
+ ["", [decl, pattern, suffix, " = ", ref, ...splices], ";"],
13489
13495
  ...thisAssignments
13490
13496
  ]
13491
13497
  };
@@ -15184,26 +15190,23 @@ ${input.slice(result.pos)}
15184
15190
  return result;
15185
15191
  }
15186
15192
  }
15187
- var LexicalDeclaration$0 = $TS($S(LetOrConst, LexicalBinding, $Q($S(__, Comma, LexicalBinding))), function($skip, $loc, $0, $1, $2, $3) {
15188
- var d = $1;
15193
+ var LexicalDeclaration$0 = $TS($S(LetOrConst, LexicalBinding, $Q($S(__, Comma, __, LexicalBinding))), function($skip, $loc, $0, $1, $2, $3) {
15194
+ var decl = $1;
15189
15195
  var binding = $2;
15190
15196
  var tail = $3;
15191
- const { splices, thisAssignments } = binding;
15197
+ const bindings = [binding].concat(tail.map(([, , , b]) => b));
15192
15198
  return {
15193
15199
  type: "Declaration",
15194
15200
  children: $0,
15195
- names: [...binding.names].concat(tail.flatMap(([, , b]) => b.names)),
15196
- binding: {
15197
- ...binding.binding,
15198
- children: [d, ...binding.binding.children]
15199
- },
15200
- initializer: binding.initializer,
15201
- splices,
15202
- thisAssignments
15201
+ names: bindings.flatMap((b) => b.names),
15202
+ bindings,
15203
+ decl,
15204
+ splices: bindings.flatMap((b) => b.splices),
15205
+ thisAssignments: bindings.flatMap((b) => b.thisAssignments)
15203
15206
  };
15204
15207
  });
15205
15208
  var LexicalDeclaration$1 = $TS($S(InsertConst, $C(BindingPattern, BindingIdentifier), $E(TypeSuffix), __, ConstAssignment, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
15206
- return processConstAssignmentDeclaration(...$0);
15209
+ return processAssignmentDeclaration(...$0);
15207
15210
  });
15208
15211
  var LexicalDeclaration$2 = $TS($S(InsertLet, $C(BindingPattern, BindingIdentifier), $E(TypeSuffix), __, LetAssignment, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
15209
15212
  var l = $1;
@@ -15212,7 +15215,7 @@ ${input.slice(result.pos)}
15212
15215
  var ws = $4;
15213
15216
  var la = $5;
15214
15217
  var e = $6;
15215
- return processLetAssignmentDeclaration(...$0);
15218
+ return processAssignmentDeclaration(...$0);
15216
15219
  });
15217
15220
  function LexicalDeclaration(state) {
15218
15221
  let eventData;
@@ -15286,48 +15289,32 @@ ${input.slice(result.pos)}
15286
15289
  return result;
15287
15290
  }
15288
15291
  }
15289
- var LexicalBinding$0 = $TS($S(BindingPattern, $E(TypeSuffix), $E(_), Initializer), function($skip, $loc, $0, $1, $2, $3, $4) {
15290
- var binding = $1;
15292
+ var LexicalBinding$0 = $TS($S(BindingPattern, $E(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
15293
+ var pattern = $1;
15291
15294
  var suffix = $2;
15292
- var ws = $3;
15293
- var initializer = $4;
15294
- const bindingChildren = [...binding.children];
15295
- if (suffix)
15296
- bindingChildren.push(suffix);
15297
- if (ws)
15298
- bindingChildren.push(...ws);
15299
- binding = {
15300
- ...binding,
15301
- children: bindingChildren
15302
- };
15303
- const [splices, thisAssignments] = gatherBindingCode(binding.children);
15295
+ var initializer = $3;
15296
+ const [splices, thisAssignments] = gatherBindingCode(pattern);
15304
15297
  return {
15305
- children: [binding, initializer],
15306
- names: binding.names,
15307
- binding,
15298
+ type: "Binding",
15299
+ children: $0,
15300
+ names: pattern.names,
15301
+ pattern,
15302
+ suffix,
15308
15303
  initializer,
15309
15304
  splices: splices.map((s) => [",", s]),
15310
15305
  thisAssignments: thisAssignments.map((s) => ["", s, ";"])
15311
15306
  };
15312
15307
  });
15313
- var LexicalBinding$1 = $TS($S(BindingIdentifier, $E(TypeSuffix), $E(_), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4) {
15314
- var binding = $1;
15308
+ var LexicalBinding$1 = $TS($S(BindingIdentifier, $E(TypeSuffix), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
15309
+ var pattern = $1;
15315
15310
  var suffix = $2;
15316
- var ws = $3;
15317
- var initializer = $4;
15318
- const bindingChildren = [...binding.children];
15319
- if (suffix)
15320
- bindingChildren.push(suffix);
15321
- if (ws)
15322
- bindingChildren.push(...ws);
15323
- binding = {
15324
- ...binding,
15325
- children: bindingChildren
15326
- };
15311
+ var initializer = $3;
15327
15312
  return {
15328
- children: [binding, initializer],
15329
- names: binding.names,
15330
- binding,
15313
+ type: "Binding",
15314
+ children: $0,
15315
+ names: pattern.names,
15316
+ pattern,
15317
+ suffix,
15331
15318
  initializer,
15332
15319
  splices: [],
15333
15320
  thisAssignments: []
@@ -15379,9 +15366,10 @@ ${input.slice(result.pos)}
15379
15366
  }
15380
15367
  }
15381
15368
  var VariableStatement$0 = $TS($S(Var, __, VariableDeclarationList), function($skip, $loc, $0, $1, $2, $3) {
15382
- return Object.assign({}, $3, {
15369
+ return {
15370
+ ...$3,
15383
15371
  children: [$1, ...$2, ...$3.children]
15384
- });
15372
+ };
15385
15373
  });
15386
15374
  function VariableStatement(state) {
15387
15375
  let eventData;
@@ -15405,18 +15393,15 @@ ${input.slice(result.pos)}
15405
15393
  return result;
15406
15394
  }
15407
15395
  }
15408
- var VariableDeclarationList$0 = $TS($S(VariableDeclaration, $Q($S(__, Comma, __, VariableDeclaration))), function($skip, $loc, $0, $1, $2) {
15409
- let children;
15410
- if ($2.length) {
15411
- children = [$1, ...$2];
15412
- } else {
15413
- children = [$1];
15414
- }
15415
- const names = children.flatMap((c) => c.names || []);
15396
+ var VariableDeclarationList$0 = $TS($S(LexicalBinding, $Q($S(__, Comma, __, LexicalBinding))), function($skip, $loc, $0, $1, $2) {
15397
+ var binding = $1;
15398
+ var tail = $2;
15399
+ const bindings = [binding].concat(tail.map(([, , , b]) => b));
15416
15400
  return {
15417
15401
  type: "Declaration",
15418
- children,
15419
- names
15402
+ children: [binding, ...tail],
15403
+ bindings,
15404
+ names: bindings.flatMap((b) => b.names)
15420
15405
  };
15421
15406
  });
15422
15407
  function VariableDeclarationList(state) {
@@ -15441,49 +15426,6 @@ ${input.slice(result.pos)}
15441
15426
  return result;
15442
15427
  }
15443
15428
  }
15444
- var VariableDeclaration$0 = $TS($S(BindingPattern, $E(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
15445
- const children = [...$1.children];
15446
- if ($2)
15447
- children.push($2);
15448
- children.push($3);
15449
- return {
15450
- children,
15451
- names: $1.names
15452
- };
15453
- });
15454
- var VariableDeclaration$1 = $TS($S(BindingIdentifier, $E(TypeSuffix), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
15455
- const children = [...$1.children];
15456
- if ($2)
15457
- children.push($2);
15458
- if ($3)
15459
- children.push($3);
15460
- return {
15461
- children,
15462
- names: $1.names
15463
- };
15464
- });
15465
- function VariableDeclaration(state) {
15466
- let eventData;
15467
- if (state.events) {
15468
- const result = state.events.enter?.("VariableDeclaration", state);
15469
- if (result) {
15470
- if (result.cache)
15471
- return result.cache;
15472
- eventData = result.data;
15473
- }
15474
- }
15475
- if (state.tokenize) {
15476
- const result = $TOKEN("VariableDeclaration", state, VariableDeclaration$0(state) || VariableDeclaration$1(state));
15477
- if (state.events)
15478
- state.events.exit?.("VariableDeclaration", state, result, eventData);
15479
- return result;
15480
- } else {
15481
- const result = VariableDeclaration$0(state) || VariableDeclaration$1(state);
15482
- if (state.events)
15483
- state.events.exit?.("VariableDeclaration", state, result, eventData);
15484
- return result;
15485
- }
15486
- }
15487
15429
  var NumericLiteral$0 = $TS($S(NumericLiteralKind), function($skip, $loc, $0, $1) {
15488
15430
  return { type: "NumericLiteral", $loc, token: $1 };
15489
15431
  });
@@ -21244,9 +21186,9 @@ ${input.slice(result.pos)}
21244
21186
  ["let ", id, " = {};\n"],
21245
21187
  ...block.properties.map((property, i) => {
21246
21188
  let init, isString;
21247
- if (property.init) {
21189
+ if (property.initializer) {
21248
21190
  init = replaceNodes(
21249
- deepCopy(property.init),
21191
+ deepCopy(property.initializer),
21250
21192
  (n) => n.type === "Identifier" && names.has(n.name),
21251
21193
  (n) => [id, '["', n.name, '"]']
21252
21194
  );
@@ -21409,11 +21351,11 @@ ${input.slice(result.pos)}
21409
21351
  }
21410
21352
  var EnumProperty$0 = $TS($S(Identifier, $E($S(__, Equals, ExtendedExpression)), ObjectPropertyDelimiter), function($skip, $loc, $0, $1, $2, $3) {
21411
21353
  var name = $1;
21412
- var init = $2;
21354
+ var initializer = $2;
21413
21355
  return {
21414
21356
  type: "EnumProperty",
21415
21357
  name,
21416
- init,
21358
+ initializer,
21417
21359
  children: $0
21418
21360
  };
21419
21361
  });
@@ -24226,8 +24168,7 @@ ${input.slice(result.pos)}
24226
24168
  processBinaryOpExpression,
24227
24169
  processCallMemberExpression,
24228
24170
  processCoffeeInterpolation,
24229
- processConstAssignmentDeclaration,
24230
- processLetAssignmentDeclaration,
24171
+ processAssignmentDeclaration,
24231
24172
  processProgram,
24232
24173
  processUnaryExpression,
24233
24174
  quoteString,