@danielx/civet 0.9.1 → 0.9.2

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
@@ -485,9 +485,9 @@ ${body}`;
485
485
  // source/parser.hera
486
486
  var import_lib2 = __toESM(require_machine());
487
487
 
488
- // source/parser/lib.civet
489
- var lib_exports = {};
490
- __export(lib_exports, {
488
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
489
+ var lib_civet_exports = {};
490
+ __export(lib_civet_exports, {
491
491
  addPostfixStatement: () => addPostfixStatement,
492
492
  adjustBindingElements: () => adjustBindingElements,
493
493
  adjustIndexAccess: () => adjustIndexAccess,
@@ -561,7 +561,7 @@ __export(lib_exports, {
561
561
  wrapTypeInPromise: () => wrapTypeInPromise
562
562
  });
563
563
 
564
- // source/parser/util.civet
564
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\util.civet.jsx
565
565
  function len(arr, length) {
566
566
  return arr.length === length;
567
567
  }
@@ -585,10 +585,8 @@ var assert = {
585
585
  }
586
586
  };
587
587
  function addParentPointers(node, parent) {
588
- if (node == null)
589
- return;
590
- if (typeof node !== "object")
591
- return;
588
+ if (node == null) return;
589
+ if (typeof node !== "object") return;
592
590
  if (Array.isArray(node)) {
593
591
  for (const child of node) {
594
592
  addParentPointers(child, parent);
@@ -654,8 +652,7 @@ function isToken(node) {
654
652
  return node != null && node.token != null;
655
653
  }
656
654
  function isEmptyBareBlock(node) {
657
- if (node?.type !== "BlockStatement")
658
- return false;
655
+ if (node?.type !== "BlockStatement") return false;
659
656
  const { bare, expressions } = node;
660
657
  return bare && (Array.isArray(expressions) && len(expressions, 0) || Array.isArray(expressions) && len(expressions, 1) && Array.isArray(expressions[0]) && expressions[0].length >= 2 && typeof expressions[0][1] === "object" && expressions[0][1] != null && "type" in expressions[0][1] && expressions[0][1].type === "EmptyStatement");
661
658
  }
@@ -688,20 +685,13 @@ function isStatement(node) {
688
685
  statementTypes.has(node.type);
689
686
  }
690
687
  function isWhitespaceOrEmpty(node) {
691
- if (!node)
692
- return true;
693
- if (node.type === "Ref")
694
- return false;
695
- if (node.token)
696
- return /^\s*$/.test(node.token);
697
- if (node.children)
698
- node = node.children;
699
- if (!node.length)
700
- return true;
701
- if (typeof node === "string")
702
- return /^\s*$/.test(node);
703
- if (Array.isArray(node))
704
- return node.every(isWhitespaceOrEmpty);
688
+ if (!node) return true;
689
+ if (node.type === "Ref") return false;
690
+ if (node.token) return /^\s*$/.test(node.token);
691
+ if (node.children) node = node.children;
692
+ if (!node.length) return true;
693
+ if (typeof node === "string") return /^\s*$/.test(node);
694
+ if (Array.isArray(node)) return node.every(isWhitespaceOrEmpty);
705
695
  return false;
706
696
  }
707
697
  function firstNonSpace(node) {
@@ -745,12 +735,14 @@ function isExit(node) {
745
735
  let ref3;
746
736
  let ref4;
747
737
  switch (node.type) {
738
+ // Exit from normal flow
748
739
  case "ReturnStatement":
749
740
  case "ThrowStatement":
750
741
  case "BreakStatement":
751
742
  case "ContinueStatement": {
752
743
  return true;
753
744
  }
745
+ // if checks then and else clause
754
746
  case "IfStatement": {
755
747
  return (
756
748
  // `insertReturn` for IfStatement adds a return to children
@@ -774,9 +766,11 @@ function isExit(node) {
774
766
  case "BlockStatement": {
775
767
  return node.expressions.some((s) => isExit(s[1]));
776
768
  }
769
+ // Infinite loops
777
770
  case "IterationStatement": {
778
771
  return isLoopStatement(node) && gatherRecursiveWithinFunction(node.block, ($1) => $1.type === "BreakStatement").length === 0;
779
772
  }
773
+ // TODO: Distinguish between break of this loop vs. break of inner loops
780
774
  default: {
781
775
  return false;
782
776
  }
@@ -996,8 +990,7 @@ function makeNumericLiteral(n) {
996
990
  };
997
991
  }
998
992
  function startsWith(target, value) {
999
- if (!target)
1000
- return;
993
+ if (!target) return;
1001
994
  if (Array.isArray(target)) {
1002
995
  let i = 0;
1003
996
  let l = target.length;
@@ -1012,12 +1005,9 @@ function startsWith(target, value) {
1012
1005
  return startsWith(target[i], value);
1013
1006
  }
1014
1007
  }
1015
- if (typeof target === "string")
1016
- return value.test(target);
1017
- if (target.children)
1018
- return startsWith(target.children, value);
1019
- if (target.token)
1020
- return value.test(target.token);
1008
+ if (typeof target === "string") return value.test(target);
1009
+ if (target.children) return startsWith(target.children, value);
1010
+ if (target.token) return value.test(target.token);
1021
1011
  return;
1022
1012
  }
1023
1013
  function startsWithPredicate(node, predicate, skip = isWhitespaceOrEmpty) {
@@ -1148,10 +1138,8 @@ function replaceNodes(root, predicate, replacer) {
1148
1138
  return root;
1149
1139
  }
1150
1140
  function removeHoistDecs(node) {
1151
- if (node == null)
1152
- return;
1153
- if (typeof node !== "object")
1154
- return;
1141
+ if (node == null) return;
1142
+ if (typeof node !== "object") return;
1155
1143
  if ("hoistDec" in node) {
1156
1144
  node.hoistDec = void 0;
1157
1145
  }
@@ -1283,8 +1271,7 @@ function makeNode(node) {
1283
1271
  return node;
1284
1272
  }
1285
1273
  function skipIfOnlyWS(target) {
1286
- if (!target)
1287
- return target;
1274
+ if (!target) return target;
1288
1275
  if (Array.isArray(target)) {
1289
1276
  if (target.length === 1) {
1290
1277
  return skipIfOnlyWS(target[0]);
@@ -1345,8 +1332,9 @@ function parenthesizeType(type) {
1345
1332
  children: ["(", type, ")"]
1346
1333
  });
1347
1334
  }
1348
- function wrapIIFE(expressions, asyncFlag, generator) {
1335
+ function wrapIIFE(expressions, asyncFlag, generatorStar) {
1349
1336
  let awaitPrefix;
1337
+ const generator = generatorStar ? [generatorStar] : [];
1350
1338
  const async = [];
1351
1339
  if (asyncFlag) {
1352
1340
  async.push("async ");
@@ -1358,9 +1346,9 @@ function wrapIIFE(expressions, asyncFlag, generator) {
1358
1346
  };
1359
1347
  }
1360
1348
  let yieldWrap = false;
1361
- if (!generator) {
1349
+ if (!generator.length) {
1362
1350
  if (hasYield(expressions)) {
1363
- generator = "*";
1351
+ generator.push("*");
1364
1352
  yieldWrap = true;
1365
1353
  }
1366
1354
  }
@@ -1371,30 +1359,34 @@ function wrapIIFE(expressions, asyncFlag, generator) {
1371
1359
  bare: false,
1372
1360
  root: false
1373
1361
  });
1362
+ const parameterList = [];
1374
1363
  const parameters = {
1375
1364
  type: "Parameters",
1376
- children: ["()"],
1365
+ children: ["(", parameterList, ")"],
1366
+ parameters: parameterList,
1377
1367
  names: []
1378
1368
  };
1379
1369
  const signature = {
1370
+ type: "FunctionSignature",
1380
1371
  modifier: {
1381
1372
  async: !!async.length,
1382
- generator: !!generator
1373
+ generator: !!generator.length
1383
1374
  },
1384
- returnType: void 0
1375
+ parameters,
1376
+ returnType: void 0,
1377
+ children: generator.length ? [async, "function", generator, parameters] : [async, parameters]
1385
1378
  };
1386
1379
  let fn;
1387
- if (generator) {
1380
+ if (generator.length) {
1388
1381
  fn = makeNode({
1389
1382
  type: "FunctionExpression",
1390
1383
  signature,
1391
1384
  parameters,
1392
1385
  returnType: void 0,
1393
- ts: false,
1394
1386
  async,
1395
1387
  block,
1396
1388
  generator,
1397
- children: [async, "function", generator, parameters, block]
1389
+ children: [...signature.children, block]
1398
1390
  });
1399
1391
  } else {
1400
1392
  fn = makeNode({
@@ -1402,10 +1394,9 @@ function wrapIIFE(expressions, asyncFlag, generator) {
1402
1394
  signature,
1403
1395
  parameters,
1404
1396
  returnType: void 0,
1405
- ts: false,
1406
1397
  async,
1407
1398
  block,
1408
- children: [async, parameters, "=>", block]
1399
+ children: [...signature.children, "=>", block]
1409
1400
  });
1410
1401
  }
1411
1402
  const children = [makeLeftHandSideExpression(fn), "()"];
@@ -1414,8 +1405,19 @@ function wrapIIFE(expressions, asyncFlag, generator) {
1414
1405
  children.splice(1, 0, ".bind(this)");
1415
1406
  }
1416
1407
  if (gatherRecursiveWithinFunction(block, (a2) => typeof a2 === "object" && a2 != null && "token" in a2 && a2.token === "arguments").length) {
1417
- let ref9;
1418
- children[children.length - 1] = (ref9 = parameters.children)[ref9.length - 1] = "(arguments)";
1408
+ const binding = {
1409
+ type: "Identifier",
1410
+ name: "arguments",
1411
+ names: ["arguments"],
1412
+ children: ["arguments"]
1413
+ };
1414
+ parameterList.push({
1415
+ type: "Parameter",
1416
+ children: [binding],
1417
+ names: ["arguments"],
1418
+ binding
1419
+ });
1420
+ children[children.length - 1] = "(arguments)";
1419
1421
  }
1420
1422
  }
1421
1423
  let exp = makeNode({
@@ -1467,7 +1469,7 @@ function flatJoin(array, separator) {
1467
1469
  return result;
1468
1470
  }
1469
1471
 
1470
- // source/parser/traversal.civet
1472
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\traversal.civet.jsx
1471
1473
  function gatherRecursiveWithinFunction(node, predicate) {
1472
1474
  return gatherRecursive(node, predicate, isFunction);
1473
1475
  }
@@ -1534,7 +1536,6 @@ function gatherNodes(node, predicate) {
1534
1536
  }
1535
1537
  default: {
1536
1538
  return gatherNodes(
1537
- //@ts-ignore
1538
1539
  node.children,
1539
1540
  predicate
1540
1541
  );
@@ -1555,7 +1556,6 @@ function gatherRecursive(node, predicate, skipPredicate) {
1555
1556
  return [node];
1556
1557
  }
1557
1558
  return gatherRecursive(
1558
- //@ts-ignore
1559
1559
  node.children,
1560
1560
  predicate,
1561
1561
  skipPredicate
@@ -1569,7 +1569,6 @@ function gatherRecursiveAll(node, predicate) {
1569
1569
  return node.flatMap((n) => gatherRecursiveAll(n, predicate));
1570
1570
  }
1571
1571
  const nodes = gatherRecursiveAll(
1572
- //@ts-ignore
1573
1572
  node.children,
1574
1573
  predicate
1575
1574
  );
@@ -1579,7 +1578,7 @@ function gatherRecursiveAll(node, predicate) {
1579
1578
  return nodes;
1580
1579
  }
1581
1580
 
1582
- // source/parser/ref.civet
1581
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\ref.civet.jsx
1583
1582
  function makeRef(base = "ref", id = base) {
1584
1583
  return {
1585
1584
  type: "Ref",
@@ -1640,9 +1639,10 @@ function maybeRefAssignment(exp, base = "ref") {
1640
1639
  }
1641
1640
  }
1642
1641
 
1643
- // source/parser/binding.civet
1642
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\binding.civet.jsx
1644
1643
  function adjustAtBindings(statements, asThis = false) {
1645
- gatherRecursiveAll(statements, ($) => $.type === "AtBindingProperty").forEach((binding) => {
1644
+ for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "AtBindingProperty"), i1 = 0, len3 = ref1.length; i1 < len3; i1++) {
1645
+ const binding = ref1[i1];
1646
1646
  const { ref } = binding;
1647
1647
  if (asThis) {
1648
1648
  const atBinding = binding.binding;
@@ -1653,20 +1653,18 @@ function adjustAtBindings(statements, asThis = false) {
1653
1653
  binding.ref = void 0;
1654
1654
  return;
1655
1655
  }
1656
- if (ref.names[0] !== ref.base) {
1657
- return binding.children.unshift(ref.base, ": ");
1656
+ if (!(ref.names[0] === ref.base)) {
1657
+ binding.children.unshift(ref.base, ": ");
1658
1658
  }
1659
- ;
1660
- return;
1661
- });
1659
+ }
1662
1660
  }
1663
1661
  function adjustBindingElements(elements) {
1664
1662
  const names = elements.flatMap(($1) => $1.names || []);
1665
1663
  const { length } = elements;
1666
1664
  let blockPrefix, restIndex = -1, restCount = 0;
1667
- for (let i1 = 0, len3 = elements.length; i1 < len3; i1++) {
1668
- const i = i1;
1669
- const { type } = elements[i1];
1665
+ for (let i2 = 0, len1 = elements.length; i2 < len1; i2++) {
1666
+ const i = i2;
1667
+ const { type } = elements[i2];
1670
1668
  if (type === "BindingRestElement") {
1671
1669
  if (restIndex < 0) {
1672
1670
  restIndex = i;
@@ -1688,8 +1686,7 @@ function adjustBindingElements(elements) {
1688
1686
  names.push(...rest.names || []);
1689
1687
  let l = after.length;
1690
1688
  if (l) {
1691
- if (arrayElementHasTrailingComma(after[l - 1]))
1692
- l++;
1689
+ if (arrayElementHasTrailingComma(after[l - 1])) l++;
1693
1690
  const elements2 = trimFirstSpace(after);
1694
1691
  blockPrefix = {
1695
1692
  type: "PostRestBindingElements",
@@ -1724,35 +1721,36 @@ function gatherBindingCode(statements, opts) {
1724
1721
  const thisAssignments = [];
1725
1722
  const splices = [];
1726
1723
  function insertRestSplices(s, p, thisAssignments2) {
1727
- gatherRecursiveAll(s, (n) => n.blockPrefix || opts?.injectParamProps && n.accessModifier || n.type === "AtBinding").forEach((n) => {
1724
+ for (let ref2 = gatherRecursiveAll(s, (n) => n.blockPrefix || opts?.injectParamProps && n.accessModifier || n.type === "AtBinding"), i3 = 0, len22 = ref2.length; i3 < len22; i3++) {
1725
+ const n = ref2[i3];
1728
1726
  if (n.type === "AtBinding") {
1729
1727
  const { ref } = n;
1730
1728
  const { id } = ref;
1731
1729
  thisAssignments2.push([`this.${id} = `, ref]);
1732
- return;
1730
+ continue;
1733
1731
  }
1734
1732
  if (opts?.injectParamProps && n.type === "Parameter" && n.accessModifier) {
1735
- for (let ref1 = n.names, i2 = 0, len1 = ref1.length; i2 < len1; i2++) {
1736
- const id = ref1[i2];
1733
+ for (let ref3 = n.names, i4 = 0, len3 = ref3.length; i4 < len3; i4++) {
1734
+ const id = ref3[i4];
1737
1735
  thisAssignments2.push({
1738
1736
  type: "AssignmentExpression",
1739
1737
  children: [`this.${id} = `, id],
1740
1738
  js: true
1741
1739
  });
1742
1740
  }
1743
- return;
1741
+ continue;
1744
1742
  }
1745
1743
  const { blockPrefix } = n;
1746
1744
  p.push(blockPrefix);
1747
- return insertRestSplices(blockPrefix, p, thisAssignments2);
1748
- });
1745
+ insertRestSplices(blockPrefix, p, thisAssignments2);
1746
+ }
1749
1747
  }
1750
1748
  insertRestSplices(statements, splices, thisAssignments);
1751
1749
  return [splices, thisAssignments];
1752
1750
  }
1753
1751
  function arrayElementHasTrailingComma(elementNode) {
1754
- let ref2;
1755
- const lastChild = (ref2 = elementNode.children)[ref2.length - 1];
1752
+ let ref4;
1753
+ const lastChild = (ref4 = elementNode.children)[ref4.length - 1];
1756
1754
  return lastChild && lastChild[lastChild.length - 1]?.token === ",";
1757
1755
  }
1758
1756
  function gatherBindingPatternTypeSuffix(pattern) {
@@ -1764,8 +1762,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
1764
1762
  case "ArrayBindingPattern": {
1765
1763
  {
1766
1764
  const results = [];
1767
- for (let ref3 = pattern.elements, i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
1768
- const elem = ref3[i3];
1765
+ for (let ref5 = pattern.elements, i5 = 0, len4 = ref5.length; i5 < len4; i5++) {
1766
+ const elem = ref5[i5];
1769
1767
  let { typeSuffix } = elem;
1770
1768
  typeSuffix ??= elem.binding?.typeSuffix;
1771
1769
  if (typeSuffix) {
@@ -1803,8 +1801,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
1803
1801
  {
1804
1802
  let restType;
1805
1803
  const results1 = [];
1806
- for (let ref4 = pattern.properties, i4 = 0, len3 = ref4.length; i4 < len3; i4++) {
1807
- const prop = ref4[i4];
1804
+ for (let ref6 = pattern.properties, i6 = 0, len5 = ref6.length; i6 < len5; i6++) {
1805
+ const prop = ref6[i6];
1808
1806
  let { typeSuffix } = prop;
1809
1807
  typeSuffix ??= prop.value?.typeSuffix;
1810
1808
  if (typeSuffix) {
@@ -1854,12 +1852,12 @@ function gatherBindingPatternTypeSuffix(pattern) {
1854
1852
  return pattern;
1855
1853
  }
1856
1854
 
1857
- // source/parser/comptime.civet
1855
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
1858
1856
  import { resolve, dirname } from "node:path";
1859
1857
  import { createRequire } from "node:module";
1860
1858
  import vm from "node:vm";
1861
1859
 
1862
- // source/parser/helper.civet
1860
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\helper.civet.jsx
1863
1861
  var preludeVar = "var ";
1864
1862
  function ts(children) {
1865
1863
  return {
@@ -2089,7 +2087,7 @@ function extractPreludeFor(node) {
2089
2087
  return state.prelude.filter((s) => gatherRecursive(s, helpers.has.bind(helpers)).length);
2090
2088
  }
2091
2089
 
2092
- // source/generate.civet
2090
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\generate.civet.jsx
2093
2091
  function stringify(node) {
2094
2092
  try {
2095
2093
  return JSON.stringify(removeParentPointers(node));
@@ -2170,7 +2168,7 @@ function gen(root, options) {
2170
2168
  throw new Error(`Unknown node ${stringify(node)}`);
2171
2169
  }
2172
2170
  }
2173
- var generate_default = gen;
2171
+ var generate_civet_default = gen;
2174
2172
  function prune(node) {
2175
2173
  if (!(node != null)) {
2176
2174
  return;
@@ -2198,7 +2196,7 @@ function prune(node) {
2198
2196
  return node;
2199
2197
  }
2200
2198
 
2201
- // source/parser/comptime.civet
2199
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
2202
2200
  function expressionizeComptime(statement) {
2203
2201
  const { expressions } = statement.block;
2204
2202
  const expression = wrapIIFE(expressions, hasAwait(expressions));
@@ -2237,7 +2235,7 @@ function runComptime(statements) {
2237
2235
  content
2238
2236
  ];
2239
2237
  const options = { js: true };
2240
- let js = generate_default(prune(content), options);
2238
+ let js = generate_civet_default(prune(content), options);
2241
2239
  js = `"use strict";${js}`;
2242
2240
  if (options.errors != null) {
2243
2241
  return;
@@ -2321,10 +2319,8 @@ function serialize(value, context) {
2321
2319
  if (typeof val === "string") {
2322
2320
  return JSON.stringify(val);
2323
2321
  } else if (typeof val === "number") {
2324
- if (Object.is(-0, val))
2325
- return "-0";
2326
- else
2327
- return val.toString();
2322
+ if (Object.is(-0, val)) return "-0";
2323
+ else return val.toString();
2328
2324
  } else if (typeof val === "boolean" || val == null) {
2329
2325
  return String(val);
2330
2326
  } else if (typeof val === "bigint") {
@@ -2496,6 +2492,7 @@ function serialize(value, context) {
2496
2492
  ref1 = `new ${val.constructor.name}([${Array.from(val, ($1) => `${$1}n`).join(",")}])`;
2497
2493
  break;
2498
2494
  }
2495
+ // Spelled differently for browsers, where `Buffer` doesn't exist
2499
2496
  case globalThis.Buffer?.prototype:
2500
2497
  case context?.Buffer?.prototype: {
2501
2498
  ref1 = `Buffer.from([${val.join(",")}])`;
@@ -2520,7 +2517,8 @@ function serialize(value, context) {
2520
2517
  return recurse(value);
2521
2518
  }
2522
2519
 
2523
- // source/parser/function.civet
2520
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\function.civet.jsx
2521
+ var concatAssign = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
2524
2522
  function getTypeArguments(args) {
2525
2523
  while (typeof args === "object" && args != null && "args" in args) {
2526
2524
  args = args.args;
@@ -2578,8 +2576,7 @@ function wrapTypeInApplication(t, id, raw) {
2578
2576
  };
2579
2577
  }
2580
2578
  function implicitFunctionBlock(f) {
2581
- if (f.abstract || f.block || f.signature?.optional)
2582
- return;
2579
+ if (f.abstract || f.block || f.signature?.optional) return;
2583
2580
  const { name, parent } = f;
2584
2581
  let ancestor = parent;
2585
2582
  let child = f;
@@ -2718,16 +2715,14 @@ function patternAsValue(pattern) {
2718
2715
  case "ArrayBindingPattern": {
2719
2716
  const children = [...pattern.children];
2720
2717
  const index = children.indexOf(pattern.elements);
2721
- if (index < 0)
2722
- throw new Error("failed to find elements in ArrayBindingPattern");
2718
+ if (index < 0) throw new Error("failed to find elements in ArrayBindingPattern");
2723
2719
  const elements = children[index] = pattern.elements.map(patternAsValue);
2724
2720
  return { ...pattern, elements, children };
2725
2721
  }
2726
2722
  case "ObjectBindingPattern": {
2727
2723
  const children = [...pattern.children];
2728
2724
  const index = children.indexOf(pattern.properties);
2729
- if (index < 0)
2730
- throw new Error("failed to find properties in ArrayBindingPattern");
2725
+ if (index < 0) throw new Error("failed to find properties in ArrayBindingPattern");
2731
2726
  const properties = children[index] = pattern.properties.map(patternAsValue);
2732
2727
  return { ...pattern, properties, children };
2733
2728
  }
@@ -2820,8 +2815,7 @@ function patternBindings(pattern) {
2820
2815
  }
2821
2816
  }
2822
2817
  function assignResults(node, collect) {
2823
- if (!node)
2824
- return;
2818
+ if (!node) return;
2825
2819
  switch (node.type) {
2826
2820
  case "BlockStatement":
2827
2821
  if (node.expressions.length) {
@@ -2956,8 +2950,7 @@ function assignResults(node, collect) {
2956
2950
  node[1] = collect(node[1]);
2957
2951
  }
2958
2952
  function insertReturn(node) {
2959
- if (!node)
2960
- return;
2953
+ if (!node) return;
2961
2954
  switch (node.type) {
2962
2955
  case "BlockStatement": {
2963
2956
  if (node.expressions.length) {
@@ -2974,6 +2967,7 @@ function insertReturn(node) {
2974
2967
  }
2975
2968
  return;
2976
2969
  }
2970
+ // NOTE: "CaseClause"s don't get a return statement inserted
2977
2971
  case "WhenClause": {
2978
2972
  if (node.break) {
2979
2973
  const breakIndex = node.children.indexOf(node.break);
@@ -2997,8 +2991,7 @@ function insertReturn(node) {
2997
2991
  return;
2998
2992
  }
2999
2993
  }
3000
- if (!Array.isArray(node))
3001
- return;
2994
+ if (!Array.isArray(node)) return;
3002
2995
  let [, exp, semi] = node;
3003
2996
  if (semi?.type === "SemicolonDelimiter") {
3004
2997
  return;
@@ -3078,14 +3071,12 @@ function insertReturn(node) {
3078
3071
  }
3079
3072
  case "IfStatement": {
3080
3073
  insertReturn(exp.then);
3081
- if (exp.else)
3082
- insertReturn(exp.else.block);
3083
- else
3084
- exp.children.push([
3085
- "",
3086
- // NOTE: add a prefixed semicolon because the if block may not be braced
3087
- wrapWithReturn(void 0, exp, true)
3088
- ]);
3074
+ if (exp.else) insertReturn(exp.else.block);
3075
+ else exp.children.push([
3076
+ "",
3077
+ // NOTE: add a prefixed semicolon because the if block may not be braced
3078
+ wrapWithReturn(void 0, exp, true)
3079
+ ]);
3089
3080
  return;
3090
3081
  }
3091
3082
  case "PatternMatchingStatement": {
@@ -3382,6 +3373,183 @@ function processParams(f) {
3382
3373
  if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
3383
3374
  parameters.tp.parameters.push(",");
3384
3375
  }
3376
+ let tt, before = [], rest, after = [];
3377
+ function append2(p) {
3378
+ (rest ? after : before).push(p);
3379
+ }
3380
+ for (let ref16 = parameters.parameters, i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
3381
+ const param = ref16[i8];
3382
+ switch (param.type) {
3383
+ case "ThisType": {
3384
+ if (tt) {
3385
+ append2({
3386
+ type: "Error",
3387
+ message: "Only one typed this parameter is allowed"
3388
+ });
3389
+ append2(param);
3390
+ } else {
3391
+ tt = trimFirstSpace(param);
3392
+ if (before.length || rest) {
3393
+ let ref17;
3394
+ let delim = (ref17 = tt.children)[ref17.length - 1];
3395
+ if (Array.isArray(delim)) {
3396
+ delim = delim[delim.length - 1];
3397
+ }
3398
+ if (!(typeof delim === "object" && delim != null && "token" in delim && delim.token === ",")) {
3399
+ tt = {
3400
+ ...tt,
3401
+ children: [...tt.children, ", "]
3402
+ };
3403
+ }
3404
+ }
3405
+ }
3406
+ ;
3407
+ break;
3408
+ }
3409
+ case "FunctionRestParameter": {
3410
+ if (rest) {
3411
+ append2({
3412
+ type: "Error",
3413
+ message: "Only one rest parameter is allowed"
3414
+ });
3415
+ append2(param);
3416
+ } else {
3417
+ rest = param;
3418
+ }
3419
+ ;
3420
+ break;
3421
+ }
3422
+ default: {
3423
+ append2(param);
3424
+ }
3425
+ }
3426
+ }
3427
+ parameters.names = before.flatMap(($6) => $6.names);
3428
+ parameters.parameters.splice(0, 1 / 0, ...[]);
3429
+ if (tt) {
3430
+ parameters.parameters.push(tt);
3431
+ }
3432
+ parameters.parameters.push(...before);
3433
+ if (rest) {
3434
+ const restIdentifier = rest.binding.ref || rest.binding;
3435
+ parameters.names.push(...rest.names || []);
3436
+ rest.children.pop();
3437
+ if (after.length) {
3438
+ if (rest.binding.type === "ArrayBindingPattern" || rest.binding.type === "ObjectBindingPattern") {
3439
+ parameters.parameters.push({
3440
+ type: "Error",
3441
+ message: "Non-end rest parameter cannot be binding pattern"
3442
+ });
3443
+ }
3444
+ after = trimFirstSpace(after);
3445
+ const names = after.flatMap(($7) => $7.names);
3446
+ const elements = after.map((p) => {
3447
+ if (p.type === "Error") {
3448
+ return p;
3449
+ }
3450
+ return {
3451
+ ...p,
3452
+ // omit individual argument types from output
3453
+ children: p.children.filter((a2) => a2 !== p.typeSuffix),
3454
+ type: "BindingElement"
3455
+ };
3456
+ });
3457
+ const pattern = gatherBindingPatternTypeSuffix(makeNode({
3458
+ type: "ArrayBindingPattern",
3459
+ elements,
3460
+ length: after.length,
3461
+ children: ["[", elements, "]"],
3462
+ names
3463
+ }));
3464
+ const { typeSuffix } = pattern;
3465
+ const blockPrefix = parameters.blockPrefix = makeNode({
3466
+ type: "PostRestBindingElements",
3467
+ children: [
3468
+ pattern,
3469
+ " = ",
3470
+ restIdentifier,
3471
+ ".splice(-",
3472
+ after.length.toString(),
3473
+ ")"
3474
+ ],
3475
+ elements,
3476
+ names
3477
+ });
3478
+ if (rest.typeSuffix) {
3479
+ let optionalType = function(typeSuffix3, fallback) {
3480
+ const t2 = typeSuffix3?.t ?? fallback;
3481
+ if (typeSuffix3?.optional) {
3482
+ return [
3483
+ t2,
3484
+ {
3485
+ type: "Error",
3486
+ message: "Optional parameter not allowed in/after rest parameter"
3487
+ }
3488
+ ];
3489
+ }
3490
+ return t2;
3491
+ };
3492
+ const ref = makeRef("rest");
3493
+ const restRef = [
3494
+ { children: [ref], ts: true },
3495
+ { children: [restIdentifier], js: true }
3496
+ ];
3497
+ blockPrefix.children[blockPrefix.children.indexOf(restIdentifier)] = restRef;
3498
+ blockPrefix.children.push({
3499
+ ts: true,
3500
+ children: [
3501
+ ", ",
3502
+ restIdentifier,
3503
+ " = ",
3504
+ ref,
3505
+ " as ",
3506
+ trimFirstSpace(rest.typeSuffix.t)
3507
+ ]
3508
+ });
3509
+ const bindingIndex = rest.rest.children.indexOf(rest.rest.binding);
3510
+ assert.notEqual(bindingIndex, -1, "Could not find binding in rest parameter");
3511
+ rest.rest.children[bindingIndex] = rest.rest.binding = { ...rest.rest.binding, js: true };
3512
+ rest.rest.children.splice(bindingIndex + 1, 0, {
3513
+ children: [ref],
3514
+ ts: true
3515
+ });
3516
+ const oldSuffix = rest.typeSuffix;
3517
+ const colon = oldSuffix.colon ?? ": ";
3518
+ const afterTypes = after.flatMap((p) => {
3519
+ return [",", optionalType(p.typeSuffix, " unknown")];
3520
+ });
3521
+ const t = [
3522
+ "[",
3523
+ "...",
3524
+ optionalType(oldSuffix, "unknown[]"),
3525
+ ...afterTypes,
3526
+ "]"
3527
+ ];
3528
+ const typeSuffix2 = makeNode({
3529
+ type: "TypeSuffix",
3530
+ ts: true,
3531
+ colon,
3532
+ t,
3533
+ children: [
3534
+ ...oldSuffix.children.filter(($8) => (
3535
+ // spaces and colon
3536
+ $8 !== oldSuffix.optional && $8 !== oldSuffix.t
3537
+ )),
3538
+ !oldSuffix.colon ? colon : void 0,
3539
+ t
3540
+ ]
3541
+ });
3542
+ const suffixIndex = rest.children.indexOf(rest.typeSuffix);
3543
+ assert.notEqual(suffixIndex, -1, "Could not find typeSuffix in rest parameter");
3544
+ rest.children[suffixIndex] = rest.typeSuffix = typeSuffix2;
3545
+ blockPrefix.children.splice(-1, 0, {
3546
+ ts: true,
3547
+ children: [" as [", afterTypes.slice(1), "]"]
3548
+ });
3549
+ }
3550
+ }
3551
+ parameters.parameters.push(rest);
3552
+ }
3385
3553
  if (!block) {
3386
3554
  return;
3387
3555
  }
@@ -3399,9 +3567,9 @@ function processParams(f) {
3399
3567
  injectParamProps: isConstructor
3400
3568
  });
3401
3569
  if (isConstructor) {
3402
- const { ancestor } = findAncestor(f, ($6) => $6.type === "ClassExpression");
3570
+ const { ancestor } = findAncestor(f, ($9) => $9.type === "ClassExpression");
3403
3571
  if (ancestor != null) {
3404
- const fields = new Set(gatherRecursiveWithinFunction(ancestor, ($7) => $7.type === "FieldDefinition").map(($8) => $8.id).filter((a2) => typeof a2 === "object" && a2 != null && "type" in a2 && a2.type === "Identifier").map(($9) => $9.name));
3572
+ const fields = new Set(gatherRecursiveWithinFunction(ancestor, ($10) => $10.type === "FieldDefinition").map(($11) => $11.id).filter((a3) => typeof a3 === "object" && a3 != null && "type" in a3 && a3.type === "Identifier").map(($12) => $12.name));
3405
3573
  const classExpressions = ancestor.body.expressions;
3406
3574
  let index = findChildIndex(classExpressions, f);
3407
3575
  assert.notEqual(index, -1, "Could not find constructor in class");
@@ -3410,14 +3578,14 @@ function processParams(f) {
3410
3578
  index--;
3411
3579
  }
3412
3580
  const fStatement = classExpressions[index];
3413
- for (let ref16 = gatherRecursive(parameters, ($10) => $10.type === "Parameter"), i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
3414
- const parameter = ref16[i8];
3581
+ for (let ref18 = gatherRecursive(parameters, ($13) => $13.type === "Parameter"), i9 = 0, len8 = ref18.length; i9 < len8; i9++) {
3582
+ const parameter = ref18[i9];
3415
3583
  const { accessModifier } = parameter;
3416
3584
  if (!(accessModifier || parameter.typeSuffix)) {
3417
3585
  continue;
3418
3586
  }
3419
- for (let ref17 = gatherRecursive(parameter, ($11) => $11.type === "AtBinding"), i9 = 0, len8 = ref17.length; i9 < len8; i9++) {
3420
- const binding = ref17[i9];
3587
+ for (let ref19 = gatherRecursive(parameter, ($14) => $14.type === "AtBinding"), i10 = 0, len9 = ref19.length; i10 < len9; i10++) {
3588
+ const binding = ref19[i10];
3421
3589
  const typeSuffix = binding.parent?.typeSuffix;
3422
3590
  if (!(accessModifier || typeSuffix)) {
3423
3591
  continue;
@@ -3445,23 +3613,35 @@ function processParams(f) {
3445
3613
  type: "SemicolonDelimiter",
3446
3614
  children: [";"]
3447
3615
  };
3448
- const prefix = splices.map((s) => ["let ", s]).concat(thisAssignments).map(
3449
- (s) => s.type ? {
3450
- // TODO: figure out how to get JS only statement tuples
3451
- ...s,
3452
- children: [indent, ...s.children, delimiter]
3453
- } : [indent, s, delimiter]
3454
- );
3616
+ let prefix = [];
3617
+ for (let ref20 = splices, i11 = 0, len10 = ref20.length; i11 < len10; i11++) {
3618
+ const binding = ref20[i11];
3619
+ assert.equal(binding.type, "PostRestBindingElements", "splice should be of type Binding");
3620
+ prefix.push(makeNode({
3621
+ type: "Declaration",
3622
+ children: ["let ", binding],
3623
+ names: binding.names,
3624
+ bindings: [],
3625
+ // avoid implicit return of any bindings
3626
+ decl: "let"
3627
+ }));
3628
+ }
3629
+ concatAssign(prefix, thisAssignments);
3630
+ prefix = prefix.map((s) => s?.js ? ["", makeNode({
3631
+ // TODO: figure out how to get JS only statement tuples
3632
+ ...s,
3633
+ children: [indent, ...s.children, delimiter]
3634
+ })] : [indent, s, delimiter]);
3455
3635
  if (!prefix.length) {
3456
3636
  return;
3457
3637
  }
3458
3638
  if (isConstructor) {
3459
3639
  const superCalls = gatherNodes(
3460
3640
  expressions,
3461
- (a3) => typeof a3 === "object" && a3 != null && "type" in a3 && a3.type === "CallExpression" && "children" in a3 && Array.isArray(a3.children) && a3.children.length >= 1 && typeof a3.children[0] === "object" && a3.children[0] != null && "token" in a3.children[0] && a3.children[0].token === "super"
3641
+ (a4) => typeof a4 === "object" && a4 != null && "type" in a4 && a4.type === "CallExpression" && "children" in a4 && Array.isArray(a4.children) && a4.children.length >= 1 && typeof a4.children[0] === "object" && a4.children[0] != null && "token" in a4.children[0] && a4.children[0].token === "super"
3462
3642
  );
3463
3643
  if (superCalls.length) {
3464
- const { child } = findAncestor(superCalls[0], (a4) => a4 === block);
3644
+ const { child } = findAncestor(superCalls[0], (a5) => a5 === block);
3465
3645
  const index = findChildIndex(expressions, child);
3466
3646
  if (index < 0) {
3467
3647
  throw new Error("Could not find super call within top-level expressions");
@@ -3471,6 +3651,7 @@ function processParams(f) {
3471
3651
  }
3472
3652
  }
3473
3653
  expressions.unshift(...prefix);
3654
+ updateParentPointers(block);
3474
3655
  braceBlock(block);
3475
3656
  }
3476
3657
  function processSignature(f) {
@@ -3480,8 +3661,8 @@ function processSignature(f) {
3480
3661
  f.async.push("async ");
3481
3662
  signature.modifier.async = true;
3482
3663
  } else {
3483
- for (let ref18 = gatherRecursiveWithinFunction(block, ($12) => $12.type === "Await"), i10 = 0, len9 = ref18.length; i10 < len9; i10++) {
3484
- const a = ref18[i10];
3664
+ for (let ref21 = gatherRecursiveWithinFunction(block, ($15) => $15.type === "Await"), i12 = 0, len11 = ref21.length; i12 < len11; i12++) {
3665
+ const a = ref21[i12];
3485
3666
  const i = findChildIndex(a.parent, a);
3486
3667
  a.parent.children.splice(i + 1, 0, {
3487
3668
  type: "Error",
@@ -3495,9 +3676,9 @@ function processSignature(f) {
3495
3676
  f.generator.push("*");
3496
3677
  signature.modifier.generator = true;
3497
3678
  } else {
3498
- for (let ref19 = gatherRecursiveWithinFunction(block, ($13) => $13.type === "YieldExpression"), i11 = 0, len10 = ref19.length; i11 < len10; i11++) {
3499
- const y = ref19[i11];
3500
- const i = y.children.findIndex(($14) => $14.type === "Yield");
3679
+ for (let ref22 = gatherRecursiveWithinFunction(block, ($16) => $16.type === "YieldExpression"), i13 = 0, len12 = ref22.length; i13 < len12; i13++) {
3680
+ const y = ref22[i13];
3681
+ const i = y.children.findIndex(($17) => $17.type === "Yield");
3501
3682
  y.children.splice(i + 1, 0, {
3502
3683
  type: "Error",
3503
3684
  message: `yield invalid in ${f.type === "ArrowFunction" ? "=> arrow function" : signature.modifier.get ? "getter" : signature.modifier.set ? "setter" : signature.name}`
@@ -3510,8 +3691,8 @@ function processSignature(f) {
3510
3691
  }
3511
3692
  }
3512
3693
  function processFunctions(statements, config2) {
3513
- for (let ref20 = gatherRecursiveAll(statements, ($15) => $15.type === "FunctionExpression" || $15.type === "ArrowFunction" || $15.type === "MethodDefinition"), i12 = 0, len11 = ref20.length; i12 < len11; i12++) {
3514
- const f = ref20[i12];
3694
+ for (let ref23 = gatherRecursiveAll(statements, ($18) => $18.type === "FunctionExpression" || $18.type === "ArrowFunction" || $18.type === "MethodDefinition"), i14 = 0, len13 = ref23.length; i14 < len13; i14++) {
3695
+ const f = ref23[i14];
3515
3696
  if (f.type === "FunctionExpression" || f.type === "MethodDefinition") {
3516
3697
  implicitFunctionBlock(f);
3517
3698
  }
@@ -3567,9 +3748,9 @@ function expressionizeIteration(exp) {
3567
3748
  }
3568
3749
  let done;
3569
3750
  if (!async) {
3570
- let ref21;
3571
- if ((ref21 = blockContainingStatement(exp)) && typeof ref21 === "object" && "block" in ref21 && "index" in ref21) {
3572
- const { block: parentBlock, index } = ref21;
3751
+ let ref24;
3752
+ if ((ref24 = blockContainingStatement(exp)) && typeof ref24 === "object" && "block" in ref24 && "index" in ref24) {
3753
+ const { block: parentBlock, index } = ref24;
3573
3754
  statements[0][0] = parentBlock.expressions[index][0];
3574
3755
  parentBlock.expressions.splice(index, index + 1 - index, ...statements);
3575
3756
  updateParentPointers(parentBlock);
@@ -3586,8 +3767,8 @@ function expressionizeIteration(exp) {
3586
3767
  }
3587
3768
  }
3588
3769
  function processIterationExpressions(statements) {
3589
- for (let ref22 = gatherRecursiveAll(statements, ($16) => $16.type === "IterationExpression"), i13 = 0, len12 = ref22.length; i13 < len12; i13++) {
3590
- const s = ref22[i13];
3770
+ for (let ref25 = gatherRecursiveAll(statements, ($19) => $19.type === "IterationExpression"), i15 = 0, len14 = ref25.length; i15 < len14; i15++) {
3771
+ const s = ref25[i15];
3591
3772
  expressionizeIteration(s);
3592
3773
  }
3593
3774
  }
@@ -3608,38 +3789,40 @@ function processCoffeeDo(ws, expression) {
3608
3789
  ws = trimFirstSpace(ws);
3609
3790
  const args = [];
3610
3791
  if (typeof expression === "object" && expression != null && "type" in expression && expression.type === "ArrowFunction" || typeof expression === "object" && expression != null && "type" in expression && expression.type === "FunctionExpression") {
3611
- const { parameters } = expression;
3792
+ let { parameters } = expression;
3793
+ const parameterList = parameters.parameters;
3794
+ const results1 = [];
3795
+ for (let i16 = 0, len15 = parameterList.length; i16 < len15; i16++) {
3796
+ let parameter = parameterList[i16];
3797
+ if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
3798
+ let ref26;
3799
+ if (ref26 = parameter.initializer) {
3800
+ const initializer = ref26;
3801
+ args.push(initializer.expression, parameter.delim);
3802
+ parameter = {
3803
+ ...parameter,
3804
+ initializer: void 0,
3805
+ children: parameter.children.filter((a6) => a6 !== initializer)
3806
+ };
3807
+ } else {
3808
+ args.push(parameter.children.filter(
3809
+ (a7) => a7 !== parameter.typeSuffix
3810
+ ));
3811
+ }
3812
+ }
3813
+ results1.push(parameter);
3814
+ }
3815
+ ;
3816
+ const newParameterList = results1;
3612
3817
  const newParameters = {
3613
3818
  ...parameters,
3614
- children: (() => {
3615
- const results1 = [];
3616
- for (let ref23 = parameters.children, i14 = 0, len13 = ref23.length; i14 < len13; i14++) {
3617
- let parameter = ref23[i14];
3618
- if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
3619
- let ref24;
3620
- if (ref24 = parameter.initializer) {
3621
- const initializer = ref24;
3622
- args.push(initializer.expression, parameter.delim);
3623
- parameter = {
3624
- ...parameter,
3625
- initializer: void 0,
3626
- children: parameter.children.filter((a5) => a5 !== initializer)
3627
- };
3628
- } else {
3629
- args.push(parameter.children.filter(
3630
- (a6) => a6 !== parameter.typeSuffix
3631
- ));
3632
- }
3633
- }
3634
- results1.push(parameter);
3635
- }
3636
- return results1;
3637
- })()
3819
+ parameters: newParameterList,
3820
+ children: parameters.children.map(($20) => $20 === parameterList ? newParameterList : $20)
3638
3821
  };
3639
3822
  expression = {
3640
3823
  ...expression,
3641
3824
  parameters: newParameters,
3642
- children: expression.children.map(($17) => $17 === parameters ? newParameters : $17)
3825
+ children: expression.children.map(($21) => $21 === parameters ? newParameters : $21)
3643
3826
  };
3644
3827
  }
3645
3828
  return {
@@ -3661,12 +3844,16 @@ function makeAmpersandFunction(rhs) {
3661
3844
  ref = makeRef("$");
3662
3845
  inplacePrepend(ref, body);
3663
3846
  }
3664
- if (startsWithPredicate(body, ($18) => $18.type === "ObjectExpression")) {
3847
+ if (startsWithPredicate(body, ($22) => $22.type === "ObjectExpression")) {
3665
3848
  body = makeLeftHandSideExpression(body);
3666
3849
  }
3850
+ const parameterList = [
3851
+ typeSuffix ? [ref, typeSuffix] : ref
3852
+ ];
3667
3853
  const parameters = makeNode({
3668
3854
  type: "Parameters",
3669
- children: typeSuffix ? ["(", ref, typeSuffix, ")"] : [ref],
3855
+ children: typeSuffix ? ["(", parameterList, ")"] : [parameterList],
3856
+ parameters: parameterList,
3670
3857
  names: []
3671
3858
  });
3672
3859
  const expressions = [[" ", body]];
@@ -3700,14 +3887,14 @@ function makeAmpersandFunction(rhs) {
3700
3887
  }
3701
3888
  if (gatherRecursiveWithinFunction(
3702
3889
  block,
3703
- (a7) => a7 === ref
3890
+ (a8) => a8 === ref
3704
3891
  ).length > 1) {
3705
3892
  fn.ampersandBlock = false;
3706
3893
  }
3707
3894
  return fn;
3708
3895
  }
3709
3896
 
3710
- // source/parser/block.civet
3897
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\block.civet.jsx
3711
3898
  function blockWithPrefix(prefixStatements, block) {
3712
3899
  if (prefixStatements && prefixStatements.length) {
3713
3900
  const expressions = [...prefixStatements, ...block.expressions];
@@ -3794,10 +3981,8 @@ function getIndent(statement) {
3794
3981
  if (Array.isArray(indent)) {
3795
3982
  indent = indent.flat(Infinity);
3796
3983
  return indent.filter((n) => n && !(n.type === "Comment")).map((n) => {
3797
- if (typeof n === "string")
3798
- return n;
3799
- if (n.token != null)
3800
- return n.token;
3984
+ if (typeof n === "string") return n;
3985
+ if (n.token != null) return n.token;
3801
3986
  return "";
3802
3987
  });
3803
3988
  }
@@ -3925,7 +4110,7 @@ function blockContainingStatement(exp) {
3925
4110
  };
3926
4111
  }
3927
4112
 
3928
- // source/parser/op.civet
4113
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\op.civet.jsx
3929
4114
  var precedenceOrder = [
3930
4115
  ["||", "??"],
3931
4116
  ["^^"],
@@ -3989,7 +4174,7 @@ function processExpandedBinaryOpExpression(expandedOps) {
3989
4174
  while (i < expandedOps.length) {
3990
4175
  let op = expandedOps[i];
3991
4176
  if (op.special) {
3992
- let advanceLeft2 = function(allowEqual) {
4177
+ let advanceLeft = function(allowEqual) {
3993
4178
  while (start >= 4) {
3994
4179
  const prevPrec = getPrecedence(expandedOps[start - 2]);
3995
4180
  if (!(prevPrec > prec || allowEqual && prevPrec === prec)) {
@@ -3998,7 +4183,7 @@ function processExpandedBinaryOpExpression(expandedOps) {
3998
4183
  start -= 4;
3999
4184
  }
4000
4185
  return false;
4001
- }, advanceRight2 = function(allowEqual) {
4186
+ }, advanceRight = function(allowEqual) {
4002
4187
  while (end + 4 < expandedOps.length) {
4003
4188
  const nextPrec = getPrecedence(expandedOps[end + 2]);
4004
4189
  if (!(nextPrec > prec || allowEqual && nextPrec === prec)) {
@@ -4008,24 +4193,23 @@ function processExpandedBinaryOpExpression(expandedOps) {
4008
4193
  }
4009
4194
  return false;
4010
4195
  };
4011
- var advanceLeft = advanceLeft2, advanceRight = advanceRight2;
4012
4196
  let start = i - 2, end = i + 2;
4013
4197
  const prec = getPrecedence(op);
4014
4198
  let error;
4015
4199
  switch (op.assoc) {
4016
4200
  case "left":
4017
4201
  case void 0: {
4018
- advanceLeft2(true);
4019
- advanceRight2(false);
4202
+ advanceLeft(true);
4203
+ advanceRight(false);
4020
4204
  break;
4021
4205
  }
4022
4206
  case "right": {
4023
- advanceLeft2(false);
4024
- advanceRight2(true);
4207
+ advanceLeft(false);
4208
+ advanceRight(true);
4025
4209
  break;
4026
4210
  }
4027
4211
  case "non": {
4028
- if (advanceLeft2(false) || advanceRight2(false)) {
4212
+ if (advanceLeft(false) || advanceRight(false)) {
4029
4213
  error = {
4030
4214
  type: "Error",
4031
4215
  message: `non-associative operator ${op.token} used at same precedence level without parenthesization`
@@ -4035,13 +4219,13 @@ function processExpandedBinaryOpExpression(expandedOps) {
4035
4219
  break;
4036
4220
  }
4037
4221
  case "arguments": {
4038
- if (advanceLeft2(false)) {
4222
+ if (advanceLeft(false)) {
4039
4223
  error = {
4040
4224
  type: "Error",
4041
4225
  message: `arguments operator ${op.token} used at same precedence level as ${expandedOps[start - 2].token} to the left`
4042
4226
  };
4043
4227
  }
4044
- advanceRight2(true);
4228
+ advanceRight(true);
4045
4229
  break;
4046
4230
  }
4047
4231
  default: {
@@ -4125,13 +4309,11 @@ function processExpandedBinaryOpExpression(expandedOps) {
4125
4309
  type = "CallExpression";
4126
4310
  } else if (op.token) {
4127
4311
  children = [a, wsOp, op, wsB, b];
4128
- if (op.negated)
4129
- children = ["(", ...children, ")"];
4312
+ if (op.negated) children = ["(", ...children, ")"];
4130
4313
  } else {
4131
4314
  throw new Error("Unknown operator: " + JSON.stringify(op));
4132
4315
  }
4133
- if (op.negated)
4134
- children.unshift("!");
4316
+ if (op.negated) children.unshift("!");
4135
4317
  if (error != null) {
4136
4318
  children.push(error);
4137
4319
  }
@@ -4264,7 +4446,7 @@ function expandChainedComparisons([first, binops]) {
4264
4446
  }
4265
4447
  }
4266
4448
 
4267
- // source/parser/pattern-matching.civet
4449
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pattern-matching.civet.jsx
4268
4450
  function processPatternTest(lhs, patterns) {
4269
4451
  const { ref, refAssignmentComma } = maybeRefAssignment(lhs, "m");
4270
4452
  const conditionExpression = flatJoin(patterns.map(($1) => getPatternConditions($1, ref)).map(($2) => flatJoin($2, " && ")), " || ");
@@ -4386,8 +4568,7 @@ function processPatternMatching(statements) {
4386
4568
  });
4387
4569
  }
4388
4570
  function getPatternConditions(pattern, ref, conditions = []) {
4389
- if (pattern.rest)
4390
- return conditions;
4571
+ if (pattern.rest) return conditions;
4391
4572
  switch (pattern.type) {
4392
4573
  case "ArrayBindingPattern": {
4393
4574
  const { elements, length } = pattern, hasRest = elements.some((e) => e.rest), l = (length - +hasRest).toString(), lengthCheck = hasRest ? [ref, ".length >= ", l] : [getHelperRef("len"), "(", ref, ", ", l, ")"];
@@ -4498,7 +4679,7 @@ function getPatternConditions(pattern, ref, conditions = []) {
4498
4679
  }
4499
4680
  return conditions;
4500
4681
  }
4501
- function getPatternBlockPrefix(pattern, ref, decl = "const ", suffix) {
4682
+ function getPatternBlockPrefix(pattern, ref, decl = "const ", typeSuffix) {
4502
4683
  switch (pattern.type) {
4503
4684
  case "ArrayBindingPattern": {
4504
4685
  if (!pattern.length) {
@@ -4529,7 +4710,7 @@ function getPatternBlockPrefix(pattern, ref, decl = "const ", suffix) {
4529
4710
  return [
4530
4711
  ["", {
4531
4712
  type: "Declaration",
4532
- children: [decl, patternBindings2, suffix, " = ", ref, ...splices],
4713
+ children: [decl, patternBindings2, typeSuffix, " = ", ref, ...splices],
4533
4714
  names: [],
4534
4715
  bindings: []
4535
4716
  // avoid implicit return of any bindings
@@ -4718,7 +4899,7 @@ function aliasBinding(p, ref) {
4718
4899
  }
4719
4900
  }
4720
4901
 
4721
- // source/parser/declaration.civet
4902
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\declaration.civet.jsx
4722
4903
  function len2(arr, length) {
4723
4904
  return arr.length === length;
4724
4905
  }
@@ -4762,21 +4943,22 @@ function processAssignmentDeclaration(decl, pattern, typeSuffix, ws, assign, e)
4762
4943
  });
4763
4944
  }
4764
4945
  function processDeclarations(statements) {
4765
- gatherRecursiveAll(statements, ($) => $.type === "Declaration").forEach((statement) => {
4766
- const { bindings } = statement;
4767
- return bindings?.forEach((binding) => {
4946
+ for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "Declaration"), i1 = 0, len1 = ref1.length; i1 < len1; i1++) {
4947
+ const declaration = ref1[i1];
4948
+ const { bindings } = declaration;
4949
+ bindings?.forEach((binding) => {
4768
4950
  const { typeSuffix } = binding;
4769
4951
  if (typeSuffix && typeSuffix.optional && typeSuffix.t) {
4770
4952
  convertOptionalType(typeSuffix);
4771
4953
  }
4772
4954
  const { initializer } = binding;
4773
4955
  if (initializer) {
4774
- return prependStatementExpressionBlock(initializer, statement);
4956
+ return prependStatementExpressionBlock(initializer, declaration);
4775
4957
  }
4776
4958
  ;
4777
4959
  return;
4778
4960
  });
4779
- });
4961
+ }
4780
4962
  }
4781
4963
  function prependStatementExpressionBlock(initializer, statement) {
4782
4964
  let { expression: exp } = initializer;
@@ -4946,8 +5128,8 @@ function processDeclarationConditionStatement(s) {
4946
5128
  ({ children } = condition.expression.children[1]);
4947
5129
  }
4948
5130
  children.unshift("(");
4949
- for (let i1 = 0, len1 = conditions.length; i1 < len1; i1++) {
4950
- const c = conditions[i1];
5131
+ for (let i2 = 0, len22 = conditions.length; i2 < len22; i2++) {
5132
+ const c = conditions[i2];
4951
5133
  children.push(" && ", c);
4952
5134
  }
4953
5135
  children.push(")");
@@ -4969,11 +5151,11 @@ function processDeclarationConditionStatement(s) {
4969
5151
  ancestor.expressions.splice(index + 1, 0, ...blockPrefix);
4970
5152
  updateParentPointers(ancestor);
4971
5153
  braceBlock(ancestor);
4972
- let ref1;
5154
+ let ref2;
4973
5155
  switch (s.type) {
4974
5156
  case "IfStatement": {
4975
- if (ref1 = s.else?.block) {
4976
- const elseBlock = ref1;
5157
+ if (ref2 = s.else?.block) {
5158
+ const elseBlock = ref2;
4977
5159
  if (elseBlock.bare && !elseBlock.semicolon) {
4978
5160
  elseBlock.children.push(elseBlock.semicolon = ";");
4979
5161
  }
@@ -5064,11 +5246,11 @@ function processDeclarationConditionStatement(s) {
5064
5246
  function dynamizeFromClause(from) {
5065
5247
  from = from.slice(1);
5066
5248
  from = trimFirstSpace(from);
5067
- let ref2;
5068
- if (ref2 = from[from.length - 1]?.assertion) {
5069
- const assert2 = ref2;
5070
- let ref3;
5071
- ref3 = from[from.length - 1], ref3.children = ref3.children.filter((a2) => a2 !== assert2);
5249
+ let ref3;
5250
+ if (ref3 = from[from.length - 1]?.assertion) {
5251
+ const assert2 = ref3;
5252
+ let ref4;
5253
+ ref4 = from[from.length - 1], ref4.children = ref4.children.filter((a2) => a2 !== assert2);
5072
5254
  from.push(", {", assert2.keyword, ":", assert2.object, "}");
5073
5255
  }
5074
5256
  return ["(", ...from, ")"];
@@ -5077,20 +5259,20 @@ function dynamizeImportDeclaration(decl) {
5077
5259
  const { imports } = decl;
5078
5260
  let { star, binding, specifiers } = imports;
5079
5261
  const justDefault = binding && !specifiers && !star;
5080
- let ref4;
5262
+ let ref5;
5081
5263
  {
5082
5264
  if (binding) {
5083
5265
  if (specifiers) {
5084
- ref4 = makeRef();
5266
+ ref5 = makeRef();
5085
5267
  } else {
5086
- ref4 = binding;
5268
+ ref5 = binding;
5087
5269
  }
5088
5270
  } else {
5089
- ref4 = convertNamedImportsToObject(imports, true);
5271
+ ref5 = convertNamedImportsToObject(imports, true);
5090
5272
  }
5091
5273
  }
5092
5274
  ;
5093
- const pattern = ref4;
5275
+ const pattern = ref5;
5094
5276
  const c = "const";
5095
5277
  const expression = [
5096
5278
  justDefault ? "(" : void 0,
@@ -5213,7 +5395,7 @@ function convertWithClause(withClause, extendsClause) {
5213
5395
  return [extendsToken, insertTrimmingSpace(ws, " "), wrapped];
5214
5396
  }
5215
5397
 
5216
- // source/parser/unary.civet
5398
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\unary.civet.jsx
5217
5399
  function processUnaryExpression(pre, exp, post) {
5218
5400
  if (!(pre.length || post)) {
5219
5401
  return exp;
@@ -5375,7 +5557,7 @@ function processUnaryNestedExpression(pre, args, post) {
5375
5557
  return processUnaryExpression(pre, args, post);
5376
5558
  }
5377
5559
 
5378
- // source/parser/pipe.civet
5560
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pipe.civet.jsx
5379
5561
  function constructInvocation(fn, arg) {
5380
5562
  let expr = fn.expr;
5381
5563
  while (expr.type === "ParenthesizedExpression") {
@@ -5398,11 +5580,9 @@ function constructInvocation(fn, arg) {
5398
5580
  lhs = makeLeftHandSideExpression(lhs);
5399
5581
  }
5400
5582
  let comment = skipIfOnlyWS(fn.trailingComment);
5401
- if (comment)
5402
- lhs.children.push(comment);
5583
+ if (comment) lhs.children.push(comment);
5403
5584
  comment = skipIfOnlyWS(fn.leadingComment);
5404
- if (comment)
5405
- lhs.children.splice(1, 0, comment);
5585
+ if (comment) lhs.children.splice(1, 0, comment);
5406
5586
  switch (arg.type) {
5407
5587
  case "CommaExpression": {
5408
5588
  arg = makeLeftHandSideExpression(arg);
@@ -5491,27 +5671,26 @@ function processPipelineExpressions(statements) {
5491
5671
  let initRef;
5492
5672
  if (i2 === 0) {
5493
5673
  checkValidLHS(arg);
5494
- outer:
5495
- switch (arg.type) {
5496
- case "MemberExpression": {
5497
- if (arg.children.length <= 2) {
5498
- break;
5499
- }
5500
- }
5501
- case "CallExpression": {
5502
- const access = arg.children.pop();
5503
- usingRef = makeRef();
5504
- initRef = {
5505
- type: "AssignmentExpression",
5506
- children: [usingRef, " = ", arg, comma]
5507
- };
5508
- arg = {
5509
- type: "MemberExpression",
5510
- children: [usingRef, access]
5511
- };
5674
+ outer: switch (arg.type) {
5675
+ case "MemberExpression": {
5676
+ if (arg.children.length <= 2) {
5512
5677
  break;
5513
5678
  }
5514
5679
  }
5680
+ case "CallExpression": {
5681
+ const access = arg.children.pop();
5682
+ usingRef = makeRef();
5683
+ initRef = {
5684
+ type: "AssignmentExpression",
5685
+ children: [usingRef, " = ", arg, comma]
5686
+ };
5687
+ arg = {
5688
+ type: "MemberExpression",
5689
+ children: [usingRef, access]
5690
+ };
5691
+ break;
5692
+ }
5693
+ }
5515
5694
  const lhs = [[
5516
5695
  [initRef],
5517
5696
  arg,
@@ -5539,8 +5718,7 @@ function processPipelineExpressions(statements) {
5539
5718
  });
5540
5719
  }
5541
5720
  } else {
5542
- if (i2 === 0)
5543
- s.children = children;
5721
+ if (i2 === 0) s.children = children;
5544
5722
  }
5545
5723
  if (returns && (ref = needsRef(arg))) {
5546
5724
  usingRef = usingRef || ref;
@@ -5604,7 +5782,7 @@ function processPipelineExpressions(statements) {
5604
5782
  });
5605
5783
  }
5606
5784
 
5607
- // source/parser/for.civet
5785
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\for.civet.jsx
5608
5786
  function processRangeExpression(start, ws1, range, end) {
5609
5787
  ws1 = [ws1, range.children[0]];
5610
5788
  const ws2 = range.children[1];
@@ -5627,10 +5805,8 @@ function processRangeExpression(start, ws1, range, end) {
5627
5805
  const abs = ref;
5628
5806
  const lengthAdjust = 1 - Number(!range.left.inclusive) - Number(!range.right.inclusive);
5629
5807
  let ref1;
5630
- if (lengthAdjust > 0)
5631
- ref1 = ` + ${lengthAdjust}`;
5632
- else if (lengthAdjust < 0)
5633
- ref1 = ` - ${-lengthAdjust}`;
5808
+ if (lengthAdjust > 0) ref1 = ` + ${lengthAdjust}`;
5809
+ else if (lengthAdjust < 0) ref1 = ` - ${-lengthAdjust}`;
5634
5810
  else {
5635
5811
  ref1 = void 0;
5636
5812
  }
@@ -5766,10 +5942,8 @@ function forRange(open, forDeclaration, range, stepExp, close) {
5766
5942
  asc = stepValue > 0;
5767
5943
  }
5768
5944
  let ref3;
5769
- if (stepRef)
5770
- ref3 = start;
5771
- else
5772
- ref3 = maybeRef(start, "start");
5945
+ if (stepRef) ref3 = start;
5946
+ else ref3 = maybeRef(start, "start");
5773
5947
  let startRef = ref3;
5774
5948
  let endRef = maybeRef(end, "end");
5775
5949
  const startRefDec = startRef !== start ? [startRef, " = ", start, ", "] : [];
@@ -5946,8 +6120,7 @@ function processForInOf($0) {
5946
6120
  };
5947
6121
  }
5948
6122
  let ws2, decl2;
5949
- if (declaration2)
5950
- [, , ws2, decl2] = declaration2;
6123
+ if (declaration2) [, , ws2, decl2] = declaration2;
5951
6124
  switch (inOf.token) {
5952
6125
  case "of": {
5953
6126
  const counterRef = makeRef("i");
@@ -6012,8 +6185,8 @@ function processForInOf($0) {
6012
6185
  };
6013
6186
  }
6014
6187
 
6015
- // source/parser/auto-dec.civet
6016
- var concatAssign = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
6188
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\auto-dec.civet.jsx
6189
+ var concatAssign2 = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
6017
6190
  function findDecs(statements) {
6018
6191
  const declarations = gatherNodes(statements, ($) => $.type === "Declaration");
6019
6192
  const declarationNames = declarations.flatMap((d) => d.names);
@@ -6068,8 +6241,7 @@ function createConstLetDecs(statements, scopes, letOrConst) {
6068
6241
  }
6069
6242
  continue;
6070
6243
  }
6071
- if (node.names == null)
6072
- continue;
6244
+ if (node.names == null) continue;
6073
6245
  let names = node.names.filter((name) => !hasDec(name));
6074
6246
  if (node.type == "AssignmentExpression") {
6075
6247
  undeclaredIdentifiers.push(...names);
@@ -6105,7 +6277,7 @@ function createVarDecs(block, scopes, pushVar) {
6105
6277
  function findAssignments(statements2, decs2) {
6106
6278
  let assignmentStatements2 = gatherNodes(statements2, ($3) => $3.type === "AssignmentExpression");
6107
6279
  if (assignmentStatements2.length) {
6108
- concatAssign(
6280
+ concatAssign2(
6109
6281
  assignmentStatements2,
6110
6282
  findAssignments(assignmentStatements2.map((s) => s.children), decs2)
6111
6283
  );
@@ -6125,8 +6297,7 @@ function createVarDecs(block, scopes, pushVar) {
6125
6297
  const assignmentStatements = findAssignments(statements, scopes);
6126
6298
  const undeclaredIdentifiers = assignmentStatements.flatMap(($4) => $4?.names || []);
6127
6299
  undeclaredIdentifiers.filter((x, i, a) => {
6128
- if (!hasDec(x))
6129
- return a.indexOf(x) === i;
6300
+ if (!hasDec(x)) return a.indexOf(x) === i;
6130
6301
  return;
6131
6302
  }).forEach(pushVar);
6132
6303
  const fnNodes = gatherNodes(statements, isFunction);
@@ -6162,7 +6333,7 @@ function createVarDecs(block, scopes, pushVar) {
6162
6333
  scopes.pop();
6163
6334
  }
6164
6335
 
6165
- // source/parser/string.civet
6336
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\string.civet.jsx
6166
6337
  function getIndentLevel(str, tab) {
6167
6338
  if (tab != null && tab != 1) {
6168
6339
  const tabs = str.match(/\t/g);
@@ -6330,7 +6501,7 @@ function quoteString(str) {
6330
6501
  return JSON.stringify(str);
6331
6502
  }
6332
6503
 
6333
- // source/parser/lib.civet
6504
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
6334
6505
  var xor = (a, b) => a ? !b && a : b;
6335
6506
  function addPostfixStatement(statement, ws, post) {
6336
6507
  const expressions = [
@@ -6344,8 +6515,7 @@ function addPostfixStatement(statement, ws, post) {
6344
6515
  bare: false
6345
6516
  });
6346
6517
  const children = [...post.children, block];
6347
- if (!isWhitespaceOrEmpty(ws))
6348
- children.push(ws);
6518
+ if (!isWhitespaceOrEmpty(ws)) children.push(ws);
6349
6519
  post = makeNode({ ...post, children, block });
6350
6520
  if (post.type === "IfStatement") {
6351
6521
  post.then = block;
@@ -6417,8 +6587,7 @@ function expressionizeBlock(blockOrExpression) {
6417
6587
  let i1 = 0;
6418
6588
  for (const [ws, s, _delim] of expressions) {
6419
6589
  const i = i1++;
6420
- if (!isExpression(s))
6421
- return;
6590
+ if (!isExpression(s)) return;
6422
6591
  const wrapped = makeLeftHandSideExpression(s);
6423
6592
  if (i === l - 1) {
6424
6593
  results.push([ws, wrapped]);
@@ -6780,8 +6949,7 @@ function processCallMemberExpression(node) {
6780
6949
  prefix = [ref].concat(glob.dot);
6781
6950
  }
6782
6951
  }
6783
- if (wValue)
6784
- value.unshift(wValue);
6952
+ if (wValue) value.unshift(wValue);
6785
6953
  if (part.type === "SpreadProperty") {
6786
6954
  parts.push({
6787
6955
  type: part.type,
@@ -6824,8 +6992,7 @@ function processCallMemberExpression(node) {
6824
6992
  ],
6825
6993
  properties: parts
6826
6994
  };
6827
- if (i === children.length - 1)
6828
- return object;
6995
+ if (i === children.length - 1) return object;
6829
6996
  return processCallMemberExpression({
6830
6997
  // in case there are more
6831
6998
  ...node,
@@ -6966,10 +7133,8 @@ function lastAccessInCallExpression(exp) {
6966
7133
  ;
6967
7134
  ({ children } = exp);
6968
7135
  i = children.length - 1;
6969
- while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"))
6970
- i--;
6971
- if (i < 0)
6972
- return;
7136
+ while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional")) i--;
7137
+ if (i < 0) return;
6973
7138
  } while (children[i].type === "MemberExpression" && (exp = children[i]));
6974
7139
  return children[i];
6975
7140
  }
@@ -7042,8 +7207,7 @@ function convertObjectToJSXAttributes(obj) {
7042
7207
  rest.push(part);
7043
7208
  continue;
7044
7209
  }
7045
- if (i > 0)
7046
- parts.push(" ");
7210
+ if (i > 0) parts.push(" ");
7047
7211
  switch (part.type) {
7048
7212
  case "Identifier": {
7049
7213
  parts.push([part.name, "={", part.name, "}"]);
@@ -7089,16 +7253,16 @@ function makeGetterMethod(name, ws, value, returnType, block, kind = { token: "g
7089
7253
  const { token } = kind;
7090
7254
  ws = trimFirstSpace(ws);
7091
7255
  let setVal;
7092
- const parameters = token === "get" ? {
7093
- type: "Parameters",
7094
- children: ["()"],
7095
- names: [],
7096
- implicit: true
7097
- } : {
7256
+ const parameterList = [];
7257
+ const isGet = token === "get";
7258
+ if (!isGet) {
7259
+ parameterList.push(setVal = makeRef("value"));
7260
+ }
7261
+ const parameters = {
7098
7262
  type: "Parameters",
7099
- children: ["(", setVal = makeRef("value"), ")"],
7100
- names: [],
7101
- implicit: false
7263
+ children: ["(", parameterList, ")"],
7264
+ parameters: parameterList,
7265
+ implicit: isGet
7102
7266
  };
7103
7267
  let expressions;
7104
7268
  if (block) {
@@ -7114,7 +7278,7 @@ function makeGetterMethod(name, ws, value, returnType, block, kind = { token: "g
7114
7278
  };
7115
7279
  }
7116
7280
  if (autoReturn) {
7117
- const finalStatement = token === "get" ? [[expressions[0]?.[0] || "", ws], wrapWithReturn(value)] : [[expressions[0]?.[0] || "", ws], [value, " = ", setVal]];
7281
+ const finalStatement = isGet ? [[expressions[0]?.[0] || "", ws], wrapWithReturn(value)] : [[expressions[0]?.[0] || "", ws], [value, " = ", setVal]];
7118
7282
  expressions.push(finalStatement);
7119
7283
  }
7120
7284
  const children = [kind, " ", name, parameters, returnType, block];
@@ -7143,7 +7307,7 @@ function processBindingPatternLHS(lhs, tail) {
7143
7307
  }
7144
7308
  function processAssignments(statements) {
7145
7309
  for (let ref7 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len3 = ref7.length; i5 < len3; i5++) {
7146
- let extractAssignment2 = function(lhs) {
7310
+ let extractAssignment = function(lhs) {
7147
7311
  let expr = lhs;
7148
7312
  while (expr.type === "ParenthesizedExpression") {
7149
7313
  expr = expr.expression;
@@ -7162,7 +7326,6 @@ function processAssignments(statements) {
7162
7326
  ;
7163
7327
  return;
7164
7328
  };
7165
- var extractAssignment = extractAssignment2;
7166
7329
  const exp = ref7[i5];
7167
7330
  checkValidLHS(exp.assigned);
7168
7331
  const pre = [], post = [];
@@ -7175,7 +7338,7 @@ function processAssignments(statements) {
7175
7338
  for (let ref9 = exp.lhs, i6 = 0, len4 = ref9.length; i6 < len4; i6++) {
7176
7339
  const lhsPart = ref9[i6];
7177
7340
  let ref10;
7178
- if (ref10 = extractAssignment2(lhsPart[1])) {
7341
+ if (ref10 = extractAssignment(lhsPart[1])) {
7179
7342
  const newLhs = ref10;
7180
7343
  lhsPart[1] = newLhs;
7181
7344
  }
@@ -7184,7 +7347,7 @@ function processAssignments(statements) {
7184
7347
  break;
7185
7348
  }
7186
7349
  case "UpdateExpression": {
7187
- if (ref8 = extractAssignment2(exp.assigned)) {
7350
+ if (ref8 = extractAssignment(exp.assigned)) {
7188
7351
  const newLhs = ref8;
7189
7352
  const i = exp.children.indexOf(exp.assigned);
7190
7353
  exp.assigned = exp.children[i] = newLhs;
@@ -7240,13 +7403,11 @@ function processAssignments(statements) {
7240
7403
  }
7241
7404
  }
7242
7405
  if ($1.some(($8) => $8[$8.length - 1].special)) {
7243
- if ($1.length !== 1)
7244
- throw new Error("Only one assignment with id= is allowed");
7406
+ if ($1.length !== 1) throw new Error("Only one assignment with id= is allowed");
7245
7407
  const [, lhs, , op] = $1[0];
7246
7408
  const { call, omitLhs } = op;
7247
7409
  const index = exp.children.indexOf($2);
7248
- if (index < 0)
7249
- throw new Error("Assertion error: exp not in AssignmentExpression");
7410
+ if (index < 0) throw new Error("Assertion error: exp not in AssignmentExpression");
7250
7411
  exp.children.splice(
7251
7412
  index,
7252
7413
  1,
@@ -7297,8 +7458,7 @@ function processAssignments(statements) {
7297
7458
  c[4] = [", ...", $2];
7298
7459
  c[5] = ")";
7299
7460
  lastAssignment.pop();
7300
- if (isWhitespaceOrEmpty(lastAssignment[2]))
7301
- lastAssignment.pop();
7461
+ if (isWhitespaceOrEmpty(lastAssignment[2])) lastAssignment.pop();
7302
7462
  if ($1.length > 1) {
7303
7463
  throw new Error("Not implemented yet! TODO: Handle multiple splice assignments");
7304
7464
  }
@@ -7358,8 +7518,7 @@ function processAssignments(statements) {
7358
7518
  exp.names = $1.flatMap(([, l]) => l.names || []);
7359
7519
  if (tail.length) {
7360
7520
  const index = exp.children.indexOf($2);
7361
- if (index < 0)
7362
- throw new Error("Assertion error: exp not in AssignmentExpression");
7521
+ if (index < 0) throw new Error("Assertion error: exp not in AssignmentExpression");
7363
7522
  exp.children.splice(index + 1, 0, ...tail);
7364
7523
  }
7365
7524
  if (block) {
@@ -7536,10 +7695,8 @@ function processTypes(node) {
7536
7695
  const space = getTrimmingSpace(unary);
7537
7696
  inplaceInsertTrimmingSpace(unary, "");
7538
7697
  let ref16;
7539
- if (unary.suffix.length)
7540
- ref16 = unary;
7541
- else
7542
- ref16 = unary.t;
7698
+ if (unary.suffix.length) ref16 = unary;
7699
+ else ref16 = unary.t;
7543
7700
  const t = ref16;
7544
7701
  const arg = makeNode({
7545
7702
  type: "TypeArgument",
@@ -7615,6 +7772,7 @@ function processStatementExpressions(statements) {
7615
7772
  ;
7616
7773
  break;
7617
7774
  }
7775
+ // else do nothing, handled separately currently
7618
7776
  default: {
7619
7777
  replaceNode(statement, wrapIIFE([["", statement]]), exp);
7620
7778
  }
@@ -7832,8 +7990,7 @@ function populateRefs(statements) {
7832
7990
  const names = new Set(ids.flatMap(({ names: names2 }) => names2 || []));
7833
7991
  refNodes.forEach((ref) => {
7834
7992
  const { type, base } = ref;
7835
- if (type !== "Ref")
7836
- return;
7993
+ if (type !== "Ref") return;
7837
7994
  ref.type = "Identifier";
7838
7995
  let n = 0;
7839
7996
  let name = base;
@@ -8023,8 +8180,7 @@ function reorderBindingRestProperty(props) {
8023
8180
  let restCount = 0;
8024
8181
  props.forEach(({ type }, i) => {
8025
8182
  if (type === "BindingRestProperty") {
8026
- if (restIndex < 0)
8027
- restIndex = i;
8183
+ if (restIndex < 0) restIndex = i;
8028
8184
  return restCount++;
8029
8185
  }
8030
8186
  ;
@@ -9403,10 +9559,8 @@ function NonPipelineExpression(ctx, state2) {
9403
9559
  var NestedExpressionizedStatement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)(EOS), PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, ExpressionizedStatementWithTrailingCallExpressions)), PopIndent, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
9404
9560
  var expression = $3;
9405
9561
  var trailing = $5;
9406
- if (!expression)
9407
- return $skip;
9408
- if (!trailing)
9409
- return expression;
9562
+ if (!expression) return $skip;
9563
+ if (!trailing) return expression;
9410
9564
  return {
9411
9565
  type: "CallExpression",
9412
9566
  children: [expression, ...trailing]
@@ -9416,8 +9570,7 @@ function NestedExpressionizedStatement(ctx, state2) {
9416
9570
  return (0, import_lib2.$EVENT)(ctx, state2, "NestedExpressionizedStatement", NestedExpressionizedStatement$0);
9417
9571
  }
9418
9572
  var ExpressionizedStatementWithTrailingCallExpressions$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ExpressionizedStatement, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2) {
9419
- if (!$2)
9420
- return $1;
9573
+ if (!$2) return $1;
9421
9574
  return {
9422
9575
  type: "CallExpression",
9423
9576
  children: [
@@ -9442,8 +9595,7 @@ function ExpressionizedStatement(ctx, state2) {
9442
9595
  }
9443
9596
  var StatementExpression$0 = DebuggerStatement;
9444
9597
  var StatementExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(IfStatement), function($skip, $loc, $0, $1) {
9445
- if (!$1.else && $1.then.implicit)
9446
- return $skip;
9598
+ if (!$1.else && $1.then.implicit) return $skip;
9447
9599
  return $1;
9448
9600
  });
9449
9601
  var StatementExpression$2 = IterationExpression;
@@ -9455,8 +9607,7 @@ function StatementExpression(ctx, state2) {
9455
9607
  return (0, import_lib2.$EVENT_C)(ctx, state2, "StatementExpression", StatementExpression$$);
9456
9608
  }
9457
9609
  var CommaExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(AssignmentExpression, (0, import_lib2.$Q)((0, import_lib2.$S)(CommaDelimiter, AssignmentExpression))), function($skip, $loc, $0, $1, $2) {
9458
- if ($2.length == 0)
9459
- return $1;
9610
+ if ($2.length == 0) return $1;
9460
9611
  return $0;
9461
9612
  });
9462
9613
  function CommaExpression(ctx, state2) {
@@ -9465,8 +9616,7 @@ function CommaExpression(ctx, state2) {
9465
9616
  var Arguments$0 = ExplicitArguments;
9466
9617
  var Arguments$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidTrailingMemberProperty, (0, import_lib2.$E)(ImplicitArguments), RestoreTrailingMemberProperty), function($skip, $loc, $0, $1, $2, $3) {
9467
9618
  var args = $2;
9468
- if (args)
9469
- return args;
9619
+ if (args) return args;
9470
9620
  return $skip;
9471
9621
  });
9472
9622
  var Arguments$$ = [Arguments$0, Arguments$1];
@@ -9478,10 +9628,8 @@ var ImplicitArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ApplicationSt
9478
9628
  var ws = $3;
9479
9629
  var args = $6;
9480
9630
  var close = $9;
9481
- if (!args)
9482
- return $skip;
9483
- if (skipImplicitArguments(args))
9484
- return $skip;
9631
+ if (!args) return $skip;
9632
+ if (skipImplicitArguments(args)) return $skip;
9485
9633
  return {
9486
9634
  type: "Call",
9487
9635
  args,
@@ -9527,14 +9675,12 @@ var ForbiddenImplicitCalls$3 = (0, import_lib2.$S)(ClassImplicitCallForbidden, (
9527
9675
  var ForbiddenImplicitCalls$4 = (0, import_lib2.$S)(Identifier, (0, import_lib2.$EXPECT)($L3, 'ForbiddenImplicitCalls "="'), Whitespace);
9528
9676
  var ForbiddenImplicitCalls$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(Identifier, (0, import_lib2.$N)((0, import_lib2.$EXPECT)($L4, 'ForbiddenImplicitCalls "("'))), function($skip, $loc, $0, $1, $2) {
9529
9677
  var id = $1;
9530
- if (state.operators.has(id.name))
9531
- return $0;
9678
+ if (state.operators.has(id.name)) return $0;
9532
9679
  return $skip;
9533
9680
  });
9534
9681
  var ForbiddenImplicitCalls$6 = (0, import_lib2.$TS)((0, import_lib2.$S)(OmittedNegation, (0, import_lib2.$E)(_), Identifier), function($skip, $loc, $0, $1, $2, $3) {
9535
9682
  var id = $3;
9536
- if (state.operators.has(id.name))
9537
- return $0;
9683
+ if (state.operators.has(id.name)) return $0;
9538
9684
  return $skip;
9539
9685
  });
9540
9686
  var ForbiddenImplicitCalls$7 = (0, import_lib2.$S)(PostfixStatement, NoBlock);
@@ -9557,18 +9703,15 @@ function ArgumentsWithTrailingCallExpressions(ctx, state2) {
9557
9703
  }
9558
9704
  var TrailingCallExpressions$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Q)(ExplicitCallExpressionRest), (0, import_lib2.$E)(IndentedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2) {
9559
9705
  $1 = $1.flat();
9560
- if (!$1.length && !$2)
9561
- return $skip;
9562
- if (!$2)
9563
- return $1;
9706
+ if (!$1.length && !$2) return $skip;
9707
+ if (!$2) return $1;
9564
9708
  return [...$1, ...$2];
9565
9709
  });
9566
9710
  function TrailingCallExpressions(ctx, state2) {
9567
9711
  return (0, import_lib2.$EVENT)(ctx, state2, "TrailingCallExpressions", TrailingCallExpressions$0);
9568
9712
  }
9569
9713
  var IndentedTrailingCallExpressions$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedTrailingCallExpression), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
9570
- if (!$2.length)
9571
- return $skip;
9714
+ if (!$2.length) return $skip;
9572
9715
  return $2.flat();
9573
9716
  });
9574
9717
  var IndentedTrailingCallExpressions$1 = (0, import_lib2.$TV)((0, import_lib2.$P)(NestedTrailingCallExpression), function($skip, $loc, $0, $1) {
@@ -9616,8 +9759,7 @@ var ArgumentList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N
9616
9759
  ];
9617
9760
  });
9618
9761
  var ArgumentList$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(NestedArguments, (0, import_lib2.$Q)((0, import_lib2.$S)(OptionalCommaDelimiter, NestedArguments))), function($skip, $loc, $0, $1, $2) {
9619
- if (!Array.isArray($1))
9620
- $1 = [$1];
9762
+ if (!Array.isArray($1)) $1 = [$1];
9621
9763
  return [
9622
9764
  ...trimFirstSpace($1),
9623
9765
  ...$2.flatMap(
@@ -9644,8 +9786,7 @@ function NestedArguments(ctx, state2) {
9644
9786
  }
9645
9787
  var NestedArgumentList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, AllowPipeline, AllowTrailingMemberProperty, (0, import_lib2.$Q)(NestedArgument), RestoreTrailingMemberProperty, RestorePipeline, PopIndent), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
9646
9788
  var args = $4;
9647
- if (!args.length)
9648
- return $skip;
9789
+ if (!args.length) return $skip;
9649
9790
  return stripTrailingImplicitComma(args.flat());
9650
9791
  });
9651
9792
  function NestedArgumentList(ctx, state2) {
@@ -9699,8 +9840,7 @@ function ArgumentPart(ctx, state2) {
9699
9840
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ArgumentPart", ArgumentPart$$);
9700
9841
  }
9701
9842
  var BinaryOpExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UnaryExpression, (0, import_lib2.$Q)(BinaryOpRHS)), function($skip, $loc, $0, $1, $2) {
9702
- if (!$2.length)
9703
- return $1;
9843
+ if (!$2.length) return $1;
9704
9844
  return processBinaryOpExpression($0);
9705
9845
  });
9706
9846
  function BinaryOpExpression(ctx, state2) {
@@ -9754,8 +9894,7 @@ function IsLike(ctx, state2) {
9754
9894
  }
9755
9895
  var WRHS$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$S)(Nested, (0, import_lib2.$E)(_)), RHS)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
9756
9896
  var wrhs = $2;
9757
- if (!wrhs)
9758
- return $skip;
9897
+ if (!wrhs) return $skip;
9759
9898
  return wrhs;
9760
9899
  });
9761
9900
  var WRHS$1 = (0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$S)(EOS, __), _), RHS);
@@ -9817,8 +9956,7 @@ function UnaryBody(ctx, state2) {
9817
9956
  return (0, import_lib2.$EVENT_C)(ctx, state2, "UnaryBody", UnaryBody$$);
9818
9957
  }
9819
9958
  var MaybeNestedCoffeeDoBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, CoffeeDoBody)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
9820
- if (!$2)
9821
- return $skip;
9959
+ if (!$2) return $skip;
9822
9960
  return $2;
9823
9961
  });
9824
9962
  var MaybeNestedCoffeeDoBody$1 = (0, import_lib2.$S)((0, import_lib2.$E)(_), CoffeeDoBody);
@@ -9907,8 +10045,7 @@ var UpdateExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UpdateExpressi
9907
10045
  };
9908
10046
  });
9909
10047
  var UpdateExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(LeftHandSideExpression, (0, import_lib2.$E)((0, import_lib2.$S)(UpdateExpressionSymbol, (0, import_lib2.$EXPECT)($R4, "UpdateExpression /(?!\\p{ID_Start}|[_$0-9(\\[{])/")))), function($skip, $loc, $0, $1, $2) {
9910
- if (!$2)
9911
- return $1;
10048
+ if (!$2) return $1;
9912
10049
  return {
9913
10050
  type: "UpdateExpression",
9914
10051
  assigned: $1,
@@ -10041,14 +10178,14 @@ var ArrowFunction$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$
10041
10178
  var returnType = $3;
10042
10179
  var arrow = $4;
10043
10180
  var expOrBlock = $5;
10044
- if (!async)
10045
- async = [];
10181
+ if (!async) async = [];
10046
10182
  return {
10047
10183
  type: "ArrowFunction",
10048
10184
  signature: {
10049
10185
  modifier: {
10050
10186
  async: !!async.length
10051
10187
  },
10188
+ parameters,
10052
10189
  returnType
10053
10190
  },
10054
10191
  parameters,
@@ -10065,8 +10202,7 @@ function ArrowFunction(ctx, state2) {
10065
10202
  var FatArrow$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), FatArrowToken), function($skip, $loc, $0, $1, $2) {
10066
10203
  var ws = $1;
10067
10204
  var arrow = $2;
10068
- if (!ws)
10069
- ws = " ";
10205
+ if (!ws) ws = " ";
10070
10206
  return [ws, arrow];
10071
10207
  });
10072
10208
  function FatArrow(ctx, state2) {
@@ -10133,8 +10269,7 @@ function TernaryRest(ctx, state2) {
10133
10269
  }
10134
10270
  var NestedTernaryRest$0 = (0, import_lib2.$S)(Nested, QuestionMark, MaybeNestedExpression, Nested, Colon, MaybeNestedExpression);
10135
10271
  var NestedTernaryRest$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, QuestionMark, MaybeNestedExpression, Nested, Colon, MaybeNestedExpression)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
10136
- if ($2)
10137
- return $2;
10272
+ if ($2) return $2;
10138
10273
  return $skip;
10139
10274
  });
10140
10275
  var NestedTernaryRest$$ = [NestedTernaryRest$0, NestedTernaryRest$1];
@@ -10173,8 +10308,7 @@ function PipelineExpression(ctx, state2) {
10173
10308
  var PipelineExpressionBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PipelineExpressionBodySameLine, PushIndent, (0, import_lib2.$Q)((0, import_lib2.$S)((0, import_lib2.$S)(Nested, Pipe, __, PipelineTailItem), PipelineExpressionBodySameLine)), PopIndent), function($skip, $loc, $0, $1, $2, $3, $4) {
10174
10309
  var first = $1;
10175
10310
  var rest = $3;
10176
- if (!rest.length)
10177
- return $skip;
10311
+ if (!rest.length) return $skip;
10178
10312
  return [
10179
10313
  ...first,
10180
10314
  ...rest.map(([nested, line]) => [nested, ...line]).flat()
@@ -10237,8 +10371,7 @@ var OptimizedParenthesizedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S
10237
10371
  const { expression } = $1;
10238
10372
  switch (expression.type) {
10239
10373
  case "StatementExpression":
10240
- if (expression.statement.type !== "IterationExpression")
10241
- break;
10374
+ if (expression.statement.type !== "IterationExpression") break;
10242
10375
  case "IterationExpression":
10243
10376
  return expression;
10244
10377
  }
@@ -10249,8 +10382,7 @@ function OptimizedParenthesizedExpression(ctx, state2) {
10249
10382
  }
10250
10383
  var ParenthesizedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(PostfixedCommaExpression, __, CloseParen)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
10251
10384
  var open = $1;
10252
- if (!$3)
10253
- return $skip;
10385
+ if (!$3) return $skip;
10254
10386
  const [expression, ws, close] = $3;
10255
10387
  if (expression.type === "ParenthesizedExpression" && expression.implicit) {
10256
10388
  return {
@@ -10308,8 +10440,7 @@ function PlaceholderTypeSuffix(ctx, state2) {
10308
10440
  return (0, import_lib2.$EVENT)(ctx, state2, "PlaceholderTypeSuffix", PlaceholderTypeSuffix$0);
10309
10441
  }
10310
10442
  var ClassDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ClassExpression), function($skip, $loc, $0, $1) {
10311
- if ($1.id)
10312
- return $1;
10443
+ if ($1.id) return $1;
10313
10444
  return makeLeftHandSideExpression($1);
10314
10445
  });
10315
10446
  function ClassDeclaration(ctx, state2) {
@@ -10354,10 +10485,8 @@ var ClassHeritage$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ExtendsClause, (0
10354
10485
  var ClassHeritage$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(WithClause), (0, import_lib2.$E)(ImplementsClause)), function($skip, $loc, $0, $1, $2) {
10355
10486
  var withClause = $1;
10356
10487
  var implementsClause = $2;
10357
- if (withClause)
10358
- return [convertWithClause(withClause), implementsClause];
10359
- if (implementsClause)
10360
- return implementsClause;
10488
+ if (withClause) return [convertWithClause(withClause), implementsClause];
10489
+ if (implementsClause) return implementsClause;
10361
10490
  return $skip;
10362
10491
  });
10363
10492
  var ClassHeritage$$ = [ClassHeritage$0, ClassHeritage$1];
@@ -10492,8 +10621,7 @@ var ClassBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, OpenBrace, AllowA
10492
10621
  var expressions = $4;
10493
10622
  var ws2 = $6;
10494
10623
  var close = $7;
10495
- if (!expressions)
10496
- expressions = [];
10624
+ if (!expressions) expressions = [];
10497
10625
  return {
10498
10626
  type: "BlockStatement",
10499
10627
  subtype: "ClassBody",
@@ -10503,8 +10631,7 @@ var ClassBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, OpenBrace, AllowA
10503
10631
  });
10504
10632
  var ClassBody$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBrace, (0, import_lib2.$E)(NestedClassElements), InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
10505
10633
  var expressions = $2;
10506
- if (!expressions)
10507
- expressions = $0[1] = [];
10634
+ if (!expressions) expressions = $0[1] = [];
10508
10635
  return {
10509
10636
  type: "BlockStatement",
10510
10637
  subtype: "ClassBody",
@@ -10519,8 +10646,7 @@ function ClassBody(ctx, state2) {
10519
10646
  var ClassBracedContent$0 = NestedClassElements;
10520
10647
  var ClassBracedContent$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidNewlineBinaryOp, (0, import_lib2.$Q)((0, import_lib2.$S)((0, import_lib2.$S)((0, import_lib2.$E)(_), (0, import_lib2.$N)(EOS)), ClassElement, StatementDelimiter)), RestoreNewlineBinaryOp), function($skip, $loc, $0, $1, $2, $3) {
10521
10648
  var stmts = $2;
10522
- if (!stmts)
10523
- return $skip;
10649
+ if (!stmts) return $skip;
10524
10650
  return stmts;
10525
10651
  });
10526
10652
  var ClassBracedContent$$ = [ClassBracedContent$0, ClassBracedContent$1];
@@ -10529,8 +10655,7 @@ function ClassBracedContent(ctx, state2) {
10529
10655
  }
10530
10656
  var NestedClassElements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedClassElement), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
10531
10657
  var elements = $2;
10532
- if (!elements.length)
10533
- return $skip;
10658
+ if (!elements.length) return $skip;
10534
10659
  return elements;
10535
10660
  });
10536
10661
  function NestedClassElements(ctx, state2) {
@@ -10588,8 +10713,7 @@ function ClassSignatureBody(ctx, state2) {
10588
10713
  }
10589
10714
  var NestedClassSignatureElements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedClassSignatureElement), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
10590
10715
  var elements = $2;
10591
- if (!elements.length)
10592
- return $skip;
10716
+ if (!elements.length) return $skip;
10593
10717
  return elements;
10594
10718
  });
10595
10719
  function NestedClassSignatureElements(ctx, state2) {
@@ -10606,8 +10730,7 @@ function ClassSignatureElement(ctx, state2) {
10606
10730
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ClassSignatureElement", ClassSignatureElement$$);
10607
10731
  }
10608
10732
  var AccessModifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$C)(Public, Private, Protected), NotDedented)), (0, import_lib2.$E)((0, import_lib2.$S)(Readonly, NotDedented))), function($skip, $loc, $0, $1, $2) {
10609
- if (!($1 || $2))
10610
- return $skip;
10733
+ if (!($1 || $2)) return $skip;
10611
10734
  return {
10612
10735
  ts: true,
10613
10736
  children: $0
@@ -10620,6 +10743,7 @@ var FieldDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeClassesEn
10620
10743
  var id = $2;
10621
10744
  var exp = $6;
10622
10745
  switch (exp.type) {
10746
+ // TODO: => functions
10623
10747
  case "FunctionExpression":
10624
10748
  const fnTokenIndex = exp.children.findIndex((c) => c?.token?.startsWith("function"));
10625
10749
  const children = exp.children.slice();
@@ -10703,8 +10827,7 @@ var HashThis$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(At
10703
10827
  var at = $1;
10704
10828
  var id = $2;
10705
10829
  var beforeIn = $3;
10706
- if (beforeIn != null && at == null)
10707
- return ['"', id.name, '"'];
10830
+ if (beforeIn != null && at == null) return ['"', id.name, '"'];
10708
10831
  return {
10709
10832
  type: "MemberExpression",
10710
10833
  children: [at ?? "this", {
@@ -10831,8 +10954,7 @@ var CallExpressionRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
10831
10954
  var CallExpressionRest$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ArgumentsWithTrailingCallExpressions), function($skip, $loc, $0, $1, $2) {
10832
10955
  var optional = $1;
10833
10956
  var argsWithTrailing = $2;
10834
- if (!optional)
10835
- return argsWithTrailing;
10957
+ if (!optional) return argsWithTrailing;
10836
10958
  const call = argsWithTrailing[0];
10837
10959
  return [{
10838
10960
  ...call,
@@ -10858,8 +10980,7 @@ var ExplicitCallExpressionRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0,
10858
10980
  var ExplicitCallExpressionRest$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
10859
10981
  var optional = $1;
10860
10982
  var call = $2;
10861
- if (!optional)
10862
- return call;
10983
+ if (!optional) return call;
10863
10984
  return {
10864
10985
  ...call,
10865
10986
  children: [optional, ...call.children],
@@ -10927,8 +11048,7 @@ function MemberBase(ctx, state2) {
10927
11048
  var MemberExpressionRest$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R10, "MemberExpressionRest /(?=[\\/\\[{?.!@#'\u2019:])/"), (0, import_lib2.$Q)(InlineComment), MemberExpressionRestBody), function($skip, $loc, $0, $1, $2, $3) {
10928
11049
  var comments = $2;
10929
11050
  var body = $3;
10930
- if (Array.isArray(body))
10931
- return [...comments, ...body];
11051
+ if (Array.isArray(body)) return [...comments, ...body];
10932
11052
  return {
10933
11053
  ...body,
10934
11054
  children: [...comments, ...body.children]
@@ -10941,8 +11061,7 @@ var MemberExpressionRestBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, im
10941
11061
  var dot = $1;
10942
11062
  var comments = $2;
10943
11063
  var content = $3;
10944
- if (!dot && !comments.length)
10945
- return content;
11064
+ if (!dot && !comments.length) return content;
10946
11065
  if (dot) {
10947
11066
  if (dot.type === "Optional" && content.type === "SliceExpression") {
10948
11067
  return [...dot.children.slice(0, -1), ...comments, content];
@@ -11039,8 +11158,7 @@ var SliceParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Loc, (0, import
11039
11158
  const inc = [];
11040
11159
  if (dots.right.inclusive) {
11041
11160
  end = [makeLeftHandSideExpression(end), ` ${sign} 1`];
11042
- if (!reversed)
11043
- inc.push(" || 1/0");
11161
+ if (!reversed) inc.push(" || 1/0");
11044
11162
  }
11045
11163
  children = [start, [...ws, dots.children[0], { token: ", ", $loc: dots.$loc }], [dots.children[1], end, ...inc]];
11046
11164
  } else {
@@ -11291,10 +11409,12 @@ var Parameters$0 = NonEmptyParameters;
11291
11409
  var Parameters$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(TypeParameters), Loc), function($skip, $loc, $0, $1, $2) {
11292
11410
  var tp = $1;
11293
11411
  var p = $2;
11412
+ const parameters = [];
11294
11413
  return {
11295
11414
  type: "Parameters",
11296
- children: [tp, { $loc: p.$loc, token: "()" }],
11415
+ children: [tp, { $loc: p.$loc, token: "(" }, parameters, ")"],
11297
11416
  tp,
11417
+ parameters,
11298
11418
  names: [],
11299
11419
  implicit: true
11300
11420
  };
@@ -11317,10 +11437,11 @@ function ShortArrowParameters(ctx, state2) {
11317
11437
  return (0, import_lib2.$EVENT)(ctx, state2, "ShortArrowParameters", ShortArrowParameters$0);
11318
11438
  }
11319
11439
  var ArrowParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ShortArrowParameters), function($skip, $loc, $0, $1) {
11440
+ const parameters = [$1];
11320
11441
  return {
11321
11442
  type: "Parameters",
11322
- children: ["(", $1, ")"],
11323
- names: $1.names
11443
+ children: ["(", parameters, ")"],
11444
+ parameters
11324
11445
  };
11325
11446
  });
11326
11447
  var ArrowParameters$1 = Parameters;
@@ -11331,83 +11452,13 @@ function ArrowParameters(ctx, state2) {
11331
11452
  var NonEmptyParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(TypeParameters), OpenParen, ParameterList, (0, import_lib2.$S)(__, CloseParen)), function($skip, $loc, $0, $1, $2, $3, $4) {
11332
11453
  var tp = $1;
11333
11454
  var open = $2;
11334
- var params = $3;
11455
+ var parameters = $3;
11335
11456
  var close = $4;
11336
- let tt, before = [], rest, after = [], errors = [];
11337
- function append2(p) {
11338
- (rest ? after : before).push(p);
11339
- }
11340
- for (const param of params) {
11341
- switch (param.type) {
11342
- case "ThisType":
11343
- if (tt) {
11344
- append2({
11345
- type: "Error",
11346
- message: "Only one typed this parameter is allowed"
11347
- });
11348
- append2(param);
11349
- } else {
11350
- tt = trimFirstSpace(param);
11351
- if (before.length || rest) {
11352
- let delim = tt.children.at(-1);
11353
- if (Array.isArray(delim))
11354
- delim = delim.at(-1);
11355
- if (delim?.token !== ",") {
11356
- tt = {
11357
- ...tt,
11358
- children: [...tt.children, ", "]
11359
- };
11360
- }
11361
- }
11362
- }
11363
- break;
11364
- case "FunctionRestParameter":
11365
- if (rest) {
11366
- append2({
11367
- type: "Error",
11368
- message: "Only one rest parameter is allowed"
11369
- });
11370
- append2(param);
11371
- } else {
11372
- rest = param;
11373
- }
11374
- break;
11375
- default:
11376
- append2(param);
11377
- }
11378
- }
11379
- const names = before.flatMap((p) => p.names);
11380
- if (rest) {
11381
- const restIdentifier = rest.binding.ref || rest.binding;
11382
- names.push(...rest.names || []);
11383
- let blockPrefix;
11384
- if (after.length) {
11385
- blockPrefix = {
11386
- children: ["[", trimFirstSpace(after), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
11387
- names: after.flatMap((p) => p.names)
11388
- };
11389
- }
11390
- return {
11391
- type: "Parameters",
11392
- children: [
11393
- tp,
11394
- open,
11395
- tt,
11396
- ...before,
11397
- // Remove delimiter
11398
- { ...rest, children: rest.children.slice(0, -1) },
11399
- close
11400
- ],
11401
- tp,
11402
- names,
11403
- blockPrefix
11404
- };
11405
- }
11406
11457
  return {
11407
11458
  type: "Parameters",
11408
- children: [tp, open, tt, ...before, close],
11409
- names,
11410
- tp
11459
+ children: [tp, open, parameters, close],
11460
+ tp,
11461
+ parameters
11411
11462
  };
11412
11463
  });
11413
11464
  function NonEmptyParameters(ctx, state2) {
@@ -11428,8 +11479,7 @@ function ParameterList(ctx, state2) {
11428
11479
  }
11429
11480
  var NestedParameterList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedParameter), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
11430
11481
  var params = $2;
11431
- if (!params.length)
11432
- return $skip;
11482
+ if (!params.length) return $skip;
11433
11483
  return params;
11434
11484
  });
11435
11485
  function NestedParameterList(ctx, state2) {
@@ -11453,12 +11503,15 @@ function Parameter(ctx, state2) {
11453
11503
  return (0, import_lib2.$EVENT_C)(ctx, state2, "Parameter", Parameter$$);
11454
11504
  }
11455
11505
  var FunctionRestParameter$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(EOS), BindingRestElement, (0, import_lib2.$E)(TypeSuffix), ParameterElementDelimiter), function($skip, $loc, $0, $1, $2, $3, $4) {
11456
- var id = $2;
11506
+ var rest = $2;
11507
+ var typeSuffix = $3;
11457
11508
  return {
11458
11509
  type: "FunctionRestParameter",
11459
11510
  children: $0.slice(1),
11460
- names: id.names,
11461
- binding: id.binding
11511
+ rest,
11512
+ names: rest.names,
11513
+ binding: rest.binding,
11514
+ typeSuffix
11462
11515
  };
11463
11516
  });
11464
11517
  function FunctionRestParameter(ctx, state2) {
@@ -11606,8 +11659,7 @@ function ObjectBindingPattern(ctx, state2) {
11606
11659
  var ObjectBindingPatternContent$0 = NestedBindingProperties;
11607
11660
  var ObjectBindingPatternContent$1 = (0, import_lib2.$TV)((0, import_lib2.$E)(BindingPropertyList), function($skip, $loc, $0, $1) {
11608
11661
  var props = $0;
11609
- if (!props)
11610
- return { children: [], names: [] };
11662
+ if (!props) return { children: [], names: [] };
11611
11663
  return reorderBindingRestProperty(props);
11612
11664
  });
11613
11665
  var ObjectBindingPatternContent$$ = [ObjectBindingPatternContent$0, ObjectBindingPatternContent$1];
@@ -11647,8 +11699,7 @@ function ArrayBindingPattern(ctx, state2) {
11647
11699
  var ArrayBindingPatternContent$0 = NestedBindingElements;
11648
11700
  var ArrayBindingPatternContent$1 = (0, import_lib2.$TV)((0, import_lib2.$E)(BindingElementList), function($skip, $loc, $0, $1) {
11649
11701
  var elements = $0;
11650
- if (!elements)
11651
- return { children: [], names: [], length: 0 };
11702
+ if (!elements) return { children: [], names: [], length: 0 };
11652
11703
  return adjustBindingElements(elements);
11653
11704
  });
11654
11705
  var ArrayBindingPatternContent$$ = [ArrayBindingPatternContent$0, ArrayBindingPatternContent$1];
@@ -11673,8 +11724,7 @@ var NestedBindingElementList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested
11673
11724
  var indent = $1;
11674
11725
  var elements = $2;
11675
11726
  return elements.map((element, i) => {
11676
- if (i > 0)
11677
- return element;
11727
+ if (i > 0) return element;
11678
11728
  return {
11679
11729
  ...element,
11680
11730
  children: [indent, ...element.children.slice(1)]
@@ -11691,8 +11741,7 @@ function Elision(ctx, state2) {
11691
11741
  }
11692
11742
  var NestedBindingProperties$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedBindingPropertyList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
11693
11743
  var props = $2;
11694
- if (!props.length)
11695
- return $skip;
11744
+ if (!props.length) return $skip;
11696
11745
  return reorderBindingRestProperty(props.flat());
11697
11746
  });
11698
11747
  function NestedBindingProperties(ctx, state2) {
@@ -11702,8 +11751,7 @@ var NestedBindingPropertyList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Neste
11702
11751
  var ws = $1;
11703
11752
  var props = $2;
11704
11753
  return props.map((prop, i) => {
11705
- if (i > 0)
11706
- return prop;
11754
+ if (i > 0) return prop;
11707
11755
  return prepend(ws, prop);
11708
11756
  });
11709
11757
  });
@@ -11828,8 +11876,7 @@ function BindingTypeSuffix(ctx, state2) {
11828
11876
  }
11829
11877
  var NestedBindingElements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedBindingElementList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
11830
11878
  var elements = $2;
11831
- if (!elements.length)
11832
- return $skip;
11879
+ if (!elements.length) return $skip;
11833
11880
  return adjustBindingElements(elements.flat());
11834
11881
  });
11835
11882
  function NestedBindingElements(ctx, state2) {
@@ -11868,7 +11915,7 @@ var BindingRestElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
11868
11915
  var typeSuffix = $4;
11869
11916
  return {
11870
11917
  type: "BindingRestElement",
11871
- children: [ws, [dots, binding]],
11918
+ children: [ws, dots, binding],
11872
11919
  dots,
11873
11920
  binding,
11874
11921
  typeSuffix,
@@ -11908,10 +11955,8 @@ function EmptyBindingPattern(ctx, state2) {
11908
11955
  return (0, import_lib2.$EVENT)(ctx, state2, "EmptyBindingPattern", EmptyBindingPattern$0);
11909
11956
  }
11910
11957
  var FunctionDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(FunctionExpression), function($skip, $loc, $0, $1) {
11911
- if ($1.type !== "FunctionExpression")
11912
- return $skip;
11913
- if ($1.id)
11914
- return $1;
11958
+ if ($1.type !== "FunctionExpression") return $skip;
11959
+ if ($1.id) return $1;
11915
11960
  return makeLeftHandSideExpression($1);
11916
11961
  });
11917
11962
  function FunctionDeclaration(ctx, state2) {
@@ -11925,10 +11970,8 @@ var FunctionSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
11925
11970
  var w = $5;
11926
11971
  var parameters = $6;
11927
11972
  var returnType = $7;
11928
- if (!async)
11929
- async = [];
11930
- if (!generator)
11931
- generator = [];
11973
+ if (!async) async = [];
11974
+ if (!generator) generator = [];
11932
11975
  const id = wid?.[1];
11933
11976
  return {
11934
11977
  type: "FunctionSignature",
@@ -11973,16 +12016,16 @@ var FunctionExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
11973
12016
  var open = $2;
11974
12017
  var op = $3;
11975
12018
  var close = $4;
11976
- if (op.special && op.call && !op.negated)
11977
- return op.call;
12019
+ if (op.special && op.call && !op.negated) return op.call;
11978
12020
  const refA = makeRef("a"), refB = makeRef("b"), body = processBinaryOpExpression([refA, [
11979
12021
  [[], op, [], refB]
11980
12022
  // BinaryOpRHS
11981
12023
  ]]);
12024
+ const parameterList = [[refA, ","], refB];
11982
12025
  const parameters = {
11983
12026
  type: "Parameters",
11984
- children: ["(", refA, ",", refB, ")"],
11985
- names: []
12027
+ children: ["(", parameterList, ")"],
12028
+ parameters: parameterList
11986
12029
  };
11987
12030
  const block = {
11988
12031
  expressions: [body]
@@ -12143,10 +12186,8 @@ var OperatorSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
12143
12186
  var w2 = $8;
12144
12187
  var parameters = $9;
12145
12188
  var returnType = $10;
12146
- if (!async)
12147
- async = [];
12148
- if (!generator)
12149
- generator = [];
12189
+ if (!async) async = [];
12190
+ if (!generator) generator = [];
12150
12191
  if (!func) {
12151
12192
  func = { $loc: op.$loc, token: "function" };
12152
12193
  } else {
@@ -12215,8 +12256,7 @@ var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
12215
12256
  var returnType = $3;
12216
12257
  var arrow = $5;
12217
12258
  var block = $6;
12218
- if (!async)
12219
- async = [];
12259
+ if (!async) async = [];
12220
12260
  const generator = [];
12221
12261
  return {
12222
12262
  type: "FunctionExpression",
@@ -12261,8 +12301,7 @@ var ExplicitBlock$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$
12261
12301
  var block = $4;
12262
12302
  var ws2 = $6;
12263
12303
  var close = $7;
12264
- if (!block)
12265
- return $skip;
12304
+ if (!block) return $skip;
12266
12305
  return {
12267
12306
  ...block,
12268
12307
  children: [ws1, open, ...block.children, ws2, close],
@@ -12275,8 +12314,7 @@ var ExplicitBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(IndentedAtLeast,
12275
12314
  var block = $4;
12276
12315
  var ws2 = $6;
12277
12316
  var close = $7;
12278
- if (!block)
12279
- return $skip;
12317
+ if (!block) return $skip;
12280
12318
  return {
12281
12319
  ...block,
12282
12320
  children: [ws1, open, ...block.children, ws2, close],
@@ -12301,8 +12339,7 @@ function EmptyBracedContent(ctx, state2) {
12301
12339
  }
12302
12340
  var ImplicitNestedBlock$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)(EOS), InsertOpenBrace, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(NestedBlockStatements, InsertNewline, InsertIndent, InsertCloseBrace)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
12303
12341
  var open = $2;
12304
- if (!$4)
12305
- return $skip;
12342
+ if (!$4) return $skip;
12306
12343
  const [block, ...tail] = $4;
12307
12344
  return {
12308
12345
  ...block,
@@ -12332,8 +12369,7 @@ function Block(ctx, state2) {
12332
12369
  return (0, import_lib2.$EVENT_C)(ctx, state2, "Block", Block$$);
12333
12370
  }
12334
12371
  var BareNestedBlock$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)(EOS), AllowAll, (0, import_lib2.$E)(NestedBlockStatements), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
12335
- if (!$3)
12336
- return $skip;
12372
+ if (!$3) return $skip;
12337
12373
  return $3;
12338
12374
  });
12339
12375
  function BareNestedBlock(ctx, state2) {
@@ -12469,8 +12505,7 @@ var BracedBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBrace, (0
12469
12505
  var s = $3;
12470
12506
  var ws = $4;
12471
12507
  var c = $5;
12472
- if (!s.children.length)
12473
- return $skip;
12508
+ if (!s.children.length) return $skip;
12474
12509
  return {
12475
12510
  type: "BlockStatement",
12476
12511
  expressions: s.expressions,
@@ -12488,8 +12523,7 @@ var NoPostfixBracedBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpen
12488
12523
  var s = $3;
12489
12524
  var ws = $4;
12490
12525
  var c = $5;
12491
- if (!s.expressions.length)
12492
- return $skip;
12526
+ if (!s.expressions.length) return $skip;
12493
12527
  return {
12494
12528
  type: "BlockStatement",
12495
12529
  expressions: s.expressions,
@@ -12507,8 +12541,7 @@ var NoCommaBracedBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBr
12507
12541
  var s = $3;
12508
12542
  var ws = $4;
12509
12543
  var c = $5;
12510
- if (!s.children.length)
12511
- return $skip;
12544
+ if (!s.children.length) return $skip;
12512
12545
  return {
12513
12546
  type: "BlockStatement",
12514
12547
  expressions: s.expressions,
@@ -12549,11 +12582,9 @@ var SingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidNewl
12549
12582
  var stmts = $2;
12550
12583
  var last = $3;
12551
12584
  const expressions = [...stmts];
12552
- if (last)
12553
- expressions.push(last);
12585
+ if (last) expressions.push(last);
12554
12586
  const children = [expressions];
12555
- if (hasTrailingComment(expressions))
12556
- children.push(["\n"]);
12587
+ if (hasTrailingComment(expressions)) children.push(["\n"]);
12557
12588
  return {
12558
12589
  type: "BlockStatement",
12559
12590
  expressions,
@@ -12568,8 +12599,7 @@ var PostfixedSingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((
12568
12599
  var stmts = $1;
12569
12600
  var last = $2;
12570
12601
  const children = [...stmts];
12571
- if (last)
12572
- children.push(last);
12602
+ if (last) children.push(last);
12573
12603
  return {
12574
12604
  type: "BlockStatement",
12575
12605
  expressions: children,
@@ -12584,8 +12614,7 @@ var PostfixedSingleLineNoCommaStatements$0 = (0, import_lib2.$TS)((0, import_lib
12584
12614
  var stmts = $1;
12585
12615
  var last = $2;
12586
12616
  const children = [...stmts];
12587
- if (last)
12588
- children.push(last);
12617
+ if (last) children.push(last);
12589
12618
  return {
12590
12619
  type: "BlockStatement",
12591
12620
  expressions: children,
@@ -12598,8 +12627,7 @@ function PostfixedSingleLineNoCommaStatements(ctx, state2) {
12598
12627
  }
12599
12628
  var NestedBlockStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedBlockStatement), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
12600
12629
  var statements = $2;
12601
- if (!statements.length)
12602
- return $skip;
12630
+ if (!statements.length) return $skip;
12603
12631
  statements = statements.flat();
12604
12632
  return {
12605
12633
  type: "BlockStatement",
@@ -12626,8 +12654,7 @@ var BlockStatementPart$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
12626
12654
  var ws = $2;
12627
12655
  var statement = $3;
12628
12656
  var delimiter = $4;
12629
- if (ws)
12630
- statement = prepend(ws, statement);
12657
+ if (ws) statement = prepend(ws, statement);
12631
12658
  return [statement, delimiter];
12632
12659
  });
12633
12660
  function BlockStatementPart(ctx, state2) {
@@ -12776,8 +12803,7 @@ var _ArrayLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, Clos
12776
12803
  var open = $1;
12777
12804
  var close = $2;
12778
12805
  var content = $5;
12779
- if (!content)
12780
- return $skip;
12806
+ if (!content) return $skip;
12781
12807
  let last = content[content.length - 1];
12782
12808
  let lastArray = Array.isArray(last) ? last : last.children;
12783
12809
  if (isComma(lastArray[lastArray.length - 1])) {
@@ -12797,8 +12823,7 @@ var _ArrayLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, Clos
12797
12823
  });
12798
12824
  var _ArrayLiteral$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(ArrayLiteralContent, __, CloseBracket)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
12799
12825
  var open = $1;
12800
- if (!$3)
12801
- return $skip;
12826
+ if (!$3) return $skip;
12802
12827
  const [content, ws, close] = $3;
12803
12828
  if (content.type === "RangeExpression") {
12804
12829
  return prepend(ws, content);
@@ -12933,8 +12958,7 @@ var ArrayLiteralContent$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(ElementList
12933
12958
  var list = $1;
12934
12959
  var delimiter = $2;
12935
12960
  var nested = $3;
12936
- if (!nested)
12937
- return list;
12961
+ if (!nested) return list;
12938
12962
  return [...list, delimiter, ...nested];
12939
12963
  });
12940
12964
  var ArrayLiteralContent$3 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0, import_lib2.$S)(__, ElementListWithIndentedApplicationForbidden, ArrayElementDelimiter)), function($skip, $loc, $0, $1) {
@@ -12958,13 +12982,10 @@ var NestedElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested, ElementLi
12958
12982
  var list = $2;
12959
12983
  var delimiter = $3;
12960
12984
  const { length } = list;
12961
- if (!length)
12962
- return $skip;
12985
+ if (!length) return $skip;
12963
12986
  return list.map((e, i) => {
12964
- if (i === 0)
12965
- e = prepend(indent, e);
12966
- if (i === length - 1)
12967
- e = append(e, delimiter);
12987
+ if (i === 0) e = prepend(indent, e);
12988
+ if (i === length - 1) e = append(e, delimiter);
12968
12989
  return e;
12969
12990
  });
12970
12991
  });
@@ -12981,8 +13002,7 @@ function ArrayElementDelimiter(ctx, state2) {
12981
13002
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ArrayElementDelimiter", ArrayElementDelimiter$$);
12982
13003
  }
12983
13004
  var ElementListWithIndentedApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidIndentedApplication, (0, import_lib2.$E)(ElementList), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3) {
12984
- if ($2)
12985
- return $2;
13005
+ if ($2) return $2;
12986
13006
  return $skip;
12987
13007
  });
12988
13008
  function ElementListWithIndentedApplicationForbidden(ctx, state2) {
@@ -12999,8 +13019,7 @@ function ElementList(ctx, state2) {
12999
13019
  var SingleLineElementList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(EOS), ArrayElementExpression, (0, import_lib2.$Q)(ElementListRest)), function($skip, $loc, $0, $1, $2, $3) {
13000
13020
  var first = $2;
13001
13021
  var rest = $3;
13002
- if (!rest.length)
13003
- return [first];
13022
+ if (!rest.length) return [first];
13004
13023
  return [
13005
13024
  append(first, rest[0][0])
13006
13025
  ].concat(
@@ -13065,8 +13084,7 @@ var NestedBulletedArray$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_
13065
13084
  var open = $1;
13066
13085
  var content = $4;
13067
13086
  var close = $6;
13068
- if (!content.length)
13069
- return $skip;
13087
+ if (!content.length) return $skip;
13070
13088
  content = content.flat();
13071
13089
  const last = content[content.length - 1];
13072
13090
  if (last.children?.at(-1)?.implicit) {
@@ -13084,8 +13102,7 @@ var BulletedArray$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBracket
13084
13102
  var open = $1;
13085
13103
  var content = $2;
13086
13104
  var close = $3;
13087
- if (!content)
13088
- return $skip;
13105
+ if (!content) return $skip;
13089
13106
  content = [
13090
13107
  ...trimFirstSpace(content[0]),
13091
13108
  // replace first space with bracket
@@ -13114,11 +13131,9 @@ function NestedArrayBullet(ctx, state2) {
13114
13131
  var ArrayBullet$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(BulletIndent, (0, import_lib2.$E)((0, import_lib2.$S)(ElementList, ArrayBulletDelimiter)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
13115
13132
  var bullet = $1;
13116
13133
  var content = $2;
13117
- if (!content)
13118
- return $skip;
13134
+ if (!content) return $skip;
13119
13135
  let [list, delimiter] = content;
13120
- if (!list.length)
13121
- return $skip;
13136
+ if (!list.length) return $skip;
13122
13137
  list = list.slice();
13123
13138
  list[0] = prepend(bullet, list[0]);
13124
13139
  if (delimiter) {
@@ -13145,8 +13160,7 @@ var BulletIndent$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Bullet), function(
13145
13160
  $loc,
13146
13161
  level: getIndentLevel(" ".repeat(state.currentIndent.level) + bullet + ws, config.tab)
13147
13162
  };
13148
- if (config.verbose)
13149
- console.log("pushing bullet indent", indent);
13163
+ if (config.verbose) console.log("pushing bullet indent", indent);
13150
13164
  state.indentLevels.push(indent);
13151
13165
  return indent;
13152
13166
  });
@@ -13191,8 +13205,7 @@ var BracedObjectLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace,
13191
13205
  var open = $1;
13192
13206
  var close = $2;
13193
13207
  var properties = $5;
13194
- if (!properties?.length)
13195
- return $skip;
13208
+ if (!properties?.length) return $skip;
13196
13209
  let last = properties[properties.length - 1];
13197
13210
  if (last.delim?.implicit) {
13198
13211
  last = {
@@ -13211,8 +13224,7 @@ var BracedObjectLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace,
13211
13224
  });
13212
13225
  var BracedObjectLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(BracedObjectLiteralContent, __, CloseBrace)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
13213
13226
  var open = $1;
13214
- if (!$3)
13215
- return $skip;
13227
+ if (!$3) return $skip;
13216
13228
  const [properties, ...close] = $3;
13217
13229
  return {
13218
13230
  type: "ObjectExpression",
@@ -13230,8 +13242,7 @@ var SingleLineObjectProperties$0 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0,
13230
13242
  return line.flatMap(([prop, delim]) => {
13231
13243
  prop = Array.isArray(prop) ? prop : [prop];
13232
13244
  let last = prop[prop.length - 1];
13233
- if (!last)
13234
- return [];
13245
+ if (!last) return [];
13235
13246
  last = {
13236
13247
  ...last,
13237
13248
  delim,
@@ -13268,8 +13279,7 @@ function BracedObjectLiteralContent(ctx, state2) {
13268
13279
  }
13269
13280
  var NestedImplicitObjectLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBrace, PushIndent, AllowPipeline, (0, import_lib2.$E)(NestedImplicitPropertyDefinitions), RestorePipeline, PopIndent, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
13270
13281
  var properties = $4;
13271
- if (!properties)
13272
- return $skip;
13282
+ if (!properties) return $skip;
13273
13283
  return {
13274
13284
  type: "ObjectExpression",
13275
13285
  properties,
@@ -13303,8 +13313,7 @@ function NestedImplicitPropertyDefinition(ctx, state2) {
13303
13313
  }
13304
13314
  var NestedPropertyDefinitions$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedPropertyDefinition), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
13305
13315
  var defs = $2;
13306
- if (!defs.length)
13307
- return $skip;
13316
+ if (!defs.length) return $skip;
13308
13317
  return defs.flat();
13309
13318
  });
13310
13319
  function NestedPropertyDefinitions(ctx, state2) {
@@ -13314,8 +13323,7 @@ var NestedPropertyDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested
13314
13323
  var ws = $1;
13315
13324
  var inlineProps = $2;
13316
13325
  return inlineProps.flatMap(([prop, delim], i) => {
13317
- if (!Array.isArray(prop))
13318
- prop = [prop];
13326
+ if (!Array.isArray(prop)) prop = [prop];
13319
13327
  if (i === 0) {
13320
13328
  const [first, ...rest] = prop;
13321
13329
  prop = [prepend(ws, first), ...rest];
@@ -13448,8 +13456,7 @@ var PropertyDefinition$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
13448
13456
  children: def.children.flatMap((c, i) => i ? [",", c] : [c])
13449
13457
  };
13450
13458
  }
13451
- if (!def.block || def.block.empty)
13452
- return $skip;
13459
+ if (!def.block || def.block.empty) return $skip;
13453
13460
  return prepend(ws, def);
13454
13461
  });
13455
13462
  var PropertyDefinition$4 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), DotDotDot, Expression), function($skip, $loc, $0, $1, $2, $3) {
@@ -13471,8 +13478,11 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
13471
13478
  var post = $5;
13472
13479
  if (!pre.length && !post) {
13473
13480
  switch (value.type) {
13481
+ // `{identifier}` remains `{identifier}`, the one shorthand JS supports
13474
13482
  case "Identifier":
13475
13483
  return prepend(ws, value);
13484
+ // PropertyGlob like x.{a,b} turns into ObjectExpression {a: x.a, b: x.b}
13485
+ // (via `processCallMemberExpression`)
13476
13486
  case "ObjectExpression":
13477
13487
  let first = value.properties[0];
13478
13488
  if (first) {
@@ -13486,8 +13496,7 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
13486
13496
  }
13487
13497
  }
13488
13498
  const last = lastAccessInCallExpression(value);
13489
- if (!last)
13490
- return $skip;
13499
+ if (!last) return $skip;
13491
13500
  let name, ref, refAssignment;
13492
13501
  const { expression, type } = last;
13493
13502
  if (type === "Index") {
@@ -13500,11 +13509,10 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
13500
13509
  value = {
13501
13510
  ...value,
13502
13511
  children: value.children.map((c) => {
13503
- if (c === last)
13504
- return {
13505
- type: "Index",
13506
- children: ["[", ref, "]"]
13507
- };
13512
+ if (c === last) return {
13513
+ type: "Index",
13514
+ children: ["[", ref, "]"]
13515
+ };
13508
13516
  return c;
13509
13517
  })
13510
13518
  };
@@ -13516,11 +13524,9 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
13516
13524
  }
13517
13525
  } else {
13518
13526
  ({ name } = last);
13519
- if (!name)
13520
- return $skip;
13527
+ if (!name) return $skip;
13521
13528
  }
13522
- if (name[0] === "#")
13523
- name = name.slice(1);
13529
+ if (name[0] === "#") name = name.slice(1);
13524
13530
  return {
13525
13531
  type: "Property",
13526
13532
  children: [ws, name, ": ", processUnaryExpression(pre, value, post)],
@@ -13591,8 +13597,7 @@ var ComputedPropertyName$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracke
13591
13597
  });
13592
13598
  var ComputedPropertyName$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBracket, TemplateLiteral, InsertCloseBracket), function($skip, $loc, $0, $1, $2, $3) {
13593
13599
  var expression = $2;
13594
- if ($2.type === "StringLiteral")
13595
- return $2;
13600
+ if ($2.type === "StringLiteral") return $2;
13596
13601
  return {
13597
13602
  type: "ComputedPropertyName",
13598
13603
  children: $0,
@@ -13619,8 +13624,7 @@ function Decorator(ctx, state2) {
13619
13624
  }
13620
13625
  var Decorators$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidClassImplicitCall, (0, import_lib2.$Q)((0, import_lib2.$S)(__, Decorator)), __, RestoreClassImplicitCall), function($skip, $loc, $0, $1, $2, $3, $4) {
13621
13626
  var decorators = $2;
13622
- if (!decorators.length)
13623
- return $skip;
13627
+ if (!decorators.length) return $skip;
13624
13628
  return $0;
13625
13629
  });
13626
13630
  function Decorators(ctx, state2) {
@@ -13659,8 +13663,7 @@ var MethodDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0,
13659
13663
  var ws = $2;
13660
13664
  var content = $4;
13661
13665
  var block = $6;
13662
- if (!content)
13663
- return $skip;
13666
+ if (!content) return $skip;
13664
13667
  const [base, rest, returnType] = content;
13665
13668
  const value = [base, rest];
13666
13669
  if (!rest.length) {
@@ -13671,12 +13674,9 @@ var MethodDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0,
13671
13674
  ({ name: name2 } = lastAccess2);
13672
13675
  }
13673
13676
  }
13674
- if (!name2)
13675
- ({ name: name2 } = base);
13676
- if (!name2)
13677
- return $skip;
13678
- if (name2[0] === "#")
13679
- name2 = name2.slice(1);
13677
+ if (!name2) ({ name: name2 } = base);
13678
+ if (!name2) return $skip;
13679
+ if (name2[0] === "#") name2 = name2.slice(1);
13680
13680
  const autoReturn = !block || base.type !== "Identifier";
13681
13681
  return makeGetterMethod(name2, ws, base, returnType, block, kind, autoReturn);
13682
13682
  }
@@ -13749,10 +13749,8 @@ var MethodModifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0, im
13749
13749
  var MethodModifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(Async, __)), (0, import_lib2.$E)((0, import_lib2.$S)(Star, __))), function($skip, $loc, $0, $1, $2) {
13750
13750
  var async = $1;
13751
13751
  var generator = $2;
13752
- if (!async)
13753
- async = [];
13754
- if (!generator)
13755
- generator = [];
13752
+ if (!async) async = [];
13753
+ if (!generator) generator = [];
13756
13754
  return {
13757
13755
  async,
13758
13756
  generator,
@@ -13793,8 +13791,7 @@ var MethodSignature$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(MethodModifier,
13793
13791
  } else if (name.token) {
13794
13792
  name = name.token.match(/^(?:"|')/) ? name.token.slice(1, -1) : name.token;
13795
13793
  }
13796
- if (optional)
13797
- optional = { ...optional, ts: true };
13794
+ if (optional) optional = { ...optional, ts: true };
13798
13795
  return {
13799
13796
  type: "MethodSignature",
13800
13797
  children: [...modifier.children, name, ws1, optional, ws2, parameters, returnType],
@@ -13851,8 +13848,7 @@ var AssignmentOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(AssignmentOpSymbol
13851
13848
  children: [$1, ...$2]
13852
13849
  };
13853
13850
  }
13854
- if (typeof $1 !== "string")
13855
- return $1;
13851
+ if (typeof $1 !== "string") return $1;
13856
13852
  return { $loc, token: $1 };
13857
13853
  });
13858
13854
  function AssignmentOp(ctx, state2) {
@@ -13970,10 +13966,8 @@ var NotDedentedBinaryOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_
13970
13966
  var ws2 = $2;
13971
13967
  var op = $3;
13972
13968
  const ws = [];
13973
- if (ws1)
13974
- ws.push(...ws1);
13975
- if (ws2)
13976
- ws.push(...ws2);
13969
+ if (ws1) ws.push(...ws1);
13970
+ if (ws2) ws.push(...ws2);
13977
13971
  return [ws, op];
13978
13972
  });
13979
13973
  var NotDedentedBinaryOp$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(NestedBinaryOpAllowed, Nested, (0, import_lib2.$E)(_), (0, import_lib2.$N)(Identifier), (0, import_lib2.$C)((0, import_lib2.$N)((0, import_lib2.$EXPECT)($L75, 'NotDedentedBinaryOp "*"')), (0, import_lib2.$N)(ImportDeclaration)), BinaryOp), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
@@ -13981,8 +13975,7 @@ var NotDedentedBinaryOp$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(NestedBinar
13981
13975
  var ws2 = $3;
13982
13976
  var op = $6;
13983
13977
  const ws = [...ws1];
13984
- if (ws2)
13985
- ws.push(...ws2);
13978
+ if (ws2) ws.push(...ws2);
13986
13979
  return [ws, op];
13987
13980
  });
13988
13981
  var NotDedentedBinaryOp$$ = [NotDedentedBinaryOp$0, NotDedentedBinaryOp$1];
@@ -13991,8 +13984,7 @@ function NotDedentedBinaryOp(ctx, state2) {
13991
13984
  }
13992
13985
  var IdentifierBinaryOp$0 = (0, import_lib2.$TV)(Identifier, function($skip, $loc, $0, $1) {
13993
13986
  var id = $0;
13994
- if (state.operators.has(id.name))
13995
- return id;
13987
+ if (state.operators.has(id.name)) return id;
13996
13988
  return $skip;
13997
13989
  });
13998
13990
  function IdentifierBinaryOp(ctx, state2) {
@@ -14006,14 +13998,12 @@ function BinaryOp(ctx, state2) {
14006
13998
  return (0, import_lib2.$EVENT)(ctx, state2, "BinaryOp", BinaryOp$0);
14007
13999
  }
14008
14000
  var _BinaryOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(BinaryOpSymbol), function($skip, $loc, $0, $1) {
14009
- if (typeof $1 === "string")
14010
- return { $loc, token: $1 };
14001
+ if (typeof $1 === "string") return { $loc, token: $1 };
14011
14002
  return $1;
14012
14003
  });
14013
14004
  var _BinaryOp$1 = (0, import_lib2.$TV)(Identifier, function($skip, $loc, $0, $1) {
14014
14005
  var id = $0;
14015
- if (!state.operators.has(id.name))
14016
- return $skip;
14006
+ if (!state.operators.has(id.name)) return $skip;
14017
14007
  return {
14018
14008
  token: id.name,
14019
14009
  call: id,
@@ -14023,8 +14013,7 @@ var _BinaryOp$1 = (0, import_lib2.$TV)(Identifier, function($skip, $loc, $0, $1)
14023
14013
  });
14024
14014
  var _BinaryOp$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OmittedNegation, __, Identifier), function($skip, $loc, $0, $1, $2, $3) {
14025
14015
  var id = $3;
14026
- if (!state.operators.has(id.name))
14027
- return $skip;
14016
+ if (!state.operators.has(id.name)) return $skip;
14028
14017
  return {
14029
14018
  token: id.name,
14030
14019
  call: id,
@@ -14107,13 +14096,11 @@ var BinaryOpSymbol$24 = (0, import_lib2.$T)((0, import_lib2.$EXPECT)($L92, 'Bina
14107
14096
  return "!==";
14108
14097
  });
14109
14098
  var BinaryOpSymbol$25 = (0, import_lib2.$TV)((0, import_lib2.$C)((0, import_lib2.$EXPECT)($L93, 'BinaryOpSymbol "!="'), (0, import_lib2.$EXPECT)($L94, 'BinaryOpSymbol "\u2260"')), function($skip, $loc, $0, $1) {
14110
- if (config.coffeeEq)
14111
- return "!==";
14099
+ if (config.coffeeEq) return "!==";
14112
14100
  return "!=";
14113
14101
  });
14114
14102
  var BinaryOpSymbol$26 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L95, 'BinaryOpSymbol "isnt"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
14115
- if (config.coffeeIsnt)
14116
- return "!==";
14103
+ if (config.coffeeIsnt) return "!==";
14117
14104
  return $skip;
14118
14105
  });
14119
14106
  var BinaryOpSymbol$27 = (0, import_lib2.$EXPECT)($L96, 'BinaryOpSymbol "==="');
@@ -14121,8 +14108,7 @@ var BinaryOpSymbol$28 = (0, import_lib2.$T)((0, import_lib2.$C)((0, import_lib2.
14121
14108
  return "===";
14122
14109
  });
14123
14110
  var BinaryOpSymbol$29 = (0, import_lib2.$TV)((0, import_lib2.$C)((0, import_lib2.$EXPECT)($L99, 'BinaryOpSymbol "=="'), (0, import_lib2.$EXPECT)($L100, 'BinaryOpSymbol "\u2261"'), (0, import_lib2.$EXPECT)($L101, 'BinaryOpSymbol "\u2A75"')), function($skip, $loc, $0, $1) {
14124
- if (config.coffeeEq)
14125
- return "===";
14111
+ if (config.coffeeEq) return "===";
14126
14112
  return "==";
14127
14113
  });
14128
14114
  var BinaryOpSymbol$30 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L102, 'BinaryOpSymbol "and"'), NonIdContinue), function(value) {
@@ -14320,8 +14306,7 @@ var UnaryOp$1 = AwaitOp;
14320
14306
  var UnaryOp$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$C)(Delete, Void, Typeof), (0, import_lib2.$N)((0, import_lib2.$EXPECT)($R30, "UnaryOp /[:.]/")), (0, import_lib2.$E)(_)), function($skip, $loc, $0, $1, $2, $3) {
14321
14307
  var op = $1;
14322
14308
  var ws = $3;
14323
- if (!ws)
14324
- return [op, [" "]];
14309
+ if (!ws) return [op, [" "]];
14325
14310
  return [op, ws];
14326
14311
  });
14327
14312
  var UnaryOp$3 = (0, import_lib2.$T)((0, import_lib2.$S)(Not, (0, import_lib2.$N)((0, import_lib2.$EXPECT)($R30, "UnaryOp /[:.]/")), (0, import_lib2.$E)((0, import_lib2.$EXPECT)($L18, 'UnaryOp " "')), (0, import_lib2.$E)(_)), function(value) {
@@ -14365,8 +14350,7 @@ function StatementListItem(ctx, state2) {
14365
14350
  var PostfixedStatement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Statement, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
14366
14351
  var statement = $1;
14367
14352
  var post = $2;
14368
- if (post)
14369
- return addPostfixStatement(statement, ...post);
14353
+ if (post) return addPostfixStatement(statement, ...post);
14370
14354
  return statement;
14371
14355
  });
14372
14356
  function PostfixedStatement(ctx, state2) {
@@ -14381,8 +14365,7 @@ function NoCommaStatementListItem(ctx, state2) {
14381
14365
  var PostfixedNoCommaStatement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(NoCommaStatement, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
14382
14366
  var statement = $1;
14383
14367
  var post = $2;
14384
- if (post)
14385
- return addPostfixStatement(statement, ...post);
14368
+ if (post) return addPostfixStatement(statement, ...post);
14386
14369
  return statement;
14387
14370
  });
14388
14371
  function PostfixedNoCommaStatement(ctx, state2) {
@@ -14391,8 +14374,7 @@ function PostfixedNoCommaStatement(ctx, state2) {
14391
14374
  var PostfixedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Expression, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
14392
14375
  var expression = $1;
14393
14376
  var post = $2;
14394
- if (post)
14395
- return attachPostfixStatementAsExpression(expression, post);
14377
+ if (post) return attachPostfixStatementAsExpression(expression, post);
14396
14378
  return expression;
14397
14379
  });
14398
14380
  function PostfixedExpression(ctx, state2) {
@@ -14401,8 +14383,7 @@ function PostfixedExpression(ctx, state2) {
14401
14383
  var PostfixedCommaExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PostfixedExpression, (0, import_lib2.$C)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement), (0, import_lib2.$Q)((0, import_lib2.$S)(CommaDelimiter, AssignmentExpression)))), function($skip, $loc, $0, $1, $2) {
14402
14384
  var expression = $1;
14403
14385
  var post = $2;
14404
- if (!post.length)
14405
- return $1;
14386
+ if (!post.length) return $1;
14406
14387
  if (post.length === 2 && !Array.isArray(post[1])) {
14407
14388
  return attachPostfixStatementAsExpression(expression, post);
14408
14389
  }
@@ -14431,10 +14412,8 @@ var Statement$2 = (0, import_lib2.$T)((0, import_lib2.$S)(IfStatement, (0, impor
14431
14412
  return value[0];
14432
14413
  });
14433
14414
  var Statement$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(IterationStatement, (0, import_lib2.$N)(ShouldExpressionize)), function($skip, $loc, $0, $1, $2) {
14434
- if ($1.generator)
14435
- return $skip;
14436
- if ($1.reduction)
14437
- return $skip;
14415
+ if ($1.generator) return $skip;
14416
+ if ($1.reduction) return $skip;
14438
14417
  return $1;
14439
14418
  });
14440
14419
  var Statement$4 = (0, import_lib2.$T)((0, import_lib2.$S)(SwitchStatement, (0, import_lib2.$N)(ShouldExpressionize)), function(value) {
@@ -14509,8 +14488,7 @@ var Label$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Colon, IdentifierName, Wh
14509
14488
  var colon = $1;
14510
14489
  var id = $2;
14511
14490
  var w = $3;
14512
- if (id.name === "void")
14513
- return $skip;
14491
+ if (id.name === "void") return $skip;
14514
14492
  return {
14515
14493
  type: "Label",
14516
14494
  name: id.name,
@@ -14822,8 +14800,7 @@ function ForClause(ctx, state2) {
14822
14800
  var ForStatementControlWithWhen$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForStatementControlWithReduction, (0, import_lib2.$E)(WhenCondition)), function($skip, $loc, $0, $1, $2) {
14823
14801
  var control = $1;
14824
14802
  var condition = $2;
14825
- if (!condition)
14826
- return control;
14803
+ if (!condition) return control;
14827
14804
  const expressions = [["", {
14828
14805
  type: "ContinueStatement",
14829
14806
  children: ["continue"]
@@ -15113,8 +15090,7 @@ var SwitchStatement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Switch, ForbidN
15113
15090
  var s = $1;
15114
15091
  var condition = $3;
15115
15092
  var caseBlock = $5;
15116
- if (!condition)
15117
- return $skip;
15093
+ if (!condition) return $skip;
15118
15094
  if (condition.type === "EmptyCondition") {
15119
15095
  caseBlock.clauses.forEach(({ cases }) => {
15120
15096
  if (cases) {
@@ -15177,8 +15153,7 @@ function CaseBlock(ctx, state2) {
15177
15153
  }
15178
15154
  var NestedCaseClauses$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedCaseClause), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
15179
15155
  var clauses = $2;
15180
- if (clauses.length)
15181
- return clauses;
15156
+ if (clauses.length) return clauses;
15182
15157
  return $skip;
15183
15158
  });
15184
15159
  function NestedCaseClauses(ctx, state2) {
@@ -15257,8 +15232,7 @@ function PatternExpressionList(ctx, state2) {
15257
15232
  var PatternExpression$0 = BindingPattern;
15258
15233
  var PatternExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidIndentedApplication, (0, import_lib2.$E)((0, import_lib2.$P)(SingleLineBinaryOpRHS)), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3) {
15259
15234
  var pattern = $2;
15260
- if (!pattern)
15261
- return $skip;
15235
+ if (!pattern) return $skip;
15262
15236
  return {
15263
15237
  type: "ConditionFragment",
15264
15238
  children: pattern
@@ -15273,8 +15247,7 @@ var CaseExpressionList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
15273
15247
  var rest = $2;
15274
15248
  const result = rest.map(([ws, _comma, exp, col]) => {
15275
15249
  exp = trimFirstSpace(exp);
15276
- if (ws.length)
15277
- return [insertTrimmingSpace("case ", ws), exp, col];
15250
+ if (ws.length) return [insertTrimmingSpace("case ", ws), exp, col];
15278
15251
  return ["case ", exp, col];
15279
15252
  });
15280
15253
  result.unshift(first);
@@ -15286,8 +15259,7 @@ function CaseExpressionList(ctx, state2) {
15286
15259
  var CaseExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PropertyName, (0, import_lib2.$Y)((0, import_lib2.$S)((0, import_lib2.$E)(_), Colon))), function($skip, $loc, $0, $1, $2) {
15287
15260
  var value = $1;
15288
15261
  if (value.type === "ComputedPropertyName") {
15289
- if (value.implicit)
15290
- return value.expression;
15262
+ if (value.implicit) return value.expression;
15291
15263
  return { ...value, type: "ArrayExpression" };
15292
15264
  }
15293
15265
  return value;
@@ -15304,8 +15276,7 @@ function ImpliedColon(ctx, state2) {
15304
15276
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ImpliedColon", ImpliedColon$$);
15305
15277
  }
15306
15278
  var IgnoreColon$0 = (0, import_lib2.$TV)((0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$E)(_), Colon)), function($skip, $loc, $0, $1) {
15307
- if ($1)
15308
- return $1[0];
15279
+ if ($1) return $1[0];
15309
15280
  });
15310
15281
  function IgnoreColon(ctx, state2) {
15311
15282
  return (0, import_lib2.$EVENT)(ctx, state2, "IgnoreColon", IgnoreColon$0);
@@ -15336,8 +15307,7 @@ var CatchBinding$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E
15336
15307
  var parameter = $5;
15337
15308
  var ws3 = $7;
15338
15309
  var close = $8;
15339
- if (!parameter)
15340
- return $skip;
15310
+ if (!parameter) return $skip;
15341
15311
  return {
15342
15312
  type: "CatchBinding",
15343
15313
  parameter,
@@ -15349,8 +15319,7 @@ var CatchBinding$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(_, InsertOpenParen
15349
15319
  var open = $2;
15350
15320
  var parameter = $5;
15351
15321
  var close = $7;
15352
- if (!parameter)
15353
- return $skip;
15322
+ if (!parameter) return $skip;
15354
15323
  return {
15355
15324
  type: "CatchBinding",
15356
15325
  parameter,
@@ -15437,8 +15406,7 @@ var Condition$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, InsertOpe
15437
15406
  var open = $2;
15438
15407
  var expression = $3;
15439
15408
  var close = $4;
15440
- if (!expression)
15441
- return $skip;
15409
+ if (!expression) return $skip;
15442
15410
  return {
15443
15411
  type: "ParenthesizedExpression",
15444
15412
  children: [open, expression, close],
@@ -15449,8 +15417,7 @@ var Condition$4 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenParen, Expr
15449
15417
  var open = $1;
15450
15418
  var expression = $2;
15451
15419
  var close = $3;
15452
- if (expression.type === "ParenthesizedExpression")
15453
- return expression;
15420
+ if (expression.type === "ParenthesizedExpression") return expression;
15454
15421
  expression = trimFirstSpace(expression);
15455
15422
  return {
15456
15423
  type: "ParenthesizedExpression",
@@ -15466,8 +15433,7 @@ var BoundedCondition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenPare
15466
15433
  var open = $1;
15467
15434
  var expression = $2;
15468
15435
  var close = $3;
15469
- if (expression.type === "ParenthesizedExpression")
15470
- return expression;
15436
+ if (expression.type === "ParenthesizedExpression") return expression;
15471
15437
  expression = trimFirstSpace(expression);
15472
15438
  return {
15473
15439
  type: "ParenthesizedExpression",
@@ -15480,8 +15446,7 @@ function BoundedCondition(ctx, state2) {
15480
15446
  }
15481
15447
  var DeclarationCondition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidBracedApplication, ForbidIndentedApplication, ForbidNewlineBinaryOp, (0, import_lib2.$E)(LexicalDeclaration), RestoreNewlineBinaryOp, RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
15482
15448
  var declaration = $4;
15483
- if (!declaration)
15484
- return $skip;
15449
+ if (!declaration) return $skip;
15485
15450
  return {
15486
15451
  type: "DeclarationCondition",
15487
15452
  declaration,
@@ -15493,8 +15458,7 @@ function DeclarationCondition(ctx, state2) {
15493
15458
  }
15494
15459
  var ExpressionWithIndentedApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidIndentedApplication, ForbidNewlineBinaryOp, (0, import_lib2.$E)(Expression), RestoreNewlineBinaryOp, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
15495
15460
  var exp = $3;
15496
- if (exp)
15497
- return exp;
15461
+ if (exp) return exp;
15498
15462
  return $skip;
15499
15463
  });
15500
15464
  function ExpressionWithIndentedApplicationForbidden(ctx, state2) {
@@ -15502,8 +15466,7 @@ function ExpressionWithIndentedApplicationForbidden(ctx, state2) {
15502
15466
  }
15503
15467
  var SingleLineExpressionWithIndentedApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidIndentedApplication, ForbidNewlineBinaryOp, (0, import_lib2.$E)(SingleLineAssignmentExpression), RestoreNewlineBinaryOp, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
15504
15468
  var exp = $3;
15505
- if (exp)
15506
- return exp;
15469
+ if (exp) return exp;
15507
15470
  return $skip;
15508
15471
  });
15509
15472
  function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
@@ -15511,8 +15474,7 @@ function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
15511
15474
  }
15512
15475
  var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidBracedApplication, ForbidIndentedApplication, (0, import_lib2.$E)(Expression), RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
15513
15476
  var exp = $3;
15514
- if (exp)
15515
- return exp;
15477
+ if (exp) return exp;
15516
15478
  return $skip;
15517
15479
  });
15518
15480
  function ExpressionWithObjectApplicationForbidden(ctx, state2) {
@@ -15520,8 +15482,7 @@ function ExpressionWithObjectApplicationForbidden(ctx, state2) {
15520
15482
  }
15521
15483
  var LeftHandSideExpressionWithObjectApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidBracedApplication, ForbidIndentedApplication, ForbidNewlineBinaryOp, (0, import_lib2.$E)(LeftHandSideExpression), RestoreNewlineBinaryOp, RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
15522
15484
  var exp = $4;
15523
- if (exp)
15524
- return exp;
15485
+ if (exp) return exp;
15525
15486
  return $skip;
15526
15487
  });
15527
15488
  function LeftHandSideExpressionWithObjectApplicationForbidden(ctx, state2) {
@@ -15546,8 +15507,7 @@ function RestoreClassImplicitCall(ctx, state2) {
15546
15507
  return (0, import_lib2.$EVENT)(ctx, state2, "RestoreClassImplicitCall", RestoreClassImplicitCall$0);
15547
15508
  }
15548
15509
  var ClassImplicitCallForbidden$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ClassImplicitCallForbidden ""'), function($skip, $loc, $0, $1) {
15549
- if (!state.classImplicitCallForbidden)
15550
- return $skip;
15510
+ if (!state.classImplicitCallForbidden) return $skip;
15551
15511
  return;
15552
15512
  });
15553
15513
  function ClassImplicitCallForbidden(ctx, state2) {
@@ -15575,8 +15535,7 @@ var BracedApplicationAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($
15575
15535
  if (config.verbose) {
15576
15536
  console.log("forbidBracedApplication:", state.forbidBracedApplication);
15577
15537
  }
15578
- if (state.bracedApplicationForbidden)
15579
- return $skip;
15538
+ if (state.bracedApplicationForbidden) return $skip;
15580
15539
  return;
15581
15540
  });
15582
15541
  function BracedApplicationAllowed(ctx, state2) {
@@ -15604,8 +15563,7 @@ var IndentedApplicationAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)
15604
15563
  if (config.verbose) {
15605
15564
  console.log("forbidIndentedApplication:", state.forbidIndentedApplication);
15606
15565
  }
15607
- if (state.indentedApplicationForbidden)
15608
- return $skip;
15566
+ if (state.indentedApplicationForbidden) return $skip;
15609
15567
  return;
15610
15568
  });
15611
15569
  function IndentedApplicationAllowed(ctx, state2) {
@@ -15633,8 +15591,7 @@ var TrailingMemberPropertyAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPE
15633
15591
  if (config.verbose) {
15634
15592
  console.log("forbidTrailingMemberProperty:", state.forbidTrailingMemberProperty);
15635
15593
  }
15636
- if (state.trailingMemberPropertyForbidden)
15637
- return $skip;
15594
+ if (state.trailingMemberPropertyForbidden) return $skip;
15638
15595
  });
15639
15596
  function TrailingMemberPropertyAllowed(ctx, state2) {
15640
15597
  return (0, import_lib2.$EVENT)(ctx, state2, "TrailingMemberPropertyAllowed", TrailingMemberPropertyAllowed$0);
@@ -15661,8 +15618,7 @@ var NestedBinaryOpAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0,
15661
15618
  if (config.verbose) {
15662
15619
  console.log("forbidNestedBinaryOp:", state.forbidNestedBinaryOp);
15663
15620
  }
15664
- if (state.nestedBinaryOpForbidden)
15665
- return $skip;
15621
+ if (state.nestedBinaryOpForbidden) return $skip;
15666
15622
  });
15667
15623
  function NestedBinaryOpAllowed(ctx, state2) {
15668
15624
  return (0, import_lib2.$EVENT)(ctx, state2, "NestedBinaryOpAllowed", NestedBinaryOpAllowed$0);
@@ -15689,8 +15645,7 @@ var NewlineBinaryOpAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0
15689
15645
  if (config.verbose) {
15690
15646
  console.log("forbidNewlineBinaryOp:", state.forbidNewlineBinaryOp);
15691
15647
  }
15692
- if (state.newlineBinaryOpForbidden)
15693
- return $skip;
15648
+ if (state.newlineBinaryOpForbidden) return $skip;
15694
15649
  });
15695
15650
  function NewlineBinaryOpAllowed(ctx, state2) {
15696
15651
  return (0, import_lib2.$EVENT)(ctx, state2, "NewlineBinaryOpAllowed", NewlineBinaryOpAllowed$0);
@@ -15717,8 +15672,7 @@ var PipelineAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pipe
15717
15672
  if (config.verbose) {
15718
15673
  console.log("forbidPipeline:", state.forbidPipeline);
15719
15674
  }
15720
- if (state.pipelineForbidden)
15721
- return $skip;
15675
+ if (state.pipelineForbidden) return $skip;
15722
15676
  });
15723
15677
  function PipelineAllowed(ctx, state2) {
15724
15678
  return (0, import_lib2.$EVENT)(ctx, state2, "PipelineAllowed", PipelineAllowed$0);
@@ -15747,14 +15701,12 @@ function ExpressionStatement(ctx, state2) {
15747
15701
  }
15748
15702
  var KeywordStatement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Break, (0, import_lib2.$E)((0, import_lib2.$S)(_, LabelIdentifier)), (0, import_lib2.$E)((0, import_lib2.$S)(_, With, MaybeNestedExpression))), function($skip, $loc, $0, $1, $2, $3) {
15749
15703
  const children = [$1];
15750
- if ($2)
15751
- children.push($2);
15752
- if ($3)
15753
- children.push({
15754
- type: "Error",
15755
- subtype: "Warning",
15756
- message: "'break with' outside of loop that returns a value"
15757
- });
15704
+ if ($2) children.push($2);
15705
+ if ($3) children.push({
15706
+ type: "Error",
15707
+ subtype: "Warning",
15708
+ message: "'break with' outside of loop that returns a value"
15709
+ });
15758
15710
  return {
15759
15711
  type: "BreakStatement",
15760
15712
  label: $2?.[1],
@@ -15771,14 +15723,12 @@ var KeywordStatement$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Continue, _, S
15771
15723
  });
15772
15724
  var KeywordStatement$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Continue, (0, import_lib2.$E)((0, import_lib2.$S)(_, LabelIdentifier)), (0, import_lib2.$E)((0, import_lib2.$S)(_, With, MaybeNestedExpression))), function($skip, $loc, $0, $1, $2, $3) {
15773
15725
  const children = [$1];
15774
- if ($2)
15775
- children.push($2);
15776
- if ($3)
15777
- children.push({
15778
- type: "Error",
15779
- subtype: "Warning",
15780
- message: "'continue with' outside of loop that returns a value"
15781
- });
15726
+ if ($2) children.push($2);
15727
+ if ($3) children.push({
15728
+ type: "Error",
15729
+ subtype: "Warning",
15730
+ message: "'continue with' outside of loop that returns a value"
15731
+ });
15782
15732
  return {
15783
15733
  type: "ContinueStatement",
15784
15734
  label: $2?.[1],
@@ -15832,10 +15782,8 @@ var MaybeNestedNonPipelineExpression$1 = NestedImplicitObjectLiteral;
15832
15782
  var MaybeNestedNonPipelineExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, NonPipelineExpression)), PopIndent, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2, $3, $4) {
15833
15783
  var expression = $2;
15834
15784
  var trailing = $4;
15835
- if (!expression)
15836
- return $skip;
15837
- if (!trailing)
15838
- return expression;
15785
+ if (!expression) return $skip;
15786
+ if (!trailing) return expression;
15839
15787
  return [expression, trailing];
15840
15788
  });
15841
15789
  var MaybeNestedNonPipelineExpression$3 = NonPipelineExpression;
@@ -15848,10 +15796,8 @@ var MaybeNestedPostfixedExpression$1 = NestedImplicitObjectLiteral;
15848
15796
  var MaybeNestedPostfixedExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, PostfixedExpression)), PopIndent, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2, $3, $4) {
15849
15797
  var expression = $2;
15850
15798
  var trailing = $4;
15851
- if (!expression)
15852
- return $skip;
15853
- if (!trailing)
15854
- return expression;
15799
+ if (!expression) return $skip;
15800
+ if (!trailing) return expression;
15855
15801
  return [expression, trailing];
15856
15802
  });
15857
15803
  var MaybeNestedPostfixedExpression$3 = PostfixedExpression;
@@ -15863,8 +15809,7 @@ var NestedPostfixedExpressionNoTrailing$0 = NestedBulletedArray;
15863
15809
  var NestedPostfixedExpressionNoTrailing$1 = NestedImplicitObjectLiteral;
15864
15810
  var NestedPostfixedExpressionNoTrailing$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, PostfixedExpression)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
15865
15811
  var expression = $2;
15866
- if (!expression)
15867
- return $skip;
15812
+ if (!expression) return $skip;
15868
15813
  return expression;
15869
15814
  });
15870
15815
  var NestedPostfixedExpressionNoTrailing$$ = [NestedPostfixedExpressionNoTrailing$0, NestedPostfixedExpressionNoTrailing$1, NestedPostfixedExpressionNoTrailing$2];
@@ -15876,10 +15821,8 @@ var MaybeNestedExpression$1 = NestedImplicitObjectLiteral;
15876
15821
  var MaybeNestedExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Expression)), PopIndent, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2, $3, $4) {
15877
15822
  var expression = $2;
15878
15823
  var trailing = $4;
15879
- if (!expression)
15880
- return $skip;
15881
- if (!trailing)
15882
- return expression;
15824
+ if (!expression) return $skip;
15825
+ if (!trailing) return expression;
15883
15826
  return [expression, trailing];
15884
15827
  });
15885
15828
  var MaybeNestedExpression$3 = Expression;
@@ -15898,8 +15841,7 @@ var MaybeParenNestedExpression$2 = (0, import_lib2.$T)((0, import_lib2.$S)((0, i
15898
15841
  });
15899
15842
  var MaybeParenNestedExpression$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)(EOS), InsertSpace, InsertOpenParen, PushIndent, (0, import_lib2.$S)(Nested, Expression), PopIndent, (0, import_lib2.$E)(AllowedTrailingCallExpressions), InsertNewline, InsertIndent, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9, $10) {
15900
15843
  var exp = $5;
15901
- if (!exp)
15902
- return $skip;
15844
+ if (!exp) return $skip;
15903
15845
  return $0.slice(1);
15904
15846
  });
15905
15847
  var MaybeParenNestedExpression$$ = [MaybeParenNestedExpression$0, MaybeParenNestedExpression$1, MaybeParenNestedExpression$2, MaybeParenNestedExpression$3];
@@ -16074,8 +16016,7 @@ function OperatorNamedImports(ctx, state2) {
16074
16016
  }
16075
16017
  var FromClause$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(From, __, ModuleSpecifier), function($skip, $loc, $0, $1, $2, $3) {
16076
16018
  var module = $3;
16077
- if (!Array.isArray(module))
16078
- return $0;
16019
+ if (!Array.isArray(module)) return $0;
16079
16020
  return [$1, $2, ...module];
16080
16021
  });
16081
16022
  function FromClause(ctx, state2) {
@@ -16083,8 +16024,7 @@ function FromClause(ctx, state2) {
16083
16024
  }
16084
16025
  var ImpliedFromClause$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$S)(From, __), ImpliedFrom), ModuleSpecifier), function($skip, $loc, $0, $1, $2) {
16085
16026
  var module = $2;
16086
- if (!Array.isArray(module))
16087
- return $0;
16027
+ if (!Array.isArray(module)) return $0;
16088
16028
  return [$1, ...module];
16089
16029
  });
16090
16030
  function ImpliedFromClause(ctx, state2) {
@@ -16110,8 +16050,7 @@ function ImportAssertion(ctx, state2) {
16110
16050
  return (0, import_lib2.$EVENT)(ctx, state2, "ImportAssertion", ImportAssertion$0);
16111
16051
  }
16112
16052
  var TypeAndImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(__, TypeKeyword)), ImportSpecifier), function($skip, $loc, $0, $1, $2) {
16113
- if (!$1)
16114
- return $2;
16053
+ if (!$1) return $2;
16115
16054
  return { ts: true, children: $0, binding: $2.binding };
16116
16055
  });
16117
16056
  var TypeAndImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Operator, OperatorImportSpecifier), function($skip, $loc, $0, $1, $2, $3) {
@@ -16327,8 +16266,7 @@ function ExportFromClause(ctx, state2) {
16327
16266
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ExportFromClause", ExportFromClause$$);
16328
16267
  }
16329
16268
  var TypeAndNamedExports$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(TypeKeyword, __)), NamedExports), function($skip, $loc, $0, $1, $2) {
16330
- if (!$1)
16331
- return $2;
16269
+ if (!$1) return $2;
16332
16270
  return { ts: true, children: $0 };
16333
16271
  });
16334
16272
  function TypeAndNamedExports(ctx, state2) {
@@ -16347,8 +16285,7 @@ function NamedExports(ctx, state2) {
16347
16285
  return (0, import_lib2.$EVENT_C)(ctx, state2, "NamedExports", NamedExports$$);
16348
16286
  }
16349
16287
  var ExportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, (0, import_lib2.$E)((0, import_lib2.$S)(TypeKeyword, __)), ModuleExportName, (0, import_lib2.$E)((0, import_lib2.$S)(__, As, __, ModuleExportName)), ObjectPropertyDelimiter), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
16350
- if (!$2)
16351
- return $0;
16288
+ if (!$2) return $0;
16352
16289
  return { ts: true, children: $0 };
16353
16290
  });
16354
16291
  function ExportSpecifier(ctx, state2) {
@@ -16360,11 +16297,9 @@ function ImplicitExportSpecifier(ctx, state2) {
16360
16297
  }
16361
16298
  var Declaration$0 = (0, import_lib2.$TV)(ImportDeclaration, function($skip, $loc, $0, $1) {
16362
16299
  var decl = $0;
16363
- if (decl.ts || decl.module || !decl.imports || !decl.from)
16364
- return $skip;
16300
+ if (decl.ts || decl.module || !decl.imports || !decl.from) return $skip;
16365
16301
  const { imports } = decl;
16366
- if (!imports.binding && !imports.specifiers)
16367
- return $skip;
16302
+ if (!imports.binding && !imports.specifiers) return $skip;
16368
16303
  return dynamizeImportDeclaration(decl);
16369
16304
  });
16370
16305
  var Declaration$1 = HoistableDeclaration;
@@ -16634,8 +16569,7 @@ function TripleSingleStringCharacters(ctx, state2) {
16634
16569
  return (0, import_lib2.$EVENT)(ctx, state2, "TripleSingleStringCharacters", TripleSingleStringCharacters$0);
16635
16570
  }
16636
16571
  var CoffeeStringSubstitution$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeSubstitutionStart, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(PostfixedExpression, __, CloseBrace)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
16637
- if (!$3)
16638
- return $skip;
16572
+ if (!$3) return $skip;
16639
16573
  return [$1, ...$3];
16640
16574
  });
16641
16575
  function CoffeeStringSubstitution(ctx, state2) {
@@ -16817,8 +16751,7 @@ function _TemplateLiteral(ctx, state2) {
16817
16751
  return (0, import_lib2.$EVENT_C)(ctx, state2, "_TemplateLiteral", _TemplateLiteral$$);
16818
16752
  }
16819
16753
  var TemplateSubstitution$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(SubstitutionStart, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(PostfixedExpression, __, CloseBrace)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
16820
- if (!$3)
16821
- return $skip;
16754
+ if (!$3) return $skip;
16822
16755
  return [$1, ...$3];
16823
16756
  });
16824
16757
  function TemplateSubstitution(ctx, state2) {
@@ -17663,8 +17596,7 @@ var JSXElement$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(
17663
17596
  var open = $2;
17664
17597
  var children = $3;
17665
17598
  var close = $4;
17666
- if (!children)
17667
- return $skip;
17599
+ if (!children) return $skip;
17668
17600
  let parts;
17669
17601
  $0 = $0.slice(1);
17670
17602
  if (close) {
@@ -17687,8 +17619,7 @@ var JSXElement$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeJSXEnabled, JS
17687
17619
  var open = $2;
17688
17620
  var close = $5;
17689
17621
  $0 = $0.slice(1);
17690
- if (open[1] !== close[2])
17691
- return $skip;
17622
+ if (open[1] !== close[2]) return $skip;
17692
17623
  return { type: "JSXElement", children: $0, tag: open[1] };
17693
17624
  });
17694
17625
  var JSXElement$$ = [JSXElement$0, JSXElement$1, JSXElement$2];
@@ -17720,8 +17651,7 @@ function JSXOpeningElement(ctx, state2) {
17720
17651
  }
17721
17652
  var JSXOptionalClosingElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Whitespace), JSXClosingElement), function($skip, $loc, $0, $1, $2) {
17722
17653
  var close = $2;
17723
- if (state.currentJSXTag !== close[2])
17724
- return $skip;
17654
+ if (state.currentJSXTag !== close[2]) return $skip;
17725
17655
  return $0;
17726
17656
  });
17727
17657
  var JSXOptionalClosingElement$1 = (0, import_lib2.$EXPECT)($L0, 'JSXOptionalClosingElement ""');
@@ -17737,8 +17667,7 @@ var JSXFragment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)
17737
17667
  var open = $2;
17738
17668
  var children = $3;
17739
17669
  var close = $4;
17740
- if (!children)
17741
- return $skip;
17670
+ if (!children) return $skip;
17742
17671
  $0 = $0.slice(1);
17743
17672
  const parts = close ? $0 : [
17744
17673
  ...$0,
@@ -17771,8 +17700,7 @@ function PushJSXOpeningFragment(ctx, state2) {
17771
17700
  return (0, import_lib2.$EVENT)(ctx, state2, "PushJSXOpeningFragment", PushJSXOpeningFragment$0);
17772
17701
  }
17773
17702
  var JSXOptionalClosingFragment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Whitespace), JSXClosingFragment), function($skip, $loc, $0, $1, $2) {
17774
- if (state.currentJSXTag !== "")
17775
- return $skip;
17703
+ if (state.currentJSXTag !== "") return $skip;
17776
17704
  return $0;
17777
17705
  });
17778
17706
  var JSXOptionalClosingFragment$1 = (0, import_lib2.$EXPECT)($L0, 'JSXOptionalClosingFragment ""');
@@ -17850,10 +17778,8 @@ var JSXAttributes$0 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0, import_lib2.$
17850
17778
  while (root.length && isWhitespaceOrEmpty(root[root.length - 1])) {
17851
17779
  root = root.slice(0, -1);
17852
17780
  }
17853
- while (root?.length === 1)
17854
- root = root[0];
17855
- if (root?.children)
17856
- root = root.children;
17781
+ while (root?.length === 1) root = root[0];
17782
+ if (root?.children) root = root.children;
17857
17783
  if (root?.[0]?.token === "`") {
