@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.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -484,30 +483,30 @@ ${body}`;
484
483
  }
485
484
  });
486
485
 
487
- // source/main.civet
488
- var main_exports = {};
489
- __export(main_exports, {
486
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\main.civet.jsx
487
+ var main_civet_exports = {};
488
+ __export(main_civet_exports, {
490
489
  ParseError: () => import_lib2.ParseError,
491
490
  ParseErrors: () => ParseErrors,
492
491
  SourceMap: () => SourceMap2,
493
492
  compile: () => compile,
494
- default: () => main_default,
495
- generate: () => generate_default,
493
+ default: () => main_civet_default,
494
+ generate: () => generate_civet_default,
496
495
  isCompileError: () => isCompileError,
497
- lib: () => lib_exports,
496
+ lib: () => lib_civet_exports,
498
497
  parse: () => parse,
499
498
  parseProgram: () => parseProgram,
500
499
  prune: () => prune,
501
- sourcemap: () => sourcemap_exports
500
+ sourcemap: () => sourcemap_civet_exports
502
501
  });
503
- module.exports = __toCommonJS(main_exports);
502
+ module.exports = __toCommonJS(main_civet_exports);
504
503
 
505
504
  // source/parser.hera
506
505
  var import_lib2 = __toESM(require_machine());
507
506
 
508
- // source/parser/lib.civet
509
- var lib_exports = {};
510
- __export(lib_exports, {
507
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
508
+ var lib_civet_exports = {};
509
+ __export(lib_civet_exports, {
511
510
  addPostfixStatement: () => addPostfixStatement,
512
511
  adjustBindingElements: () => adjustBindingElements,
513
512
  adjustIndexAccess: () => adjustIndexAccess,
@@ -581,7 +580,7 @@ __export(lib_exports, {
581
580
  wrapTypeInPromise: () => wrapTypeInPromise
582
581
  });
583
582
 
584
- // source/parser/util.civet
583
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\util.civet.jsx
585
584
  function len(arr, length) {
586
585
  return arr.length === length;
587
586
  }
@@ -605,10 +604,8 @@ var assert = {
605
604
  }
606
605
  };
607
606
  function addParentPointers(node, parent) {
608
- if (node == null)
609
- return;
610
- if (typeof node !== "object")
611
- return;
607
+ if (node == null) return;
608
+ if (typeof node !== "object") return;
612
609
  if (Array.isArray(node)) {
613
610
  for (const child of node) {
614
611
  addParentPointers(child, parent);
@@ -674,8 +671,7 @@ function isToken(node) {
674
671
  return node != null && node.token != null;
675
672
  }
676
673
  function isEmptyBareBlock(node) {
677
- if (node?.type !== "BlockStatement")
678
- return false;
674
+ if (node?.type !== "BlockStatement") return false;
679
675
  const { bare, expressions } = node;
680
676
  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");
681
677
  }
@@ -708,20 +704,13 @@ function isStatement(node) {
708
704
  statementTypes.has(node.type);
709
705
  }
710
706
  function isWhitespaceOrEmpty(node) {
711
- if (!node)
712
- return true;
713
- if (node.type === "Ref")
714
- return false;
715
- if (node.token)
716
- return /^\s*$/.test(node.token);
717
- if (node.children)
718
- node = node.children;
719
- if (!node.length)
720
- return true;
721
- if (typeof node === "string")
722
- return /^\s*$/.test(node);
723
- if (Array.isArray(node))
724
- return node.every(isWhitespaceOrEmpty);
707
+ if (!node) return true;
708
+ if (node.type === "Ref") return false;
709
+ if (node.token) return /^\s*$/.test(node.token);
710
+ if (node.children) node = node.children;
711
+ if (!node.length) return true;
712
+ if (typeof node === "string") return /^\s*$/.test(node);
713
+ if (Array.isArray(node)) return node.every(isWhitespaceOrEmpty);
725
714
  return false;
726
715
  }
727
716
  function firstNonSpace(node) {
@@ -765,12 +754,14 @@ function isExit(node) {
765
754
  let ref3;
766
755
  let ref4;
767
756
  switch (node.type) {
757
+ // Exit from normal flow
768
758
  case "ReturnStatement":
769
759
  case "ThrowStatement":
770
760
  case "BreakStatement":
771
761
  case "ContinueStatement": {
772
762
  return true;
773
763
  }
764
+ // if checks then and else clause
774
765
  case "IfStatement": {
775
766
  return (
776
767
  // `insertReturn` for IfStatement adds a return to children
@@ -794,9 +785,11 @@ function isExit(node) {
794
785
  case "BlockStatement": {
795
786
  return node.expressions.some((s) => isExit(s[1]));
796
787
  }
788
+ // Infinite loops
797
789
  case "IterationStatement": {
798
790
  return isLoopStatement(node) && gatherRecursiveWithinFunction(node.block, ($1) => $1.type === "BreakStatement").length === 0;
799
791
  }
792
+ // TODO: Distinguish between break of this loop vs. break of inner loops
800
793
  default: {
801
794
  return false;
802
795
  }
@@ -1016,8 +1009,7 @@ function makeNumericLiteral(n) {
1016
1009
  };
1017
1010
  }
1018
1011
  function startsWith(target, value) {
1019
- if (!target)
1020
- return;
1012
+ if (!target) return;
1021
1013
  if (Array.isArray(target)) {
1022
1014
  let i = 0;
1023
1015
  let l = target.length;
@@ -1032,12 +1024,9 @@ function startsWith(target, value) {
1032
1024
  return startsWith(target[i], value);
1033
1025
  }
1034
1026
  }
1035
- if (typeof target === "string")
1036
- return value.test(target);
1037
- if (target.children)
1038
- return startsWith(target.children, value);
1039
- if (target.token)
1040
- return value.test(target.token);
1027
+ if (typeof target === "string") return value.test(target);
1028
+ if (target.children) return startsWith(target.children, value);
1029
+ if (target.token) return value.test(target.token);
1041
1030
  return;
1042
1031
  }
1043
1032
  function startsWithPredicate(node, predicate, skip = isWhitespaceOrEmpty) {
@@ -1168,10 +1157,8 @@ function replaceNodes(root, predicate, replacer) {
1168
1157
  return root;
1169
1158
  }
1170
1159
  function removeHoistDecs(node) {
1171
- if (node == null)
1172
- return;
1173
- if (typeof node !== "object")
1174
- return;
1160
+ if (node == null) return;
1161
+ if (typeof node !== "object") return;
1175
1162
  if ("hoistDec" in node) {
1176
1163
  node.hoistDec = void 0;
1177
1164
  }
@@ -1303,8 +1290,7 @@ function makeNode(node) {
1303
1290
  return node;
1304
1291
  }
1305
1292
  function skipIfOnlyWS(target) {
1306
- if (!target)
1307
- return target;
1293
+ if (!target) return target;
1308
1294
  if (Array.isArray(target)) {
1309
1295
  if (target.length === 1) {
1310
1296
  return skipIfOnlyWS(target[0]);
@@ -1365,8 +1351,9 @@ function parenthesizeType(type) {
1365
1351
  children: ["(", type, ")"]
1366
1352
  });
1367
1353
  }
1368
- function wrapIIFE(expressions, asyncFlag, generator) {
1354
+ function wrapIIFE(expressions, asyncFlag, generatorStar) {
1369
1355
  let awaitPrefix;
1356
+ const generator = generatorStar ? [generatorStar] : [];
1370
1357
  const async = [];
1371
1358
  if (asyncFlag) {
1372
1359
  async.push("async ");
@@ -1378,9 +1365,9 @@ function wrapIIFE(expressions, asyncFlag, generator) {
1378
1365
  };
1379
1366
  }
1380
1367
  let yieldWrap = false;
1381
- if (!generator) {
1368
+ if (!generator.length) {
1382
1369
  if (hasYield(expressions)) {
1383
- generator = "*";
1370
+ generator.push("*");
1384
1371
  yieldWrap = true;
1385
1372
  }
1386
1373
  }
@@ -1391,30 +1378,34 @@ function wrapIIFE(expressions, asyncFlag, generator) {
1391
1378
  bare: false,
1392
1379
  root: false
1393
1380
  });
1381
+ const parameterList = [];
1394
1382
  const parameters = {
1395
1383
  type: "Parameters",
1396
- children: ["()"],
1384
+ children: ["(", parameterList, ")"],
1385
+ parameters: parameterList,
1397
1386
  names: []
1398
1387
  };
1399
1388
  const signature = {
1389
+ type: "FunctionSignature",
1400
1390
  modifier: {
1401
1391
  async: !!async.length,
1402
- generator: !!generator
1392
+ generator: !!generator.length
1403
1393
  },
1404
- returnType: void 0
1394
+ parameters,
1395
+ returnType: void 0,
1396
+ children: generator.length ? [async, "function", generator, parameters] : [async, parameters]
1405
1397
  };
1406
1398
  let fn;
1407
- if (generator) {
1399
+ if (generator.length) {
1408
1400
  fn = makeNode({
1409
1401
  type: "FunctionExpression",
1410
1402
  signature,
1411
1403
  parameters,
1412
1404
  returnType: void 0,
1413
- ts: false,
1414
1405
  async,
1415
1406
  block,
1416
1407
  generator,
1417
- children: [async, "function", generator, parameters, block]
1408
+ children: [...signature.children, block]
1418
1409
  });
1419
1410
  } else {
1420
1411
  fn = makeNode({
@@ -1422,10 +1413,9 @@ function wrapIIFE(expressions, asyncFlag, generator) {
1422
1413
  signature,
1423
1414
  parameters,
1424
1415
  returnType: void 0,
1425
- ts: false,
1426
1416
  async,
1427
1417
  block,
1428
- children: [async, parameters, "=>", block]
1418
+ children: [...signature.children, "=>", block]
1429
1419
  });
1430
1420
  }
1431
1421
  const children = [makeLeftHandSideExpression(fn), "()"];
@@ -1434,8 +1424,19 @@ function wrapIIFE(expressions, asyncFlag, generator) {
1434
1424
  children.splice(1, 0, ".bind(this)");
1435
1425
  }
1436
1426
  if (gatherRecursiveWithinFunction(block, (a2) => typeof a2 === "object" && a2 != null && "token" in a2 && a2.token === "arguments").length) {
1437
- let ref9;
1438
- children[children.length - 1] = (ref9 = parameters.children)[ref9.length - 1] = "(arguments)";
1427
+ const binding = {
1428
+ type: "Identifier",
1429
+ name: "arguments",
1430
+ names: ["arguments"],
1431
+ children: ["arguments"]
1432
+ };
1433
+ parameterList.push({
1434
+ type: "Parameter",
1435
+ children: [binding],
1436
+ names: ["arguments"],
1437
+ binding
1438
+ });
1439
+ children[children.length - 1] = "(arguments)";
1439
1440
  }
1440
1441
  }
1441
1442
  let exp = makeNode({
@@ -1487,7 +1488,7 @@ function flatJoin(array, separator) {
1487
1488
  return result;
1488
1489
  }
1489
1490
 
1490
- // source/parser/traversal.civet
1491
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\traversal.civet.jsx
1491
1492
  function gatherRecursiveWithinFunction(node, predicate) {
1492
1493
  return gatherRecursive(node, predicate, isFunction);
1493
1494
  }
@@ -1554,7 +1555,6 @@ function gatherNodes(node, predicate) {
1554
1555
  }
1555
1556
  default: {
1556
1557
  return gatherNodes(
1557
- //@ts-ignore
1558
1558
  node.children,
1559
1559
  predicate
1560
1560
  );
@@ -1575,7 +1575,6 @@ function gatherRecursive(node, predicate, skipPredicate) {
1575
1575
  return [node];
1576
1576
  }
1577
1577
  return gatherRecursive(
1578
- //@ts-ignore
1579
1578
  node.children,
1580
1579
  predicate,
1581
1580
  skipPredicate
@@ -1589,7 +1588,6 @@ function gatherRecursiveAll(node, predicate) {
1589
1588
  return node.flatMap((n) => gatherRecursiveAll(n, predicate));
1590
1589
  }
1591
1590
  const nodes = gatherRecursiveAll(
1592
- //@ts-ignore
1593
1591
  node.children,
1594
1592
  predicate
1595
1593
  );
@@ -1599,7 +1597,7 @@ function gatherRecursiveAll(node, predicate) {
1599
1597
  return nodes;
1600
1598
  }
1601
1599
 
1602
- // source/parser/ref.civet
1600
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\ref.civet.jsx
1603
1601
  function makeRef(base = "ref", id = base) {
1604
1602
  return {
1605
1603
  type: "Ref",
@@ -1660,9 +1658,10 @@ function maybeRefAssignment(exp, base = "ref") {
1660
1658
  }
1661
1659
  }
1662
1660
 
1663
- // source/parser/binding.civet
1661
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\binding.civet.jsx
1664
1662
  function adjustAtBindings(statements, asThis = false) {
1665
- gatherRecursiveAll(statements, ($) => $.type === "AtBindingProperty").forEach((binding) => {
1663
+ for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "AtBindingProperty"), i1 = 0, len3 = ref1.length; i1 < len3; i1++) {
1664
+ const binding = ref1[i1];
1666
1665
  const { ref } = binding;
1667
1666
  if (asThis) {
1668
1667
  const atBinding = binding.binding;
@@ -1673,20 +1672,18 @@ function adjustAtBindings(statements, asThis = false) {
1673
1672
  binding.ref = void 0;
1674
1673
  return;
1675
1674
  }
1676
- if (ref.names[0] !== ref.base) {
1677
- return binding.children.unshift(ref.base, ": ");
1675
+ if (!(ref.names[0] === ref.base)) {
1676
+ binding.children.unshift(ref.base, ": ");
1678
1677
  }
1679
- ;
1680
- return;
1681
- });
1678
+ }
1682
1679
  }
1683
1680
  function adjustBindingElements(elements) {
1684
1681
  const names = elements.flatMap(($1) => $1.names || []);
1685
1682
  const { length } = elements;
1686
1683
  let blockPrefix, restIndex = -1, restCount = 0;
1687
- for (let i1 = 0, len3 = elements.length; i1 < len3; i1++) {
1688
- const i = i1;
1689
- const { type } = elements[i1];
1684
+ for (let i2 = 0, len1 = elements.length; i2 < len1; i2++) {
1685
+ const i = i2;
1686
+ const { type } = elements[i2];
1690
1687
  if (type === "BindingRestElement") {
1691
1688
  if (restIndex < 0) {
1692
1689
  restIndex = i;
@@ -1708,8 +1705,7 @@ function adjustBindingElements(elements) {
1708
1705
  names.push(...rest.names || []);
1709
1706
  let l = after.length;
1710
1707
  if (l) {
1711
- if (arrayElementHasTrailingComma(after[l - 1]))
1712
- l++;
1708
+ if (arrayElementHasTrailingComma(after[l - 1])) l++;
1713
1709
  const elements2 = trimFirstSpace(after);
1714
1710
  blockPrefix = {
1715
1711
  type: "PostRestBindingElements",
@@ -1744,35 +1740,36 @@ function gatherBindingCode(statements, opts) {
1744
1740
  const thisAssignments = [];
1745
1741
  const splices = [];
1746
1742
  function insertRestSplices(s, p, thisAssignments2) {
1747
- gatherRecursiveAll(s, (n) => n.blockPrefix || opts?.injectParamProps && n.accessModifier || n.type === "AtBinding").forEach((n) => {
1743
+ for (let ref2 = gatherRecursiveAll(s, (n) => n.blockPrefix || opts?.injectParamProps && n.accessModifier || n.type === "AtBinding"), i3 = 0, len22 = ref2.length; i3 < len22; i3++) {
1744
+ const n = ref2[i3];
1748
1745
  if (n.type === "AtBinding") {
1749
1746
  const { ref } = n;
1750
1747
  const { id } = ref;
1751
1748
  thisAssignments2.push([`this.${id} = `, ref]);
1752
- return;
1749
+ continue;
1753
1750
  }
1754
1751
  if (opts?.injectParamProps && n.type === "Parameter" && n.accessModifier) {
1755
- for (let ref1 = n.names, i2 = 0, len1 = ref1.length; i2 < len1; i2++) {
1756
- const id = ref1[i2];
1752
+ for (let ref3 = n.names, i4 = 0, len3 = ref3.length; i4 < len3; i4++) {
1753
+ const id = ref3[i4];
1757
1754
  thisAssignments2.push({
1758
1755
  type: "AssignmentExpression",
1759
1756
  children: [`this.${id} = `, id],
1760
1757
  js: true
1761
1758
  });
1762
1759
  }
1763
- return;
1760
+ continue;
1764
1761
  }
1765
1762
  const { blockPrefix } = n;
1766
1763
  p.push(blockPrefix);
1767
- return insertRestSplices(blockPrefix, p, thisAssignments2);
1768
- });
1764
+ insertRestSplices(blockPrefix, p, thisAssignments2);
1765
+ }
1769
1766
  }
1770
1767
  insertRestSplices(statements, splices, thisAssignments);
1771
1768
  return [splices, thisAssignments];
1772
1769
  }
1773
1770
  function arrayElementHasTrailingComma(elementNode) {
1774
- let ref2;
1775
- const lastChild = (ref2 = elementNode.children)[ref2.length - 1];
1771
+ let ref4;
1772
+ const lastChild = (ref4 = elementNode.children)[ref4.length - 1];
1776
1773
  return lastChild && lastChild[lastChild.length - 1]?.token === ",";
1777
1774
  }
1778
1775
  function gatherBindingPatternTypeSuffix(pattern) {
@@ -1784,8 +1781,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
1784
1781
  case "ArrayBindingPattern": {
1785
1782
  {
1786
1783
  const results = [];
1787
- for (let ref3 = pattern.elements, i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
1788
- const elem = ref3[i3];
1784
+ for (let ref5 = pattern.elements, i5 = 0, len4 = ref5.length; i5 < len4; i5++) {
1785
+ const elem = ref5[i5];
1789
1786
  let { typeSuffix } = elem;
1790
1787
  typeSuffix ??= elem.binding?.typeSuffix;
1791
1788
  if (typeSuffix) {
@@ -1823,8 +1820,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
1823
1820
  {
1824
1821
  let restType;
1825
1822
  const results1 = [];
1826
- for (let ref4 = pattern.properties, i4 = 0, len3 = ref4.length; i4 < len3; i4++) {
1827
- const prop = ref4[i4];
1823
+ for (let ref6 = pattern.properties, i6 = 0, len5 = ref6.length; i6 < len5; i6++) {
1824
+ const prop = ref6[i6];
1828
1825
  let { typeSuffix } = prop;
1829
1826
  typeSuffix ??= prop.value?.typeSuffix;
1830
1827
  if (typeSuffix) {
@@ -1874,12 +1871,12 @@ function gatherBindingPatternTypeSuffix(pattern) {
1874
1871
  return pattern;
1875
1872
  }
1876
1873
 
1877
- // source/parser/comptime.civet
1874
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
1878
1875
  var import_node_path = require("node:path");
1879
1876
  var import_node_module = require("node:module");
1880
1877
  var import_node_vm = __toESM(require("node:vm"));
1881
1878
 
1882
- // source/parser/helper.civet
1879
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\helper.civet.jsx
1883
1880
  var preludeVar = "var ";
1884
1881
  function ts(children) {
1885
1882
  return {
@@ -2109,7 +2106,7 @@ function extractPreludeFor(node) {
2109
2106
  return state.prelude.filter((s) => gatherRecursive(s, helpers.has.bind(helpers)).length);
2110
2107
  }
2111
2108
 
2112
- // source/generate.civet
2109
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\generate.civet.jsx
2113
2110
  function stringify(node) {
2114
2111
  try {
2115
2112
  return JSON.stringify(removeParentPointers(node));
@@ -2190,7 +2187,7 @@ function gen(root, options) {
2190
2187
  throw new Error(`Unknown node ${stringify(node)}`);
2191
2188
  }
2192
2189
  }
2193
- var generate_default = gen;
2190
+ var generate_civet_default = gen;
2194
2191
  function prune(node) {
2195
2192
  if (!(node != null)) {
2196
2193
  return;
@@ -2218,7 +2215,7 @@ function prune(node) {
2218
2215
  return node;
2219
2216
  }
2220
2217
 
2221
- // source/parser/comptime.civet
2218
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
2222
2219
  function expressionizeComptime(statement) {
2223
2220
  const { expressions } = statement.block;
2224
2221
  const expression = wrapIIFE(expressions, hasAwait(expressions));
@@ -2257,7 +2254,7 @@ function runComptime(statements) {
2257
2254
  content
2258
2255
  ];
2259
2256
  const options = { js: true };
2260
- let js = generate_default(prune(content), options);
2257
+ let js = generate_civet_default(prune(content), options);
2261
2258
  js = `"use strict";${js}`;
2262
2259
  if (options.errors != null) {
2263
2260
  return;
@@ -2341,10 +2338,8 @@ function serialize(value, context) {
2341
2338
  if (typeof val === "string") {
2342
2339
  return JSON.stringify(val);
2343
2340
  } else if (typeof val === "number") {
2344
- if (Object.is(-0, val))
2345
- return "-0";
2346
- else
2347
- return val.toString();
2341
+ if (Object.is(-0, val)) return "-0";
2342
+ else return val.toString();
2348
2343
  } else if (typeof val === "boolean" || val == null) {
2349
2344
  return String(val);
2350
2345
  } else if (typeof val === "bigint") {
@@ -2516,6 +2511,7 @@ function serialize(value, context) {
2516
2511
  ref1 = `new ${val.constructor.name}([${Array.from(val, ($1) => `${$1}n`).join(",")}])`;
2517
2512
  break;
2518
2513
  }
2514
+ // Spelled differently for browsers, where `Buffer` doesn't exist
2519
2515
  case globalThis.Buffer?.prototype:
2520
2516
  case context?.Buffer?.prototype: {
2521
2517
  ref1 = `Buffer.from([${val.join(",")}])`;
@@ -2540,7 +2536,8 @@ function serialize(value, context) {
2540
2536
  return recurse(value);
2541
2537
  }
2542
2538
 
2543
- // source/parser/function.civet
2539
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\function.civet.jsx
2540
+ var concatAssign = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
2544
2541
  function getTypeArguments(args) {
2545
2542
  while (typeof args === "object" && args != null && "args" in args) {
2546
2543
  args = args.args;
@@ -2598,8 +2595,7 @@ function wrapTypeInApplication(t, id, raw) {
2598
2595
  };
2599
2596
  }
2600
2597
  function implicitFunctionBlock(f) {
2601
- if (f.abstract || f.block || f.signature?.optional)
2602
- return;
2598
+ if (f.abstract || f.block || f.signature?.optional) return;
2603
2599
  const { name, parent } = f;
2604
2600
  let ancestor = parent;
2605
2601
  let child = f;
@@ -2738,16 +2734,14 @@ function patternAsValue(pattern) {
2738
2734
  case "ArrayBindingPattern": {
2739
2735
  const children = [...pattern.children];
2740
2736
  const index = children.indexOf(pattern.elements);
2741
- if (index < 0)
2742
- throw new Error("failed to find elements in ArrayBindingPattern");
2737
+ if (index < 0) throw new Error("failed to find elements in ArrayBindingPattern");
2743
2738
  const elements = children[index] = pattern.elements.map(patternAsValue);
2744
2739
  return { ...pattern, elements, children };
2745
2740
  }
2746
2741
  case "ObjectBindingPattern": {
2747
2742
  const children = [...pattern.children];
2748
2743
  const index = children.indexOf(pattern.properties);
2749
- if (index < 0)
2750
- throw new Error("failed to find properties in ArrayBindingPattern");
2744
+ if (index < 0) throw new Error("failed to find properties in ArrayBindingPattern");
2751
2745
  const properties = children[index] = pattern.properties.map(patternAsValue);
2752
2746
  return { ...pattern, properties, children };
2753
2747
  }
@@ -2840,8 +2834,7 @@ function patternBindings(pattern) {
2840
2834
  }
2841
2835
  }
2842
2836
  function assignResults(node, collect) {
2843
- if (!node)
2844
- return;
2837
+ if (!node) return;
2845
2838
  switch (node.type) {
2846
2839
  case "BlockStatement":
2847
2840
  if (node.expressions.length) {
@@ -2976,8 +2969,7 @@ function assignResults(node, collect) {
2976
2969
  node[1] = collect(node[1]);
2977
2970
  }
2978
2971
  function insertReturn(node) {
2979
- if (!node)
2980
- return;
2972
+ if (!node) return;
2981
2973
  switch (node.type) {
2982
2974
  case "BlockStatement": {
2983
2975
  if (node.expressions.length) {
@@ -2994,6 +2986,7 @@ function insertReturn(node) {
2994
2986
  }
2995
2987
  return;
2996
2988
  }
2989
+ // NOTE: "CaseClause"s don't get a return statement inserted
2997
2990
  case "WhenClause": {
2998
2991
  if (node.break) {
2999
2992
  const breakIndex = node.children.indexOf(node.break);
@@ -3017,8 +3010,7 @@ function insertReturn(node) {
3017
3010
  return;
3018
3011
  }
3019
3012
  }
3020
- if (!Array.isArray(node))
3021
- return;
3013
+ if (!Array.isArray(node)) return;
3022
3014
  let [, exp, semi] = node;
3023
3015
  if (semi?.type === "SemicolonDelimiter") {
3024
3016
  return;
@@ -3098,14 +3090,12 @@ function insertReturn(node) {
3098
3090
  }
3099
3091
  case "IfStatement": {
3100
3092
  insertReturn(exp.then);
3101
- if (exp.else)
3102
- insertReturn(exp.else.block);
3103
- else
3104
- exp.children.push([
3105
- "",
3106
- // NOTE: add a prefixed semicolon because the if block may not be braced
3107
- wrapWithReturn(void 0, exp, true)
3108
- ]);
3093
+ if (exp.else) insertReturn(exp.else.block);
3094
+ else exp.children.push([
3095
+ "",
3096
+ // NOTE: add a prefixed semicolon because the if block may not be braced
3097
+ wrapWithReturn(void 0, exp, true)
3098
+ ]);
3109
3099
  return;
3110
3100
  }
3111
3101
  case "PatternMatchingStatement": {
@@ -3402,6 +3392,183 @@ function processParams(f) {
3402
3392
  if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
3403
3393
  parameters.tp.parameters.push(",");
3404
3394
  }
3395
+ let tt, before = [], rest, after = [];
3396
+ function append2(p) {
3397
+ (rest ? after : before).push(p);
3398
+ }
3399
+ for (let ref16 = parameters.parameters, i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
3400
+ const param = ref16[i8];
3401
+ switch (param.type) {
3402
+ case "ThisType": {
3403
+ if (tt) {
3404
+ append2({
3405
+ type: "Error",
3406
+ message: "Only one typed this parameter is allowed"
3407
+ });
3408
+ append2(param);
3409
+ } else {
3410
+ tt = trimFirstSpace(param);
3411
+ if (before.length || rest) {
3412
+ let ref17;
3413
+ let delim = (ref17 = tt.children)[ref17.length - 1];
3414
+ if (Array.isArray(delim)) {
3415
+ delim = delim[delim.length - 1];
3416
+ }
3417
+ if (!(typeof delim === "object" && delim != null && "token" in delim && delim.token === ",")) {
3418
+ tt = {
3419
+ ...tt,
3420
+ children: [...tt.children, ", "]
3421
+ };
3422
+ }
3423
+ }
3424
+ }
3425
+ ;
3426
+ break;
3427
+ }
3428
+ case "FunctionRestParameter": {
3429
+ if (rest) {
3430
+ append2({
3431
+ type: "Error",
3432
+ message: "Only one rest parameter is allowed"
3433
+ });
3434
+ append2(param);
3435
+ } else {
3436
+ rest = param;
3437
+ }
3438
+ ;
3439
+ break;
3440
+ }
3441
+ default: {
3442
+ append2(param);
3443
+ }
3444
+ }
3445
+ }
3446
+ parameters.names = before.flatMap(($6) => $6.names);
3447
+ parameters.parameters.splice(0, 1 / 0, ...[]);
3448
+ if (tt) {
3449
+ parameters.parameters.push(tt);
3450
+ }
3451
+ parameters.parameters.push(...before);
3452
+ if (rest) {
3453
+ const restIdentifier = rest.binding.ref || rest.binding;
3454
+ parameters.names.push(...rest.names || []);
3455
+ rest.children.pop();
3456
+ if (after.length) {
3457
+ if (rest.binding.type === "ArrayBindingPattern" || rest.binding.type === "ObjectBindingPattern") {
3458
+ parameters.parameters.push({
3459
+ type: "Error",
3460
+ message: "Non-end rest parameter cannot be binding pattern"
3461
+ });
3462
+ }
3463
+ after = trimFirstSpace(after);
3464
+ const names = after.flatMap(($7) => $7.names);
3465
+ const elements = after.map((p) => {
3466
+ if (p.type === "Error") {
3467
+ return p;
3468
+ }
3469
+ return {
3470
+ ...p,
3471
+ // omit individual argument types from output
3472
+ children: p.children.filter((a2) => a2 !== p.typeSuffix),
3473
+ type: "BindingElement"
3474
+ };
3475
+ });
3476
+ const pattern = gatherBindingPatternTypeSuffix(makeNode({
3477
+ type: "ArrayBindingPattern",
3478
+ elements,
3479
+ length: after.length,
3480
+ children: ["[", elements, "]"],
3481
+ names
3482
+ }));
3483
+ const { typeSuffix } = pattern;
3484
+ const blockPrefix = parameters.blockPrefix = makeNode({
3485
+ type: "PostRestBindingElements",
3486
+ children: [
3487
+ pattern,
3488
+ " = ",
3489
+ restIdentifier,
3490
+ ".splice(-",
3491
+ after.length.toString(),
3492
+ ")"
3493
+ ],
3494
+ elements,
3495
+ names
3496
+ });
3497
+ if (rest.typeSuffix) {
3498
+ let optionalType = function(typeSuffix3, fallback) {
3499
+ const t2 = typeSuffix3?.t ?? fallback;
3500
+ if (typeSuffix3?.optional) {
3501
+ return [
3502
+ t2,
3503
+ {
3504
+ type: "Error",
3505
+ message: "Optional parameter not allowed in/after rest parameter"
3506
+ }
3507
+ ];
3508
+ }
3509
+ return t2;
3510
+ };
3511
+ const ref = makeRef("rest");
3512
+ const restRef = [
3513
+ { children: [ref], ts: true },
3514
+ { children: [restIdentifier], js: true }
3515
+ ];
3516
+ blockPrefix.children[blockPrefix.children.indexOf(restIdentifier)] = restRef;
3517
+ blockPrefix.children.push({
3518
+ ts: true,
3519
+ children: [
3520
+ ", ",
3521
+ restIdentifier,
3522
+ " = ",
3523
+ ref,
3524
+ " as ",
3525
+ trimFirstSpace(rest.typeSuffix.t)
3526
+ ]
3527
+ });
3528
+ const bindingIndex = rest.rest.children.indexOf(rest.rest.binding);
3529
+ assert.notEqual(bindingIndex, -1, "Could not find binding in rest parameter");
3530
+ rest.rest.children[bindingIndex] = rest.rest.binding = { ...rest.rest.binding, js: true };
3531
+ rest.rest.children.splice(bindingIndex + 1, 0, {
3532
+ children: [ref],
3533
+ ts: true
3534
+ });
3535
+ const oldSuffix = rest.typeSuffix;
3536
+ const colon = oldSuffix.colon ?? ": ";
3537
+ const afterTypes = after.flatMap((p) => {
3538
+ return [",", optionalType(p.typeSuffix, " unknown")];
3539
+ });
3540
+ const t = [
3541
+ "[",
3542
+ "...",
3543
+ optionalType(oldSuffix, "unknown[]"),
3544
+ ...afterTypes,
3545
+ "]"
3546
+ ];
3547
+ const typeSuffix2 = makeNode({
3548
+ type: "TypeSuffix",
3549
+ ts: true,
3550
+ colon,
3551
+ t,
3552
+ children: [
3553
+ ...oldSuffix.children.filter(($8) => (
3554
+ // spaces and colon
3555
+ $8 !== oldSuffix.optional && $8 !== oldSuffix.t
3556
+ )),
3557
+ !oldSuffix.colon ? colon : void 0,
3558
+ t
3559
+ ]
3560
+ });
3561
+ const suffixIndex = rest.children.indexOf(rest.typeSuffix);
3562
+ assert.notEqual(suffixIndex, -1, "Could not find typeSuffix in rest parameter");
3563
+ rest.children[suffixIndex] = rest.typeSuffix = typeSuffix2;
3564
+ blockPrefix.children.splice(-1, 0, {
3565
+ ts: true,
3566
+ children: [" as [", afterTypes.slice(1), "]"]
3567
+ });
3568
+ }
3569
+ }
3570
+ parameters.parameters.push(rest);
3571
+ }
3405
3572
  if (!block) {
3406
3573
  return;
3407
3574
  }
@@ -3419,9 +3586,9 @@ function processParams(f) {
3419
3586
  injectParamProps: isConstructor
3420
3587
  });
3421
3588
  if (isConstructor) {
3422
- const { ancestor } = findAncestor(f, ($6) => $6.type === "ClassExpression");
3589
+ const { ancestor } = findAncestor(f, ($9) => $9.type === "ClassExpression");
3423
3590
  if (ancestor != null) {
3424
- 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));
3591
+ 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));
3425
3592
  const classExpressions = ancestor.body.expressions;
3426
3593
  let index = findChildIndex(classExpressions, f);
3427
3594
  assert.notEqual(index, -1, "Could not find constructor in class");
@@ -3430,14 +3597,14 @@ function processParams(f) {
3430
3597
  index--;
3431
3598
  }
3432
3599
  const fStatement = classExpressions[index];
3433
- for (let ref16 = gatherRecursive(parameters, ($10) => $10.type === "Parameter"), i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
3434
- const parameter = ref16[i8];
3600
+ for (let ref18 = gatherRecursive(parameters, ($13) => $13.type === "Parameter"), i9 = 0, len8 = ref18.length; i9 < len8; i9++) {
3601
+ const parameter = ref18[i9];
3435
3602
  const { accessModifier } = parameter;
3436
3603
  if (!(accessModifier || parameter.typeSuffix)) {
3437
3604
  continue;
3438
3605
  }
3439
- for (let ref17 = gatherRecursive(parameter, ($11) => $11.type === "AtBinding"), i9 = 0, len8 = ref17.length; i9 < len8; i9++) {
3440
- const binding = ref17[i9];
3606
+ for (let ref19 = gatherRecursive(parameter, ($14) => $14.type === "AtBinding"), i10 = 0, len9 = ref19.length; i10 < len9; i10++) {
3607
+ const binding = ref19[i10];
3441
3608
  const typeSuffix = binding.parent?.typeSuffix;
3442
3609
  if (!(accessModifier || typeSuffix)) {
3443
3610
  continue;
@@ -3465,23 +3632,35 @@ function processParams(f) {
3465
3632
  type: "SemicolonDelimiter",
3466
3633
  children: [";"]
3467
3634
  };
3468
- const prefix = splices.map((s) => ["let ", s]).concat(thisAssignments).map(
3469
- (s) => s.type ? {
3470
- // TODO: figure out how to get JS only statement tuples
3471
- ...s,
3472
- children: [indent, ...s.children, delimiter]
3473
- } : [indent, s, delimiter]
3474
- );
3635
+ let prefix = [];
3636
+ for (let ref20 = splices, i11 = 0, len10 = ref20.length; i11 < len10; i11++) {
3637
+ const binding = ref20[i11];
3638
+ assert.equal(binding.type, "PostRestBindingElements", "splice should be of type Binding");
3639
+ prefix.push(makeNode({
3640
+ type: "Declaration",
3641
+ children: ["let ", binding],
3642
+ names: binding.names,
3643
+ bindings: [],
3644
+ // avoid implicit return of any bindings
3645
+ decl: "let"
3646
+ }));
3647
+ }
3648
+ concatAssign(prefix, thisAssignments);
3649
+ prefix = prefix.map((s) => s?.js ? ["", makeNode({
3650
+ // TODO: figure out how to get JS only statement tuples
3651
+ ...s,
3652
+ children: [indent, ...s.children, delimiter]
3653
+ })] : [indent, s, delimiter]);
3475
3654
  if (!prefix.length) {
3476
3655
  return;
3477
3656
  }
3478
3657
  if (isConstructor) {
3479
3658
  const superCalls = gatherNodes(
3480
3659
  expressions,
3481
- (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"
3660
+ (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"
3482
3661
  );
3483
3662
  if (superCalls.length) {
3484
- const { child } = findAncestor(superCalls[0], (a4) => a4 === block);
3663
+ const { child } = findAncestor(superCalls[0], (a5) => a5 === block);
3485
3664
  const index = findChildIndex(expressions, child);
3486
3665
  if (index < 0) {
3487
3666
  throw new Error("Could not find super call within top-level expressions");
@@ -3491,6 +3670,7 @@ function processParams(f) {
3491
3670
  }
3492
3671
  }
3493
3672
  expressions.unshift(...prefix);
3673
+ updateParentPointers(block);
3494
3674
  braceBlock(block);
3495
3675
  }
3496
3676
  function processSignature(f) {
@@ -3500,8 +3680,8 @@ function processSignature(f) {
3500
3680
  f.async.push("async ");
3501
3681
  signature.modifier.async = true;
3502
3682
  } else {
3503
- for (let ref18 = gatherRecursiveWithinFunction(block, ($12) => $12.type === "Await"), i10 = 0, len9 = ref18.length; i10 < len9; i10++) {
3504
- const a = ref18[i10];
3683
+ for (let ref21 = gatherRecursiveWithinFunction(block, ($15) => $15.type === "Await"), i12 = 0, len11 = ref21.length; i12 < len11; i12++) {
3684
+ const a = ref21[i12];
3505
3685
  const i = findChildIndex(a.parent, a);
3506
3686
  a.parent.children.splice(i + 1, 0, {
3507
3687
  type: "Error",
@@ -3515,9 +3695,9 @@ function processSignature(f) {
3515
3695
  f.generator.push("*");
3516
3696
  signature.modifier.generator = true;
3517
3697
  } else {
3518
- for (let ref19 = gatherRecursiveWithinFunction(block, ($13) => $13.type === "YieldExpression"), i11 = 0, len10 = ref19.length; i11 < len10; i11++) {
3519
- const y = ref19[i11];
3520
- const i = y.children.findIndex(($14) => $14.type === "Yield");
3698
+ for (let ref22 = gatherRecursiveWithinFunction(block, ($16) => $16.type === "YieldExpression"), i13 = 0, len12 = ref22.length; i13 < len12; i13++) {
3699
+ const y = ref22[i13];
3700
+ const i = y.children.findIndex(($17) => $17.type === "Yield");
3521
3701
  y.children.splice(i + 1, 0, {
3522
3702
  type: "Error",
3523
3703
  message: `yield invalid in ${f.type === "ArrowFunction" ? "=> arrow function" : signature.modifier.get ? "getter" : signature.modifier.set ? "setter" : signature.name}`
@@ -3530,8 +3710,8 @@ function processSignature(f) {
3530
3710
  }
3531
3711
  }
3532
3712
  function processFunctions(statements, config2) {
3533
- for (let ref20 = gatherRecursiveAll(statements, ($15) => $15.type === "FunctionExpression" || $15.type === "ArrowFunction" || $15.type === "MethodDefinition"), i12 = 0, len11 = ref20.length; i12 < len11; i12++) {
3534
- const f = ref20[i12];
3713
+ for (let ref23 = gatherRecursiveAll(statements, ($18) => $18.type === "FunctionExpression" || $18.type === "ArrowFunction" || $18.type === "MethodDefinition"), i14 = 0, len13 = ref23.length; i14 < len13; i14++) {
3714
+ const f = ref23[i14];
3535
3715
  if (f.type === "FunctionExpression" || f.type === "MethodDefinition") {
3536
3716
  implicitFunctionBlock(f);
3537
3717
  }
@@ -3587,9 +3767,9 @@ function expressionizeIteration(exp) {
3587
3767
  }
3588
3768
  let done;
3589
3769
  if (!async) {
3590
- let ref21;
3591
- if ((ref21 = blockContainingStatement(exp)) && typeof ref21 === "object" && "block" in ref21 && "index" in ref21) {
3592
- const { block: parentBlock, index } = ref21;
3770
+ let ref24;
3771
+ if ((ref24 = blockContainingStatement(exp)) && typeof ref24 === "object" && "block" in ref24 && "index" in ref24) {
3772
+ const { block: parentBlock, index } = ref24;
3593
3773
  statements[0][0] = parentBlock.expressions[index][0];
3594
3774
  parentBlock.expressions.splice(index, index + 1 - index, ...statements);
3595
3775
  updateParentPointers(parentBlock);
@@ -3606,8 +3786,8 @@ function expressionizeIteration(exp) {
3606
3786
  }
3607
3787
  }
3608
3788
  function processIterationExpressions(statements) {
3609
- for (let ref22 = gatherRecursiveAll(statements, ($16) => $16.type === "IterationExpression"), i13 = 0, len12 = ref22.length; i13 < len12; i13++) {
3610
- const s = ref22[i13];
3789
+ for (let ref25 = gatherRecursiveAll(statements, ($19) => $19.type === "IterationExpression"), i15 = 0, len14 = ref25.length; i15 < len14; i15++) {
3790
+ const s = ref25[i15];
3611
3791
  expressionizeIteration(s);
3612
3792
  }
3613
3793
  }
@@ -3628,38 +3808,40 @@ function processCoffeeDo(ws, expression) {
3628
3808
  ws = trimFirstSpace(ws);
3629
3809
  const args = [];
3630
3810
  if (typeof expression === "object" && expression != null && "type" in expression && expression.type === "ArrowFunction" || typeof expression === "object" && expression != null && "type" in expression && expression.type === "FunctionExpression") {
3631
- const { parameters } = expression;
3811
+ let { parameters } = expression;
3812
+ const parameterList = parameters.parameters;
3813
+ const results1 = [];
3814
+ for (let i16 = 0, len15 = parameterList.length; i16 < len15; i16++) {
3815
+ let parameter = parameterList[i16];
3816
+ if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
3817
+ let ref26;
3818
+ if (ref26 = parameter.initializer) {
3819
+ const initializer = ref26;
3820
+ args.push(initializer.expression, parameter.delim);
3821
+ parameter = {
3822
+ ...parameter,
3823
+ initializer: void 0,
3824
+ children: parameter.children.filter((a6) => a6 !== initializer)
3825
+ };
3826
+ } else {
3827
+ args.push(parameter.children.filter(
3828
+ (a7) => a7 !== parameter.typeSuffix
3829
+ ));
3830
+ }
3831
+ }
3832
+ results1.push(parameter);
3833
+ }
3834
+ ;
3835
+ const newParameterList = results1;
3632
3836
  const newParameters = {
3633
3837
  ...parameters,
3634
- children: (() => {
3635
- const results1 = [];
3636
- for (let ref23 = parameters.children, i14 = 0, len13 = ref23.length; i14 < len13; i14++) {
3637
- let parameter = ref23[i14];
3638
- if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
3639
- let ref24;
3640
- if (ref24 = parameter.initializer) {
3641
- const initializer = ref24;
3642
- args.push(initializer.expression, parameter.delim);
3643
- parameter = {
3644
- ...parameter,
3645
- initializer: void 0,
3646
- children: parameter.children.filter((a5) => a5 !== initializer)
3647
- };
3648
- } else {
3649
- args.push(parameter.children.filter(
3650
- (a6) => a6 !== parameter.typeSuffix
3651
- ));
3652
- }
3653
- }
3654
- results1.push(parameter);
3655
- }
3656
- return results1;
3657
- })()
3838
+ parameters: newParameterList,
3839
+ children: parameters.children.map(($20) => $20 === parameterList ? newParameterList : $20)
3658
3840
  };
3659
3841
  expression = {
3660
3842
  ...expression,
3661
3843
  parameters: newParameters,
3662
- children: expression.children.map(($17) => $17 === parameters ? newParameters : $17)
3844
+ children: expression.children.map(($21) => $21 === parameters ? newParameters : $21)
3663
3845
  };
3664
3846
  }
3665
3847
  return {
@@ -3681,12 +3863,16 @@ function makeAmpersandFunction(rhs) {
3681
3863
  ref = makeRef("$");
3682
3864
  inplacePrepend(ref, body);
3683
3865
  }
3684
- if (startsWithPredicate(body, ($18) => $18.type === "ObjectExpression")) {
3866
+ if (startsWithPredicate(body, ($22) => $22.type === "ObjectExpression")) {
3685
3867
  body = makeLeftHandSideExpression(body);
3686
3868
  }
3869
+ const parameterList = [
3870
+ typeSuffix ? [ref, typeSuffix] : ref
3871
+ ];
3687
3872
  const parameters = makeNode({
3688
3873
  type: "Parameters",
3689
- children: typeSuffix ? ["(", ref, typeSuffix, ")"] : [ref],
3874
+ children: typeSuffix ? ["(", parameterList, ")"] : [parameterList],
3875
+ parameters: parameterList,
3690
3876
  names: []
3691
3877
  });
3692
3878
  const expressions = [[" ", body]];
@@ -3720,14 +3906,14 @@ function makeAmpersandFunction(rhs) {
3720
3906
  }
3721
3907
  if (gatherRecursiveWithinFunction(
3722
3908
  block,
3723
- (a7) => a7 === ref
3909
+ (a8) => a8 === ref
3724
3910
  ).length > 1) {
3725
3911
  fn.ampersandBlock = false;
3726
3912
  }
3727
3913
  return fn;
3728
3914
  }
3729
3915
 
3730
- // source/parser/block.civet
3916
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\block.civet.jsx
3731
3917
  function blockWithPrefix(prefixStatements, block) {
3732
3918
  if (prefixStatements && prefixStatements.length) {
3733
3919
  const expressions = [...prefixStatements, ...block.expressions];
@@ -3814,10 +4000,8 @@ function getIndent(statement) {
3814
4000
  if (Array.isArray(indent)) {
3815
4001
  indent = indent.flat(Infinity);
3816
4002
  return indent.filter((n) => n && !(n.type === "Comment")).map((n) => {
3817
- if (typeof n === "string")
3818
- return n;
3819
- if (n.token != null)
3820
- return n.token;
4003
+ if (typeof n === "string") return n;
4004
+ if (n.token != null) return n.token;
3821
4005
  return "";
3822
4006
  });
3823
4007
  }
@@ -3945,7 +4129,7 @@ function blockContainingStatement(exp) {
3945
4129
  };
3946
4130
  }
3947
4131
 
3948
- // source/parser/op.civet
4132
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\op.civet.jsx
3949
4133
  var precedenceOrder = [
3950
4134
  ["||", "??"],
3951
4135
  ["^^"],
@@ -4009,7 +4193,7 @@ function processExpandedBinaryOpExpression(expandedOps) {
4009
4193
  while (i < expandedOps.length) {
4010
4194
  let op = expandedOps[i];
4011
4195
  if (op.special) {
4012
- let advanceLeft2 = function(allowEqual) {
4196
+ let advanceLeft = function(allowEqual) {
4013
4197
  while (start >= 4) {
4014
4198
  const prevPrec = getPrecedence(expandedOps[start - 2]);
4015
4199
  if (!(prevPrec > prec || allowEqual && prevPrec === prec)) {
@@ -4018,7 +4202,7 @@ function processExpandedBinaryOpExpression(expandedOps) {
4018
4202
  start -= 4;
4019
4203
  }
4020
4204
  return false;
4021
- }, advanceRight2 = function(allowEqual) {
4205
+ }, advanceRight = function(allowEqual) {
4022
4206
  while (end + 4 < expandedOps.length) {
4023
4207
  const nextPrec = getPrecedence(expandedOps[end + 2]);
4024
4208
  if (!(nextPrec > prec || allowEqual && nextPrec === prec)) {
@@ -4028,24 +4212,23 @@ function processExpandedBinaryOpExpression(expandedOps) {
4028
4212
  }
4029
4213
  return false;
4030
4214
  };
4031
- var advanceLeft = advanceLeft2, advanceRight = advanceRight2;
4032
4215
  let start = i - 2, end = i + 2;
4033
4216
  const prec = getPrecedence(op);
4034
4217
  let error;
4035
4218
  switch (op.assoc) {
4036
4219
  case "left":
4037
4220
  case void 0: {
4038
- advanceLeft2(true);
4039
- advanceRight2(false);
4221
+ advanceLeft(true);
4222
+ advanceRight(false);
4040
4223
  break;
4041
4224
  }
4042
4225
  case "right": {
4043
- advanceLeft2(false);
4044
- advanceRight2(true);
4226
+ advanceLeft(false);
4227
+ advanceRight(true);
4045
4228
  break;
4046
4229
  }
4047
4230
  case "non": {
4048
- if (advanceLeft2(false) || advanceRight2(false)) {
4231
+ if (advanceLeft(false) || advanceRight(false)) {
4049
4232
  error = {
4050
4233
  type: "Error",
4051
4234
  message: `non-associative operator ${op.token} used at same precedence level without parenthesization`
@@ -4055,13 +4238,13 @@ function processExpandedBinaryOpExpression(expandedOps) {
4055
4238
  break;
4056
4239
  }
4057
4240
  case "arguments": {
4058
- if (advanceLeft2(false)) {
4241
+ if (advanceLeft(false)) {
4059
4242
  error = {
4060
4243
  type: "Error",
4061
4244
  message: `arguments operator ${op.token} used at same precedence level as ${expandedOps[start - 2].token} to the left`
4062
4245
  };
4063
4246
  }
4064
- advanceRight2(true);
4247
+ advanceRight(true);
4065
4248
  break;
4066
4249
  }
4067
4250
  default: {
@@ -4145,13 +4328,11 @@ function processExpandedBinaryOpExpression(expandedOps) {
4145
4328
  type = "CallExpression";
4146
4329
  } else if (op.token) {
4147
4330
  children = [a, wsOp, op, wsB, b];
4148
- if (op.negated)
4149
- children = ["(", ...children, ")"];
4331
+ if (op.negated) children = ["(", ...children, ")"];
4150
4332
  } else {
4151
4333
  throw new Error("Unknown operator: " + JSON.stringify(op));
4152
4334
  }
4153
- if (op.negated)
4154
- children.unshift("!");
4335
+ if (op.negated) children.unshift("!");
4155
4336
  if (error != null) {
4156
4337
  children.push(error);
4157
4338
  }
@@ -4284,7 +4465,7 @@ function expandChainedComparisons([first, binops]) {
4284
4465
  }
4285
4466
  }
4286
4467
 
4287
- // source/parser/pattern-matching.civet
4468
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pattern-matching.civet.jsx
4288
4469
  function processPatternTest(lhs, patterns) {
4289
4470
  const { ref, refAssignmentComma } = maybeRefAssignment(lhs, "m");
4290
4471
  const conditionExpression = flatJoin(patterns.map(($1) => getPatternConditions($1, ref)).map(($2) => flatJoin($2, " && ")), " || ");
@@ -4406,8 +4587,7 @@ function processPatternMatching(statements) {
4406
4587
  });
4407
4588
  }
4408
4589
  function getPatternConditions(pattern, ref, conditions = []) {
4409
- if (pattern.rest)
4410
- return conditions;
4590
+ if (pattern.rest) return conditions;
4411
4591
  switch (pattern.type) {
4412
4592
  case "ArrayBindingPattern": {
4413
4593
  const { elements, length } = pattern, hasRest = elements.some((e) => e.rest), l = (length - +hasRest).toString(), lengthCheck = hasRest ? [ref, ".length >= ", l] : [getHelperRef("len"), "(", ref, ", ", l, ")"];
@@ -4518,7 +4698,7 @@ function getPatternConditions(pattern, ref, conditions = []) {
4518
4698
  }
4519
4699
  return conditions;
4520
4700
  }
4521
- function getPatternBlockPrefix(pattern, ref, decl = "const ", suffix) {
4701
+ function getPatternBlockPrefix(pattern, ref, decl = "const ", typeSuffix) {
4522
4702
  switch (pattern.type) {
4523
4703
  case "ArrayBindingPattern": {
4524
4704
  if (!pattern.length) {
@@ -4549,7 +4729,7 @@ function getPatternBlockPrefix(pattern, ref, decl = "const ", suffix) {
4549
4729
  return [
4550
4730
  ["", {
4551
4731
  type: "Declaration",
4552
- children: [decl, patternBindings2, suffix, " = ", ref, ...splices],
4732
+ children: [decl, patternBindings2, typeSuffix, " = ", ref, ...splices],
4553
4733
  names: [],
4554
4734
  bindings: []
4555
4735
  // avoid implicit return of any bindings
@@ -4738,7 +4918,7 @@ function aliasBinding(p, ref) {
4738
4918
  }
4739
4919
  }
4740
4920
 
4741
- // source/parser/declaration.civet
4921
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\declaration.civet.jsx
4742
4922
  function len2(arr, length) {
4743
4923
  return arr.length === length;
4744
4924
  }
@@ -4782,21 +4962,22 @@ function processAssignmentDeclaration(decl, pattern, typeSuffix, ws, assign, e)
4782
4962
  });
4783
4963
  }
4784
4964
  function processDeclarations(statements) {
4785
- gatherRecursiveAll(statements, ($) => $.type === "Declaration").forEach((statement) => {
4786
- const { bindings } = statement;
4787
- return bindings?.forEach((binding) => {
4965
+ for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "Declaration"), i1 = 0, len1 = ref1.length; i1 < len1; i1++) {
4966
+ const declaration = ref1[i1];
4967
+ const { bindings } = declaration;
4968
+ bindings?.forEach((binding) => {
4788
4969
  const { typeSuffix } = binding;
4789
4970
  if (typeSuffix && typeSuffix.optional && typeSuffix.t) {
4790
4971
  convertOptionalType(typeSuffix);
4791
4972
  }
4792
4973
  const { initializer } = binding;
4793
4974
  if (initializer) {
4794
- return prependStatementExpressionBlock(initializer, statement);
4975
+ return prependStatementExpressionBlock(initializer, declaration);
4795
4976
  }
4796
4977
  ;
4797
4978
  return;
4798
4979
  });
4799
- });
4980
+ }
4800
4981
  }
4801
4982
  function prependStatementExpressionBlock(initializer, statement) {
4802
4983
  let { expression: exp } = initializer;
@@ -4966,8 +5147,8 @@ function processDeclarationConditionStatement(s) {
4966
5147
  ({ children } = condition.expression.children[1]);
4967
5148
  }
4968
5149
  children.unshift("(");
4969
- for (let i1 = 0, len1 = conditions.length; i1 < len1; i1++) {
4970
- const c = conditions[i1];
5150
+ for (let i2 = 0, len22 = conditions.length; i2 < len22; i2++) {
5151
+ const c = conditions[i2];
4971
5152
  children.push(" && ", c);
4972
5153
  }
4973
5154
  children.push(")");
@@ -4989,11 +5170,11 @@ function processDeclarationConditionStatement(s) {
4989
5170
  ancestor.expressions.splice(index + 1, 0, ...blockPrefix);
4990
5171
  updateParentPointers(ancestor);
4991
5172
  braceBlock(ancestor);
4992
- let ref1;
5173
+ let ref2;
4993
5174
  switch (s.type) {
4994
5175
  case "IfStatement": {
4995
- if (ref1 = s.else?.block) {
4996
- const elseBlock = ref1;
5176
+ if (ref2 = s.else?.block) {
5177
+ const elseBlock = ref2;
4997
5178
  if (elseBlock.bare && !elseBlock.semicolon) {
4998
5179
  elseBlock.children.push(elseBlock.semicolon = ";");
4999
5180
  }
@@ -5084,11 +5265,11 @@ function processDeclarationConditionStatement(s) {
5084
5265
  function dynamizeFromClause(from) {
5085
5266
  from = from.slice(1);
5086
5267
  from = trimFirstSpace(from);
5087
- let ref2;
5088
- if (ref2 = from[from.length - 1]?.assertion) {
5089
- const assert2 = ref2;
5090
- let ref3;
5091
- ref3 = from[from.length - 1], ref3.children = ref3.children.filter((a2) => a2 !== assert2);
5268
+ let ref3;
5269
+ if (ref3 = from[from.length - 1]?.assertion) {
5270
+ const assert2 = ref3;
5271
+ let ref4;
5272
+ ref4 = from[from.length - 1], ref4.children = ref4.children.filter((a2) => a2 !== assert2);
5092
5273
  from.push(", {", assert2.keyword, ":", assert2.object, "}");
5093
5274
  }
5094
5275
  return ["(", ...from, ")"];
@@ -5097,20 +5278,20 @@ function dynamizeImportDeclaration(decl) {
5097
5278
  const { imports } = decl;
5098
5279
  let { star, binding, specifiers } = imports;
5099
5280
  const justDefault = binding && !specifiers && !star;
5100
- let ref4;
5281
+ let ref5;
5101
5282
  {
5102
5283
  if (binding) {
5103
5284
  if (specifiers) {
5104
- ref4 = makeRef();
5285
+ ref5 = makeRef();
5105
5286
  } else {
5106
- ref4 = binding;
5287
+ ref5 = binding;
5107
5288
  }
5108
5289
  } else {
5109
- ref4 = convertNamedImportsToObject(imports, true);
5290
+ ref5 = convertNamedImportsToObject(imports, true);
5110
5291
  }
5111
5292
  }
5112
5293
  ;
5113
- const pattern = ref4;
5294
+ const pattern = ref5;
5114
5295
  const c = "const";
5115
5296
  const expression = [
5116
5297
  justDefault ? "(" : void 0,
@@ -5233,7 +5414,7 @@ function convertWithClause(withClause, extendsClause) {
5233
5414
  return [extendsToken, insertTrimmingSpace(ws, " "), wrapped];
5234
5415
  }
5235
5416
 
5236
- // source/parser/unary.civet
5417
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\unary.civet.jsx
5237
5418
  function processUnaryExpression(pre, exp, post) {
5238
5419
  if (!(pre.length || post)) {
5239
5420
  return exp;
@@ -5395,7 +5576,7 @@ function processUnaryNestedExpression(pre, args, post) {
5395
5576
  return processUnaryExpression(pre, args, post);
5396
5577
  }
5397
5578
 
5398
- // source/parser/pipe.civet
5579
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pipe.civet.jsx
5399
5580
  function constructInvocation(fn, arg) {
5400
5581
  let expr = fn.expr;
5401
5582
  while (expr.type === "ParenthesizedExpression") {
@@ -5418,11 +5599,9 @@ function constructInvocation(fn, arg) {
5418
5599
  lhs = makeLeftHandSideExpression(lhs);
5419
5600
  }
5420
5601
  let comment = skipIfOnlyWS(fn.trailingComment);
5421
- if (comment)
5422
- lhs.children.push(comment);
5602
+ if (comment) lhs.children.push(comment);
5423
5603
  comment = skipIfOnlyWS(fn.leadingComment);
5424
- if (comment)
5425
- lhs.children.splice(1, 0, comment);
5604
+ if (comment) lhs.children.splice(1, 0, comment);
5426
5605
  switch (arg.type) {
5427
5606
  case "CommaExpression": {
5428
5607
  arg = makeLeftHandSideExpression(arg);
@@ -5511,27 +5690,26 @@ function processPipelineExpressions(statements) {
5511
5690
  let initRef;
5512
5691
  if (i2 === 0) {
5513
5692
  checkValidLHS(arg);
5514
- outer:
5515
- switch (arg.type) {
5516
- case "MemberExpression": {
5517
- if (arg.children.length <= 2) {
5518
- break;
5519
- }
5520
- }
5521
- case "CallExpression": {
5522
- const access = arg.children.pop();
5523
- usingRef = makeRef();
5524
- initRef = {
5525
- type: "AssignmentExpression",
5526
- children: [usingRef, " = ", arg, comma]
5527
- };
5528
- arg = {
5529
- type: "MemberExpression",
5530
- children: [usingRef, access]
5531
- };
5693
+ outer: switch (arg.type) {
5694
+ case "MemberExpression": {
5695
+ if (arg.children.length <= 2) {
5532
5696
  break;
5533
5697
  }
5534
5698
  }
5699
+ case "CallExpression": {
5700
+ const access = arg.children.pop();
5701
+ usingRef = makeRef();
5702
+ initRef = {
5703
+ type: "AssignmentExpression",
5704
+ children: [usingRef, " = ", arg, comma]
5705
+ };
5706
+ arg = {
5707
+ type: "MemberExpression",
5708
+ children: [usingRef, access]
5709
+ };
5710
+ break;
5711
+ }
5712
+ }
5535
5713
  const lhs = [[
5536
5714
  [initRef],
5537
5715
  arg,
@@ -5559,8 +5737,7 @@ function processPipelineExpressions(statements) {
5559
5737
  });
5560
5738
  }
5561
5739
  } else {
5562
- if (i2 === 0)
5563
- s.children = children;
5740
+ if (i2 === 0) s.children = children;
5564
5741
  }
5565
5742
  if (returns && (ref = needsRef(arg))) {
5566
5743
  usingRef = usingRef || ref;
@@ -5624,7 +5801,7 @@ function processPipelineExpressions(statements) {
5624
5801
  });
5625
5802
  }
5626
5803
 
5627
- // source/parser/for.civet
5804
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\for.civet.jsx
5628
5805
  function processRangeExpression(start, ws1, range, end) {
5629
5806
  ws1 = [ws1, range.children[0]];
5630
5807
  const ws2 = range.children[1];
@@ -5647,10 +5824,8 @@ function processRangeExpression(start, ws1, range, end) {
5647
5824
  const abs = ref;
5648
5825
  const lengthAdjust = 1 - Number(!range.left.inclusive) - Number(!range.right.inclusive);
5649
5826
  let ref1;
5650
- if (lengthAdjust > 0)
5651
- ref1 = ` + ${lengthAdjust}`;
5652
- else if (lengthAdjust < 0)
5653
- ref1 = ` - ${-lengthAdjust}`;
5827
+ if (lengthAdjust > 0) ref1 = ` + ${lengthAdjust}`;
5828
+ else if (lengthAdjust < 0) ref1 = ` - ${-lengthAdjust}`;
5654
5829
  else {
5655
5830
  ref1 = void 0;
5656
5831
  }
@@ -5786,10 +5961,8 @@ function forRange(open, forDeclaration, range, stepExp, close) {
5786
5961
  asc = stepValue > 0;
5787
5962
  }
5788
5963
  let ref3;
5789
- if (stepRef)
5790
- ref3 = start;
5791
- else
5792
- ref3 = maybeRef(start, "start");
5964
+ if (stepRef) ref3 = start;
5965
+ else ref3 = maybeRef(start, "start");
5793
5966
  let startRef = ref3;
5794
5967
  let endRef = maybeRef(end, "end");
5795
5968
  const startRefDec = startRef !== start ? [startRef, " = ", start, ", "] : [];
@@ -5966,8 +6139,7 @@ function processForInOf($0) {
5966
6139
  };
5967
6140
  }
5968
6141
  let ws2, decl2;
5969
- if (declaration2)
5970
- [, , ws2, decl2] = declaration2;
6142
+ if (declaration2) [, , ws2, decl2] = declaration2;
5971
6143
  switch (inOf.token) {
5972
6144
  case "of": {
5973
6145
  const counterRef = makeRef("i");
@@ -6032,8 +6204,8 @@ function processForInOf($0) {
6032
6204
  };
6033
6205
  }
6034
6206
 
6035
- // source/parser/auto-dec.civet
6036
- var concatAssign = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
6207
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\auto-dec.civet.jsx
6208
+ var concatAssign2 = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
6037
6209
  function findDecs(statements) {
6038
6210
  const declarations = gatherNodes(statements, ($) => $.type === "Declaration");
6039
6211
  const declarationNames = declarations.flatMap((d) => d.names);
@@ -6088,8 +6260,7 @@ function createConstLetDecs(statements, scopes, letOrConst) {
6088
6260
  }
6089
6261
  continue;
6090
6262
  }
6091
- if (node.names == null)
6092
- continue;
6263
+ if (node.names == null) continue;
6093
6264
  let names = node.names.filter((name) => !hasDec(name));
6094
6265
  if (node.type == "AssignmentExpression") {
6095
6266
  undeclaredIdentifiers.push(...names);
@@ -6125,7 +6296,7 @@ function createVarDecs(block, scopes, pushVar) {
6125
6296
  function findAssignments(statements2, decs2) {
6126
6297
  let assignmentStatements2 = gatherNodes(statements2, ($3) => $3.type === "AssignmentExpression");
6127
6298
  if (assignmentStatements2.length) {
6128
- concatAssign(
6299
+ concatAssign2(
6129
6300
  assignmentStatements2,
6130
6301
  findAssignments(assignmentStatements2.map((s) => s.children), decs2)
6131
6302
  );
@@ -6145,8 +6316,7 @@ function createVarDecs(block, scopes, pushVar) {
6145
6316
  const assignmentStatements = findAssignments(statements, scopes);
6146
6317
  const undeclaredIdentifiers = assignmentStatements.flatMap(($4) => $4?.names || []);
6147
6318
  undeclaredIdentifiers.filter((x, i, a) => {
6148
- if (!hasDec(x))
6149
- return a.indexOf(x) === i;
6319
+ if (!hasDec(x)) return a.indexOf(x) === i;
6150
6320
  return;
6151
6321
  }).forEach(pushVar);
6152
6322
  const fnNodes = gatherNodes(statements, isFunction);
@@ -6182,7 +6352,7 @@ function createVarDecs(block, scopes, pushVar) {
6182
6352
  scopes.pop();
6183
6353
  }
6184
6354
 
6185
- // source/parser/string.civet
6355
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\string.civet.jsx
6186
6356
  function getIndentLevel(str, tab) {
6187
6357
  if (tab != null && tab != 1) {
6188
6358
  const tabs = str.match(/\t/g);
@@ -6350,7 +6520,7 @@ function quoteString(str) {
6350
6520
  return JSON.stringify(str);
6351
6521
  }
6352
6522
 
6353
- // source/parser/lib.civet
6523
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
6354
6524
  var xor = (a, b) => a ? !b && a : b;
6355
6525
  function addPostfixStatement(statement, ws, post) {
6356
6526
  const expressions = [
@@ -6364,8 +6534,7 @@ function addPostfixStatement(statement, ws, post) {
6364
6534
  bare: false
6365
6535
  });
6366
6536
  const children = [...post.children, block];
6367
- if (!isWhitespaceOrEmpty(ws))
6368
- children.push(ws);
6537
+ if (!isWhitespaceOrEmpty(ws)) children.push(ws);
6369
6538
  post = makeNode({ ...post, children, block });
6370
6539
  if (post.type === "IfStatement") {
6371
6540
  post.then = block;
@@ -6437,8 +6606,7 @@ function expressionizeBlock(blockOrExpression) {
6437
6606
  let i1 = 0;
6438
6607
  for (const [ws, s, _delim] of expressions) {
6439
6608
  const i = i1++;
6440
- if (!isExpression(s))
6441
- return;
6609
+ if (!isExpression(s)) return;
6442
6610
  const wrapped = makeLeftHandSideExpression(s);
6443
6611
  if (i === l - 1) {
6444
6612
  results.push([ws, wrapped]);
@@ -6800,8 +6968,7 @@ function processCallMemberExpression(node) {
6800
6968
  prefix = [ref].concat(glob.dot);
6801
6969
  }
6802
6970
  }
6803
- if (wValue)
6804
- value.unshift(wValue);
6971
+ if (wValue) value.unshift(wValue);
6805
6972
  if (part.type === "SpreadProperty") {
6806
6973
  parts.push({
6807
6974
  type: part.type,
@@ -6844,8 +7011,7 @@ function processCallMemberExpression(node) {
6844
7011
  ],
6845
7012
  properties: parts
6846
7013
  };
6847
- if (i === children.length - 1)
6848
- return object;
7014
+ if (i === children.length - 1) return object;
6849
7015
  return processCallMemberExpression({
6850
7016
  // in case there are more
6851
7017
  ...node,
@@ -6986,10 +7152,8 @@ function lastAccessInCallExpression(exp) {
6986
7152
  ;
6987
7153
  ({ children } = exp);
6988
7154
  i = children.length - 1;
6989
- while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"))
6990
- i--;
6991
- if (i < 0)
6992
- return;
7155
+ while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional")) i--;
7156
+ if (i < 0) return;
6993
7157
  } while (children[i].type === "MemberExpression" && (exp = children[i]));
6994
7158
  return children[i];
6995
7159
  }
@@ -7062,8 +7226,7 @@ function convertObjectToJSXAttributes(obj) {
7062
7226
  rest.push(part);
7063
7227
  continue;
7064
7228
  }
7065
- if (i > 0)
7066
- parts.push(" ");
7229
+ if (i > 0) parts.push(" ");
7067
7230
  switch (part.type) {
7068
7231
  case "Identifier": {
7069
7232
  parts.push([part.name, "={", part.name, "}"]);
@@ -7109,16 +7272,16 @@ function makeGetterMethod(name, ws, value, returnType, block, kind = { token: "g
7109
7272
  const { token } = kind;
7110
7273
  ws = trimFirstSpace(ws);
7111
7274
  let setVal;
7112
- const parameters = token === "get" ? {
7113
- type: "Parameters",
7114
- children: ["()"],
7115
- names: [],
7116
- implicit: true
7117
- } : {
7275
+ const parameterList = [];
7276
+ const isGet = token === "get";
7277
+ if (!isGet) {
7278
+ parameterList.push(setVal = makeRef("value"));
7279
+ }
7280
+ const parameters = {
7118
7281
  type: "Parameters",
7119
- children: ["(", setVal = makeRef("value"), ")"],
7120
- names: [],
7121
- implicit: false
7282
+ children: ["(", parameterList, ")"],
7283
+ parameters: parameterList,
7284
+ implicit: isGet
7122
7285
  };
7123
7286
  let expressions;
7124
7287
  if (block) {
@@ -7134,7 +7297,7 @@ function makeGetterMethod(name, ws, value, returnType, block, kind = { token: "g
7134
7297
  };
7135
7298
  }
7136
7299
  if (autoReturn) {
7137
- const finalStatement = token === "get" ? [[expressions[0]?.[0] || "", ws], wrapWithReturn(value)] : [[expressions[0]?.[0] || "", ws], [value, " = ", setVal]];
7300
+ const finalStatement = isGet ? [[expressions[0]?.[0] || "", ws], wrapWithReturn(value)] : [[expressions[0]?.[0] || "", ws], [value, " = ", setVal]];
7138
7301
  expressions.push(finalStatement);
7139
7302
  }
7140
7303
  const children = [kind, " ", name, parameters, returnType, block];
@@ -7163,7 +7326,7 @@ function processBindingPatternLHS(lhs, tail) {
7163
7326
  }
7164
7327
  function processAssignments(statements) {
7165
7328
  for (let ref7 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len3 = ref7.length; i5 < len3; i5++) {
7166
- let extractAssignment2 = function(lhs) {
7329
+ let extractAssignment = function(lhs) {
7167
7330
  let expr = lhs;
7168
7331
  while (expr.type === "ParenthesizedExpression") {
7169
7332
  expr = expr.expression;
@@ -7182,7 +7345,6 @@ function processAssignments(statements) {
7182
7345
  ;
7183
7346
  return;
7184
7347
  };
7185
- var extractAssignment = extractAssignment2;
7186
7348
  const exp = ref7[i5];
7187
7349
  checkValidLHS(exp.assigned);
7188
7350
  const pre = [], post = [];
@@ -7195,7 +7357,7 @@ function processAssignments(statements) {
7195
7357
  for (let ref9 = exp.lhs, i6 = 0, len4 = ref9.length; i6 < len4; i6++) {
7196
7358
  const lhsPart = ref9[i6];
7197
7359
  let ref10;
7198
- if (ref10 = extractAssignment2(lhsPart[1])) {
7360
+ if (ref10 = extractAssignment(lhsPart[1])) {
7199
7361
  const newLhs = ref10;
7200
7362
  lhsPart[1] = newLhs;
7201
7363
  }
@@ -7204,7 +7366,7 @@ function processAssignments(statements) {
7204
7366
  break;
7205
7367
  }
7206
7368
  case "UpdateExpression": {
7207
- if (ref8 = extractAssignment2(exp.assigned)) {
7369
+ if (ref8 = extractAssignment(exp.assigned)) {
7208
7370
  const newLhs = ref8;
7209
7371
  const i = exp.children.indexOf(exp.assigned);
7210
7372
  exp.assigned = exp.children[i] = newLhs;
@@ -7260,13 +7422,11 @@ function processAssignments(statements) {
7260
7422
  }
7261
7423
  }
7262
7424
  if ($1.some(($8) => $8[$8.length - 1].special)) {
7263
- if ($1.length !== 1)
7264
- throw new Error("Only one assignment with id= is allowed");
7425
+ if ($1.length !== 1) throw new Error("Only one assignment with id= is allowed");
7265
7426
  const [, lhs, , op] = $1[0];
7266
7427
  const { call, omitLhs } = op;
7267
7428
  const index = exp.children.indexOf($2);
7268
- if (index < 0)
7269
- throw new Error("Assertion error: exp not in AssignmentExpression");
7429
+ if (index < 0) throw new Error("Assertion error: exp not in AssignmentExpression");
7270
7430
  exp.children.splice(
7271
7431
  index,
7272
7432
  1,
@@ -7317,8 +7477,7 @@ function processAssignments(statements) {
7317
7477
  c[4] = [", ...", $2];
7318
7478
  c[5] = ")";
7319
7479
  lastAssignment.pop();
7320
- if (isWhitespaceOrEmpty(lastAssignment[2]))
7321
- lastAssignment.pop();
7480
+ if (isWhitespaceOrEmpty(lastAssignment[2])) lastAssignment.pop();
7322
7481
  if ($1.length > 1) {
7323
7482
  throw new Error("Not implemented yet! TODO: Handle multiple splice assignments");
7324
7483
  }
@@ -7378,8 +7537,7 @@ function processAssignments(statements) {
7378
7537
  exp.names = $1.flatMap(([, l]) => l.names || []);
7379
7538
  if (tail.length) {
7380
7539
  const index = exp.children.indexOf($2);
7381
- if (index < 0)
7382
- throw new Error("Assertion error: exp not in AssignmentExpression");
7540
+ if (index < 0) throw new Error("Assertion error: exp not in AssignmentExpression");
7383
7541
  exp.children.splice(index + 1, 0, ...tail);
7384
7542
  }
7385
7543
  if (block) {
@@ -7556,10 +7714,8 @@ function processTypes(node) {
7556
7714
  const space = getTrimmingSpace(unary);
7557
7715
  inplaceInsertTrimmingSpace(unary, "");
7558
7716
  let ref16;
7559
- if (unary.suffix.length)
7560
- ref16 = unary;
7561
- else
7562
- ref16 = unary.t;
7717
+ if (unary.suffix.length) ref16 = unary;
7718
+ else ref16 = unary.t;
7563
7719
  const t = ref16;
7564
7720
  const arg = makeNode({
7565
7721
  type: "TypeArgument",
@@ -7635,6 +7791,7 @@ function processStatementExpressions(statements) {
7635
7791
  ;
7636
7792
  break;
7637
7793
  }
7794
+ // else do nothing, handled separately currently
7638
7795
  default: {
7639
7796
  replaceNode(statement, wrapIIFE([["", statement]]), exp);
7640
7797
  }
@@ -7852,8 +8009,7 @@ function populateRefs(statements) {
7852
8009
  const names = new Set(ids.flatMap(({ names: names2 }) => names2 || []));
7853
8010
  refNodes.forEach((ref) => {
7854
8011
  const { type, base } = ref;
7855
- if (type !== "Ref")
7856
- return;
8012
+ if (type !== "Ref") return;
7857
8013
  ref.type = "Identifier";
7858
8014
  let n = 0;
7859
8015
  let name = base;
@@ -8043,8 +8199,7 @@ function reorderBindingRestProperty(props) {
8043
8199
  let restCount = 0;
8044
8200
  props.forEach(({ type }, i) => {
8045
8201
  if (type === "BindingRestProperty") {
8046
- if (restIndex < 0)
8047
- restIndex = i;
8202
+ if (restIndex < 0) restIndex = i;
8048
8203
  return restCount++;
8049
8204
  }
8050
8205
  ;
@@ -9423,10 +9578,8 @@ function NonPipelineExpression(ctx, state2) {
9423
9578
  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) {
9424
9579
  var expression = $3;
9425
9580
  var trailing = $5;
9426
- if (!expression)
9427
- return $skip;
9428
- if (!trailing)
9429
- return expression;
9581
+ if (!expression) return $skip;
9582
+ if (!trailing) return expression;
9430
9583
  return {
9431
9584
  type: "CallExpression",
9432
9585
  children: [expression, ...trailing]
@@ -9436,8 +9589,7 @@ function NestedExpressionizedStatement(ctx, state2) {
9436
9589
  return (0, import_lib2.$EVENT)(ctx, state2, "NestedExpressionizedStatement", NestedExpressionizedStatement$0);
9437
9590
  }
9438
9591
  var ExpressionizedStatementWithTrailingCallExpressions$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ExpressionizedStatement, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2) {
9439
- if (!$2)
9440
- return $1;
9592
+ if (!$2) return $1;
9441
9593
  return {
9442
9594
  type: "CallExpression",
9443
9595
  children: [
@@ -9462,8 +9614,7 @@ function ExpressionizedStatement(ctx, state2) {
9462
9614
  }
9463
9615
  var StatementExpression$0 = DebuggerStatement;
9464
9616
  var StatementExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(IfStatement), function($skip, $loc, $0, $1) {
9465
- if (!$1.else && $1.then.implicit)
9466
- return $skip;
9617
+ if (!$1.else && $1.then.implicit) return $skip;
9467
9618
  return $1;
9468
9619
  });
9469
9620
  var StatementExpression$2 = IterationExpression;
@@ -9475,8 +9626,7 @@ function StatementExpression(ctx, state2) {
9475
9626
  return (0, import_lib2.$EVENT_C)(ctx, state2, "StatementExpression", StatementExpression$$);
9476
9627
  }
9477
9628
  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) {
9478
- if ($2.length == 0)
9479
- return $1;
9629
+ if ($2.length == 0) return $1;
9480
9630
  return $0;
9481
9631
  });
9482
9632
  function CommaExpression(ctx, state2) {
@@ -9485,8 +9635,7 @@ function CommaExpression(ctx, state2) {
9485
9635
  var Arguments$0 = ExplicitArguments;
9486
9636
  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) {
9487
9637
  var args = $2;
9488
- if (args)
9489
- return args;
9638
+ if (args) return args;
9490
9639
  return $skip;
9491
9640
  });
9492
9641
  var Arguments$$ = [Arguments$0, Arguments$1];
@@ -9498,10 +9647,8 @@ var ImplicitArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ApplicationSt
9498
9647
  var ws = $3;
9499
9648
  var args = $6;
9500
9649
  var close = $9;
9501
- if (!args)
9502
- return $skip;
9503
- if (skipImplicitArguments(args))
9504
- return $skip;
9650
+ if (!args) return $skip;
9651
+ if (skipImplicitArguments(args)) return $skip;
9505
9652
  return {
9506
9653
  type: "Call",
9507
9654
  args,
@@ -9547,14 +9694,12 @@ var ForbiddenImplicitCalls$3 = (0, import_lib2.$S)(ClassImplicitCallForbidden, (
9547
9694
  var ForbiddenImplicitCalls$4 = (0, import_lib2.$S)(Identifier, (0, import_lib2.$EXPECT)($L3, 'ForbiddenImplicitCalls "="'), Whitespace);
9548
9695
  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) {
9549
9696
  var id = $1;
9550
- if (state.operators.has(id.name))
9551
- return $0;
9697
+ if (state.operators.has(id.name)) return $0;
9552
9698
  return $skip;
9553
9699
  });
9554
9700
  var ForbiddenImplicitCalls$6 = (0, import_lib2.$TS)((0, import_lib2.$S)(OmittedNegation, (0, import_lib2.$E)(_), Identifier), function($skip, $loc, $0, $1, $2, $3) {
9555
9701
  var id = $3;
9556
- if (state.operators.has(id.name))
9557
- return $0;
9702
+ if (state.operators.has(id.name)) return $0;
9558
9703
  return $skip;
9559
9704
  });
9560
9705
  var ForbiddenImplicitCalls$7 = (0, import_lib2.$S)(PostfixStatement, NoBlock);
@@ -9577,18 +9722,15 @@ function ArgumentsWithTrailingCallExpressions(ctx, state2) {
9577
9722
  }
9578
9723
  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) {
9579
9724
  $1 = $1.flat();
9580
- if (!$1.length && !$2)
9581
- return $skip;
9582
- if (!$2)
9583
- return $1;
9725
+ if (!$1.length && !$2) return $skip;
9726
+ if (!$2) return $1;
9584
9727
  return [...$1, ...$2];
9585
9728
  });
9586
9729
  function TrailingCallExpressions(ctx, state2) {
9587
9730
  return (0, import_lib2.$EVENT)(ctx, state2, "TrailingCallExpressions", TrailingCallExpressions$0);
9588
9731
  }
9589
9732
  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) {
9590
- if (!$2.length)
9591
- return $skip;
9733
+ if (!$2.length) return $skip;
9592
9734
  return $2.flat();
9593
9735
  });
9594
9736
  var IndentedTrailingCallExpressions$1 = (0, import_lib2.$TV)((0, import_lib2.$P)(NestedTrailingCallExpression), function($skip, $loc, $0, $1) {
@@ -9636,8 +9778,7 @@ var ArgumentList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N
9636
9778
  ];
9637
9779
  });
9638
9780
  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) {
9639
- if (!Array.isArray($1))
9640
- $1 = [$1];
9781
+ if (!Array.isArray($1)) $1 = [$1];
9641
9782
  return [
9642
9783
  ...trimFirstSpace($1),
9643
9784
  ...$2.flatMap(
@@ -9664,8 +9805,7 @@ function NestedArguments(ctx, state2) {
9664
9805
  }
9665
9806
  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) {
9666
9807
  var args = $4;
9667
- if (!args.length)
9668
- return $skip;
9808
+ if (!args.length) return $skip;
9669
9809
  return stripTrailingImplicitComma(args.flat());
9670
9810
  });
9671
9811
  function NestedArgumentList(ctx, state2) {
@@ -9719,8 +9859,7 @@ function ArgumentPart(ctx, state2) {
9719
9859
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ArgumentPart", ArgumentPart$$);
9720
9860
  }
9721
9861
  var BinaryOpExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UnaryExpression, (0, import_lib2.$Q)(BinaryOpRHS)), function($skip, $loc, $0, $1, $2) {
9722
- if (!$2.length)
9723
- return $1;
9862
+ if (!$2.length) return $1;
9724
9863
  return processBinaryOpExpression($0);
9725
9864
  });
9726
9865
  function BinaryOpExpression(ctx, state2) {
@@ -9774,8 +9913,7 @@ function IsLike(ctx, state2) {
9774
9913
  }
9775
9914
  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) {
9776
9915
  var wrhs = $2;
9777
- if (!wrhs)
9778
- return $skip;
9916
+ if (!wrhs) return $skip;
9779
9917
  return wrhs;
9780
9918
  });
9781
9919
  var WRHS$1 = (0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$S)(EOS, __), _), RHS);
@@ -9837,8 +9975,7 @@ function UnaryBody(ctx, state2) {
9837
9975
  return (0, import_lib2.$EVENT_C)(ctx, state2, "UnaryBody", UnaryBody$$);
9838
9976
  }
9839
9977
  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) {
9840
- if (!$2)
9841
- return $skip;
9978
+ if (!$2) return $skip;
9842
9979
  return $2;
9843
9980
  });
9844
9981
  var MaybeNestedCoffeeDoBody$1 = (0, import_lib2.$S)((0, import_lib2.$E)(_), CoffeeDoBody);
@@ -9927,8 +10064,7 @@ var UpdateExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UpdateExpressi
9927
10064
  };
9928
10065
  });
9929
10066
  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) {
9930
- if (!$2)
9931
- return $1;
10067
+ if (!$2) return $1;
9932
10068
  return {
9933
10069
  type: "UpdateExpression",
9934
10070
  assigned: $1,
@@ -10061,14 +10197,14 @@ var ArrowFunction$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$
10061
10197
  var returnType = $3;
10062
10198
  var arrow = $4;
10063
10199
  var expOrBlock = $5;
10064
- if (!async)
10065
- async = [];
10200
+ if (!async) async = [];
10066
10201
  return {
10067
10202
  type: "ArrowFunction",
10068
10203
  signature: {
10069
10204
  modifier: {
10070
10205
  async: !!async.length
10071
10206
  },
10207
+ parameters,
10072
10208
  returnType
10073
10209
  },
10074
10210
  parameters,
@@ -10085,8 +10221,7 @@ function ArrowFunction(ctx, state2) {
10085
10221
  var FatArrow$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), FatArrowToken), function($skip, $loc, $0, $1, $2) {
10086
10222
  var ws = $1;
10087
10223
  var arrow = $2;
10088
- if (!ws)
10089
- ws = " ";
10224
+ if (!ws) ws = " ";
10090
10225
  return [ws, arrow];
10091
10226
  });
10092
10227
  function FatArrow(ctx, state2) {
@@ -10153,8 +10288,7 @@ function TernaryRest(ctx, state2) {
10153
10288
  }
10154
10289
  var NestedTernaryRest$0 = (0, import_lib2.$S)(Nested, QuestionMark, MaybeNestedExpression, Nested, Colon, MaybeNestedExpression);
10155
10290
  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) {
10156
- if ($2)
10157
- return $2;
10291
+ if ($2) return $2;
10158
10292
  return $skip;
10159
10293
  });
10160
10294
  var NestedTernaryRest$$ = [NestedTernaryRest$0, NestedTernaryRest$1];
@@ -10193,8 +10327,7 @@ function PipelineExpression(ctx, state2) {
10193
10327
  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) {
10194
10328
  var first = $1;
10195
10329
  var rest = $3;
10196
- if (!rest.length)
10197
- return $skip;
10330
+ if (!rest.length) return $skip;
10198
10331
  return [
10199
10332
  ...first,
10200
10333
  ...rest.map(([nested, line]) => [nested, ...line]).flat()
@@ -10257,8 +10390,7 @@ var OptimizedParenthesizedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S
10257
10390
  const { expression } = $1;
10258
10391
  switch (expression.type) {
10259
10392
  case "StatementExpression":
10260
- if (expression.statement.type !== "IterationExpression")
10261
- break;
10393
+ if (expression.statement.type !== "IterationExpression") break;
10262
10394
  case "IterationExpression":
10263
10395
  return expression;
10264
10396
  }
@@ -10269,8 +10401,7 @@ function OptimizedParenthesizedExpression(ctx, state2) {
10269
10401
  }
10270
10402
  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) {
10271
10403
  var open = $1;
10272
- if (!$3)
10273
- return $skip;
10404
+ if (!$3) return $skip;
10274
10405
  const [expression, ws, close] = $3;
10275
10406
  if (expression.type === "ParenthesizedExpression" && expression.implicit) {
10276
10407
  return {
@@ -10328,8 +10459,7 @@ function PlaceholderTypeSuffix(ctx, state2) {
10328
10459
  return (0, import_lib2.$EVENT)(ctx, state2, "PlaceholderTypeSuffix", PlaceholderTypeSuffix$0);
10329
10460
  }
10330
10461
  var ClassDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ClassExpression), function($skip, $loc, $0, $1) {
10331
- if ($1.id)
10332
- return $1;
10462
+ if ($1.id) return $1;
10333
10463
  return makeLeftHandSideExpression($1);
10334
10464
  });
10335
10465
  function ClassDeclaration(ctx, state2) {
@@ -10374,10 +10504,8 @@ var ClassHeritage$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ExtendsClause, (0
10374
10504
  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) {
10375
10505
  var withClause = $1;
10376
10506
  var implementsClause = $2;
10377
- if (withClause)
10378
- return [convertWithClause(withClause), implementsClause];
10379
- if (implementsClause)
10380
- return implementsClause;
10507
+ if (withClause) return [convertWithClause(withClause), implementsClause];
10508
+ if (implementsClause) return implementsClause;
10381
10509
  return $skip;
10382
10510
  });
10383
10511
  var ClassHeritage$$ = [ClassHeritage$0, ClassHeritage$1];
@@ -10512,8 +10640,7 @@ var ClassBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, OpenBrace, AllowA
10512
10640
  var expressions = $4;
10513
10641
  var ws2 = $6;
10514
10642
  var close = $7;
10515
- if (!expressions)
10516
- expressions = [];
10643
+ if (!expressions) expressions = [];
10517
10644
  return {
10518
10645
  type: "BlockStatement",
10519
10646
  subtype: "ClassBody",
@@ -10523,8 +10650,7 @@ var ClassBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, OpenBrace, AllowA
10523
10650
  });
10524
10651
  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) {
10525
10652
  var expressions = $2;
10526
- if (!expressions)
10527
- expressions = $0[1] = [];
10653
+ if (!expressions) expressions = $0[1] = [];
10528
10654
  return {
10529
10655
  type: "BlockStatement",
10530
10656
  subtype: "ClassBody",
@@ -10539,8 +10665,7 @@ function ClassBody(ctx, state2) {
10539
10665
  var ClassBracedContent$0 = NestedClassElements;
10540
10666
  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) {
10541
10667
  var stmts = $2;
10542
- if (!stmts)
10543
- return $skip;
10668
+ if (!stmts) return $skip;
10544
10669
  return stmts;
10545
10670
  });
10546
10671
  var ClassBracedContent$$ = [ClassBracedContent$0, ClassBracedContent$1];
@@ -10549,8 +10674,7 @@ function ClassBracedContent(ctx, state2) {
10549
10674
  }
10550
10675
  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) {
10551
10676
  var elements = $2;
10552
- if (!elements.length)
10553
- return $skip;
10677
+ if (!elements.length) return $skip;
10554
10678
  return elements;
10555
10679
  });
10556
10680
  function NestedClassElements(ctx, state2) {
@@ -10608,8 +10732,7 @@ function ClassSignatureBody(ctx, state2) {
10608
10732
  }
10609
10733
  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) {
10610
10734
  var elements = $2;
10611
- if (!elements.length)
10612
- return $skip;
10735
+ if (!elements.length) return $skip;
10613
10736
  return elements;
10614
10737
  });
10615
10738
  function NestedClassSignatureElements(ctx, state2) {
@@ -10626,8 +10749,7 @@ function ClassSignatureElement(ctx, state2) {
10626
10749
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ClassSignatureElement", ClassSignatureElement$$);
10627
10750
  }
10628
10751
  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) {
10629
- if (!($1 || $2))
10630
- return $skip;
10752
+ if (!($1 || $2)) return $skip;
10631
10753
  return {
10632
10754
  ts: true,
10633
10755
  children: $0
@@ -10640,6 +10762,7 @@ var FieldDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeClassesEn
10640
10762
  var id = $2;
10641
10763
  var exp = $6;
10642
10764
  switch (exp.type) {
10765
+ // TODO: => functions
10643
10766
  case "FunctionExpression":
10644
10767
  const fnTokenIndex = exp.children.findIndex((c) => c?.token?.startsWith("function"));
10645
10768
  const children = exp.children.slice();
@@ -10723,8 +10846,7 @@ var HashThis$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(At
10723
10846
  var at = $1;
10724
10847
  var id = $2;
10725
10848
  var beforeIn = $3;
10726
- if (beforeIn != null && at == null)
10727
- return ['"', id.name, '"'];
10849
+ if (beforeIn != null && at == null) return ['"', id.name, '"'];
10728
10850
  return {
10729
10851
  type: "MemberExpression",
10730
10852
  children: [at ?? "this", {
@@ -10851,8 +10973,7 @@ var CallExpressionRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
10851
10973
  var CallExpressionRest$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ArgumentsWithTrailingCallExpressions), function($skip, $loc, $0, $1, $2) {
10852
10974
  var optional = $1;
10853
10975
  var argsWithTrailing = $2;
10854
- if (!optional)
10855
- return argsWithTrailing;
10976
+ if (!optional) return argsWithTrailing;
10856
10977
  const call = argsWithTrailing[0];
10857
10978
  return [{
10858
10979
  ...call,
@@ -10878,8 +10999,7 @@ var ExplicitCallExpressionRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0,
10878
10999
  var ExplicitCallExpressionRest$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
10879
11000
  var optional = $1;
10880
11001
  var call = $2;
10881
- if (!optional)
10882
- return call;
11002
+ if (!optional) return call;
10883
11003
  return {
10884
11004
  ...call,
10885
11005
  children: [optional, ...call.children],
@@ -10947,8 +11067,7 @@ function MemberBase(ctx, state2) {
10947
11067
  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) {
10948
11068
  var comments = $2;
10949
11069
  var body = $3;
10950
- if (Array.isArray(body))
10951
- return [...comments, ...body];
11070
+ if (Array.isArray(body)) return [...comments, ...body];
10952
11071
  return {
10953
11072
  ...body,
10954
11073
  children: [...comments, ...body.children]
@@ -10961,8 +11080,7 @@ var MemberExpressionRestBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, im
10961
11080
  var dot = $1;
10962
11081
  var comments = $2;
10963
11082
  var content = $3;
10964
- if (!dot && !comments.length)
10965
- return content;
11083
+ if (!dot && !comments.length) return content;
10966
11084
  if (dot) {
10967
11085
  if (dot.type === "Optional" && content.type === "SliceExpression") {
10968
11086
  return [...dot.children.slice(0, -1), ...comments, content];
@@ -11059,8 +11177,7 @@ var SliceParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Loc, (0, import
11059
11177
  const inc = [];
11060
11178
  if (dots.right.inclusive) {
11061
11179
  end = [makeLeftHandSideExpression(end), ` ${sign} 1`];
11062
- if (!reversed)
11063
- inc.push(" || 1/0");
11180
+ if (!reversed) inc.push(" || 1/0");
11064
11181
  }
11065
11182
  children = [start, [...ws, dots.children[0], { token: ", ", $loc: dots.$loc }], [dots.children[1], end, ...inc]];
11066
11183
  } else {
@@ -11311,10 +11428,12 @@ var Parameters$0 = NonEmptyParameters;
11311
11428
  var Parameters$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(TypeParameters), Loc), function($skip, $loc, $0, $1, $2) {
11312
11429
  var tp = $1;
11313
11430
  var p = $2;
11431
+ const parameters = [];
11314
11432
  return {
11315
11433
  type: "Parameters",
11316
- children: [tp, { $loc: p.$loc, token: "()" }],
11434
+ children: [tp, { $loc: p.$loc, token: "(" }, parameters, ")"],
11317
11435
  tp,
11436
+ parameters,
11318
11437
  names: [],
11319
11438
  implicit: true
11320
11439
  };
@@ -11337,10 +11456,11 @@ function ShortArrowParameters(ctx, state2) {
11337
11456
  return (0, import_lib2.$EVENT)(ctx, state2, "ShortArrowParameters", ShortArrowParameters$0);
11338
11457
  }
11339
11458
  var ArrowParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ShortArrowParameters), function($skip, $loc, $0, $1) {
11459
+ const parameters = [$1];
11340
11460
  return {
11341
11461
  type: "Parameters",
11342
- children: ["(", $1, ")"],
11343
- names: $1.names
11462
+ children: ["(", parameters, ")"],
11463
+ parameters
11344
11464
  };
11345
11465
  });
11346
11466
  var ArrowParameters$1 = Parameters;
@@ -11351,83 +11471,13 @@ function ArrowParameters(ctx, state2) {
11351
11471
  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) {
11352
11472
  var tp = $1;
11353
11473
  var open = $2;
11354
- var params = $3;
11474
+ var parameters = $3;
11355
11475
  var close = $4;
11356
- let tt, before = [], rest, after = [], errors = [];
11357
- function append2(p) {
11358
- (rest ? after : before).push(p);
11359
- }
11360
- for (const param of params) {
11361
- switch (param.type) {
11362
- case "ThisType":
11363
- if (tt) {
11364
- append2({
11365
- type: "Error",
11366
- message: "Only one typed this parameter is allowed"
11367
- });
11368
- append2(param);
11369
- } else {
11370
- tt = trimFirstSpace(param);
11371
- if (before.length || rest) {
11372
- let delim = tt.children.at(-1);
11373
- if (Array.isArray(delim))
11374
- delim = delim.at(-1);
11375
- if (delim?.token !== ",") {
11376
- tt = {
11377
- ...tt,
11378
- children: [...tt.children, ", "]
11379
- };
11380
- }
11381
- }
11382
- }
11383
- break;
11384
- case "FunctionRestParameter":
11385
- if (rest) {
11386
- append2({
11387
- type: "Error",
11388
- message: "Only one rest parameter is allowed"
11389
- });
11390
- append2(param);
11391
- } else {
11392
- rest = param;
11393
- }
11394
- break;
11395
- default:
11396
- append2(param);
11397
- }
11398
- }
11399
- const names = before.flatMap((p) => p.names);
11400
- if (rest) {
11401
- const restIdentifier = rest.binding.ref || rest.binding;
11402
- names.push(...rest.names || []);
11403
- let blockPrefix;
11404
- if (after.length) {
11405
- blockPrefix = {
11406
- children: ["[", trimFirstSpace(after), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
11407
- names: after.flatMap((p) => p.names)
11408
- };
11409
- }
11410
- return {
11411
- type: "Parameters",
11412
- children: [
11413
- tp,
11414
- open,
11415
- tt,
11416
- ...before,
11417
- // Remove delimiter
11418
- { ...rest, children: rest.children.slice(0, -1) },
11419
- close
11420
- ],
11421
- tp,
11422
- names,
11423
- blockPrefix
11424
- };
11425
- }
11426
11476
  return {
11427
11477
  type: "Parameters",
11428
- children: [tp, open, tt, ...before, close],
11429
- names,
11430
- tp
11478
+ children: [tp, open, parameters, close],
11479
+ tp,
11480
+ parameters
11431
11481
  };
11432
11482
  });
11433
11483
  function NonEmptyParameters(ctx, state2) {
@@ -11448,8 +11498,7 @@ function ParameterList(ctx, state2) {
11448
11498
  }
11449
11499
  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) {
11450
11500
  var params = $2;
11451
- if (!params.length)
11452
- return $skip;
11501
+ if (!params.length) return $skip;
11453
11502
  return params;
11454
11503
  });
11455
11504
  function NestedParameterList(ctx, state2) {
@@ -11473,12 +11522,15 @@ function Parameter(ctx, state2) {
11473
11522
  return (0, import_lib2.$EVENT_C)(ctx, state2, "Parameter", Parameter$$);
11474
11523
  }
11475
11524
  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) {
11476
- var id = $2;
11525
+ var rest = $2;
11526
+ var typeSuffix = $3;
11477
11527
  return {
11478
11528
  type: "FunctionRestParameter",
11479
11529
  children: $0.slice(1),
11480
- names: id.names,
11481
- binding: id.binding
11530
+ rest,
11531
+ names: rest.names,
11532
+ binding: rest.binding,
11533
+ typeSuffix
11482
11534
  };
11483
11535
  });
11484
11536
  function FunctionRestParameter(ctx, state2) {
@@ -11626,8 +11678,7 @@ function ObjectBindingPattern(ctx, state2) {
11626
11678
  var ObjectBindingPatternContent$0 = NestedBindingProperties;
11627
11679
  var ObjectBindingPatternContent$1 = (0, import_lib2.$TV)((0, import_lib2.$E)(BindingPropertyList), function($skip, $loc, $0, $1) {
11628
11680
  var props = $0;
11629
- if (!props)
11630
- return { children: [], names: [] };
11681
+ if (!props) return { children: [], names: [] };
11631
11682
  return reorderBindingRestProperty(props);
11632
11683
  });
11633
11684
  var ObjectBindingPatternContent$$ = [ObjectBindingPatternContent$0, ObjectBindingPatternContent$1];
@@ -11667,8 +11718,7 @@ function ArrayBindingPattern(ctx, state2) {
11667
11718
  var ArrayBindingPatternContent$0 = NestedBindingElements;
11668
11719
  var ArrayBindingPatternContent$1 = (0, import_lib2.$TV)((0, import_lib2.$E)(BindingElementList), function($skip, $loc, $0, $1) {
11669
11720
  var elements = $0;
11670
- if (!elements)
11671
- return { children: [], names: [], length: 0 };
11721
+ if (!elements) return { children: [], names: [], length: 0 };
11672
11722
  return adjustBindingElements(elements);
11673
11723
  });
11674
11724
  var ArrayBindingPatternContent$$ = [ArrayBindingPatternContent$0, ArrayBindingPatternContent$1];
@@ -11693,8 +11743,7 @@ var NestedBindingElementList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested
11693
11743
  var indent = $1;
11694
11744
  var elements = $2;
11695
11745
  return elements.map((element, i) => {
11696
- if (i > 0)
11697
- return element;
11746
+ if (i > 0) return element;
11698
11747
  return {
11699
11748
  ...element,
11700
11749
  children: [indent, ...element.children.slice(1)]
@@ -11711,8 +11760,7 @@ function Elision(ctx, state2) {
11711
11760
  }
11712
11761
  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) {
11713
11762
  var props = $2;
11714
- if (!props.length)
11715
- return $skip;
11763
+ if (!props.length) return $skip;
11716
11764
  return reorderBindingRestProperty(props.flat());
11717
11765
  });
11718
11766
  function NestedBindingProperties(ctx, state2) {
@@ -11722,8 +11770,7 @@ var NestedBindingPropertyList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Neste
11722
11770
  var ws = $1;
11723
11771
  var props = $2;
11724
11772
  return props.map((prop, i) => {
11725
- if (i > 0)
11726
- return prop;
11773
+ if (i > 0) return prop;
11727
11774
  return prepend(ws, prop);
11728
11775
  });
11729
11776
  });
@@ -11848,8 +11895,7 @@ function BindingTypeSuffix(ctx, state2) {
11848
11895
  }
11849
11896
  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) {
11850
11897
  var elements = $2;
11851
- if (!elements.length)
11852
- return $skip;
11898
+ if (!elements.length) return $skip;
11853
11899
  return adjustBindingElements(elements.flat());
11854
11900
  });
11855
11901
  function NestedBindingElements(ctx, state2) {
@@ -11888,7 +11934,7 @@ var BindingRestElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
11888
11934
  var typeSuffix = $4;
11889
11935
  return {
11890
11936
  type: "BindingRestElement",
11891
- children: [ws, [dots, binding]],
11937
+ children: [ws, dots, binding],
11892
11938
  dots,
11893
11939
  binding,
11894
11940
  typeSuffix,
@@ -11928,10 +11974,8 @@ function EmptyBindingPattern(ctx, state2) {
11928
11974
  return (0, import_lib2.$EVENT)(ctx, state2, "EmptyBindingPattern", EmptyBindingPattern$0);
11929
11975
  }
11930
11976
  var FunctionDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(FunctionExpression), function($skip, $loc, $0, $1) {
11931
- if ($1.type !== "FunctionExpression")
11932
- return $skip;
11933
- if ($1.id)
11934
- return $1;
11977
+ if ($1.type !== "FunctionExpression") return $skip;
11978
+ if ($1.id) return $1;
11935
11979
  return makeLeftHandSideExpression($1);
11936
11980
  });
11937
11981
  function FunctionDeclaration(ctx, state2) {
@@ -11945,10 +11989,8 @@ var FunctionSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
11945
11989
  var w = $5;
11946
11990
  var parameters = $6;
11947
11991
  var returnType = $7;
11948
- if (!async)
11949
- async = [];
11950
- if (!generator)
11951
- generator = [];
11992
+ if (!async) async = [];
11993
+ if (!generator) generator = [];
11952
11994
  const id = wid?.[1];
11953
11995
  return {
11954
11996
  type: "FunctionSignature",
@@ -11993,16 +12035,16 @@ var FunctionExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
11993
12035
  var open = $2;
11994
12036
  var op = $3;
11995
12037
  var close = $4;
11996
- if (op.special && op.call && !op.negated)
11997
- return op.call;
12038
+ if (op.special && op.call && !op.negated) return op.call;
11998
12039
  const refA = makeRef("a"), refB = makeRef("b"), body = processBinaryOpExpression([refA, [
11999
12040
  [[], op, [], refB]
12000
12041
  // BinaryOpRHS
12001
12042
  ]]);
12043
+ const parameterList = [[refA, ","], refB];
12002
12044
  const parameters = {
12003
12045
  type: "Parameters",
12004
- children: ["(", refA, ",", refB, ")"],
12005
- names: []
12046
+ children: ["(", parameterList, ")"],
12047
+ parameters: parameterList
12006
12048
  };
12007
12049
  const block = {
12008
12050
  expressions: [body]
@@ -12163,10 +12205,8 @@ var OperatorSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
12163
12205
  var w2 = $8;
12164
12206
  var parameters = $9;
12165
12207
  var returnType = $10;
12166
- if (!async)
12167
- async = [];
12168
- if (!generator)
12169
- generator = [];
12208
+ if (!async) async = [];
12209
+ if (!generator) generator = [];
12170
12210
  if (!func) {
12171
12211
  func = { $loc: op.$loc, token: "function" };
12172
12212
  } else {
@@ -12235,8 +12275,7 @@ var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
12235
12275
  var returnType = $3;
12236
12276
  var arrow = $5;
12237
12277
  var block = $6;
12238
- if (!async)
12239
- async = [];
12278
+ if (!async) async = [];
12240
12279
  const generator = [];
12241
12280
  return {
12242
12281
  type: "FunctionExpression",
@@ -12281,8 +12320,7 @@ var ExplicitBlock$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$
12281
12320
  var block = $4;
12282
12321
  var ws2 = $6;
12283
12322
  var close = $7;
12284
- if (!block)
12285
- return $skip;
12323
+ if (!block) return $skip;
12286
12324
  return {
12287
12325
  ...block,
12288
12326
  children: [ws1, open, ...block.children, ws2, close],
@@ -12295,8 +12333,7 @@ var ExplicitBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(IndentedAtLeast,
12295
12333
  var block = $4;
12296
12334
  var ws2 = $6;
12297
12335
  var close = $7;
12298
- if (!block)
12299
- return $skip;
12336
+ if (!block) return $skip;
12300
12337
  return {
12301
12338
  ...block,
12302
12339
  children: [ws1, open, ...block.children, ws2, close],
@@ -12321,8 +12358,7 @@ function EmptyBracedContent(ctx, state2) {
12321
12358
  }
12322
12359
  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) {
12323
12360
  var open = $2;
12324
- if (!$4)
12325
- return $skip;
12361
+ if (!$4) return $skip;
12326
12362
  const [block, ...tail] = $4;
12327
12363
  return {
12328
12364
  ...block,
@@ -12352,8 +12388,7 @@ function Block(ctx, state2) {
12352
12388
  return (0, import_lib2.$EVENT_C)(ctx, state2, "Block", Block$$);
12353
12389
  }
12354
12390
  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) {
12355
- if (!$3)
12356
- return $skip;
12391
+ if (!$3) return $skip;
12357
12392
  return $3;
12358
12393
  });
12359
12394
  function BareNestedBlock(ctx, state2) {
@@ -12489,8 +12524,7 @@ var BracedBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBrace, (0
12489
12524
  var s = $3;
12490
12525
  var ws = $4;
12491
12526
  var c = $5;
12492
- if (!s.children.length)
12493
- return $skip;
12527
+ if (!s.children.length) return $skip;
12494
12528
  return {
12495
12529
  type: "BlockStatement",
12496
12530
  expressions: s.expressions,
@@ -12508,8 +12542,7 @@ var NoPostfixBracedBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpen
12508
12542
  var s = $3;
12509
12543
  var ws = $4;
12510
12544
  var c = $5;
12511
- if (!s.expressions.length)
12512
- return $skip;
12545
+ if (!s.expressions.length) return $skip;
12513
12546
  return {
12514
12547
  type: "BlockStatement",
12515
12548
  expressions: s.expressions,
@@ -12527,8 +12560,7 @@ var NoCommaBracedBlock$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBr
12527
12560
  var s = $3;
12528
12561
  var ws = $4;
12529
12562
  var c = $5;
12530
- if (!s.children.length)
12531
- return $skip;
12563
+ if (!s.children.length) return $skip;
12532
12564
  return {
12533
12565
  type: "BlockStatement",
12534
12566
  expressions: s.expressions,
@@ -12569,11 +12601,9 @@ var SingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidNewl
12569
12601
  var stmts = $2;
12570
12602
  var last = $3;
12571
12603
  const expressions = [...stmts];
12572
- if (last)
12573
- expressions.push(last);
12604
+ if (last) expressions.push(last);
12574
12605
  const children = [expressions];
12575
- if (hasTrailingComment(expressions))
12576
- children.push(["\n"]);
12606
+ if (hasTrailingComment(expressions)) children.push(["\n"]);
12577
12607
  return {
12578
12608
  type: "BlockStatement",
12579
12609
  expressions,
@@ -12588,8 +12618,7 @@ var PostfixedSingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((
12588
12618
  var stmts = $1;
12589
12619
  var last = $2;
12590
12620
  const children = [...stmts];
12591
- if (last)
12592
- children.push(last);
12621
+ if (last) children.push(last);
12593
12622
  return {
12594
12623
  type: "BlockStatement",
12595
12624
  expressions: children,
@@ -12604,8 +12633,7 @@ var PostfixedSingleLineNoCommaStatements$0 = (0, import_lib2.$TS)((0, import_lib
12604
12633
  var stmts = $1;
12605
12634
  var last = $2;
12606
12635
  const children = [...stmts];
12607
- if (last)
12608
- children.push(last);
12636
+ if (last) children.push(last);
12609
12637
  return {
12610
12638
  type: "BlockStatement",
12611
12639
  expressions: children,
@@ -12618,8 +12646,7 @@ function PostfixedSingleLineNoCommaStatements(ctx, state2) {
12618
12646
  }
12619
12647
  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) {
12620
12648
  var statements = $2;
12621
- if (!statements.length)
12622
- return $skip;
12649
+ if (!statements.length) return $skip;
12623
12650
  statements = statements.flat();
12624
12651
  return {
12625
12652
  type: "BlockStatement",
@@ -12646,8 +12673,7 @@ var BlockStatementPart$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
12646
12673
  var ws = $2;
12647
12674
  var statement = $3;
12648
12675
  var delimiter = $4;
12649
- if (ws)
12650
- statement = prepend(ws, statement);
12676
+ if (ws) statement = prepend(ws, statement);
12651
12677
  return [statement, delimiter];
12652
12678
  });
12653
12679
  function BlockStatementPart(ctx, state2) {
@@ -12796,8 +12822,7 @@ var _ArrayLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, Clos
12796
12822
  var open = $1;
12797
12823
  var close = $2;
12798
12824
  var content = $5;
12799
- if (!content)
12800
- return $skip;
12825
+ if (!content) return $skip;
12801
12826
  let last = content[content.length - 1];
12802
12827
  let lastArray = Array.isArray(last) ? last : last.children;
12803
12828
  if (isComma(lastArray[lastArray.length - 1])) {
@@ -12817,8 +12842,7 @@ var _ArrayLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, Clos
12817
12842
  });
12818
12843
  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) {
12819
12844
  var open = $1;
12820
- if (!$3)
12821
- return $skip;
12845
+ if (!$3) return $skip;
12822
12846
  const [content, ws, close] = $3;
12823
12847
  if (content.type === "RangeExpression") {
12824
12848
  return prepend(ws, content);
@@ -12953,8 +12977,7 @@ var ArrayLiteralContent$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(ElementList
12953
12977
  var list = $1;
12954
12978
  var delimiter = $2;
12955
12979
  var nested = $3;
12956
- if (!nested)
12957
- return list;
12980
+ if (!nested) return list;
12958
12981
  return [...list, delimiter, ...nested];
12959
12982
  });
12960
12983
  var ArrayLiteralContent$3 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0, import_lib2.$S)(__, ElementListWithIndentedApplicationForbidden, ArrayElementDelimiter)), function($skip, $loc, $0, $1) {
@@ -12978,13 +13001,10 @@ var NestedElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested, ElementLi
12978
13001
  var list = $2;
12979
13002
  var delimiter = $3;
12980
13003
  const { length } = list;
12981
- if (!length)
12982
- return $skip;
13004
+ if (!length) return $skip;
12983
13005
  return list.map((e, i) => {
12984
- if (i === 0)
12985
- e = prepend(indent, e);
12986
- if (i === length - 1)
12987
- e = append(e, delimiter);
13006
+ if (i === 0) e = prepend(indent, e);
13007
+ if (i === length - 1) e = append(e, delimiter);
12988
13008
  return e;
12989
13009
  });
12990
13010
  });
@@ -13001,8 +13021,7 @@ function ArrayElementDelimiter(ctx, state2) {
13001
13021
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ArrayElementDelimiter", ArrayElementDelimiter$$);
13002
13022
  }
13003
13023
  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) {
13004
- if ($2)
13005
- return $2;
13024
+ if ($2) return $2;
13006
13025
  return $skip;
13007
13026
  });
13008
13027
  function ElementListWithIndentedApplicationForbidden(ctx, state2) {
@@ -13019,8 +13038,7 @@ function ElementList(ctx, state2) {
13019
13038
  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) {
13020
13039
  var first = $2;
13021
13040
  var rest = $3;
13022
- if (!rest.length)
13023
- return [first];
13041
+ if (!rest.length) return [first];
13024
13042
  return [
13025
13043
  append(first, rest[0][0])
13026
13044
  ].concat(
@@ -13085,8 +13103,7 @@ var NestedBulletedArray$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_
13085
13103
  var open = $1;
13086
13104
  var content = $4;
13087
13105
  var close = $6;
13088
- if (!content.length)
13089
- return $skip;
13106
+ if (!content.length) return $skip;
13090
13107
  content = content.flat();
13091
13108
  const last = content[content.length - 1];
13092
13109
  if (last.children?.at(-1)?.implicit) {
@@ -13104,8 +13121,7 @@ var BulletedArray$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBracket
13104
13121
  var open = $1;
13105
13122
  var content = $2;
13106
13123
  var close = $3;
13107
- if (!content)
13108
- return $skip;
13124
+ if (!content) return $skip;
13109
13125
  content = [
13110
13126
  ...trimFirstSpace(content[0]),
13111
13127
  // replace first space with bracket
@@ -13134,11 +13150,9 @@ function NestedArrayBullet(ctx, state2) {
13134
13150
  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) {
13135
13151
  var bullet = $1;
13136
13152
  var content = $2;
13137
- if (!content)
13138
- return $skip;
13153
+ if (!content) return $skip;
13139
13154
  let [list, delimiter] = content;
13140
- if (!list.length)
13141
- return $skip;
13155
+ if (!list.length) return $skip;
13142
13156
  list = list.slice();
13143
13157
  list[0] = prepend(bullet, list[0]);
13144
13158
  if (delimiter) {
@@ -13165,8 +13179,7 @@ var BulletIndent$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Bullet), function(
13165
13179
  $loc,
13166
13180
  level: getIndentLevel(" ".repeat(state.currentIndent.level) + bullet + ws, config.tab)
13167
13181
  };
13168
- if (config.verbose)
13169
- console.log("pushing bullet indent", indent);
13182
+ if (config.verbose) console.log("pushing bullet indent", indent);
13170
13183
  state.indentLevels.push(indent);
13171
13184
  return indent;
13172
13185
  });
@@ -13211,8 +13224,7 @@ var BracedObjectLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace,
13211
13224
  var open = $1;
13212
13225
  var close = $2;
13213
13226
  var properties = $5;
13214
- if (!properties?.length)
13215
- return $skip;
13227
+ if (!properties?.length) return $skip;
13216
13228
  let last = properties[properties.length - 1];
13217
13229
  if (last.delim?.implicit) {
13218
13230
  last = {
@@ -13231,8 +13243,7 @@ var BracedObjectLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace,
13231
13243
  });
13232
13244
  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) {
13233
13245
  var open = $1;
13234
- if (!$3)
13235
- return $skip;
13246
+ if (!$3) return $skip;
13236
13247
  const [properties, ...close] = $3;
13237
13248
  return {
13238
13249
  type: "ObjectExpression",
@@ -13250,8 +13261,7 @@ var SingleLineObjectProperties$0 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0,
13250
13261
  return line.flatMap(([prop, delim]) => {
13251
13262
  prop = Array.isArray(prop) ? prop : [prop];
13252
13263
  let last = prop[prop.length - 1];
13253
- if (!last)
13254
- return [];
13264
+ if (!last) return [];
13255
13265
  last = {
13256
13266
  ...last,
13257
13267
  delim,
@@ -13288,8 +13298,7 @@ function BracedObjectLiteralContent(ctx, state2) {
13288
13298
  }
13289
13299
  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) {
13290
13300
  var properties = $4;
13291
- if (!properties)
13292
- return $skip;
13301
+ if (!properties) return $skip;
13293
13302
  return {
13294
13303
  type: "ObjectExpression",
13295
13304
  properties,
@@ -13323,8 +13332,7 @@ function NestedImplicitPropertyDefinition(ctx, state2) {
13323
13332
  }
13324
13333
  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) {
13325
13334
  var defs = $2;
13326
- if (!defs.length)
13327
- return $skip;
13335
+ if (!defs.length) return $skip;
13328
13336
  return defs.flat();
13329
13337
  });
13330
13338
  function NestedPropertyDefinitions(ctx, state2) {
@@ -13334,8 +13342,7 @@ var NestedPropertyDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested
13334
13342
  var ws = $1;
13335
13343
  var inlineProps = $2;
13336
13344
  return inlineProps.flatMap(([prop, delim], i) => {
13337
- if (!Array.isArray(prop))
13338
- prop = [prop];
13345
+ if (!Array.isArray(prop)) prop = [prop];
13339
13346
  if (i === 0) {
13340
13347
  const [first, ...rest] = prop;
13341
13348
  prop = [prepend(ws, first), ...rest];
@@ -13468,8 +13475,7 @@ var PropertyDefinition$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
13468
13475
  children: def.children.flatMap((c, i) => i ? [",", c] : [c])
13469
13476
  };
13470
13477
  }
13471
- if (!def.block || def.block.empty)
13472
- return $skip;
13478
+ if (!def.block || def.block.empty) return $skip;
13473
13479
  return prepend(ws, def);
13474
13480
  });
13475
13481
  var PropertyDefinition$4 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), DotDotDot, Expression), function($skip, $loc, $0, $1, $2, $3) {
@@ -13491,8 +13497,11 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
13491
13497
  var post = $5;
13492
13498
  if (!pre.length && !post) {
13493
13499
  switch (value.type) {
13500
+ // `{identifier}` remains `{identifier}`, the one shorthand JS supports
13494
13501
  case "Identifier":
13495
13502
  return prepend(ws, value);
13503
+ // PropertyGlob like x.{a,b} turns into ObjectExpression {a: x.a, b: x.b}
13504
+ // (via `processCallMemberExpression`)
13496
13505
  case "ObjectExpression":
13497
13506
  let first = value.properties[0];
13498
13507
  if (first) {
@@ -13506,8 +13515,7 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
13506
13515
  }
13507
13516
  }
13508
13517
  const last = lastAccessInCallExpression(value);
13509
- if (!last)
13510
- return $skip;
13518
+ if (!last) return $skip;
13511
13519
  let name, ref, refAssignment;
13512
13520
  const { expression, type } = last;
13513
13521
  if (type === "Index") {
@@ -13520,11 +13528,10 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
13520
13528
  value = {
13521
13529
  ...value,
13522
13530
  children: value.children.map((c) => {
13523
- if (c === last)
13524
- return {
13525
- type: "Index",
13526
- children: ["[", ref, "]"]
13527
- };
13531
+ if (c === last) return {
13532
+ type: "Index",
13533
+ children: ["[", ref, "]"]
13534
+ };
13528
13535
  return c;
13529
13536
  })
13530
13537
  };
@@ -13536,11 +13543,9 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
13536
13543
  }
13537
13544
  } else {
13538
13545
  ({ name } = last);
13539
- if (!name)
13540
- return $skip;
13546
+ if (!name) return $skip;
13541
13547
  }
13542
- if (name[0] === "#")
13543
- name = name.slice(1);
13548
+ if (name[0] === "#") name = name.slice(1);
13544
13549
  return {
13545
13550
  type: "Property",
13546
13551
  children: [ws, name, ": ", processUnaryExpression(pre, value, post)],
@@ -13611,8 +13616,7 @@ var ComputedPropertyName$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracke
13611
13616
  });
13612
13617
  var ComputedPropertyName$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBracket, TemplateLiteral, InsertCloseBracket), function($skip, $loc, $0, $1, $2, $3) {
13613
13618
  var expression = $2;
13614
- if ($2.type === "StringLiteral")
13615
- return $2;
13619
+ if ($2.type === "StringLiteral") return $2;
13616
13620
  return {
13617
13621
  type: "ComputedPropertyName",
13618
13622
  children: $0,
@@ -13639,8 +13643,7 @@ function Decorator(ctx, state2) {
13639
13643
  }
13640
13644
  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) {
13641
13645
  var decorators = $2;
13642
- if (!decorators.length)
13643
- return $skip;
13646
+ if (!decorators.length) return $skip;
13644
13647
  return $0;
13645
13648
  });
13646
13649
  function Decorators(ctx, state2) {
@@ -13679,8 +13682,7 @@ var MethodDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0,
13679
13682
  var ws = $2;
13680
13683
  var content = $4;
13681
13684
  var block = $6;
13682
- if (!content)
13683
- return $skip;
13685
+ if (!content) return $skip;
13684
13686
  const [base, rest, returnType] = content;
13685
13687
  const value = [base, rest];
13686
13688
  if (!rest.length) {
@@ -13691,12 +13693,9 @@ var MethodDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0,
13691
13693
  ({ name: name2 } = lastAccess2);
13692
13694
  }
13693
13695
  }
13694
- if (!name2)
13695
- ({ name: name2 } = base);
13696
- if (!name2)
13697
- return $skip;
13698
- if (name2[0] === "#")
13699
- name2 = name2.slice(1);
13696
+ if (!name2) ({ name: name2 } = base);
13697
+ if (!name2) return $skip;
13698
+ if (name2[0] === "#") name2 = name2.slice(1);
13700
13699
  const autoReturn = !block || base.type !== "Identifier";
13701
13700
  return makeGetterMethod(name2, ws, base, returnType, block, kind, autoReturn);
13702
13701
  }
@@ -13769,10 +13768,8 @@ var MethodModifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0, im
13769
13768
  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) {
13770
13769
  var async = $1;
13771
13770
  var generator = $2;
13772
- if (!async)
13773
- async = [];
13774
- if (!generator)
13775
- generator = [];
13771
+ if (!async) async = [];
13772
+ if (!generator) generator = [];
13776
13773
  return {
13777
13774
  async,
13778
13775
  generator,
@@ -13813,8 +13810,7 @@ var MethodSignature$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(MethodModifier,
13813
13810
  } else if (name.token) {
13814
13811
  name = name.token.match(/^(?:"|')/) ? name.token.slice(1, -1) : name.token;
13815
13812
  }
13816
- if (optional)
13817
- optional = { ...optional, ts: true };
13813
+ if (optional) optional = { ...optional, ts: true };
13818
13814
  return {
13819
13815
  type: "MethodSignature",
13820
13816
  children: [...modifier.children, name, ws1, optional, ws2, parameters, returnType],
@@ -13871,8 +13867,7 @@ var AssignmentOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(AssignmentOpSymbol
13871
13867
  children: [$1, ...$2]
13872
13868
  };
13873
13869
  }
13874
- if (typeof $1 !== "string")
13875
- return $1;
13870
+ if (typeof $1 !== "string") return $1;
13876
13871
  return { $loc, token: $1 };
13877
13872
  });
13878
13873
  function AssignmentOp(ctx, state2) {
@@ -13990,10 +13985,8 @@ var NotDedentedBinaryOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_
13990
13985
  var ws2 = $2;
13991
13986
  var op = $3;
13992
13987
  const ws = [];
13993
- if (ws1)
13994
- ws.push(...ws1);
13995
- if (ws2)
13996
- ws.push(...ws2);
13988
+ if (ws1) ws.push(...ws1);
13989
+ if (ws2) ws.push(...ws2);
13997
13990
  return [ws, op];
13998
13991
  });
13999
13992
  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) {
@@ -14001,8 +13994,7 @@ var NotDedentedBinaryOp$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(NestedBinar
14001
13994
  var ws2 = $3;
14002
13995
  var op = $6;
14003
13996
  const ws = [...ws1];
14004
- if (ws2)
14005
- ws.push(...ws2);
13997
+ if (ws2) ws.push(...ws2);
14006
13998
  return [ws, op];
14007
13999
  });
14008
14000
  var NotDedentedBinaryOp$$ = [NotDedentedBinaryOp$0, NotDedentedBinaryOp$1];
@@ -14011,8 +14003,7 @@ function NotDedentedBinaryOp(ctx, state2) {
14011
14003
  }
14012
14004
  var IdentifierBinaryOp$0 = (0, import_lib2.$TV)(Identifier, function($skip, $loc, $0, $1) {
14013
14005
  var id = $0;
14014
- if (state.operators.has(id.name))
14015
- return id;
14006
+ if (state.operators.has(id.name)) return id;
14016
14007
  return $skip;
14017
14008
  });
14018
14009
  function IdentifierBinaryOp(ctx, state2) {
@@ -14026,14 +14017,12 @@ function BinaryOp(ctx, state2) {
14026
14017
  return (0, import_lib2.$EVENT)(ctx, state2, "BinaryOp", BinaryOp$0);
14027
14018
  }
14028
14019
  var _BinaryOp$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(BinaryOpSymbol), function($skip, $loc, $0, $1) {
14029
- if (typeof $1 === "string")
14030
- return { $loc, token: $1 };
14020
+ if (typeof $1 === "string") return { $loc, token: $1 };
14031
14021
  return $1;
14032
14022
  });
14033
14023
  var _BinaryOp$1 = (0, import_lib2.$TV)(Identifier, function($skip, $loc, $0, $1) {
14034
14024
  var id = $0;
14035
- if (!state.operators.has(id.name))
14036
- return $skip;
14025
+ if (!state.operators.has(id.name)) return $skip;
14037
14026
  return {
14038
14027
  token: id.name,
14039
14028
  call: id,
@@ -14043,8 +14032,7 @@ var _BinaryOp$1 = (0, import_lib2.$TV)(Identifier, function($skip, $loc, $0, $1)
14043
14032
  });
14044
14033
  var _BinaryOp$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OmittedNegation, __, Identifier), function($skip, $loc, $0, $1, $2, $3) {
14045
14034
  var id = $3;
14046
- if (!state.operators.has(id.name))
14047
- return $skip;
14035
+ if (!state.operators.has(id.name)) return $skip;
14048
14036
  return {
14049
14037
  token: id.name,
14050
14038
  call: id,
@@ -14127,13 +14115,11 @@ var BinaryOpSymbol$24 = (0, import_lib2.$T)((0, import_lib2.$EXPECT)($L92, 'Bina
14127
14115
  return "!==";
14128
14116
  });
14129
14117
  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) {
14130
- if (config.coffeeEq)
14131
- return "!==";
14118
+ if (config.coffeeEq) return "!==";
14132
14119
  return "!=";
14133
14120
  });
14134
14121
  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) {
14135
- if (config.coffeeIsnt)
14136
- return "!==";
14122
+ if (config.coffeeIsnt) return "!==";
14137
14123
  return $skip;
14138
14124
  });
14139
14125
  var BinaryOpSymbol$27 = (0, import_lib2.$EXPECT)($L96, 'BinaryOpSymbol "==="');
@@ -14141,8 +14127,7 @@ var BinaryOpSymbol$28 = (0, import_lib2.$T)((0, import_lib2.$C)((0, import_lib2.
14141
14127
  return "===";
14142
14128
  });
14143
14129
  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) {
14144
- if (config.coffeeEq)
14145
- return "===";
14130
+ if (config.coffeeEq) return "===";
14146
14131
  return "==";
14147
14132
  });
14148
14133
  var BinaryOpSymbol$30 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L102, 'BinaryOpSymbol "and"'), NonIdContinue), function(value) {
@@ -14340,8 +14325,7 @@ var UnaryOp$1 = AwaitOp;
14340
14325
  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) {
14341
14326
  var op = $1;
14342
14327
  var ws = $3;
14343
- if (!ws)
14344
- return [op, [" "]];
14328
+ if (!ws) return [op, [" "]];
14345
14329
  return [op, ws];
14346
14330
  });
14347
14331
  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) {
@@ -14385,8 +14369,7 @@ function StatementListItem(ctx, state2) {
14385
14369
  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) {
14386
14370
  var statement = $1;
14387
14371
  var post = $2;
14388
- if (post)
14389
- return addPostfixStatement(statement, ...post);
14372
+ if (post) return addPostfixStatement(statement, ...post);
14390
14373
  return statement;
14391
14374
  });
14392
14375
  function PostfixedStatement(ctx, state2) {
@@ -14401,8 +14384,7 @@ function NoCommaStatementListItem(ctx, state2) {
14401
14384
  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) {
14402
14385
  var statement = $1;
14403
14386
  var post = $2;
14404
- if (post)
14405
- return addPostfixStatement(statement, ...post);
14387
+ if (post) return addPostfixStatement(statement, ...post);
14406
14388
  return statement;
14407
14389
  });
14408
14390
  function PostfixedNoCommaStatement(ctx, state2) {
@@ -14411,8 +14393,7 @@ function PostfixedNoCommaStatement(ctx, state2) {
14411
14393
  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) {
14412
14394
  var expression = $1;
14413
14395
  var post = $2;
14414
- if (post)
14415
- return attachPostfixStatementAsExpression(expression, post);
14396
+ if (post) return attachPostfixStatementAsExpression(expression, post);
14416
14397
  return expression;
14417
14398
  });
14418
14399
  function PostfixedExpression(ctx, state2) {
@@ -14421,8 +14402,7 @@ function PostfixedExpression(ctx, state2) {
14421
14402
  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) {
14422
14403
  var expression = $1;
14423
14404
  var post = $2;
14424
- if (!post.length)
14425
- return $1;
14405
+ if (!post.length) return $1;
14426
14406
  if (post.length === 2 && !Array.isArray(post[1])) {
14427
14407
  return attachPostfixStatementAsExpression(expression, post);
14428
14408
  }
@@ -14451,10 +14431,8 @@ var Statement$2 = (0, import_lib2.$T)((0, import_lib2.$S)(IfStatement, (0, impor
14451
14431
  return value[0];
14452
14432
  });
14453
14433
  var Statement$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(IterationStatement, (0, import_lib2.$N)(ShouldExpressionize)), function($skip, $loc, $0, $1, $2) {
14454
- if ($1.generator)
14455
- return $skip;
14456
- if ($1.reduction)
14457
- return $skip;
14434
+ if ($1.generator) return $skip;
14435
+ if ($1.reduction) return $skip;
14458
14436
  return $1;
14459
14437
  });
14460
14438
  var Statement$4 = (0, import_lib2.$T)((0, import_lib2.$S)(SwitchStatement, (0, import_lib2.$N)(ShouldExpressionize)), function(value) {
@@ -14529,8 +14507,7 @@ var Label$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Colon, IdentifierName, Wh
14529
14507
  var colon = $1;
14530
14508
  var id = $2;
14531
14509
  var w = $3;
14532
- if (id.name === "void")
14533
- return $skip;
14510
+ if (id.name === "void") return $skip;
14534
14511
  return {
14535
14512
  type: "Label",
14536
14513
  name: id.name,
@@ -14842,8 +14819,7 @@ function ForClause(ctx, state2) {
14842
14819
  var ForStatementControlWithWhen$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForStatementControlWithReduction, (0, import_lib2.$E)(WhenCondition)), function($skip, $loc, $0, $1, $2) {
14843
14820
  var control = $1;
14844
14821
  var condition = $2;
14845
- if (!condition)
14846
- return control;
14822
+ if (!condition) return control;
14847
14823
  const expressions = [["", {
14848
14824
  type: "ContinueStatement",
14849
14825
  children: ["continue"]
@@ -15133,8 +15109,7 @@ var SwitchStatement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Switch, ForbidN
15133
15109
  var s = $1;
15134
15110
  var condition = $3;
15135
15111
  var caseBlock = $5;
15136
- if (!condition)
15137
- return $skip;
15112
+ if (!condition) return $skip;
15138
15113
  if (condition.type === "EmptyCondition") {
15139
15114
  caseBlock.clauses.forEach(({ cases }) => {
15140
15115
  if (cases) {
@@ -15197,8 +15172,7 @@ function CaseBlock(ctx, state2) {
15197
15172
  }
15198
15173
  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) {
15199
15174
  var clauses = $2;
15200
- if (clauses.length)
15201
- return clauses;
15175
+ if (clauses.length) return clauses;
15202
15176
  return $skip;
15203
15177
  });
15204
15178
  function NestedCaseClauses(ctx, state2) {
@@ -15277,8 +15251,7 @@ function PatternExpressionList(ctx, state2) {
15277
15251
  var PatternExpression$0 = BindingPattern;
15278
15252
  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) {
15279
15253
  var pattern = $2;
15280
- if (!pattern)
15281
- return $skip;
15254
+ if (!pattern) return $skip;
15282
15255
  return {
15283
15256
  type: "ConditionFragment",
15284
15257
  children: pattern
@@ -15293,8 +15266,7 @@ var CaseExpressionList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
15293
15266
  var rest = $2;
15294
15267
  const result = rest.map(([ws, _comma, exp, col]) => {
15295
15268
  exp = trimFirstSpace(exp);
15296
- if (ws.length)
15297
- return [insertTrimmingSpace("case ", ws), exp, col];
15269
+ if (ws.length) return [insertTrimmingSpace("case ", ws), exp, col];
15298
15270
  return ["case ", exp, col];
15299
15271
  });
15300
15272
  result.unshift(first);
@@ -15306,8 +15278,7 @@ function CaseExpressionList(ctx, state2) {
15306
15278
  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) {
15307
15279
  var value = $1;
15308
15280
  if (value.type === "ComputedPropertyName") {
15309
- if (value.implicit)
15310
- return value.expression;
15281
+ if (value.implicit) return value.expression;
15311
15282
  return { ...value, type: "ArrayExpression" };
15312
15283
  }
15313
15284
  return value;
@@ -15324,8 +15295,7 @@ function ImpliedColon(ctx, state2) {
15324
15295
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ImpliedColon", ImpliedColon$$);
15325
15296
  }
15326
15297
  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) {
15327
- if ($1)
15328
- return $1[0];
15298
+ if ($1) return $1[0];
15329
15299
  });
15330
15300
  function IgnoreColon(ctx, state2) {
15331
15301
  return (0, import_lib2.$EVENT)(ctx, state2, "IgnoreColon", IgnoreColon$0);
@@ -15356,8 +15326,7 @@ var CatchBinding$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E
15356
15326
  var parameter = $5;
15357
15327
  var ws3 = $7;
15358
15328
  var close = $8;
15359
- if (!parameter)
15360
- return $skip;
15329
+ if (!parameter) return $skip;
15361
15330
  return {
15362
15331
  type: "CatchBinding",
15363
15332
  parameter,
@@ -15369,8 +15338,7 @@ var CatchBinding$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(_, InsertOpenParen
15369
15338
  var open = $2;
15370
15339
  var parameter = $5;
15371
15340
  var close = $7;
15372
- if (!parameter)
15373
- return $skip;
15341
+ if (!parameter) return $skip;
15374
15342
  return {
15375
15343
  type: "CatchBinding",
15376
15344
  parameter,
@@ -15457,8 +15425,7 @@ var Condition$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, InsertOpe
15457
15425
  var open = $2;
15458
15426
  var expression = $3;
15459
15427
  var close = $4;
15460
- if (!expression)
15461
- return $skip;
15428
+ if (!expression) return $skip;
15462
15429
  return {
15463
15430
  type: "ParenthesizedExpression",
15464
15431
  children: [open, expression, close],
@@ -15469,8 +15436,7 @@ var Condition$4 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenParen, Expr
15469
15436
  var open = $1;
15470
15437
  var expression = $2;
15471
15438
  var close = $3;
15472
- if (expression.type === "ParenthesizedExpression")
15473
- return expression;
15439
+ if (expression.type === "ParenthesizedExpression") return expression;
15474
15440
  expression = trimFirstSpace(expression);
15475
15441
  return {
15476
15442
  type: "ParenthesizedExpression",
@@ -15486,8 +15452,7 @@ var BoundedCondition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenPare
15486
15452
  var open = $1;
15487
15453
  var expression = $2;
15488
15454
  var close = $3;
15489
- if (expression.type === "ParenthesizedExpression")
15490
- return expression;
15455
+ if (expression.type === "ParenthesizedExpression") return expression;
15491
15456
  expression = trimFirstSpace(expression);
15492
15457
  return {
15493
15458
  type: "ParenthesizedExpression",
@@ -15500,8 +15465,7 @@ function BoundedCondition(ctx, state2) {
15500
15465
  }
15501
15466
  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) {
15502
15467
  var declaration = $4;
15503
- if (!declaration)
15504
- return $skip;
15468
+ if (!declaration) return $skip;
15505
15469
  return {
15506
15470
  type: "DeclarationCondition",
15507
15471
  declaration,
@@ -15513,8 +15477,7 @@ function DeclarationCondition(ctx, state2) {
15513
15477
  }
15514
15478
  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) {
15515
15479
  var exp = $3;
15516
- if (exp)
15517
- return exp;
15480
+ if (exp) return exp;
15518
15481
  return $skip;
15519
15482
  });
15520
15483
  function ExpressionWithIndentedApplicationForbidden(ctx, state2) {
@@ -15522,8 +15485,7 @@ function ExpressionWithIndentedApplicationForbidden(ctx, state2) {
15522
15485
  }
15523
15486
  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) {
15524
15487
  var exp = $3;
15525
- if (exp)
15526
- return exp;
15488
+ if (exp) return exp;
15527
15489
  return $skip;
15528
15490
  });
15529
15491
  function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
@@ -15531,8 +15493,7 @@ function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
15531
15493
  }
15532
15494
  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) {
15533
15495
  var exp = $3;
15534
- if (exp)
15535
- return exp;
15496
+ if (exp) return exp;
15536
15497
  return $skip;
15537
15498
  });
15538
15499
  function ExpressionWithObjectApplicationForbidden(ctx, state2) {
@@ -15540,8 +15501,7 @@ function ExpressionWithObjectApplicationForbidden(ctx, state2) {
15540
15501
  }
15541
15502
  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) {
15542
15503
  var exp = $4;
15543
- if (exp)
15544
- return exp;
15504
+ if (exp) return exp;
15545
15505
  return $skip;
15546
15506
  });
15547
15507
  function LeftHandSideExpressionWithObjectApplicationForbidden(ctx, state2) {
@@ -15566,8 +15526,7 @@ function RestoreClassImplicitCall(ctx, state2) {
15566
15526
  return (0, import_lib2.$EVENT)(ctx, state2, "RestoreClassImplicitCall", RestoreClassImplicitCall$0);
15567
15527
  }
15568
15528
  var ClassImplicitCallForbidden$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ClassImplicitCallForbidden ""'), function($skip, $loc, $0, $1) {
15569
- if (!state.classImplicitCallForbidden)
15570
- return $skip;
15529
+ if (!state.classImplicitCallForbidden) return $skip;
15571
15530
  return;
15572
15531
  });
15573
15532
  function ClassImplicitCallForbidden(ctx, state2) {
@@ -15595,8 +15554,7 @@ var BracedApplicationAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($
15595
15554
  if (config.verbose) {
15596
15555
  console.log("forbidBracedApplication:", state.forbidBracedApplication);
15597
15556
  }
15598
- if (state.bracedApplicationForbidden)
15599
- return $skip;
15557
+ if (state.bracedApplicationForbidden) return $skip;
15600
15558
  return;
15601
15559
  });
15602
15560
  function BracedApplicationAllowed(ctx, state2) {
@@ -15624,8 +15582,7 @@ var IndentedApplicationAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)
15624
15582
  if (config.verbose) {
15625
15583
  console.log("forbidIndentedApplication:", state.forbidIndentedApplication);
15626
15584
  }
15627
- if (state.indentedApplicationForbidden)
15628
- return $skip;
15585
+ if (state.indentedApplicationForbidden) return $skip;
15629
15586
  return;
15630
15587
  });
15631
15588
  function IndentedApplicationAllowed(ctx, state2) {
@@ -15653,8 +15610,7 @@ var TrailingMemberPropertyAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPE
15653
15610
  if (config.verbose) {
15654
15611
  console.log("forbidTrailingMemberProperty:", state.forbidTrailingMemberProperty);
15655
15612
  }
15656
- if (state.trailingMemberPropertyForbidden)
15657
- return $skip;
15613
+ if (state.trailingMemberPropertyForbidden) return $skip;
15658
15614
  });
15659
15615
  function TrailingMemberPropertyAllowed(ctx, state2) {
15660
15616
  return (0, import_lib2.$EVENT)(ctx, state2, "TrailingMemberPropertyAllowed", TrailingMemberPropertyAllowed$0);
@@ -15681,8 +15637,7 @@ var NestedBinaryOpAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0,
15681
15637
  if (config.verbose) {
15682
15638
  console.log("forbidNestedBinaryOp:", state.forbidNestedBinaryOp);
15683
15639
  }
15684
- if (state.nestedBinaryOpForbidden)
15685
- return $skip;
15640
+ if (state.nestedBinaryOpForbidden) return $skip;
15686
15641
  });
15687
15642
  function NestedBinaryOpAllowed(ctx, state2) {
15688
15643
  return (0, import_lib2.$EVENT)(ctx, state2, "NestedBinaryOpAllowed", NestedBinaryOpAllowed$0);
@@ -15709,8 +15664,7 @@ var NewlineBinaryOpAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0
15709
15664
  if (config.verbose) {
15710
15665
  console.log("forbidNewlineBinaryOp:", state.forbidNewlineBinaryOp);
15711
15666
  }
15712
- if (state.newlineBinaryOpForbidden)
15713
- return $skip;
15667
+ if (state.newlineBinaryOpForbidden) return $skip;
15714
15668
  });
15715
15669
  function NewlineBinaryOpAllowed(ctx, state2) {
15716
15670
  return (0, import_lib2.$EVENT)(ctx, state2, "NewlineBinaryOpAllowed", NewlineBinaryOpAllowed$0);
@@ -15737,8 +15691,7 @@ var PipelineAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pipe
15737
15691
  if (config.verbose) {
15738
15692
  console.log("forbidPipeline:", state.forbidPipeline);
15739
15693
  }
15740
- if (state.pipelineForbidden)
15741
- return $skip;
15694
+ if (state.pipelineForbidden) return $skip;
15742
15695
  });
15743
15696
  function PipelineAllowed(ctx, state2) {
15744
15697
  return (0, import_lib2.$EVENT)(ctx, state2, "PipelineAllowed", PipelineAllowed$0);
@@ -15767,14 +15720,12 @@ function ExpressionStatement(ctx, state2) {
15767
15720
  }
15768
15721
  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) {
15769
15722
  const children = [$1];
15770
- if ($2)
15771
- children.push($2);
15772
- if ($3)
15773
- children.push({
15774
- type: "Error",
15775
- subtype: "Warning",
15776
- message: "'break with' outside of loop that returns a value"
15777
- });
15723
+ if ($2) children.push($2);
15724
+ if ($3) children.push({
15725
+ type: "Error",
15726
+ subtype: "Warning",
15727
+ message: "'break with' outside of loop that returns a value"
15728
+ });
15778
15729
  return {
15779
15730
  type: "BreakStatement",
15780
15731
  label: $2?.[1],
@@ -15791,14 +15742,12 @@ var KeywordStatement$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Continue, _, S
15791
15742
  });
15792
15743
  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) {
15793
15744
  const children = [$1];
15794
- if ($2)
15795
- children.push($2);
15796
- if ($3)
15797
- children.push({
15798
- type: "Error",
15799
- subtype: "Warning",
15800
- message: "'continue with' outside of loop that returns a value"
15801
- });
15745
+ if ($2) children.push($2);
15746
+ if ($3) children.push({
15747
+ type: "Error",
15748
+ subtype: "Warning",
15749
+ message: "'continue with' outside of loop that returns a value"
15750
+ });
15802
15751
  return {
15803
15752
  type: "ContinueStatement",
15804
15753
  label: $2?.[1],
@@ -15852,10 +15801,8 @@ var MaybeNestedNonPipelineExpression$1 = NestedImplicitObjectLiteral;
15852
15801
  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) {
15853
15802
  var expression = $2;
15854
15803
  var trailing = $4;
15855
- if (!expression)
15856
- return $skip;
15857
- if (!trailing)
15858
- return expression;
15804
+ if (!expression) return $skip;
15805
+ if (!trailing) return expression;
15859
15806
  return [expression, trailing];
15860
15807
  });
15861
15808
  var MaybeNestedNonPipelineExpression$3 = NonPipelineExpression;
@@ -15868,10 +15815,8 @@ var MaybeNestedPostfixedExpression$1 = NestedImplicitObjectLiteral;
15868
15815
  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) {
15869
15816
  var expression = $2;
15870
15817
  var trailing = $4;
15871
- if (!expression)
15872
- return $skip;
15873
- if (!trailing)
15874
- return expression;
15818
+ if (!expression) return $skip;
15819
+ if (!trailing) return expression;
15875
15820
  return [expression, trailing];
15876
15821
  });
15877
15822
  var MaybeNestedPostfixedExpression$3 = PostfixedExpression;
@@ -15883,8 +15828,7 @@ var NestedPostfixedExpressionNoTrailing$0 = NestedBulletedArray;
15883
15828
  var NestedPostfixedExpressionNoTrailing$1 = NestedImplicitObjectLiteral;
15884
15829
  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) {
15885
15830
  var expression = $2;
15886
- if (!expression)
15887
- return $skip;
15831
+ if (!expression) return $skip;
15888
15832
  return expression;
15889
15833
  });
15890
15834
  var NestedPostfixedExpressionNoTrailing$$ = [NestedPostfixedExpressionNoTrailing$0, NestedPostfixedExpressionNoTrailing$1, NestedPostfixedExpressionNoTrailing$2];
@@ -15896,10 +15840,8 @@ var MaybeNestedExpression$1 = NestedImplicitObjectLiteral;
15896
15840
  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) {
15897
15841
  var expression = $2;
15898
15842
  var trailing = $4;
15899
- if (!expression)
15900
- return $skip;
15901
- if (!trailing)
15902
- return expression;
15843
+ if (!expression) return $skip;
15844
+ if (!trailing) return expression;
15903
15845
  return [expression, trailing];
15904
15846
  });
15905
15847
  var MaybeNestedExpression$3 = Expression;
@@ -15918,8 +15860,7 @@ var MaybeParenNestedExpression$2 = (0, import_lib2.$T)((0, import_lib2.$S)((0, i
15918
15860
  });
15919
15861
  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) {
15920
15862
  var exp = $5;
15921
- if (!exp)
15922
- return $skip;
15863
+ if (!exp) return $skip;
15923
15864
  return $0.slice(1);
15924
15865
  });
15925
15866
  var MaybeParenNestedExpression$$ = [MaybeParenNestedExpression$0, MaybeParenNestedExpression$1, MaybeParenNestedExpression$2, MaybeParenNestedExpression$3];
@@ -16094,8 +16035,7 @@ function OperatorNamedImports(ctx, state2) {
16094
16035
  }
16095
16036
  var FromClause$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(From, __, ModuleSpecifier), function($skip, $loc, $0, $1, $2, $3) {
16096
16037
  var module2 = $3;
16097
- if (!Array.isArray(module2))
16098
- return $0;
16038
+ if (!Array.isArray(module2)) return $0;
16099
16039
  return [$1, $2, ...module2];
16100
16040
  });
16101
16041
  function FromClause(ctx, state2) {
@@ -16103,8 +16043,7 @@ function FromClause(ctx, state2) {
16103
16043
  }
16104
16044
  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) {
16105
16045
  var module2 = $2;
16106
- if (!Array.isArray(module2))
16107
- return $0;
16046
+ if (!Array.isArray(module2)) return $0;
16108
16047
  return [$1, ...module2];
16109
16048
  });
16110
16049
  function ImpliedFromClause(ctx, state2) {
@@ -16130,8 +16069,7 @@ function ImportAssertion(ctx, state2) {
16130
16069
  return (0, import_lib2.$EVENT)(ctx, state2, "ImportAssertion", ImportAssertion$0);
16131
16070
  }
16132
16071
  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) {
16133
- if (!$1)
16134
- return $2;
16072
+ if (!$1) return $2;
16135
16073
  return { ts: true, children: $0, binding: $2.binding };
16136
16074
  });
16137
16075
  var TypeAndImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Operator, OperatorImportSpecifier), function($skip, $loc, $0, $1, $2, $3) {
@@ -16347,8 +16285,7 @@ function ExportFromClause(ctx, state2) {
16347
16285
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ExportFromClause", ExportFromClause$$);
16348
16286
  }
16349
16287
  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) {
16350
- if (!$1)
16351
- return $2;
16288
+ if (!$1) return $2;
16352
16289
  return { ts: true, children: $0 };
16353
16290
  });
16354
16291
  function TypeAndNamedExports(ctx, state2) {
@@ -16367,8 +16304,7 @@ function NamedExports(ctx, state2) {
16367
16304
  return (0, import_lib2.$EVENT_C)(ctx, state2, "NamedExports", NamedExports$$);
16368
16305
  }
16369
16306
  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) {
16370
- if (!$2)
16371
- return $0;
16307
+ if (!$2) return $0;
16372
16308
  return { ts: true, children: $0 };
16373
16309
  });
16374
16310
  function ExportSpecifier(ctx, state2) {
@@ -16380,11 +16316,9 @@ function ImplicitExportSpecifier(ctx, state2) {
16380
16316
  }
16381
16317
  var Declaration$0 = (0, import_lib2.$TV)(ImportDeclaration, function($skip, $loc, $0, $1) {
16382
16318
  var decl = $0;
16383
- if (decl.ts || decl.module || !decl.imports || !decl.from)
16384
- return $skip;
16319
+ if (decl.ts || decl.module || !decl.imports || !decl.from) return $skip;
16385
16320
  const { imports } = decl;
16386
- if (!imports.binding && !imports.specifiers)
16387
- return $skip;
16321
+ if (!imports.binding && !imports.specifiers) return $skip;
16388
16322
  return dynamizeImportDeclaration(decl);
16389
16323
  });
16390
16324
  var Declaration$1 = HoistableDeclaration;
@@ -16654,8 +16588,7 @@ function TripleSingleStringCharacters(ctx, state2) {
16654
16588
  return (0, import_lib2.$EVENT)(ctx, state2, "TripleSingleStringCharacters", TripleSingleStringCharacters$0);
16655
16589
  }
16656
16590
  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) {
16657
- if (!$3)
16658
- return $skip;
16591
+ if (!$3) return $skip;
16659
16592
  return [$1, ...$3];
16660
16593
  });
16661
16594
  function CoffeeStringSubstitution(ctx, state2) {
@@ -16837,8 +16770,7 @@ function _TemplateLiteral(ctx, state2) {
16837
16770
  return (0, import_lib2.$EVENT_C)(ctx, state2, "_TemplateLiteral", _TemplateLiteral$$);
16838
16771
  }
16839
16772
  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) {
16840
- if (!$3)
16841
- return $skip;
16773
+ if (!$3) return $skip;
16842
16774
  return [$1, ...$3];
16843
16775
  });
16844
16776
  function TemplateSubstitution(ctx, state2) {
@@ -17683,8 +17615,7 @@ var JSXElement$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(
17683
17615
  var open = $2;
17684
17616
  var children = $3;
17685
17617
  var close = $4;
17686
- if (!children)
17687
- return $skip;
17618
+ if (!children) return $skip;
17688
17619
  let parts;
17689
17620
  $0 = $0.slice(1);
17690
17621
  if (close) {
@@ -17707,8 +17638,7 @@ var JSXElement$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeJSXEnabled, JS
17707
17638
  var open = $2;
17708
17639
  var close = $5;
17709
17640
  $0 = $0.slice(1);
17710
- if (open[1] !== close[2])
17711
- return $skip;
17641
+ if (open[1] !== close[2]) return $skip;
17712
17642
  return { type: "JSXElement", children: $0, tag: open[1] };
17713
17643
  });
17714
17644
  var JSXElement$$ = [JSXElement$0, JSXElement$1, JSXElement$2];
@@ -17740,8 +17670,7 @@ function JSXOpeningElement(ctx, state2) {
17740
17670
  }
17741
17671
  var JSXOptionalClosingElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Whitespace), JSXClosingElement), function($skip, $loc, $0, $1, $2) {
17742
17672
  var close = $2;
17743
- if (state.currentJSXTag !== close[2])
17744
- return $skip;
17673
+ if (state.currentJSXTag !== close[2]) return $skip;
17745
17674
  return $0;
17746
17675
  });
17747
17676
  var JSXOptionalClosingElement$1 = (0, import_lib2.$EXPECT)($L0, 'JSXOptionalClosingElement ""');
@@ -17757,8 +17686,7 @@ var JSXFragment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)
17757
17686
  var open = $2;
17758
17687
  var children = $3;
17759
17688
  var close = $4;
17760
- if (!children)
17761
- return $skip;
17689
+ if (!children) return $skip;
17762
17690
  $0 = $0.slice(1);
17763
17691
  const parts = close ? $0 : [
17764
17692
  ...$0,
@@ -17791,8 +17719,7 @@ function PushJSXOpeningFragment(ctx, state2) {
17791
17719
  return (0, import_lib2.$EVENT)(ctx, state2, "PushJSXOpeningFragment", PushJSXOpeningFragment$0);
17792
17720
  }
17793
17721
  var JSXOptionalClosingFragment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Whitespace), JSXClosingFragment), function($skip, $loc, $0, $1, $2) {
17794
- if (state.currentJSXTag !== "")
17795
- return $skip;
17722
+ if (state.currentJSXTag !== "") return $skip;
17796
17723
  return $0;
17797
17724
  });
17798
17725
  var JSXOptionalClosingFragment$1 = (0, import_lib2.$EXPECT)($L0, 'JSXOptionalClosingFragment ""');
@@ -17870,10 +17797,8 @@ var JSXAttributes$0 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0, import_lib2.$
17870
17797
  while (root.length && isWhitespaceOrEmpty(root[root.length - 1])) {
17871
17798
  root = root.slice(0, -1);
17872
17799
  }
17873
- while (root?.length === 1)
17874
- root = root[0];
17875
- if (root?.children)
17876
- root = root.children;
17800
+ while (root?.length === 1) root = root[0];
17801
+ if (root?.children) root = root.children;
17877
17802
  if (root?.[0]?.token === "`") {
