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