17858
17784
  classValue = ["{", ...exprs, "}"];
17859
17785
  } else {
@@ -17922,8 +17848,7 @@ var JSXAttribute$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(AtThis, (0, import
17922
17848
  children
17923
17849
  });
17924
17850
  const last = lastAccessInCallExpression(expr);
17925
- if (!last)
17926
- return $skip;
17851
+ if (!last) return $skip;
17927
17852
  let name;
17928
17853
  if (last.type === "Index") {
17929
17854
  return [
@@ -17949,8 +17874,7 @@ var JSXAttribute$4 = (0, import_lib2.$TS)((0, import_lib2.$S)(Identifier, (0, im
17949
17874
  return convertObjectToJSXAttributes(expr);
17950
17875
  }
17951
17876
  const last = lastAccessInCallExpression(expr);
17952
- if (!last)
17953
- return $skip;
17877
+ if (!last) return $skip;
17954
17878
  let name;
17955
17879
  if (last.type === "Index") {
17956
17880
  return [
@@ -18037,8 +17961,7 @@ function JSXAttributeValue(ctx, state2) {
18037
17961
  return (0, import_lib2.$EVENT_C)(ctx, state2, "JSXAttributeValue", JSXAttributeValue$$);
18038
17962
  }
18039
17963
  var InlineJSXAttributeValue$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InlineJSXUnaryExpression, (0, import_lib2.$Q)(InlineJSXBinaryOpRHS)), function($skip, $loc, $0, $1, $2) {
18040
- if ($2.length)
18041
- return processBinaryOpExpression($0);
17964
+ if ($2.length) return processBinaryOpExpression($0);
18042
17965
  return $1;
18043
17966
  });
18044
17967
  function InlineJSXAttributeValue(ctx, state2) {
@@ -18073,8 +17996,7 @@ function InlineJSXUnaryPostfix(ctx, state2) {
18073
17996
  }
18074
17997
  var InlineJSXUpdateExpression$0 = (0, import_lib2.$S)(UpdateExpressionSymbol, UnaryExpression);
18075
17998
  var InlineJSXUpdateExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InlineJSXCallExpression, (0, import_lib2.$E)(UpdateExpressionSymbol)), function($skip, $loc, $0, $1, $2) {
18076
- if ($2)
18077
- return $0;
17999
+ if ($2) return $0;
18078
18000
  return $1;
18079
18001
  });
18080
18002
  var InlineJSXUpdateExpression$$ = [InlineJSXUpdateExpression$0, InlineJSXUpdateExpression$1];
@@ -18130,8 +18052,7 @@ var InlineJSXCallExpressionRest$1 = (0, import_lib2.$TV)((0, import_lib2.$C)(Tem
18130
18052
  });
18131
18053
  var InlineJSXCallExpressionRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
18132
18054
  var args = $2;
18133
- if (!$1)
18134
- return args;
18055
+ if (!$1) return args;
18135
18056
  return [$1, args];
18136
18057
  });
18137
18058
  var InlineJSXCallExpressionRest$$ = [InlineJSXCallExpressionRest$0, InlineJSXCallExpressionRest$1, InlineJSXCallExpressionRest$2];
@@ -18155,8 +18076,7 @@ var InlineJSXMemberExpressionRest$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((
18155
18076
  var dot = $1;
18156
18077
  var comments = $2;
18157
18078
  var content = $3;
18158
- if (!dot && !comments.length)
18159
- return content;
18079
+ if (!dot && !comments.length) return content;
18160
18080
  if (dot) {
18161
18081
  if (dot.type === "Optional" && content.type === "SliceExpression") {
18162
18082
  return [...dot.children.slice(0, -1), ...comments, content];
@@ -18244,8 +18164,7 @@ var JSXNested$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(JSXEOS, Indent), func
18244
18164
  var indent = $2;
18245
18165
  const { level } = indent;
18246
18166
  const currentIndent = state.currentIndent;
18247
- if (level !== currentIndent.level)
18248
- return $skip;
18167
+ if (level !== currentIndent.level) return $skip;
18249
18168
  return $0;
18250
18169
  });
18251
18170
  function JSXNested(ctx, state2) {
@@ -18366,8 +18285,7 @@ function JSXChildExpression(ctx, state2) {
18366
18285
  return (0, import_lib2.$EVENT_C)(ctx, state2, "JSXChildExpression", JSXChildExpression$$);
18367
18286
  }
18368
18287
  var IndentedJSXChildExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)(NestedJSXChildExpression), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18369
- if (!$2)
18370
- return $skip;
18288
+ if (!$2) return $skip;
18371
18289
  return $2;
18372
18290
  });
18373
18291
  function IndentedJSXChildExpression(ctx, state2) {
@@ -18387,8 +18305,7 @@ var JSXCodeChild$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertInlineOpenBr
18387
18305
  var open = $1;
18388
18306
  var expression = $2;
18389
18307
  var close = $3;
18390
- if (!expression)
18391
- return $skip;
18308
+ if (!expression) return $skip;
18392
18309
  return [open, expression, close];
18393
18310
  });
18394
18311
  function JSXCodeChild(ctx, state2) {
@@ -18396,14 +18313,12 @@ function JSXCodeChild(ctx, state2) {
18396
18313
  }
18397
18314
  var JSXCodeChildExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(JSXEOS), ForbidNewlineBinaryOp, (0, import_lib2.$E)(JSXChildExpression), RestoreNewlineBinaryOp), function($skip, $loc, $0, $1, $2, $3, $4) {
18398
18315
  var expression = $3;
18399
- if (!expression)
18400
- return $skip;
18316
+ if (!expression) return $skip;
18401
18317
  return expression;
18402
18318
  });