17878
17803
  classValue = ["{", ...exprs, "}"];
17879
17804
  } else {
@@ -17942,8 +17867,7 @@ var JSXAttribute$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(AtThis, (0, import
17942
17867
  children
17943
17868
  });
17944
17869
  const last = lastAccessInCallExpression(expr);
17945
- if (!last)
17946
- return $skip;
17870
+ if (!last) return $skip;
17947
17871
  let name;
17948
17872
  if (last.type === "Index") {
17949
17873
  return [
@@ -17969,8 +17893,7 @@ var JSXAttribute$4 = (0, import_lib2.$TS)((0, import_lib2.$S)(Identifier, (0, im
17969
17893
  return convertObjectToJSXAttributes(expr);
17970
17894
  }
17971
17895
  const last = lastAccessInCallExpression(expr);
17972
- if (!last)
17973
- return $skip;
17896
+ if (!last) return $skip;
17974
17897
  let name;
17975
17898
  if (last.type === "Index") {
17976
17899
  return [
@@ -18057,8 +17980,7 @@ function JSXAttributeValue(ctx, state2) {
18057
17980
  return (0, import_lib2.$EVENT_C)(ctx, state2, "JSXAttributeValue", JSXAttributeValue$$);
18058
17981
  }
18059
17982
  var InlineJSXAttributeValue$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InlineJSXUnaryExpression, (0, import_lib2.$Q)(InlineJSXBinaryOpRHS)), function($skip, $loc, $0, $1, $2) {
18060
- if ($2.length)
18061
- return processBinaryOpExpression($0);
17983
+ if ($2.length) return processBinaryOpExpression($0);
18062
17984
  return $1;
18063
17985
  });
18064
17986
  function InlineJSXAttributeValue(ctx, state2) {
@@ -18093,8 +18015,7 @@ function InlineJSXUnaryPostfix(ctx, state2) {
18093
18015
  }
18094
18016
  var InlineJSXUpdateExpression$0 = (0, import_lib2.$S)(UpdateExpressionSymbol, UnaryExpression);
18095
18017
  var InlineJSXUpdateExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InlineJSXCallExpression, (0, import_lib2.$E)(UpdateExpressionSymbol)), function($skip, $loc, $0, $1, $2) {
18096
- if ($2)
18097
- return $0;
18018
+ if ($2) return $0;
18098
18019
  return $1;
18099
18020
  });
18100
18021
  var InlineJSXUpdateExpression$$ = [InlineJSXUpdateExpression$0, InlineJSXUpdateExpression$1];
@@ -18150,8 +18071,7 @@ var InlineJSXCallExpressionRest$1 = (0, import_lib2.$TV)((0, import_lib2.$C)(Tem
18150
18071
  });
18151
18072
  var InlineJSXCallExpressionRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
18152
18073
  var args = $2;
18153
- if (!$1)
18154
- return args;
18074
+ if (!$1) return args;
18155
18075
  return [$1, args];
18156
18076
  });
18157
18077
  var InlineJSXCallExpressionRest$$ = [InlineJSXCallExpressionRest$0, InlineJSXCallExpressionRest$1, InlineJSXCallExpressionRest$2];
@@ -18175,8 +18095,7 @@ var InlineJSXMemberExpressionRest$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((
18175
18095
  var dot = $1;
18176
18096
  var comments = $2;
18177
18097
  var content = $3;
18178
- if (!dot && !comments.length)
18179
- return content;
18098
+ if (!dot && !comments.length) return content;
18180
18099
  if (dot) {
18181
18100
  if (dot.type === "Optional" && content.type === "SliceExpression") {
18182
18101
  return [...dot.children.slice(0, -1), ...comments, content];
@@ -18264,8 +18183,7 @@ var JSXNested$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(JSXEOS, Indent), func
18264
18183
  var indent = $2;
18265
18184
  const { level } = indent;
18266
18185
  const currentIndent = state.currentIndent;
18267
- if (level !== currentIndent.level)
18268
- return $skip;
18186
+ if (level !== currentIndent.level) return $skip;
18269
18187
  return $0;
18270
18188
  });
18271
18189
  function JSXNested(ctx, state2) {
@@ -18386,8 +18304,7 @@ function JSXChildExpression(ctx, state2) {
18386
18304
  return (0, import_lib2.$EVENT_C)(ctx, state2, "JSXChildExpression", JSXChildExpression$$);
18387
18305
  }
18388
18306
  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) {
18389
- if (!$2)
18390
- return $skip;
18307
+ if (!$2) return $skip;
18391
18308
  return $2;
18392
18309
  });
18393
18310
  function IndentedJSXChildExpression(ctx, state2) {
@@ -18407,8 +18324,7 @@ var JSXCodeChild$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertInlineOpenBr
18407
18324
  var open = $1;
18408
18325
  var expression = $2;
18409
18326
  var close = $3;
18410
- if (!expression)
18411
- return $skip;
18327
+ if (!expression) return $skip;
18412
18328
  return [open, expression, close];
18413
18329
  });
18414
18330
  function JSXCodeChild(ctx, state2) {
@@ -18416,14 +18332,12 @@ function JSXCodeChild(ctx, state2) {
18416
18332
  }
18417
18333
  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) {
18418
18334
  var expression = $3;
18419
- if (!expression)
18420
- return $skip;
18335
+ if (!expression) return $skip;
18421
18336
  return expression;
18422
18337
  });
18423
18338
  var JSXCodeChildExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)(JSXEOS), ImplicitNestedBlock), function($skip, $loc, $0, $1, $2) {
18424
18339
  var block = $2;
18425
- if (!block)
18426
- return $skip;
18340
+ if (!block) return $skip;
18427
18341
  const statement = {
18428
18342
  type: "DoStatement",
18429
18343
  children: [block],
@@ -18669,8 +18583,7 @@ function NestedInterfaceBlock(ctx, state2) {
18669
18583
  }
18670
18584
  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) {
18671
18585
  var props = $2;
18672
- if (props.length)
18673
- return props;
18586
+ if (props.length) return props;
18674
18587
  return $skip;
18675
18588
  });