18403
18319
  var JSXCodeChildExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)(JSXEOS), ImplicitNestedBlock), function($skip, $loc, $0, $1, $2) {
18404
18320
  var block = $2;
18405
- if (!block)
18406
- return $skip;
18321
+ if (!block) return $skip;
18407
18322
  const statement = {
18408
18323
  type: "DoStatement",
18409
18324
  children: [block],
@@ -18649,8 +18564,7 @@ function NestedInterfaceBlock(ctx, state2) {
18649
18564
  }
18650
18565
  var NestedInterfaceProperties$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedInterfaceProperty), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18651
18566
  var props = $2;
18652
- if (props.length)
18653
- return props;
18567
+ if (props.length) return props;
18654
18568
  return $skip;
18655
18569
  });
18656
18570
  function NestedInterfaceProperties(ctx, state2) {
@@ -18687,8 +18601,7 @@ function ModuleOrEmptyBlock(ctx, state2) {
18687
18601
  }
18688
18602
  var NestedModuleItems$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedModuleItem), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18689
18603
  var items = $2;
18690
- if (items.length)
18691
- return items;
18604
+ if (items.length) return items;
18692
18605
  return $skip;
18693
18606
  });
18694
18607
  function NestedModuleItems(ctx, state2) {
@@ -18707,8 +18620,7 @@ function DeclareBlock(ctx, state2) {
18707
18620
  }
18708
18621
  var NestedDeclareElements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedDeclareElement), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18709
18622
  var decs = $2;
18710
- if (decs.length)
18711
- return decs;
18623
+ if (decs.length) return decs;
18712
18624
  return $skip;
18713
18625
  });
18714
18626
  function NestedDeclareElements(ctx, state2) {
@@ -18816,8 +18728,7 @@ function EnumBlock(ctx, state2) {
18816
18728
  }
18817
18729
  var NestedEnumProperties$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedEnumPropertyLine), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18818
18730
  var props = $2;
18819
- if (!props.length)
18820
- return $skip;
18731
+ if (!props.length) return $skip;
18821
18732
  return {
18822
18733
  properties: props.flat().map((p) => p.property),
18823
18734
  children: $0
@@ -18864,12 +18775,13 @@ function TypeIndex(ctx, state2) {
18864
18775
  }
18865
18776
  var TypeSuffix$0 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$E)(_), (0, import_lib2.$E)(QuestionMark), (0, import_lib2.$E)(_), Colon, MaybeNestedType), function(value) {
18866
18777
  var optional = value[1];
18778
+ var colon = value[3];
18867
18779
  var t = value[4];
18868
- return { "type": "TypeSuffix", "ts": true, "optional": optional, "t": t, "children": value };
18780
+ return { "type": "TypeSuffix", "ts": true, "optional": optional, "t": t, "colon": colon, "children": value };
18869
18781
  });