18676
18589
  function NestedInterfaceProperties(ctx, state2) {
@@ -18707,8 +18620,7 @@ function ModuleOrEmptyBlock(ctx, state2) {
18707
18620
  }
18708
18621
  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) {
18709
18622
  var items = $2;
18710
- if (items.length)
18711
- return items;
18623
+ if (items.length) return items;
18712
18624
  return $skip;
18713
18625
  });
18714
18626
  function NestedModuleItems(ctx, state2) {
@@ -18727,8 +18639,7 @@ function DeclareBlock(ctx, state2) {
18727
18639
  }
18728
18640
  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) {
18729
18641
  var decs = $2;
18730
- if (decs.length)
18731
- return decs;
18642
+ if (decs.length) return decs;
18732
18643
  return $skip;
18733
18644
  });
18734
18645
  function NestedDeclareElements(ctx, state2) {
@@ -18836,8 +18747,7 @@ function EnumBlock(ctx, state2) {
18836
18747
  }
18837
18748
  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) {
18838
18749
  var props = $2;
18839
- if (!props.length)
18840
- return $skip;
18750
+ if (!props.length) return $skip;
18841
18751
  return {
18842
18752
  properties: props.flat().map((p) => p.property),
18843
18753
  children: $0
@@ -18884,12 +18794,13 @@ function TypeIndex(ctx, state2) {
18884
18794
  }
18885
18795
  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) {
18886
18796
  var optional = value[1];
18797
+ var colon = value[3];
18887
18798
  var t = value[4];
18888
- return { "type": "TypeSuffix", "ts": true, "optional": optional, "t": t, "children": value };
18799
+ return { "type": "TypeSuffix", "ts": true, "optional": optional, "t": t, "colon": colon, "children": value };
18889
18800
  });