18870
18782
  var TypeSuffix$1 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$E)(_), QuestionMark, (0, import_lib2.$E)(_)), function(value) {
18871
18783
  var optional = value[1];
18872
- return { "type": "TypeSuffix", "ts": true, "optional": optional, "children": value };
18784
+ return { "type": "TypeSuffix", "ts": true, "optional": optional, "colon": void 0, "children": value };
18873
18785
  });
18874
18786
  var TypeSuffix$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(NonNullAssertion, (0, import_lib2.$E)(_), (0, import_lib2.$E)((0, import_lib2.$S)(Colon, MaybeNestedType))), function($skip, $loc, $0, $1, $2, $3) {
18875
18787
  var nonnull = $1;
@@ -18880,6 +18792,7 @@ var TypeSuffix$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(NonNullAssertion, (0
18880
18792
  ts: true,
18881
18793
  nonnull,
18882
18794
  t,
18795
+ colon,
18883
18796
  children: [$1, $2, colon, t]
18884
18797
  };
18885
18798
  });
@@ -18891,8 +18804,7 @@ var MaybeNestedType$0 = NestedTypeBulletedTuple;
18891
18804
  var MaybeNestedType$1 = NestedInterfaceBlock;
18892
18805
  var MaybeNestedType$2 = NestedTypeBinaryChain;