18890
18801
  var TypeSuffix$1 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$E)(_), QuestionMark, (0, import_lib2.$E)(_)), function(value) {
18891
18802
  var optional = value[1];
18892
- return { "type": "TypeSuffix", "ts": true, "optional": optional, "children": value };
18803
+ return { "type": "TypeSuffix", "ts": true, "optional": optional, "colon": void 0, "children": value };
18893
18804
  });
18894
18805
  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) {
18895
18806
  var nonnull = $1;
@@ -18900,6 +18811,7 @@ var TypeSuffix$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(NonNullAssertion, (0
18900
18811
  ts: true,
18901
18812
  nonnull,
18902
18813
  t,
18814
+ colon,
18903
18815
  children: [$1, $2, colon, t]
18904
18816
  };
18905
18817
  });
@@ -18911,8 +18823,7 @@ var MaybeNestedType$0 = NestedTypeBulletedTuple;
18911
18823
  var MaybeNestedType$1 = NestedInterfaceBlock;
18912
18824
  var MaybeNestedType$2 = NestedTypeBinaryChain;
18913
18825
  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) {
18914
- if (!$2)
18915
- return $skip;
18826
+ if (!$2) return $skip;
18916
18827
  return $2;
18917
18828
  });
18918
18829
  var MaybeNestedType$4 = Type;