18893
18806
  var MaybeNestedType$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Type)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18894
- if (!$2)
18895
- return $skip;
18807
+ if (!$2) return $skip;
18896
18808
  return $2;
18897
18809
  });
18898
18810
  var MaybeNestedType$4 = Type;
@@ -18904,8 +18816,7 @@ var MaybeNestedTypePrimary$0 = NestedTypeBulletedTuple;
18904
18816
  var MaybeNestedTypePrimary$1 = NestedInterfaceBlock;
18905
18817
  var MaybeNestedTypePrimary$2 = NestedTypeBinaryChain;
18906
18818
  var MaybeNestedTypePrimary$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Type)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18907
- if (!$2)
18908
- return $skip;
18819
+ if (!$2) return $skip;
18909
18820
  return $2;
18910
18821
  });
18911
18822
  var MaybeNestedTypePrimary$4 = TypePrimary;
@@ -18917,8 +18828,7 @@ var MaybeNestedTypeUnary$0 = NestedTypeBulletedTuple;
18917
18828
  var MaybeNestedTypeUnary$1 = NestedInterfaceBlock;
18918
18829
  var MaybeNestedTypeUnary$2 = NestedTypeBinaryChain;
18919
18830
  var MaybeNestedTypeUnary$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Type)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18920
- if (!$2)
18921
- return $skip;
18831
+ if (!$2) return $skip;
18922
18832
  return $2;