@@ -18924,8 +18835,7 @@ var MaybeNestedTypePrimary$0 = NestedTypeBulletedTuple;
18924
18835
  var MaybeNestedTypePrimary$1 = NestedInterfaceBlock;
18925
18836
  var MaybeNestedTypePrimary$2 = NestedTypeBinaryChain;
18926
18837
  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) {
18927
- if (!$2)
18928
- return $skip;
18838
+ if (!$2) return $skip;
18929
18839
  return $2;
18930
18840
  });
18931
18841
  var MaybeNestedTypePrimary$4 = TypePrimary;
@@ -18937,8 +18847,7 @@ var MaybeNestedTypeUnary$0 = NestedTypeBulletedTuple;
18937
18847
  var MaybeNestedTypeUnary$1 = NestedInterfaceBlock;
18938
18848
  var MaybeNestedTypeUnary$2 = NestedTypeBinaryChain;
18939
18849
  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) {
18940
- if (!$2)
18941
- return $skip;
18850
+ if (!$2) return $skip;
18942
18851
  return $2;
18943
18852
  });
18944
18853
  var MaybeNestedTypeUnary$4 = (0, import_lib2.$S)(NotDedented, TypeUnary);
@@ -18961,8 +18870,7 @@ function ReturnTypeSuffix(ctx, state2) {
18961
18870
  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) {
18962
18871
  var asserts = $1;
18963
18872
  var t = $3;
18964
- if (!t)
18965
- return $skip;
18873
+ if (!t) return $skip;
18966
18874
  if (asserts) {
18967
18875
  t = {
18968
18876
  type: "TypeAsserts",
@@ -18984,8 +18892,7 @@ function ReturnType(ctx, state2) {
18984
18892
  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) {
18985
18893
  var lhs = $1;
18986
18894
  var rhs = $2;
18987
- if (!rhs)
18988
- return lhs;
18895
+ if (!rhs) return lhs;
18989
18896
  return {
18990
18897
  type: "TypePredicate",
18991
18898
  lhs,
@@ -19004,20 +18911,16 @@ var TypeBinary$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(
19004
18911
  var optionalPrefix = $1;
19005
18912
  var t = $2;
19006
18913
  var ops = $3;
19007
- if (!ops.length && !optionalPrefix)
19008
- return t;
19009
- if (!ops.length)
19010
- return [optionalPrefix, t];
19011
- if (!optionalPrefix)
19012
- return [t, ...ops];
18914
+ if (!ops.length && !optionalPrefix) return t;
18915
+ if (!ops.length) return [optionalPrefix, t];
18916
+ if (!optionalPrefix) return [t, ...ops];
19013
18917
  return [optionalPrefix, t, ops];
19014
18918
  });
19015
18919
  function TypeBinary(ctx, state2) {
19016
18920
  return (0, import_lib2.$EVENT)(ctx, state2, "TypeBinary", TypeBinary$0);
19017
18921
  }
19018
18922
  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) {
19019
- if (!$2.length)
19020
- return $skip;
18923
+ if (!$2.length) return $skip;
19021
18924
  return $2;
19022
18925
  });
19023
18926
  function NestedTypeBinaryChain(ctx, state2) {
@@ -19027,8 +18930,7 @@ var NestedTypeBinary$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested, TypeBi
19027
18930
  var indent = $1;
19028
18931
  var op = $2;
19029
18932
  var t = $4;
19030
- if (!t)
19031
- return $skip;
18933
+ if (!t) return $skip;
19032
18934
  return [indent, op, t];
19033
18935
  });
19034
18936
  function NestedTypeBinary(ctx, state2) {
@@ -19038,8 +18940,7 @@ var TypeUnary$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Q)((
19038
18940
  var prefix = $1;
19039
18941
  var t = $2;
19040
18942
  var suffix = $3;
19041
- if (!prefix.length && !suffix.length)
19042
- return t;
18943
+ if (!prefix.length && !suffix.length) return t;
19043
18944
  return {
19044
18945
  type: "TypeUnary",
19045
18946
  prefix,
@@ -19143,8 +19044,7 @@ var TypePrimary$9 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)
19143
19044
  };
19144
19045
  });
19145
19046
  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) {
19146
- if (!$4)
19147
- return $skip;
19047
+ if (!$4) return $skip;
19148
19048
  return {
19149
19049
  type: "TypeParenthesized",
19150
19050
  children: [$1, $2, $4, $6, $7]
@@ -19166,8 +19066,7 @@ var TypeTuple$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, AllowAll
19166
19066
  var elements = $3;
19167
19067
  var ws = $5;
19168
19068
  var close = $6;
19169
- if (!elements)
19170
- return $skip;
19069
+ if (!elements) return $skip;
19171
19070
  return {
19172
19071
  type: "TypeTuple",
19173
19072
  elements,
@@ -19182,8 +19081,7 @@ var TypeTupleContent$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(TypeElementLis
19182
19081
  var list = $1;
19183
19082
  var delimiter = $2;
19184
19083
  var nested = $3;
19185
- if (!nested)
19186
- return list;
19084
+ if (!nested) return list;
19187
19085
  return [...list, delimiter, ...nested];
19188
19086
  });
19189
19087
  var TypeTupleContent$2 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0, import_lib2.$S)(__, TypeElementListWithIndentedApplicationForbidden, ArrayElementDelimiter)), function($skip, $loc, $0, $1) {
@@ -19194,8 +19092,7 @@ function TypeTupleContent(ctx, state2) {
19194
19092
  return (0, import_lib2.$EVENT_C)(ctx, state2, "TypeTupleContent", TypeTupleContent$$);
19195
19093
  }
19196
19094
  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) {
19197
- if ($2)
19198
- return $2;
19095
+ if ($2) return $2;
19199
19096
  return $skip;
19200
19097
  });