18923
18833
  });
18924
18834
  var MaybeNestedTypeUnary$4 = (0, import_lib2.$S)(NotDedented, TypeUnary);
@@ -18941,8 +18851,7 @@ function ReturnTypeSuffix(ctx, state2) {
18941
18851
  var ReturnType$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(__, (0, import_lib2.$EXPECT)($L240, 'ReturnType "asserts"'), NonIdContinue)), ForbidIndentedApplication, (0, import_lib2.$E)(TypePredicate), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4) {
18942
18852
  var asserts = $1;
18943
18853
  var t = $3;
18944
- if (!t)
18945
- return $skip;
18854
+ if (!t) return $skip;
18946
18855
  if (asserts) {
18947
18856
  t = {
18948
18857
  type: "TypeAsserts",
@@ -18964,8 +18873,7 @@ function ReturnType(ctx, state2) {
18964
18873
  var TypePredicate$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(MaybeNestedType, (0, import_lib2.$E)((0, import_lib2.$S)(__, Is, Type))), function($skip, $loc, $0, $1, $2) {
18965
18874
  var lhs = $1;
18966
18875
  var rhs = $2;
18967
- if (!rhs)
18968
- return lhs;
18876
+ if (!rhs) return lhs;
18969
18877
  return {
18970
18878
  type: "TypePredicate",
18971
18879
  lhs,
@@ -18984,20 +18892,16 @@ var TypeBinary$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(
18984
18892
  var optionalPrefix = $1;
18985
18893
  var t = $2;
18986
18894
  var ops = $3;
18987
- if (!ops.length && !optionalPrefix)
18988
- return t;
18989
- if (!ops.length)
18990
- return [optionalPrefix, t];
18991
- if (!optionalPrefix)
18992
- return [t, ...ops];
18895
+ if (!ops.length && !optionalPrefix) return t;
18896
+ if (!ops.length) return [optionalPrefix, t];
18897
+ if (!optionalPrefix) return [t, ...ops];
18993
18898
  return [optionalPrefix, t, ops];
18994
18899
  });
18995
18900
  function TypeBinary(ctx, state2) {
18996
18901
  return (0, import_lib2.$EVENT)(ctx, state2, "TypeBinary", TypeBinary$0);
18997
18902
  }
18998
18903
  var NestedTypeBinaryChain$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedTypeBinary), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
18999
- if (!$2.length)
19000
- return $skip;
18904
+ if (!$2.length) return $skip;
19001
18905
  return $2;
19002
18906
  });
19003
18907
  function NestedTypeBinaryChain(ctx, state2) {
@@ -19007,8 +18911,7 @@ var NestedTypeBinary$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested, TypeBi
19007
18911
  var indent = $1;
19008
18912
  var op = $2;
19009
18913
  var t = $4;
19010
- if (!t)
19011
- return $skip;
18914
+ if (!t) return $skip;
19012
18915
  return [indent, op, t];
19013
18916
  });
19014
18917
  function NestedTypeBinary(ctx, state2) {
@@ -19018,8 +18921,7 @@ var TypeUnary$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Q)((
19018
18921
  var prefix = $1;
19019
18922
  var t = $2;
19020
18923
  var suffix = $3;
19021
- if (!prefix.length && !suffix.length)
19022
- return t;
18924
+ if (!prefix.length && !suffix.length) return t;
19023
18925
  return {
19024
18926
  type: "TypeUnary",
19025
18927
  prefix,
@@ -19123,8 +19025,7 @@ var TypePrimary$9 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)
19123
19025
  };
19124
19026
  });
19125
19027
  var TypePrimary$10 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), OpenParen, AllowAll, (0, import_lib2.$E)((0, import_lib2.$C)(Type, (0, import_lib2.$S)(EOS, Type))), RestoreAll, __, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
19126
- if (!$4)
19127
- return $skip;
19028
+ if (!$4) return $skip;
19128
19029
  return {
19129
19030
  type: "TypeParenthesized",
19130
19031
  children: [$1, $2, $4, $6, $7]
@@ -19146,8 +19047,7 @@ var TypeTuple$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, AllowAll
19146
19047
  var elements = $3;
19147
19048
  var ws = $5;
19148
19049
  var close = $6;
19149
- if (!elements)
19150
- return $skip;
19050
+ if (!elements) return $skip;
19151
19051
  return {
19152
19052
  type: "TypeTuple",
19153
19053
  elements,
@@ -19162,8 +19062,7 @@ var TypeTupleContent$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(TypeElementLis
19162
19062
  var list = $1;
19163
19063
  var delimiter = $2;
19164
19064
  var nested = $3;
19165
- if (!nested)
19166
- return list;
19065
+ if (!nested) return list;
19167
19066
  return [...list, delimiter, ...nested];
19168
19067
  });
19169
19068
  var TypeTupleContent$2 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0, import_lib2.$S)(__, TypeElementListWithIndentedApplicationForbidden, ArrayElementDelimiter)), function($skip, $loc, $0, $1) {
@@ -19174,8 +19073,7 @@ function TypeTupleContent(ctx, state2) {
19174
19073
  return (0, import_lib2.$EVENT_C)(ctx, state2, "TypeTupleContent", TypeTupleContent$$);
19175
19074
  }
19176
19075
  var TypeElementListWithIndentedApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidIndentedApplication, (0, import_lib2.$E)(TypeElementList), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3) {
19177
- if ($2)
19178
- return $2;
19076
+ if ($2) return $2;
19179
19077
  return $skip;
19180
19078
  });
19181
19079
  function TypeElementListWithIndentedApplicationForbidden(ctx, state2) {
@@ -19187,8 +19085,7 @@ var TypeElementList$0 = (0, import_lib2.$T)((0, import_lib2.$S)(TypeBulletedTupl
19187
19085
  var TypeElementList$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(EOS), TypeElement, (0, import_lib2.$Q)((0, import_lib2.$S)((0, import_lib2.$S)((0, import_lib2.$E)(_), Comma, (0, import_lib2.$N)(EOS)), TypeElement))), function($skip, $loc, $0, $1, $2, $3) {
19188
19086
  var first = $2;
19189
19087
  var rest = $3;
19190
- if (!rest.length)
19191
- return [first];
19088
+ if (!rest.length) return [first];
19192
19089
  return [
19193
19090
  append(first, rest[0][0])
19194
19091
  ].concat(
@@ -19254,13 +19151,10 @@ var NestedTypeElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested, TypeE
19254
19151
  var list = $2;
19255
19152
  var delimiter = $3;
19256
19153
  const { length } = list;
19257
- if (!length)
19258
- return $skip;
19154
+ if (!length) return $skip;
19259
19155
  return list.map((e, i) => {
19260
- if (i === 0)
19261
- e = prepend(indent, e);
19262
- if (i === length - 1)
19263
- e = append(e, delimiter);
19156
+ if (i === 0) e = prepend(indent, e);
19157
+ if (i === length - 1) e = append(e, delimiter);
19264
19158
  return e;
19265
19159
  });
19266
19160
  });
@@ -19271,8 +19165,7 @@ var NestedTypeBulletedTuple$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, imp
19271
19165
  var open = $1;
19272
19166
  var content = $3;
19273
19167
  var close = $4;
19274
- if (!content.length)
19275
- return $skip;
19168
+ if (!content.length) return $skip;
19276
19169
  content = content.flat();
19277
19170
  const last = content[content.length - 1];
19278
19171
  let children = Array.isArray(last) ? last : last?.children;
@@ -19296,8 +19189,7 @@ var TypeBulletedTuple$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBra
19296
19189
  var open = $1;
19297
19190
  var content = $2;
19298
19191
  var close = $3;
19299
- if (!content)
19300
- return $skip;
19192
+ if (!content) return $skip;
19301
19193
  content = [
19302
19194
  ...trimFirstSpace(content[0]),
19303
19195
  // replace first space with bracket
@@ -19332,11 +19224,9 @@ function NestedTypeBullet(ctx, state2) {
19332
19224
  var TypeBullet$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(BulletIndent, (0, import_lib2.$E)((0, import_lib2.$S)(TypeElementList, ArrayBulletDelimiter)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
19333
19225
  var bullet = $1;
19334
19226
  var content = $2;
19335
- if (!content)
19336
- return $skip;
19227
+ if (!content) return $skip;
19337
19228
  let [list, delimiter] = content;
19338
- if (!list.length)
19339
- return $skip;
19229
+ if (!list.length) return $skip;
19340
19230
  list = list.slice();
19341
19231
  list[0] = prepend(bullet, list[0]);
19342
19232
  if (delimiter) {
@@ -19351,8 +19241,7 @@ function TypeBullet(ctx, state2) {
19351
19241
  var TypeWithPostfix$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(TypeConditional, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$E)(_), TypeIfClause))), function($skip, $loc, $0, $1, $2) {
19352
19242
  var t = $1;
19353
19243
  var postfix = $2;
19354
- if (!postfix)
19355
- return t;
19244
+ if (!postfix) return t;
19356
19245
  return prepend(
19357
19246
  postfix[0],
19358
19247
  expressionizeTypeIf([...postfix[1], $1, void 0])
@@ -19365,8 +19254,7 @@ var TypeConditional$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
19365
19254
  return prepend($1, expressionizeTypeIf($3));
19366
19255
  });
19367
19256
  var TypeConditional$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(TypeCondition, NotDedented, QuestionMark, __, Type, __, Colon, __, Type), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19368
- if ($1.negated)
19369
- return [$1, $2, $3, $4, $9, $6, $7, $8, $5];
19257
+ if ($1.negated) return [$1, $2, $3, $4, $9, $6, $7, $8, $5];
19370
19258
  return $0;
19371
19259
  });
19372
19260
  var TypeConditional$2 = TypeBinary;
@@ -19392,14 +19280,12 @@ function TypeIfThenElse(ctx, state2) {
19392
19280
  }
19393
19281
  var TypeIfClause$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$C)(If, Unless), OpenParen, AllowAll, (0, import_lib2.$E)(TypeCondition), RestoreAll, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
19394
19282
  var condition = $4;
19395
- if (!condition)
19396
- return $skip;
19283
+ if (!condition) return $skip;
19397
19284
  return [$1, condition];
19398
19285
  });