19201
19098
  function TypeElementListWithIndentedApplicationForbidden(ctx, state2) {
@@ -19207,8 +19104,7 @@ var TypeElementList$0 = (0, import_lib2.$T)((0, import_lib2.$S)(TypeBulletedTupl
19207
19104
  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) {
19208
19105
  var first = $2;
19209
19106
  var rest = $3;
19210
- if (!rest.length)
19211
- return [first];
19107
+ if (!rest.length) return [first];
19212
19108
  return [
19213
19109
  append(first, rest[0][0])
19214
19110
  ].concat(
@@ -19274,13 +19170,10 @@ var NestedTypeElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested, TypeE
19274
19170
  var list = $2;
19275
19171
  var delimiter = $3;
19276
19172
  const { length } = list;
19277
- if (!length)
19278
- return $skip;
19173
+ if (!length) return $skip;
19279
19174
  return list.map((e, i) => {
19280
- if (i === 0)
19281
- e = prepend(indent, e);
19282
- if (i === length - 1)
19283
- e = append(e, delimiter);
19175
+ if (i === 0) e = prepend(indent, e);
19176
+ if (i === length - 1) e = append(e, delimiter);
19284
19177
  return e;
19285
19178
  });
19286
19179
  });
@@ -19291,8 +19184,7 @@ var NestedTypeBulletedTuple$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, imp
19291
19184
  var open = $1;
19292
19185
  var content = $3;
19293
19186
  var close = $4;
19294
- if (!content.length)
19295
- return $skip;
19187
+ if (!content.length) return $skip;
19296
19188
  content = content.flat();
19297
19189
  const last = content[content.length - 1];
19298
19190
  let children = Array.isArray(last) ? last : last?.children;
@@ -19316,8 +19208,7 @@ var TypeBulletedTuple$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertOpenBra
19316
19208
  var open = $1;
19317
19209
  var content = $2;
19318
19210
  var close = $3;
19319
- if (!content)
19320
- return $skip;
19211
+ if (!content) return $skip;
19321
19212
  content = [
19322
19213
  ...trimFirstSpace(content[0]),
19323
19214
  // replace first space with bracket
@@ -19352,11 +19243,9 @@ function NestedTypeBullet(ctx, state2) {
19352
19243
  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) {
19353
19244
  var bullet = $1;
19354
19245
  var content = $2;
19355
- if (!content)
19356
- return $skip;
19246
+ if (!content) return $skip;
19357
19247
  let [list, delimiter] = content;
19358
- if (!list.length)
19359
- return $skip;
19248
+ if (!list.length) return $skip;
19360
19249
  list = list.slice();
19361
19250
  list[0] = prepend(bullet, list[0]);
19362
19251
  if (delimiter) {
@@ -19371,8 +19260,7 @@ function TypeBullet(ctx, state2) {
19371
19260
  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) {
19372
19261
  var t = $1;
19373
19262
  var postfix = $2;
19374
- if (!postfix)
19375
- return t;
19263
+ if (!postfix) return t;
19376
19264
  return prepend(
19377
19265
  postfix[0],
19378
19266
  expressionizeTypeIf([...postfix[1], $1, void 0])
@@ -19385,8 +19273,7 @@ var TypeConditional$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
19385
19273
  return prepend($1, expressionizeTypeIf($3));
19386
19274
  });
19387
19275
  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) {
19388
- if ($1.negated)
19389
- return [$1, $2, $3, $4, $9, $6, $7, $8, $5];
19276
+ if ($1.negated) return [$1, $2, $3, $4, $9, $6, $7, $8, $5];
19390
19277
  return $0;
19391
19278
  });
19392
19279
  var TypeConditional$2 = TypeBinary;
@@ -19412,14 +19299,12 @@ function TypeIfThenElse(ctx, state2) {
19412
19299
  }
19413
19300
  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) {
19414
19301
  var condition = $4;
19415
- if (!condition)
19416
- return $skip;
19302
+ if (!condition) return $skip;
19417
19303
  return [$1, condition];
19418
19304
  });
19419
19305
  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) {
19420
19306
  var condition = $3;
19421
- if (!condition)
19422
- return $skip;
19307
+ if (!condition) return $skip;
19423
19308
  return [$1, condition];
19424
19309
  });