19399
19286
  var TypeIfClause$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$C)(If, Unless), ForbidIndentedApplication, (0, import_lib2.$E)(TypeCondition), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4) {
19400
19287
  var condition = $3;
19401
- if (!condition)
19402
- return $skip;
19288
+ if (!condition) return $skip;
19403
19289
  return [$1, condition];
19404
19290
  });
19405
19291
  var TypeIfClause$$ = [TypeIfClause$0, TypeIfClause$1];
@@ -19418,8 +19304,7 @@ var TypeBlock$1 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$N)(EO
19418
19304
  });
19419
19305
  var TypeBlock$2 = NestedInterfaceBlock;
19420
19306
  var TypeBlock$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Type)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
19421
- if (!$2)
19422
- return $skip;
19307
+ if (!$2) return $skip;
19423
19308
  return $2;
19424
19309
  });
19425
19310
  var TypeBlock$$ = [TypeBlock$0, TypeBlock$1, TypeBlock$2, TypeBlock$3];
@@ -19459,8 +19344,7 @@ var TypeLiteral$1 = Literal;
19459
19344
  var TypeLiteral$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R14, "TypeLiteral /[+-]/"), NumericLiteral), function($skip, $loc, $0, $1, $2) {
19460
19345
  var sign = $1;
19461
19346
  var num = $2;
19462
- if (sign[0] === "+")
19463
- return num;
19347
+ if (sign[0] === "+") return num;
19464
19348
  return $0;
19465
19349
  });
19466
19350
  var TypeLiteral$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L224, 'TypeLiteral "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
@@ -19576,8 +19460,7 @@ var ImplicitTypeArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(TypeAppli
19576
19460
  var args = $4;
19577
19461
  var close = $5;
19578
19462
  const last = args[args.length - 1];
19579
- if (isComma(last))
19580
- args = args.slice(0, -1);
19463
+ if (isComma(last)) args = args.slice(0, -1);
19581
19464
  return {
19582
19465
  type: "TypeArguments",
19583
19466
  ts: true,
@@ -19631,8 +19514,7 @@ function TypeArgumentList(ctx, state2) {
19631
19514
  }
19632
19515
  var NestedTypeArgumentList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$Q)(NestedTypeArgument), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
19633
19516
  var args = $2;
19634
- if (!args.length)
19635
- return $skip;
19517
+ if (!args.length) return $skip;
19636
19518
  return args.flat();
19637
19519
  });
19638
19520
  function NestedTypeArgumentList(ctx, state2) {
@@ -19743,16 +19625,14 @@ function CivetPrologueContent(ctx, state2) {
19743
19625
  }
19744
19626
  var CivetOption$0 = (0, import_lib2.$TR)((0, import_lib2.$EXPECT)($R99, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([\\p{ID_Continue}.,+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19745
19627
  const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
19746
- if (l)
19747
- return l.toUpperCase();
19628
+ if (l) return l.toUpperCase();
19748
19629
  return "";
19749
19630
  });
19750
19631
  let value = $3 ? $4 : $1 === "-" ? false : true;
19751
19632
  switch (optionName) {
19752
19633
  case "tab":
19753
19634
  value = parseFloat(value);
19754
- if (isNaN(value))
19755
- value = 0;
19635
+ if (isNaN(value)) value = 0;
19756
19636
  break;
19757
19637
  case "globals":
19758
19638
  case "symbols":
@@ -19941,144 +19821,126 @@ function InsertType(ctx, state2) {
19941
19821
  return (0, import_lib2.$EVENT)(ctx, state2, "InsertType", InsertType$0);
19942
19822
  }
19943
19823
  var CoffeeBinaryExistentialEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeBinaryExistentialEnabled ""'), function($skip, $loc, $0, $1) {
19944
- if (config.coffeeBinaryExistential)
19945
- return;
19824
+ if (config.coffeeBinaryExistential) return;
19946
19825
  return $skip;
19947
19826
  });
19948
19827
  function CoffeeBinaryExistentialEnabled(ctx, state2) {
19949
19828
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeBinaryExistentialEnabled", CoffeeBinaryExistentialEnabled$0);
19950
19829
  }
19951
19830
  var CoffeeBooleansEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeBooleansEnabled ""'), function($skip, $loc, $0, $1) {
19952
- if (config.coffeeBooleans)
19953
- return;
19831
+ if (config.coffeeBooleans) return;
19954
19832
  return $skip;
19955
19833
  });
19956
19834
  function CoffeeBooleansEnabled(ctx, state2) {
19957
19835
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeBooleansEnabled", CoffeeBooleansEnabled$0);
19958
19836
  }
19959
19837
  var CoffeeClassesEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeClassesEnabled ""'), function($skip, $loc, $0, $1) {
19960
- if (config.coffeeClasses)
19961
- return;
19838
+ if (config.coffeeClasses) return;
19962
19839
  return $skip;
19963
19840
  });
19964
19841
  function CoffeeClassesEnabled(ctx, state2) {
19965
19842
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeClassesEnabled", CoffeeClassesEnabled$0);
19966
19843
  }
19967
19844
  var CoffeeCommentEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeCommentEnabled ""'), function($skip, $loc, $0, $1) {
19968
- if (config.coffeeComment)
19969
- return;
19845
+ if (config.coffeeComment) return;
19970
19846
  return $skip;
19971
19847
  });
19972
19848
  function CoffeeCommentEnabled(ctx, state2) {
19973
19849
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeCommentEnabled", CoffeeCommentEnabled$0);
19974
19850
  }
19975
19851
  var CoffeeDivEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeDivEnabled ""'), function($skip, $loc, $0, $1) {
19976
- if (config.coffeeDiv)
19977
- return;
19852
+ if (config.coffeeDiv) return;
19978
19853
  return $skip;
19979
19854
  });
19980
19855
  function CoffeeDivEnabled(ctx, state2) {
19981
19856
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeDivEnabled", CoffeeDivEnabled$0);
19982
19857
  }
19983
19858
  var CoffeeDoEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeDoEnabled ""'), function($skip, $loc, $0, $1) {
19984
- if (config.coffeeDo)
19985
- return;
19859
+ if (config.coffeeDo) return;
19986
19860
  return $skip;
19987
19861
  });
19988
19862
  function CoffeeDoEnabled(ctx, state2) {
19989
19863
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeDoEnabled", CoffeeDoEnabled$0);
19990
19864
  }
19991
19865
  var CoffeeForLoopsEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeForLoopsEnabled ""'), function($skip, $loc, $0, $1) {
19992
- if (config.coffeeForLoops)
19993
- return;
19866
+ if (config.coffeeForLoops) return;
19994
19867
  return $skip;
19995
19868
  });
19996
19869
  function CoffeeForLoopsEnabled(ctx, state2) {
19997
19870
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeForLoopsEnabled", CoffeeForLoopsEnabled$0);
19998
19871
  }
19999
19872
  var CoffeeInterpolationEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeInterpolationEnabled ""'), function($skip, $loc, $0, $1) {
20000
- if (config.coffeeInterpolation)
20001
- return;
19873
+ if (config.coffeeInterpolation) return;
20002
19874
  return $skip;
20003
19875
  });
20004
19876
  function CoffeeInterpolationEnabled(ctx, state2) {
20005
19877
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeInterpolationEnabled", CoffeeInterpolationEnabled$0);
20006
19878
  }
20007
19879
  var CoffeeIsntEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeIsntEnabled ""'), function($skip, $loc, $0, $1) {
20008
- if (config.coffeeIsnt)
20009
- return;
19880
+ if (config.coffeeIsnt) return;
20010
19881
  return $skip;
20011
19882
  });
20012
19883
  function CoffeeIsntEnabled(ctx, state2) {
20013
19884
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeIsntEnabled", CoffeeIsntEnabled$0);
20014
19885
  }
20015
19886
  var CoffeeJSXEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeJSXEnabled ""'), function($skip, $loc, $0, $1) {
20016
- if (config.coffeeJSX)
20017
- return;
19887
+ if (config.coffeeJSX) return;
20018
19888
  return $skip;
20019
19889
  });
20020
19890
  function CoffeeJSXEnabled(ctx, state2) {
20021
19891
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeJSXEnabled", CoffeeJSXEnabled$0);
20022
19892
  }
20023
19893
  var CoffeeLineContinuationEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeLineContinuationEnabled ""'), function($skip, $loc, $0, $1) {
20024
- if (config.coffeeLineContinuation)
20025
- return;
19894
+ if (config.coffeeLineContinuation) return;
20026
19895
  return $skip;
20027
19896
  });
20028
19897
  function CoffeeLineContinuationEnabled(ctx, state2) {
20029
19898
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeLineContinuationEnabled", CoffeeLineContinuationEnabled$0);
20030
19899
  }
20031
19900
  var CoffeeNotEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeNotEnabled ""'), function($skip, $loc, $0, $1) {
20032
- if (config.coffeeNot)
20033
- return;
19901
+ if (config.coffeeNot) return;
20034
19902
  return $skip;
20035
19903
  });
20036
19904
  function CoffeeNotEnabled(ctx, state2) {
20037
19905
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeNotEnabled", CoffeeNotEnabled$0);
20038
19906
  }
20039
19907
  var CoffeeOfEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeOfEnabled ""'), function($skip, $loc, $0, $1) {
20040
- if (config.coffeeOf)
20041
- return;
19908
+ if (config.coffeeOf) return;
20042
19909
  return $skip;
20043
19910
  });
20044
19911
  function CoffeeOfEnabled(ctx, state2) {
20045
19912
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeOfEnabled", CoffeeOfEnabled$0);
20046
19913
  }
20047
19914
  var CoffeePrototypeEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeePrototypeEnabled ""'), function($skip, $loc, $0, $1) {
20048
- if (config.coffeePrototype)
20049
- return;
19915
+ if (config.coffeePrototype) return;
20050
19916
  return $skip;
20051
19917
  });
20052
19918
  function CoffeePrototypeEnabled(ctx, state2) {
20053
19919
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeePrototypeEnabled", CoffeePrototypeEnabled$0);
20054
19920
  }
20055
19921
  var JSXCodeNestedEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'JSXCodeNestedEnabled ""'), function($skip, $loc, $0, $1) {
20056
- if (config.jsxCodeNested)
20057
- return;
19922
+ if (config.jsxCodeNested) return;
20058
19923
  return $skip;
20059
19924
  });
20060
19925
  function JSXCodeNestedEnabled(ctx, state2) {
20061
19926
  return (0, import_lib2.$EVENT)(ctx, state2, "JSXCodeNestedEnabled", JSXCodeNestedEnabled$0);
20062
19927
  }
20063
19928
  var JSXCodeSameLineEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'JSXCodeSameLineEnabled ""'), function($skip, $loc, $0, $1) {
20064
- if (config.jsxCodeSameLine)
20065
- return;
19929
+ if (config.jsxCodeSameLine) return;
20066
19930
  return $skip;
20067
19931
  });
20068
19932
  function JSXCodeSameLineEnabled(ctx, state2) {
20069
19933
  return (0, import_lib2.$EVENT)(ctx, state2, "JSXCodeSameLineEnabled", JSXCodeSameLineEnabled$0);
20070
19934
  }
20071
19935
  var ObjectIsEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ObjectIsEnabled ""'), function($skip, $loc, $0, $1) {
20072
- if (config.objectIs)
20073
- return;
19936
+ if (config.objectIs) return;
20074
19937
  return $skip;
20075
19938
  });
20076
19939
  function ObjectIsEnabled(ctx, state2) {
20077
19940
  return (0, import_lib2.$EVENT)(ctx, state2, "ObjectIsEnabled", ObjectIsEnabled$0);
20078
19941
  }
20079
19942
  var IsBare$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'IsBare ""'), function($skip, $loc, $0, $1) {
20080
- if (config.iife || config.repl)
20081
- return $skip;
19943
+ if (config.iife || config.repl) return $skip;
20082
19944
  });
20083
19945
  function IsBare(ctx, state2) {
20084
19946
  return (0, import_lib2.$EVENT)(ctx, state2, "IsBare", IsBare$0);
@@ -20251,8 +20113,7 @@ function PopIndent(ctx, state2) {
20251
20113
  }
20252
20114
  var Nested$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(EOS, Indent), function($skip, $loc, $0, $1, $2) {
20253
20115
  var indent = $2;
20254
- if (indent.level === state.currentIndent.level)
20255
- return $0;
20116
+ if (indent.level === state.currentIndent.level) return $0;
20256
20117
  if (config.verbose) {
20257
20118
  console.log(`failing Nested: ${indent.level} does not match current indent level ${state.currentIndent.level}`);
20258
20119
  }
@@ -20263,8 +20124,7 @@ function Nested(ctx, state2) {
20263
20124
  }
20264
20125
  var IndentedFurther$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(EOS, Indent), function($skip, $loc, $0, $1, $2) {
20265
20126
  var indent = $2;
20266
- if (indent.level > state.currentIndent.level)
20267
- return $0;
20127
+ if (indent.level > state.currentIndent.level) return $0;
20268
20128
  return $skip;
20269
20129
  });
20270
20130
  function IndentedFurther(ctx, state2) {
@@ -20272,8 +20132,7 @@ function IndentedFurther(ctx, state2) {
20272
20132
  }
20273
20133
  var IndentedAtLeast$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(EOS, Indent), function($skip, $loc, $0, $1, $2) {
20274
20134
  var indent = $2;
20275
- if (indent.level >= state.currentIndent.level)
20276
- return $0;
20135
+ if (indent.level >= state.currentIndent.level) return $0;
20277
20136
  return $skip;
20278
20137
  });
20279
20138
  function IndentedAtLeast(ctx, state2) {
@@ -20281,10 +20140,8 @@ function IndentedAtLeast(ctx, state2) {
20281
20140
  }
20282
20141
  var NotDedented$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(IndentedAtLeast), (0, import_lib2.$E)(_)), function($skip, $loc, $0, $1, $2) {
20283
20142
  const ws = [];
20284
- if ($1)
20285
- ws.push(...$1);
20286
- if ($2)
20287
- ws.push(...$2);
20143
+ if ($1) ws.push(...$1);
20144
+ if ($2) ws.push(...$2);
20288
20145
  return ws.flat(Infinity).filter(Boolean);
20289
20146
  });
20290
20147
  function NotDedented(ctx, state2) {
@@ -20292,10 +20149,8 @@ function NotDedented(ctx, state2) {
20292
20149
  }
20293
20150
  var SameLineOrIndentedFurther$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(IndentedFurther), (0, import_lib2.$E)(_)), function($skip, $loc, $0, $1, $2) {
20294
20151
  const ws = [];
20295
- if ($1)
20296
- ws.push(...$1);
20297
- if ($2)
20298
- ws.push(...$2);
20152
+ if ($1) ws.push(...$1);
20153
+ if ($2) ws.push(...$2);
20299
20154
  return ws.flat(Infinity).filter(Boolean);
20300
20155
  });
20301
20156
  function SameLineOrIndentedFurther(ctx, state2) {
@@ -20313,8 +20168,7 @@ var PushExtraIndent1$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pus
20313
20168
  $loc,
20314
20169
  level: state.currentIndent.level + 1
20315
20170
  };
20316
- if (config.verbose)
20317
- console.log("pushing bonus indent", indent);
20171
+ if (config.verbose) console.log("pushing bonus indent", indent);
20318
20172
  state.indentLevels.push(indent);
20319
20173
  return indent;
20320
20174
  });
@@ -20326,11 +20180,9 @@ var parser = function() {
20326
20180
  let ctx = { expectation: "", fail };
20327
20181
  return {
20328
20182
  parse: (input, options = {}) => {
20329
- if (typeof input !== "string")
20330
- throw new Error("Input must be a string");
20183
+ if (typeof input !== "string") throw new Error("Input must be a string");
20331
20184
  const parser2 = options.startRule != null ? grammar[options.startRule] : Object.values(grammar)[0];
20332
- if (!parser2)
20333
- throw new Error(`Could not find rule with name '${options.startRule}'`);
20185
+ if (!parser2) throw new Error(`Could not find rule with name '${options.startRule}'`);
20334
20186
  const filename2 = options.filename || "<anonymous>";
20335
20187
  reset();
20336
20188
  Object.assign(ctx, { ...options.events, tokenize: options.tokenize });
@@ -20461,9 +20313,9 @@ var wellKnownSymbols = [
20461
20313
  "unscopables"
20462
20314
  ];
20463
20315
 
20464
- // source/sourcemap.civet
20465
- var sourcemap_exports = {};
20466
- __export(sourcemap_exports, {
20316
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\sourcemap.civet.jsx
20317
+ var sourcemap_civet_exports = {};
20318
+ __export(sourcemap_civet_exports, {
20467
20319
  SourceMap: () => SourceMap,
20468
20320
  base64Encode: () => base64Encode,
20469
20321
  locationTable: () => locationTable,
@@ -20648,10 +20500,8 @@ var VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - 1;
20648
20500
  var encodeVlq = function(value) {
20649
20501
  let answer = "";
20650
20502
  let ref1;
20651
- if (value < 0)
20652
- ref1 = 1;
20653
- else
20654
- ref1 = 0;
20503
+ if (value < 0) ref1 = 1;
20504
+ else ref1 = 0;
20655
20505
  const signBit = ref1;
20656
20506
  let valueToEncode = (Math.abs(value) << 1) + signBit;
20657
20507
  while (valueToEncode || !answer) {
@@ -20765,7 +20615,7 @@ var remapPosition = function(position, sourcemapLines) {
20765
20615
  }
20766
20616
  };
20767
20617
 
20768
- // source/state-cache.civet
20618
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\state-cache.civet.jsx
20769
20619
  var StateCache = class {
20770
20620
  cache = /* @__PURE__ */ new Map();
20771
20621
  get(key) {
@@ -20805,8 +20655,86 @@ var StateCache = class {
20805
20655
  }
20806
20656
  };
20807
20657
 
20808
- // source/main.civet
20809
- var { SourceMap: SourceMap2 } = sourcemap_exports;
20658
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\worker-pool.civet.jsx
20659
+ var WorkerPool = class {
20660
+ idle;
20661
+ spawned;
20662
+ jobId;
20663
+ callbacks;
20664
+ todo;
20665
+ threads;
20666
+ constructor(threads) {
20667
+ this.threads = threads;
20668
+ this.idle = [];
20669
+ this.spawned = 0;
20670
+ this.jobId = 0;
20671
+ this.callbacks = /* @__PURE__ */ new Map();
20672
+ this.todo = [];
20673
+ }
20674
+ async run(op, ...args) {
20675
+ const id = this.jobId++;
20676
+ return await new Promise(async (resolve2, reject) => {
20677
+ this.callbacks.set(id, { resolve: resolve2, reject });
20678
+ const job = { id, op, args };
20679
+ if (this.idle.length) {
20680
+ const worker = this.idle.shift();
20681
+ worker.ref();
20682
+ worker.postMessage(job);
20683
+ } else if (this.spawned < this.threads) {
20684
+ (await this.startWorker()).postMessage(job);
20685
+ } else {
20686
+ this.todo.push(job);
20687
+ }
20688
+ });
20689
+ }
20690
+ async startWorker() {
20691
+ this.spawned++;
20692
+ const { Worker } = await import("node:worker_threads");
20693
+ const path = (await import("node:path")).default;
20694
+ ESM_ONLY: globalThis.__dirname = await (async () => {
20695
+ {
20696
+ const { fileURLToPath } = await import("node:url");
20697
+ return path.dirname(fileURLToPath(import.meta.url));
20698
+ }
20699
+ })();
20700
+ const worker = new Worker(path.join(__dirname, "node-worker.mjs"));
20701
+ worker.on("message", (response) => {
20702
+ const callback = this.callbacks.get(response.id);
20703
+ this.callbacks.delete(response.id);
20704
+ if (response.error) {
20705
+ callback.reject(response.error);
20706
+ } else {
20707
+ callback.resolve(response.result);
20708
+ }
20709
+ if (this.spawned > this.threads) {
20710
+ this.spawned--;
20711
+ return worker.terminate();
20712
+ } else if (this.todo.length) {
20713
+ return worker.postMessage(this.todo.shift());
20714
+ } else {
20715
+ this.idle.push(worker);
20716
+ return worker.unref();
20717
+ }
20718
+ });
20719
+ worker.on("error", (error) => {
20720
+ return console.error("Civet worker failed:", error);
20721
+ });
20722
+ return worker;
20723
+ }
20724
+ setThreads(threads1) {
20725
+ this.threads = threads1;
20726
+ while (this.spawned > this.threads) {
20727
+ if (!this.idle.length) {
20728
+ return;
20729
+ }
20730
+ this.spawned--;
20731
+ this.idle.pop().terminate();
20732
+ }
20733
+ }
20734
+ };
20735
+
20736
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\main.civet.jsx
20737
+ var { SourceMap: SourceMap2 } = sourcemap_civet_exports;
20810
20738
  var ParseErrors = class extends Error {
20811
20739
  name = "ParseErrors";
20812
20740
  errors;
@@ -20864,7 +20792,21 @@ var uncacheable = /* @__PURE__ */ new Set([
20864
20792
  "RestoreNewlineBinaryOp",
20865
20793
  "RestorePipeline"
20866
20794
  ]);
20795
+ var workerPool;
20867
20796
  function compile(src, options) {
20797
+ if (!(process.env.CIVET_THREADS == 0)) {
20798
+ const threads = parseInt(options?.threads ?? process.env.CIVET_THREADS, 10);
20799
+ if (threads === 0) {
20800
+ workerPool?.setThreads(0);
20801
+ } else if (!isNaN(threads) && threads > 0 && !options.sync) {
20802
+ if (workerPool != null) {
20803
+ workerPool.setThreads(threads);
20804
+ } else {
20805
+ workerPool = new WorkerPool(threads);
20806
+ }
20807
+ return workerPool.run("compile", src, { ...options, threads: 0 });
20808
+ }
20809
+ }
20868
20810
  if (!options) {
20869
20811
  options = {};
20870
20812
  } else {
@@ -20946,7 +20888,7 @@ ${counts}`;
20946
20888
  }
20947
20889
  if (options.sourceMap || options.inlineMap) {
20948
20890
  options.sourceMap = SourceMap2(src);
20949
- const code = generate_default(ast2, options);
20891
+ const code = generate_civet_default(ast2, options);
20950
20892
  checkErrors();
20951
20893
  if (options.inlineMap) {
20952
20894
  return SourceMap2.remap(code, options.sourceMap, filename2, filename2 + ".tsx");
@@ -20957,11 +20899,11 @@ ${counts}`;
20957
20899
  };
20958
20900
  }
20959
20901
  }
20960
- const result = generate_default(ast2, options);
20902
+ const result = generate_civet_default(ast2, options);
20961
20903
  if (options.errors?.length) {
20962
20904
  delete options.errors;
20963
20905
  options.sourceMap = SourceMap2(src);
20964
- generate_default(ast2, options);
20906
+ generate_civet_default(ast2, options);
20965
20907
  checkErrors();
20966
20908
  }
20967
20909
  return result;
@@ -21040,19 +20982,19 @@ var makeCache = function({ hits, trace } = {}) {
21040
20982
  var isCompileError = function(err) {
21041
20983
  return err instanceof import_lib2.ParseError || err instanceof ParseErrors;
21042
20984
  };
21043
- var main_default = { parse, parseProgram, ParseError: import_lib2.ParseError, ParseErrors, generate: generate_default, sourcemap: sourcemap_exports, SourceMap: SourceMap2, compile, isCompileError };
20985
+ var main_civet_default = { parse, parseProgram, ParseError: import_lib2.ParseError, ParseErrors, generate: generate_civet_default, sourcemap: sourcemap_civet_exports, SourceMap: SourceMap2, compile, isCompileError };
21044
20986
  var export_ParseError = import_lib2.ParseError;
21045
20987
  export {
21046
20988
  export_ParseError as ParseError,
21047
20989
  ParseErrors,
21048
20990
  SourceMap2 as SourceMap,
21049
20991
  compile,
21050
- main_default as default,
21051
- generate_default as generate,
20992
+ main_civet_default as default,
20993
+ generate_civet_default as generate,
21052
20994
  isCompileError,
21053
- lib_exports as lib,
20995
+ lib_civet_exports as lib,
21054
20996
  parse,
21055
20997
  parseProgram,
21056
20998
  prune,
21057
- sourcemap_exports as sourcemap
20999
+ sourcemap_civet_exports as sourcemap
21058
21000
  };