19425
19310
  var TypeIfClause$$ = [TypeIfClause$0, TypeIfClause$1];
@@ -19438,8 +19323,7 @@ var TypeBlock$1 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$N)(EO
19438
19323
  });
19439
19324
  var TypeBlock$2 = NestedInterfaceBlock;
19440
19325
  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) {
19441
- if (!$2)
19442
- return $skip;
19326
+ if (!$2) return $skip;
19443
19327
  return $2;
19444
19328
  });
19445
19329
  var TypeBlock$$ = [TypeBlock$0, TypeBlock$1, TypeBlock$2, TypeBlock$3];
@@ -19479,8 +19363,7 @@ var TypeLiteral$1 = Literal;
19479
19363
  var TypeLiteral$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R14, "TypeLiteral /[+-]/"), NumericLiteral), function($skip, $loc, $0, $1, $2) {
19480
19364
  var sign = $1;
19481
19365
  var num = $2;
19482
- if (sign[0] === "+")
19483
- return num;
19366
+ if (sign[0] === "+") return num;
19484
19367
  return $0;
19485
19368
  });
19486
19369
  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) {
@@ -19596,8 +19479,7 @@ var ImplicitTypeArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(TypeAppli
19596
19479
  var args = $4;
19597
19480
  var close = $5;
19598
19481
  const last = args[args.length - 1];
19599
- if (isComma(last))
19600
- args = args.slice(0, -1);
19482
+ if (isComma(last)) args = args.slice(0, -1);
19601
19483
  return {
19602
19484
  type: "TypeArguments",
19603
19485
  ts: true,
@@ -19651,8 +19533,7 @@ function TypeArgumentList(ctx, state2) {
19651
19533
  }
19652
19534
  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) {
19653
19535
  var args = $2;
19654
- if (!args.length)
19655
- return $skip;
19536
+ if (!args.length) return $skip;
19656
19537
  return args.flat();
19657
19538
  });
19658
19539
  function NestedTypeArgumentList(ctx, state2) {
@@ -19763,16 +19644,14 @@ function CivetPrologueContent(ctx, state2) {
19763
19644
  }
19764
19645
  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) {
19765
19646
  const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
19766
- if (l)
19767
- return l.toUpperCase();
19647
+ if (l) return l.toUpperCase();
19768
19648
  return "";
19769
19649
  });
19770
19650
  let value = $3 ? $4 : $1 === "-" ? false : true;
19771
19651
  switch (optionName) {
19772
19652
  case "tab":
19773
19653
  value = parseFloat(value);
19774
- if (isNaN(value))
19775
- value = 0;
19654
+ if (isNaN(value)) value = 0;
19776
19655
  break;
19777
19656
  case "globals":
19778
19657
  case "symbols":
@@ -19961,144 +19840,126 @@ function InsertType(ctx, state2) {
19961
19840
  return (0, import_lib2.$EVENT)(ctx, state2, "InsertType", InsertType$0);
19962
19841
  }
19963
19842
  var CoffeeBinaryExistentialEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeBinaryExistentialEnabled ""'), function($skip, $loc, $0, $1) {
19964
- if (config.coffeeBinaryExistential)
19965
- return;
19843
+ if (config.coffeeBinaryExistential) return;
19966
19844
  return $skip;
19967
19845
  });
19968
19846
  function CoffeeBinaryExistentialEnabled(ctx, state2) {
19969
19847
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeBinaryExistentialEnabled", CoffeeBinaryExistentialEnabled$0);
19970
19848
  }
19971
19849
  var CoffeeBooleansEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeBooleansEnabled ""'), function($skip, $loc, $0, $1) {
19972
- if (config.coffeeBooleans)
19973
- return;
19850
+ if (config.coffeeBooleans) return;
19974
19851
  return $skip;
19975
19852
  });
19976
19853
  function CoffeeBooleansEnabled(ctx, state2) {
19977
19854
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeBooleansEnabled", CoffeeBooleansEnabled$0);
19978
19855
  }
19979
19856
  var CoffeeClassesEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeClassesEnabled ""'), function($skip, $loc, $0, $1) {
19980
- if (config.coffeeClasses)
19981
- return;
19857
+ if (config.coffeeClasses) return;
19982
19858
  return $skip;
19983
19859
  });
19984
19860
  function CoffeeClassesEnabled(ctx, state2) {
19985
19861
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeClassesEnabled", CoffeeClassesEnabled$0);
19986
19862
  }
19987
19863
  var CoffeeCommentEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeCommentEnabled ""'), function($skip, $loc, $0, $1) {
19988
- if (config.coffeeComment)
19989
- return;
19864
+ if (config.coffeeComment) return;
19990
19865
  return $skip;
19991
19866
  });
19992
19867
  function CoffeeCommentEnabled(ctx, state2) {
19993
19868
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeCommentEnabled", CoffeeCommentEnabled$0);
19994
19869
  }
19995
19870
  var CoffeeDivEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeDivEnabled ""'), function($skip, $loc, $0, $1) {
19996
- if (config.coffeeDiv)
19997
- return;
19871
+ if (config.coffeeDiv) return;
19998
19872
  return $skip;
19999
19873
  });
20000
19874
  function CoffeeDivEnabled(ctx, state2) {
20001
19875
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeDivEnabled", CoffeeDivEnabled$0);
20002
19876
  }
20003
19877
  var CoffeeDoEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeDoEnabled ""'), function($skip, $loc, $0, $1) {
20004
- if (config.coffeeDo)
20005
- return;
19878
+ if (config.coffeeDo) return;
20006
19879
  return $skip;
20007
19880
  });
20008
19881
  function CoffeeDoEnabled(ctx, state2) {
20009
19882
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeDoEnabled", CoffeeDoEnabled$0);
20010
19883
  }
20011
19884
  var CoffeeForLoopsEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeForLoopsEnabled ""'), function($skip, $loc, $0, $1) {
20012
- if (config.coffeeForLoops)
20013
- return;
19885
+ if (config.coffeeForLoops) return;
20014
19886
  return $skip;
20015
19887
  });
20016
19888
  function CoffeeForLoopsEnabled(ctx, state2) {
20017
19889
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeForLoopsEnabled", CoffeeForLoopsEnabled$0);
20018
19890
  }
20019
19891
  var CoffeeInterpolationEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeInterpolationEnabled ""'), function($skip, $loc, $0, $1) {
20020
- if (config.coffeeInterpolation)
20021
- return;
19892
+ if (config.coffeeInterpolation) return;
20022
19893
  return $skip;
20023
19894
  });
20024
19895
  function CoffeeInterpolationEnabled(ctx, state2) {
20025
19896
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeInterpolationEnabled", CoffeeInterpolationEnabled$0);
20026
19897
  }
20027
19898
  var CoffeeIsntEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeIsntEnabled ""'), function($skip, $loc, $0, $1) {
20028
- if (config.coffeeIsnt)
20029
- return;
19899
+ if (config.coffeeIsnt) return;
20030
19900
  return $skip;
20031
19901
  });
20032
19902
  function CoffeeIsntEnabled(ctx, state2) {
20033
19903
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeIsntEnabled", CoffeeIsntEnabled$0);
20034
19904
  }
20035
19905
  var CoffeeJSXEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeJSXEnabled ""'), function($skip, $loc, $0, $1) {
20036
- if (config.coffeeJSX)
20037
- return;
19906
+ if (config.coffeeJSX) return;
20038
19907
  return $skip;
20039
19908
  });
20040
19909
  function CoffeeJSXEnabled(ctx, state2) {
20041
19910
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeJSXEnabled", CoffeeJSXEnabled$0);
20042
19911
  }
20043
19912
  var CoffeeLineContinuationEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeLineContinuationEnabled ""'), function($skip, $loc, $0, $1) {
20044
- if (config.coffeeLineContinuation)
20045
- return;
19913
+ if (config.coffeeLineContinuation) return;
20046
19914
  return $skip;
20047
19915
  });
20048
19916
  function CoffeeLineContinuationEnabled(ctx, state2) {
20049
19917
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeLineContinuationEnabled", CoffeeLineContinuationEnabled$0);
20050
19918
  }
20051
19919
  var CoffeeNotEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeNotEnabled ""'), function($skip, $loc, $0, $1) {
20052
- if (config.coffeeNot)
20053
- return;
19920
+ if (config.coffeeNot) return;
20054
19921
  return $skip;
20055
19922
  });
20056
19923
  function CoffeeNotEnabled(ctx, state2) {
20057
19924
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeNotEnabled", CoffeeNotEnabled$0);
20058
19925
  }
20059
19926
  var CoffeeOfEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeeOfEnabled ""'), function($skip, $loc, $0, $1) {
20060
- if (config.coffeeOf)
20061
- return;
19927
+ if (config.coffeeOf) return;
20062
19928
  return $skip;
20063
19929
  });
20064
19930
  function CoffeeOfEnabled(ctx, state2) {
20065
19931
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeeOfEnabled", CoffeeOfEnabled$0);
20066
19932
  }
20067
19933
  var CoffeePrototypeEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'CoffeePrototypeEnabled ""'), function($skip, $loc, $0, $1) {
20068
- if (config.coffeePrototype)
20069
- return;
19934
+ if (config.coffeePrototype) return;
20070
19935
  return $skip;
20071
19936
  });
20072
19937
  function CoffeePrototypeEnabled(ctx, state2) {
20073
19938
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeePrototypeEnabled", CoffeePrototypeEnabled$0);
20074
19939
  }
20075
19940
  var JSXCodeNestedEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'JSXCodeNestedEnabled ""'), function($skip, $loc, $0, $1) {
20076
- if (config.jsxCodeNested)
20077
- return;
19941
+ if (config.jsxCodeNested) return;
20078
19942
  return $skip;
20079
19943
  });
20080
19944
  function JSXCodeNestedEnabled(ctx, state2) {
20081
19945
  return (0, import_lib2.$EVENT)(ctx, state2, "JSXCodeNestedEnabled", JSXCodeNestedEnabled$0);
20082
19946
  }
20083
19947
  var JSXCodeSameLineEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'JSXCodeSameLineEnabled ""'), function($skip, $loc, $0, $1) {
20084
- if (config.jsxCodeSameLine)
20085
- return;
19948
+ if (config.jsxCodeSameLine) return;
20086
19949
  return $skip;
20087
19950
  });
20088
19951
  function JSXCodeSameLineEnabled(ctx, state2) {
20089
19952
  return (0, import_lib2.$EVENT)(ctx, state2, "JSXCodeSameLineEnabled", JSXCodeSameLineEnabled$0);
20090
19953
  }
20091
19954
  var ObjectIsEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ObjectIsEnabled ""'), function($skip, $loc, $0, $1) {
20092
- if (config.objectIs)
20093
- return;
19955
+ if (config.objectIs) return;
20094
19956
  return $skip;
20095
19957
  });
20096
19958
  function ObjectIsEnabled(ctx, state2) {
20097
19959
  return (0, import_lib2.$EVENT)(ctx, state2, "ObjectIsEnabled", ObjectIsEnabled$0);
20098
19960
  }
20099
19961
  var IsBare$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'IsBare ""'), function($skip, $loc, $0, $1) {
20100
- if (config.iife || config.repl)
20101
- return $skip;
19962
+ if (config.iife || config.repl) return $skip;
20102
19963
  });
20103
19964
  function IsBare(ctx, state2) {
20104
19965
  return (0, import_lib2.$EVENT)(ctx, state2, "IsBare", IsBare$0);
@@ -20271,8 +20132,7 @@ function PopIndent(ctx, state2) {
20271
20132
  }
20272
20133
  var Nested$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(EOS, Indent), function($skip, $loc, $0, $1, $2) {
20273
20134
  var indent = $2;
20274
- if (indent.level === state.currentIndent.level)
20275
- return $0;
20135
+ if (indent.level === state.currentIndent.level) return $0;
20276
20136
  if (config.verbose) {
20277
20137
  console.log(`failing Nested: ${indent.level} does not match current indent level ${state.currentIndent.level}`);
20278
20138
  }
@@ -20283,8 +20143,7 @@ function Nested(ctx, state2) {
20283
20143
  }
20284
20144
  var IndentedFurther$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(EOS, Indent), function($skip, $loc, $0, $1, $2) {
20285
20145
  var indent = $2;
20286
- if (indent.level > state.currentIndent.level)
20287
- return $0;
20146
+ if (indent.level > state.currentIndent.level) return $0;
20288
20147
  return $skip;
20289
20148
  });
20290
20149
  function IndentedFurther(ctx, state2) {
@@ -20292,8 +20151,7 @@ function IndentedFurther(ctx, state2) {
20292
20151
  }
20293
20152
  var IndentedAtLeast$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(EOS, Indent), function($skip, $loc, $0, $1, $2) {
20294
20153
  var indent = $2;
20295
- if (indent.level >= state.currentIndent.level)
20296
- return $0;
20154
+ if (indent.level >= state.currentIndent.level) return $0;
20297
20155
  return $skip;
20298
20156
  });
20299
20157
  function IndentedAtLeast(ctx, state2) {
@@ -20301,10 +20159,8 @@ function IndentedAtLeast(ctx, state2) {
20301
20159
  }
20302
20160
  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) {
20303
20161
  const ws = [];
20304
- if ($1)
20305
- ws.push(...$1);
20306
- if ($2)
20307
- ws.push(...$2);
20162
+ if ($1) ws.push(...$1);
20163
+ if ($2) ws.push(...$2);
20308
20164
  return ws.flat(Infinity).filter(Boolean);
20309
20165
  });
20310
20166
  function NotDedented(ctx, state2) {
@@ -20312,10 +20168,8 @@ function NotDedented(ctx, state2) {
20312
20168
  }
20313
20169
  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) {
20314
20170
  const ws = [];
20315
- if ($1)
20316
- ws.push(...$1);
20317
- if ($2)
20318
- ws.push(...$2);
20171
+ if ($1) ws.push(...$1);
20172
+ if ($2) ws.push(...$2);
20319
20173
  return ws.flat(Infinity).filter(Boolean);
20320
20174
  });
20321
20175
  function SameLineOrIndentedFurther(ctx, state2) {
@@ -20333,8 +20187,7 @@ var PushExtraIndent1$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pus
20333
20187
  $loc,
20334
20188
  level: state.currentIndent.level + 1
20335
20189
  };
20336
- if (config.verbose)
20337
- console.log("pushing bonus indent", indent);
20190
+ if (config.verbose) console.log("pushing bonus indent", indent);
20338
20191
  state.indentLevels.push(indent);
20339
20192
  return indent;
20340
20193
  });
@@ -20346,11 +20199,9 @@ var parser = function() {
20346
20199
  let ctx = { expectation: "", fail };
20347
20200
  return {
20348
20201
  parse: (input, options = {}) => {
20349
- if (typeof input !== "string")
20350
- throw new Error("Input must be a string");
20202
+ if (typeof input !== "string") throw new Error("Input must be a string");
20351
20203
  const parser2 = options.startRule != null ? grammar[options.startRule] : Object.values(grammar)[0];
20352
- if (!parser2)
20353
- throw new Error(`Could not find rule with name '${options.startRule}'`);
20204
+ if (!parser2) throw new Error(`Could not find rule with name '${options.startRule}'`);
20354
20205
  const filename2 = options.filename || "<anonymous>";
20355
20206
  reset();
20356
20207
  Object.assign(ctx, { ...options.events, tokenize: options.tokenize });
@@ -20481,9 +20332,9 @@ var wellKnownSymbols = [
20481
20332
  "unscopables"
20482
20333
  ];
20483
20334
 
20484
- // source/sourcemap.civet
20485
- var sourcemap_exports = {};
20486
- __export(sourcemap_exports, {
20335
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\sourcemap.civet.jsx
20336
+ var sourcemap_civet_exports = {};
20337
+ __export(sourcemap_civet_exports, {
20487
20338
  SourceMap: () => SourceMap,
20488
20339
  base64Encode: () => base64Encode,
20489
20340
  locationTable: () => locationTable,
@@ -20668,10 +20519,8 @@ var VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - 1;
20668
20519
  var encodeVlq = function(value) {
20669
20520
  let answer = "";
20670
20521
  let ref1;
20671
- if (value < 0)
20672
- ref1 = 1;
20673
- else
20674
- ref1 = 0;
20522
+ if (value < 0) ref1 = 1;
20523
+ else ref1 = 0;
20675
20524
  const signBit = ref1;
20676
20525
  let valueToEncode = (Math.abs(value) << 1) + signBit;
20677
20526
  while (valueToEncode || !answer) {
@@ -20785,7 +20634,7 @@ var remapPosition = function(position, sourcemapLines) {
20785
20634
  }
20786
20635
  };
20787
20636
 
20788
- // source/state-cache.civet
20637
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\state-cache.civet.jsx
20789
20638
  var StateCache = class {
20790
20639
  cache = /* @__PURE__ */ new Map();
20791
20640
  get(key) {
@@ -20825,8 +20674,80 @@ var StateCache = class {
20825
20674
  }
20826
20675
  };
20827
20676
 
20828
- // source/main.civet
20829
- var { SourceMap: SourceMap2 } = sourcemap_exports;
20677
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\worker-pool.civet.jsx
20678
+ var WorkerPool = class {
20679
+ idle;
20680
+ spawned;
20681
+ jobId;
20682
+ callbacks;
20683
+ todo;
20684
+ threads;
20685
+ constructor(threads) {
20686
+ this.threads = threads;
20687
+ this.idle = [];
20688
+ this.spawned = 0;
20689
+ this.jobId = 0;
20690
+ this.callbacks = /* @__PURE__ */ new Map();
20691
+ this.todo = [];
20692
+ }
20693
+ async run(op, ...args) {
20694
+ const id = this.jobId++;
20695
+ return await new Promise(async (resolve2, reject) => {
20696
+ this.callbacks.set(id, { resolve: resolve2, reject });
20697
+ const job = { id, op, args };
20698
+ if (this.idle.length) {
20699
+ const worker = this.idle.shift();
20700
+ worker.ref();
20701
+ worker.postMessage(job);
20702
+ } else if (this.spawned < this.threads) {
20703
+ (await this.startWorker()).postMessage(job);
20704
+ } else {
20705
+ this.todo.push(job);
20706
+ }
20707
+ });
20708
+ }
20709
+ async startWorker() {
20710
+ this.spawned++;
20711
+ const { Worker } = await import("node:worker_threads");
20712
+ const path = (await import("node:path")).default;
20713
+ const worker = new Worker(path.join(__dirname, "node-worker.mjs"));
20714
+ worker.on("message", (response) => {
20715
+ const callback = this.callbacks.get(response.id);
20716
+ this.callbacks.delete(response.id);
20717
+ if (response.error) {
20718
+ callback.reject(response.error);
20719
+ } else {
20720
+ callback.resolve(response.result);
20721
+ }
20722
+ if (this.spawned > this.threads) {
20723
+ this.spawned--;
20724
+ return worker.terminate();
20725
+ } else if (this.todo.length) {
20726
+ return worker.postMessage(this.todo.shift());
20727
+ } else {
20728
+ this.idle.push(worker);
20729
+ return worker.unref();
20730
+ }
20731
+ });
20732
+ worker.on("error", (error) => {
20733
+ return console.error("Civet worker failed:", error);
20734
+ });
20735
+ return worker;
20736
+ }
20737
+ setThreads(threads1) {
20738
+ this.threads = threads1;
20739
+ while (this.spawned > this.threads) {
20740
+ if (!this.idle.length) {
20741
+ return;
20742
+ }
20743
+ this.spawned--;
20744
+ this.idle.pop().terminate();
20745
+ }
20746
+ }
20747
+ };
20748
+
20749
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\main.civet.jsx
20750
+ var { SourceMap: SourceMap2 } = sourcemap_civet_exports;
20830
20751
  var ParseErrors = class extends Error {
20831
20752
  name = "ParseErrors";
20832
20753
  errors;
@@ -20884,7 +20805,21 @@ var uncacheable = /* @__PURE__ */ new Set([
20884
20805
  "RestoreNewlineBinaryOp",
20885
20806
  "RestorePipeline"
20886
20807
  ]);
20808
+ var workerPool;
20887
20809
  function compile(src, options) {
20810
+ if (!(process.env.CIVET_THREADS == 0)) {
20811
+ const threads = parseInt(options?.threads ?? process.env.CIVET_THREADS, 10);
20812
+ if (threads === 0) {
20813
+ workerPool?.setThreads(0);
20814
+ } else if (!isNaN(threads) && threads > 0 && !options.sync) {
20815
+ if (workerPool != null) {
20816
+ workerPool.setThreads(threads);
20817
+ } else {
20818
+ workerPool = new WorkerPool(threads);
20819
+ }
20820
+ return workerPool.run("compile", src, { ...options, threads: 0 });
20821
+ }
20822
+ }
20888
20823
  if (!options) {
20889
20824
  options = {};
20890
20825
  } else {
@@ -20966,7 +20901,7 @@ ${counts}`;
20966
20901
  }
20967
20902
  if (options.sourceMap || options.inlineMap) {
20968
20903
  options.sourceMap = SourceMap2(src);
20969
- const code = generate_default(ast2, options);
20904
+ const code = generate_civet_default(ast2, options);
20970
20905
  checkErrors();
20971
20906
  if (options.inlineMap) {
20972
20907
  return SourceMap2.remap(code, options.sourceMap, filename2, filename2 + ".tsx");
@@ -20977,11 +20912,11 @@ ${counts}`;
20977
20912
  };
20978
20913
  }
20979
20914
  }
20980
- const result = generate_default(ast2, options);
20915
+ const result = generate_civet_default(ast2, options);
20981
20916
  if (options.errors?.length) {
20982
20917
  delete options.errors;
20983
20918
  options.sourceMap = SourceMap2(src);
20984
- generate_default(ast2, options);
20919
+ generate_civet_default(ast2, options);
20985
20920
  checkErrors();
20986
20921
  }
20987
20922
  return result;
@@ -21060,7 +20995,7 @@ var makeCache = function({ hits, trace } = {}) {
21060
20995
  var isCompileError = function(err) {
21061
20996
  return err instanceof import_lib2.ParseError || err instanceof ParseErrors;
21062
20997
  };
21063
- var main_default = { parse, parseProgram, ParseError: import_lib2.ParseError, ParseErrors, generate: generate_default, sourcemap: sourcemap_exports, SourceMap: SourceMap2, compile, isCompileError };
20998
+ var main_civet_default = { parse, parseProgram, ParseError: import_lib2.ParseError, ParseErrors, generate: generate_civet_default, sourcemap: sourcemap_civet_exports, SourceMap: SourceMap2, compile, isCompileError };
21064
20999
  // Annotate the CommonJS export names for ESM import in node:
21065
21000
  0 && (module.exports = {
21066
21001
  ParseError,