@danielx/civet 0.9.5 → 0.9.7

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/browser.js CHANGED
@@ -473,6 +473,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
473
473
  maybeRefAssignment: () => maybeRefAssignment,
474
474
  modifyString: () => modifyString,
475
475
  negateCondition: () => negateCondition,
476
+ precedenceCustomDefault: () => precedenceCustomDefault,
476
477
  precedenceStep: () => precedenceStep,
477
478
  prepend: () => prepend,
478
479
  processAssignmentDeclaration: () => processAssignmentDeclaration,
@@ -1510,7 +1511,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
1510
1511
  type: "TypeSuffix",
1511
1512
  ts: !0,
1512
1513
  children: [": unknown"]
1513
- }, prop.type) {
1514
+ }, prop.initializer && !typeSuffix.optional && typeSuffix.children.unshift(typeSuffix.optional = "?"), prop.type) {
1514
1515
  case "BindingProperty": {
1515
1516
  let ws = prop.children.slice(0, prop.children.indexOf(prop.name));
1516
1517
  results2.push([...ws, prop.name, typeSuffix, prop.delim]);
@@ -2429,7 +2430,7 @@ ${js}`
2429
2430
  exp = exp;
2430
2431
  let outer = exp;
2431
2432
  exp.type === "LabelledStatement" && (exp = exp.statement);
2432
- let ref6;
2433
+ let ref6, m1;
2433
2434
  switch (exp.type) {
2434
2435
  case "BreakStatement":
2435
2436
  case "ContinueStatement":
@@ -2494,6 +2495,8 @@ ${js}`
2494
2495
  return;
2495
2496
  }
2496
2497
  case "PipelineExpression": {
2498
+ if (m1 = exp.children[1]?.type, m1 === "ReturnStatement" || m1 === "ThrowStatement")
2499
+ return;
2497
2500
  let semi2 = exp.children.lastIndexOf(";");
2498
2501
  if (0 <= semi2 && semi2 < exp.children.length - 1) {
2499
2502
  exp.children.splice(semi2 + 1, 1 / 0, collect(exp.children.slice(semi2 + 1)));
@@ -2514,8 +2517,8 @@ ${js}`
2514
2517
  let last = node.expressions[node.expressions.length - 1];
2515
2518
  insertReturn(last);
2516
2519
  } else {
2517
- let m1;
2518
- m1 = node.parent?.type, (m1 === "CatchClause" || m1 === "WhenClause") && node.expressions.push(["", wrapWithReturn(void 0, node)]);
2520
+ let m2;
2521
+ m2 = node.parent?.type, (m2 === "CatchClause" || m2 === "WhenClause") && node.expressions.push(["", wrapWithReturn(void 0, node)]);
2519
2522
  }
2520
2523
  return;
2521
2524
  }
@@ -2546,7 +2549,7 @@ ${js}`
2546
2549
  return;
2547
2550
  let outer = exp;
2548
2551
  exp.type === "LabelledStatement" && (exp = exp.statement);
2549
- let ref11;
2552
+ let ref11, m3;
2550
2553
  switch (exp.type) {
2551
2554
  case "BreakStatement":
2552
2555
  case "ContinueStatement":
@@ -2623,6 +2626,8 @@ ${js}`
2623
2626
  return;
2624
2627
  }
2625
2628
  case "PipelineExpression": {
2629
+ if (m3 = exp.children[1]?.type, m3 === "ReturnStatement" || m3 === "ThrowStatement")
2630
+ return;
2626
2631
  let semi2 = exp.children.lastIndexOf(";");
2627
2632
  if (0 <= semi2 && semi2 < exp.children.length - 1) {
2628
2633
  exp.children.splice(semi2 + 1, 1 / 0, wrapWithReturn(exp.children.slice(semi2 + 1)));
@@ -2641,8 +2646,8 @@ ${js}`
2641
2646
  ))
2642
2647
  if (control.with) {
2643
2648
  if (control.label) {
2644
- let m2;
2645
- if (m2 = statement.parent, !(typeof m2 == "object" && m2 != null && "type" in m2 && m2.type === "LabelledStatement" && "label" in m2 && typeof m2.label == "object" && m2.label != null && "name" in m2.label && m2.label.name === control.label.name))
2649
+ let m4;
2650
+ if (m4 = statement.parent, !(typeof m4 == "object" && m4 != null && "type" in m4 && m4.type === "LabelledStatement" && "label" in m4 && typeof m4.label == "object" && m4.label != null && "name" in m4.label && m4.label.name === control.label.name))
2646
2651
  continue;
2647
2652
  } else {
2648
2653
  let { ancestor } = findAncestor(
@@ -2793,8 +2798,8 @@ ${js}`
2793
2798
  return !1;
2794
2799
  let reduction = statement.type === "ForStatement" && statement.reduction;
2795
2800
  function fillBlock(expression) {
2796
- let ref15, m3;
2797
- return m3 = (ref15 = block.expressions)[ref15.length - 1], Array.isArray(m3) && m3.length >= 2 && typeof m3[1] == "object" && m3[1] != null && "type" in m3[1] && m3[1].type === "EmptyStatement" && "implicit" in m3[1] && m3[1].implicit === !0 && block.expressions.pop(), block.expressions.push(expression), block.empty = !1, braceBlock(block);
2801
+ let ref15, m5;
2802
+ return m5 = (ref15 = block.expressions)[ref15.length - 1], Array.isArray(m5) && m5.length >= 2 && typeof m5[1] == "object" && m5[1] != null && "type" in m5[1] && m5[1].type === "EmptyStatement" && "implicit" in m5[1] && m5[1].implicit === !0 && block.expressions.pop(), block.expressions.push(expression), block.empty = !1, braceBlock(block);
2798
2803
  }
2799
2804
  if (reduction)
2800
2805
  switch (reduction.subtype) {
@@ -2872,8 +2877,8 @@ ${js}`
2872
2877
  if (parameters.names = before.flatMap(($7) => $7.names), parameters.parameters.splice(0, 1 / 0), tt && parameters.parameters.push(tt), parameters.parameters.push(...before), rest) {
2873
2878
  let restIdentifier = rest.binding.ref || rest.binding;
2874
2879
  if (parameters.names.push(...rest.names || []), rest.children.pop(), after.length) {
2875
- let m4;
2876
- m4 = rest.binding.type, (m4 === "ArrayBindingPattern" || m4 === "ObjectBindingPattern" || m4 === "NamedBindingPattern") && parameters.parameters.push({
2880
+ let m6;
2881
+ m6 = rest.binding.type, (m6 === "ArrayBindingPattern" || m6 === "ObjectBindingPattern" || m6 === "NamedBindingPattern") && parameters.parameters.push({
2877
2882
  type: "Error",
2878
2883
  message: "Non-end rest parameter cannot be binding pattern"
2879
2884
  }), after = trimFirstSpace(after);
@@ -2975,8 +2980,8 @@ ${js}`
2975
2980
  if (ancestor != null) {
2976
2981
  let fields = new Set(gatherRecursiveWithinFunction(ancestor, ($11) => $11.type === "FieldDefinition").map(($12) => $12.id).filter((a3) => typeof a3 == "object" && a3 != null && "type" in a3 && a3.type === "Identifier").map(($13) => $13.name)), classExpressions = ancestor.body.expressions, index2 = findChildIndex(classExpressions, f);
2977
2982
  assert.notEqual(index2, -1, "Could not find constructor in class");
2978
- let m5;
2979
- for (; m5 = classExpressions[index2 - 1]?.[1], typeof m5 == "object" && m5 != null && "type" in m5 && m5.type === "MethodDefinition" && "name" in m5 && m5.name === "constructor"; )
2983
+ let m7;
2984
+ for (; m7 = classExpressions[index2 - 1]?.[1], typeof m7 == "object" && m7 != null && "type" in m7 && m7.type === "MethodDefinition" && "name" in m7 && m7.name === "constructor"; )
2980
2985
  index2--;
2981
2986
  let fStatement = classExpressions[index2];
2982
2987
  for (let ref18 = gatherRecursive(parameters, ($14) => $14.type === "Parameter"), i9 = 0, len8 = ref18.length; i9 < len8; i9++) {
@@ -4508,9 +4513,8 @@ ${js}`
4508
4513
  if (lhs.type === "NewExpression") {
4509
4514
  let { expression } = lhs;
4510
4515
  return expression = {
4511
- ...expression,
4512
4516
  type: "CallExpression",
4513
- children: [...expression.children, call]
4517
+ children: [expression, call]
4514
4518
  }, {
4515
4519
  ...lhs,
4516
4520
  expression,
@@ -4556,13 +4560,13 @@ ${js}`
4556
4560
  ];
4557
4561
  }
4558
4562
  function processPipelineExpressions(statements) {
4559
- gatherRecursiveAll(statements, (n) => n.type === "PipelineExpression").forEach((s) => {
4560
- let [ws, , body] = s.children, [, arg] = s.children, i = 0, l = body.length, children = [ws], comma = blockContainingStatement(s) ? ";" : ",", usingRef = null;
4561
- for (let i1 = 0, len3 = body.length; i1 < len3; i1++) {
4562
- let i2 = i1, step = body[i1], [leadingComment, pipe, trailingComment, expr] = step, returns = pipe.token === "||>", ref, result, returning = returns ? arg : null;
4563
+ for (let ref1 = gatherRecursiveAll(statements, ($1) => $1.type === "PipelineExpression"), i1 = 0, len3 = ref1.length; i1 < len3; i1++) {
4564
+ let s = ref1[i1], [ws, , body] = s.children, [, arg] = s.children, children = [ws], comma = blockContainingStatement(s) ? ";" : ",", usingRef = null;
4565
+ for (let i2 = 0, len1 = body.length; i2 < len1; i2++) {
4566
+ let i = i2, step = body[i2], [leadingComment, pipe, trailingComment, expr] = step, returns = pipe.token === "||>", ref, result, returning = returns ? arg : null;
4563
4567
  if (pipe.token === "|>=") {
4564
4568
  let initRef;
4565
- if (i2 === 0) {
4569
+ if (i === 0) {
4566
4570
  switch (checkValidLHS(arg), arg.type) {
4567
4571
  case "MemberExpression":
4568
4572
  if (arg.children.length <= 2)
@@ -4600,7 +4604,7 @@ ${js}`
4600
4604
  message: "Can't use |>= in the middle of a pipeline"
4601
4605
  });
4602
4606
  } else
4603
- i2 === 0 && (s.children = children);
4607
+ i === 0 && (s.children = children);
4604
4608
  if (returns && (ref = needsRef(arg)) && (usingRef = usingRef || ref, arg = {
4605
4609
  type: "ParenthesizedExpression",
4606
4610
  children: ["(", {
@@ -4616,7 +4620,7 @@ ${js}`
4616
4620
  arg,
4617
4621
  returning
4618
4622
  ), result.type === "ReturnStatement") {
4619
- i2 < l - 1 && result.children.push({
4623
+ i < body.length - 1 && result.children.push({
4620
4624
  type: "Error",
4621
4625
  message: "Can't continue a pipeline after returning"
4622
4626
  }), arg = result, children[children.length - 1] === "," && (children.pop(), children.push(";"));
@@ -4628,15 +4632,15 @@ ${js}`
4628
4632
  type: "Declaration",
4629
4633
  children: ["let ", usingRef],
4630
4634
  names: []
4631
- }), children.push(arg), !children.some(($1) => $1?.type === "ReturnStatement") && children.some(($2) => $2 === ",")) {
4635
+ }), children.push(arg), !children.some(($2) => $2?.type === "ReturnStatement") && children.some(($3) => $3 === ",")) {
4632
4636
  let { parent } = s, parenthesizedExpression = makeLeftHandSideExpression({ ...s });
4633
4637
  Object.assign(s, parenthesizedExpression, {
4634
4638
  parent,
4635
4639
  hoistDec: void 0
4636
4640
  });
4637
4641
  }
4638
- return addParentPointers(s, s.parent);
4639
- });
4642
+ addParentPointers(s, s.parent);
4643
+ }
4640
4644
  }
4641
4645
 
4642
4646
  // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\for.civet.jsx
@@ -5452,15 +5456,24 @@ ${js}`
5452
5456
  let i = i2, arg = args[i2];
5453
5457
  isComma(arg) && (arg = args[i] = deepCopy(arg), isComma(arg).token = `)${op.token}(`, commaCount++);
5454
5458
  }
5455
- if (args.length && (children.splice(
5456
- 0,
5457
- 2,
5458
- commaCount ? {
5459
- type: "ParenthesizedExpression",
5460
- children: ["(", ...call.children, ")"]
5461
- } : { ...call, type: "ParenthesizedExpression" }
5462
- ), children.length === 1))
5463
- return children[0];
5459
+ if (args.length) {
5460
+ if (commaCount)
5461
+ children.splice(0, 2, {
5462
+ type: "ParenthesizedExpression",
5463
+ children: ["(", call.children, ")"],
5464
+ expression: call.children
5465
+ });
5466
+ else {
5467
+ let middle = call.children.slice(1, -1), ref2;
5468
+ children.splice(0, 2, {
5469
+ type: "ParenthesizedExpression",
5470
+ expression: middle,
5471
+ children: [call.children[0], middle, (ref2 = call.children)[ref2.length - 1]]
5472
+ });
5473
+ }
5474
+ if (children.length === 1)
5475
+ return children[0];
5476
+ }
5464
5477
  }
5465
5478
  for (let i3 = 0, len22 = children.length; i3 < len22; i3++) {
5466
5479
  let i = i3, glob = children[i3];
@@ -5518,13 +5531,13 @@ ${js}`
5518
5531
  usesRef: !!ref
5519
5532
  });
5520
5533
  }
5521
- let ref2, object = {
5534
+ let ref3, object = {
5522
5535
  type: "ObjectExpression",
5523
5536
  children: [
5524
5537
  glob.object.children[0],
5525
5538
  // {
5526
5539
  ...parts,
5527
- (ref2 = glob.object.children)[ref2.length - 1]
5540
+ (ref3 = glob.object.children)[ref3.length - 1]
5528
5541
  // whitespace and }
5529
5542
  ],
5530
5543
  properties: parts
@@ -5579,7 +5592,7 @@ ${js}`
5579
5592
  ]
5580
5593
  })
5581
5594
  ]
5582
- }), ref3;
5595
+ }), ref4;
5583
5596
  return processCallMemberExpression({
5584
5597
  // in case there are more
5585
5598
  ...node,
@@ -5593,7 +5606,7 @@ ${js}`
5593
5606
  glob.children[0],
5594
5607
  // "[" token
5595
5608
  call,
5596
- (ref3 = glob.children)[ref3.length - 1]
5609
+ (ref4 = glob.children)[ref4.length - 1]
5597
5610
  // "]" token
5598
5611
  ]
5599
5612
  }),
@@ -5605,7 +5618,7 @@ ${js}`
5605
5618
  { ...node, children: node.children.slice(0, i) },
5606
5619
  { ...glob.children[0], token: ", " },
5607
5620
  ...glob.children.slice(1, -1)
5608
- ], ref4, rsliceCall = makeNode({
5621
+ ], ref5, rsliceCall = makeNode({
5609
5622
  type: "CallExpression",
5610
5623
  implicit: !0,
5611
5624
  children: [
@@ -5616,7 +5629,7 @@ ${js}`
5616
5629
  children: [
5617
5630
  "(",
5618
5631
  args,
5619
- (ref4 = glob.children)[ref4.length - 1]
5632
+ (ref5 = glob.children)[ref5.length - 1]
5620
5633
  ]
5621
5634
  })
5622
5635
  ]
@@ -5673,7 +5686,7 @@ ${js}`
5673
5686
  if (specifier.ts)
5674
5687
  return { type: "Error", message: "cannot use `type` in dynamic import" };
5675
5688
  {
5676
- let { source, binding } = specifier, ref5, delim = (ref5 = specifier.children)[ref5.length - 1];
5689
+ let { source, binding } = specifier, ref6, delim = (ref6 = specifier.children)[ref6.length - 1];
5677
5690
  return {
5678
5691
  type: pattern ? "BindingProperty" : "Property",
5679
5692
  name: source,
@@ -5682,7 +5695,7 @@ ${js}`
5682
5695
  children: source === binding ? [source, delim] : [source, ":", binding, delim]
5683
5696
  };
5684
5697
  }
5685
- }), ref6;
5698
+ }), ref7;
5686
5699
  return {
5687
5700
  type: pattern ? "ObjectBindingPattern" : "ObjectExpression",
5688
5701
  names: node.names,
@@ -5691,7 +5704,7 @@ ${js}`
5691
5704
  node.children[0],
5692
5705
  // {
5693
5706
  properties,
5694
- (ref6 = node.children)[ref6.length - 1]
5707
+ (ref7 = node.children)[ref7.length - 1]
5695
5708
  // }
5696
5709
  ]
5697
5710
  };
@@ -5775,7 +5788,7 @@ ${js}`
5775
5788
  );
5776
5789
  }
5777
5790
  function processAssignments(statements) {
5778
- for (let ref7 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len3 = ref7.length; i5 < len3; i5++) {
5791
+ for (let ref8 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len3 = ref8.length; i5 < len3; i5++) {
5779
5792
  let extractAssignment = function(lhs) {
5780
5793
  let expr = lhs;
5781
5794
  for (; expr.type === "ParenthesizedExpression"; )
@@ -5783,25 +5796,25 @@ ${js}`
5783
5796
  let m1;
5784
5797
  if (m1 = expr.type, m1 === "AssignmentExpression" || m1 === "UpdateExpression")
5785
5798
  return expr.type === "UpdateExpression" && expr.children[0] === expr.assigned ? (pre.push("("), post.push([", ", lhs, ")"])) : (pre.push(["(", lhs, ", "]), post.push(")")), expr.assigned;
5786
- }, exp = ref7[i5];
5799
+ }, exp = ref8[i5];
5787
5800
  checkValidLHS(exp.assigned);
5788
- let pre = [], post = [], ref8;
5801
+ let pre = [], post = [], ref9;
5789
5802
  switch (exp.type) {
5790
5803
  case "AssignmentExpression": {
5791
5804
  if (!exp.lhs)
5792
5805
  continue;
5793
- for (let ref9 = exp.lhs, i6 = 0, len4 = ref9.length; i6 < len4; i6++) {
5794
- let lhsPart = ref9[i6], ref10;
5795
- if (ref10 = extractAssignment(lhsPart[1])) {
5796
- let newLhs = ref10;
5806
+ for (let ref10 = exp.lhs, i6 = 0, len4 = ref10.length; i6 < len4; i6++) {
5807
+ let lhsPart = ref10[i6], ref11;
5808
+ if (ref11 = extractAssignment(lhsPart[1])) {
5809
+ let newLhs = ref11;
5797
5810
  lhsPart[1] = newLhs;
5798
5811
  }
5799
5812
  }
5800
5813
  break;
5801
5814
  }
5802
5815
  case "UpdateExpression": {
5803
- if (ref8 = extractAssignment(exp.assigned)) {
5804
- let newLhs = ref8, i = exp.children.indexOf(exp.assigned);
5816
+ if (ref9 = extractAssignment(exp.assigned)) {
5817
+ let newLhs = ref9, i = exp.children.indexOf(exp.assigned);
5805
5818
  exp.assigned = exp.children[i] = newLhs;
5806
5819
  }
5807
5820
  break;
@@ -5816,19 +5829,19 @@ ${js}`
5816
5829
  }), replaceNode(exp, newMemberExp));
5817
5830
  }
5818
5831
  }
5819
- for (let ref11 = gatherRecursiveAll(statements, ($6) => $6.type === "AssignmentExpression"), i7 = 0, len5 = ref11.length; i7 < len5; i7++) {
5820
- let exp = ref11[i7];
5832
+ for (let ref12 = gatherRecursiveAll(statements, ($6) => $6.type === "AssignmentExpression"), i7 = 0, len5 = ref12.length; i7 < len5; i7++) {
5833
+ let exp = ref12[i7];
5821
5834
  if (exp.names !== null)
5822
5835
  continue;
5823
- let { lhs: $1, expression: $2 } = exp, tail = [], len3 = $1.length, block, ref12;
5824
- if (blockContainingStatement(exp) && !(ref12 = $1[$1.length - 1])?.[ref12.length - 1]?.special) {
5836
+ let { lhs: $1, expression: $2 } = exp, tail = [], len3 = $1.length, block, ref13;
5837
+ if (blockContainingStatement(exp) && !(ref13 = $1[$1.length - 1])?.[ref13.length - 1]?.special) {
5825
5838
  block = makeBlockFragment();
5826
- let ref13;
5827
- if (ref13 = prependStatementExpressionBlock(
5839
+ let ref14;
5840
+ if (ref14 = prependStatementExpressionBlock(
5828
5841
  { type: "Initializer", expression: $2, children: [void 0, void 0, $2] },
5829
5842
  block
5830
5843
  )) {
5831
- let ref = ref13;
5844
+ let ref = ref14;
5832
5845
  exp.children = exp.children.map(($7) => $7 === $2 ? ref : $7), $2 = ref;
5833
5846
  } else
5834
5847
  block = void 0;
@@ -5931,9 +5944,9 @@ ${js}`
5931
5944
  }
5932
5945
  j++;
5933
5946
  }
5934
- let ref14;
5935
- if (ref14 = conditions.length) {
5936
- let l = ref14, cs = flatJoin(conditions, " && ");
5947
+ let ref15;
5948
+ if (ref15 = conditions.length) {
5949
+ let l = ref15, cs = flatJoin(conditions, " && ");
5937
5950
  return {
5938
5951
  ...exp,
5939
5952
  children: [...cs, " ? ", innerExp(children), " : void 0"],
@@ -5965,8 +5978,8 @@ ${js}`
5965
5978
  }
5966
5979
  function processTypes(node) {
5967
5980
  let results1 = [];
5968
- for (let ref15 = gatherRecursiveAll(node, ($11) => $11.type === "TypeUnary"), i8 = 0, len6 = ref15.length; i8 < len6; i8++) {
5969
- let unary = ref15[i8], suffixIndex = unary.suffix.length - 1, results2 = [];
5981
+ for (let ref16 = gatherRecursiveAll(node, ($11) => $11.type === "TypeUnary"), i8 = 0, len6 = ref16.length; i8 < len6; i8++) {
5982
+ let unary = ref16[i8], suffixIndex = unary.suffix.length - 1, results2 = [];
5970
5983
  for (; suffixIndex >= 0; ) {
5971
5984
  let suffix = unary.suffix[suffixIndex];
5972
5985
  if (typeof suffix == "object" && suffix != null && "token" in suffix && suffix.token === "?") {
@@ -6027,9 +6040,9 @@ ${js}`
6027
6040
  unary.prefix = [], unary.children = unary.children.filter((a2) => a2 !== prefix);
6028
6041
  let outer = unary.suffix.splice(suffixIndex + 1, 1 / 0), space = getTrimmingSpace(unary);
6029
6042
  inplaceInsertTrimmingSpace(unary, "");
6030
- let ref16;
6031
- unary.suffix.length ? ref16 = unary : ref16 = unary.t;
6032
- let t = ref16, argArray = [makeNode({
6043
+ let ref17;
6044
+ unary.suffix.length ? ref17 = unary : ref17 = unary.t;
6045
+ let t = ref17, argArray = [makeNode({
6033
6046
  type: "TypeArgument",
6034
6047
  ts: !0,
6035
6048
  t,
@@ -6065,16 +6078,16 @@ ${js}`
6065
6078
  return results1;
6066
6079
  }
6067
6080
  function processStatementExpressions(statements) {
6068
- for (let ref17 = gatherRecursiveAll(statements, ($12) => $12.type === "StatementExpression"), i9 = 0, len7 = ref17.length; i9 < len7; i9++) {
6069
- let exp = ref17[i9], { maybe, statement } = exp;
6081
+ for (let ref18 = gatherRecursiveAll(statements, ($12) => $12.type === "StatementExpression"), i9 = 0, len7 = ref18.length; i9 < len7; i9++) {
6082
+ let exp = ref18[i9], { maybe, statement } = exp;
6070
6083
  if ((maybe || statement.type === "ThrowStatement") && blockContainingStatement(exp)) {
6071
6084
  replaceNode(exp, statement);
6072
6085
  continue;
6073
6086
  }
6074
- let ref18;
6087
+ let ref19;
6075
6088
  switch (statement.type) {
6076
6089
  case "IfStatement": {
6077
- (ref18 = expressionizeIfStatement(statement)) ? replaceNode(statement, ref18, exp) : replaceNode(statement, wrapIIFE([["", statement]]), exp);
6090
+ (ref19 = expressionizeIfStatement(statement)) ? replaceNode(statement, ref19, exp) : replaceNode(statement, wrapIIFE([["", statement]]), exp);
6078
6091
  break;
6079
6092
  }
6080
6093
  case "IterationExpression": {
@@ -6115,11 +6128,11 @@ ${js}`
6115
6128
  });
6116
6129
  }
6117
6130
  function processFinallyClauses(statements) {
6118
- for (let ref19 = gatherRecursiveAll(statements, ($) => $.type === "FinallyClause" && $.parent?.type !== "TryStatement"), i10 = 0, len8 = ref19.length; i10 < len8; i10++) {
6119
- let f = ref19[i10], ref20;
6120
- if (!((ref20 = blockContainingStatement(f)) && typeof ref20 == "object" && "block" in ref20 && "index" in ref20))
6131
+ for (let ref20 = gatherRecursiveAll(statements, ($) => $.type === "FinallyClause" && $.parent?.type !== "TryStatement"), i10 = 0, len8 = ref20.length; i10 < len8; i10++) {
6132
+ let f = ref20[i10], ref21;
6133
+ if (!((ref21 = blockContainingStatement(f)) && typeof ref21 == "object" && "block" in ref21 && "index" in ref21))
6121
6134
  throw new Error("finally clause must be inside try statement or block");
6122
- let { block, index } = ref20, indent = block.expressions[index][0], expressions = block.expressions.slice(index + 1), t = makeNode({
6135
+ let { block, index } = ref21, indent = block.expressions[index][0], expressions = block.expressions.slice(index + 1), t = makeNode({
6123
6136
  type: "BlockStatement",
6124
6137
  expressions,
6125
6138
  children: ["{", expressions, "}"],
@@ -6179,8 +6192,8 @@ ${js}`
6179
6192
  }
6180
6193
  }
6181
6194
  function processCoffeeClasses(statements) {
6182
- for (let ref21 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0, len9 = ref21.length; i11 < len9; i11++) {
6183
- let ce = ref21[i11], { expressions } = ce.body, indent = expressions[0]?.[0] ?? `
6195
+ for (let ref22 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0, len9 = ref22.length; i11 < len9; i11++) {
6196
+ let ce = ref22[i11], { expressions } = ce.body, indent = expressions[0]?.[0] ?? `
6184
6197
  `, autoBinds = expressions.filter(($14) => $14[1]?.autoBind);
6185
6198
  if (autoBinds.length) {
6186
6199
  let construct;
@@ -6270,23 +6283,23 @@ ${js}`
6270
6283
  }
6271
6284
  function processRepl(root, rootIIFE) {
6272
6285
  let topBlock = gatherRecursive(rootIIFE, ($17) => $17.type === "BlockStatement")[0], i = 0;
6273
- for (let ref22 = gatherRecursiveWithinFunction(topBlock, ($18) => $18.type === "Declaration"), i14 = 0, len11 = ref22.length; i14 < len11; i14++) {
6274
- let decl = ref22[i14];
6286
+ for (let ref23 = gatherRecursiveWithinFunction(topBlock, ($18) => $18.type === "Declaration"), i14 = 0, len11 = ref23.length; i14 < len11; i14++) {
6287
+ let decl = ref23[i14];
6275
6288
  decl.names?.length && (decl.parent === topBlock || decl.decl === "var") && (decl.children.shift(), decl.bindings[0]?.pattern?.type === "ObjectBindingPattern" && (decl.children.unshift("("), decl.children.push(")")), root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")}`, ";"]));
6276
6289
  }
6277
- for (let ref23 = gatherRecursive(topBlock, ($19) => $19.type === "FunctionExpression"), i15 = 0, len12 = ref23.length; i15 < len12; i15++) {
6278
- let func = ref23[i15];
6290
+ for (let ref24 = gatherRecursive(topBlock, ($19) => $19.type === "FunctionExpression"), i15 = 0, len12 = ref24.length; i15 < len12; i15++) {
6291
+ let func = ref24[i15];
6279
6292
  func.name && func.parent?.type === "BlockStatement" && (func.parent === topBlock ? (replaceNode(func, void 0), root.expressions.splice(i++, 0, ["", func]), func.parent = root) : (func.children.unshift(func.name, "="), root.expressions.splice(i++, 0, ["", `var ${func.name}`, ";"])));
6280
6293
  }
6281
- for (let ref24 = gatherRecursiveWithinFunction(topBlock, ($20) => $20.type === "ClassExpression"), i16 = 0, len13 = ref24.length; i16 < len13; i16++) {
6282
- let classExp = ref24[i16], m8;
6294
+ for (let ref25 = gatherRecursiveWithinFunction(topBlock, ($20) => $20.type === "ClassExpression"), i16 = 0, len13 = ref25.length; i16 < len13; i16++) {
6295
+ let classExp = ref25[i16], m8;
6283
6296
  (classExp.name && classExp.parent === topBlock || (m8 = classExp.parent, typeof m8 == "object" && m8 != null && "type" in m8 && m8.type === "ReturnStatement" && "parent" in m8 && m8.parent === topBlock)) && (classExp.children.unshift(classExp.name, "="), root.expressions.splice(i++, 0, ["", `var ${classExp.name}`, ";"]));
6284
6297
  }
6285
6298
  }
6286
6299
  function processPlaceholders(statements) {
6287
6300
  let placeholderMap = /* @__PURE__ */ new Map(), liftedIfs = /* @__PURE__ */ new Set();
6288
- for (let ref25 = gatherRecursiveAll(statements, ($21) => $21.type === "Placeholder"), i17 = 0, len14 = ref25.length; i17 < len14; i17++) {
6289
- let exp = ref25[i17], ancestor;
6301
+ for (let ref26 = gatherRecursiveAll(statements, ($21) => $21.type === "Placeholder"), i17 = 0, len14 = ref26.length; i17 < len14; i17++) {
6302
+ let exp = ref26[i17], ancestor;
6290
6303
  if (exp.subtype === ".") {
6291
6304
  ({ ancestor } = findAncestor(
6292
6305
  exp,
@@ -6358,8 +6371,8 @@ ${js}`
6358
6371
  for (let i18 = 0, len15 = placeholders.length; i18 < len15; i18++) {
6359
6372
  let placeholder = placeholders[i18];
6360
6373
  typeSuffix ??= placeholder.typeSuffix;
6361
- let ref26;
6362
- (ref26 = placeholder.children)[ref26.length - 1] = ref;
6374
+ let ref27;
6375
+ (ref27 = placeholder.children)[ref27.length - 1] = ref;
6363
6376
  }
6364
6377
  let { parent } = ancestor, body = maybeUnwrap(ancestor), fnExp = makeAmpersandFunction({ ref, typeSuffix, body }), outer;
6365
6378
  switch (parent?.type) {
@@ -6376,8 +6389,8 @@ ${js}`
6376
6389
  break;
6377
6390
  }
6378
6391
  case "PipelineExpression": {
6379
- let i = findChildIndex(parent, ancestor), ref27;
6380
- i === 1 ? ref27 = ancestor === parent.children[i] : i === 2 ? ref27 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3] : ref27 = void 0, outer = ref27;
6392
+ let i = findChildIndex(parent, ancestor), ref28;
6393
+ i === 1 ? ref28 = ancestor === parent.children[i] : i === 2 ? ref28 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3] : ref28 = void 0, outer = ref28;
6381
6394
  break;
6382
6395
  }
6383
6396
  case "AssignmentExpression":
@@ -6388,10 +6401,10 @@ ${js}`
6388
6401
  break;
6389
6402
  }
6390
6403
  }
6391
- outer || (fnExp = makeLeftHandSideExpression(fnExp)), replaceNode(ancestor, fnExp, parent);
6392
- let ref28;
6393
- if (ref28 = getTrimmingSpace(body)) {
6394
- let ws = ref28;
6404
+ outer || (fnExp = makeLeftHandSideExpression(fnExp)), replaceNode(ancestor, fnExp, parent), typeof parent == "object" && parent != null && "type" in parent && parent.type === "BlockStatement" && "parent" in parent && typeof parent.parent == "object" && parent.parent != null && "type" in parent.parent && parent.parent.type === "ArrowFunction" && "ampersandBlock" in parent.parent && parent.parent.ampersandBlock === !0 && "body" in parent.parent && parent.parent.body === body && (parent.parent.body = fnExp);
6405
+ let ref29;
6406
+ if (ref29 = getTrimmingSpace(body)) {
6407
+ let ws = ref29;
6395
6408
  inplaceInsertTrimmingSpace(body, ""), inplacePrepend(ws, fnExp);
6396
6409
  }
6397
6410
  }
@@ -6422,8 +6435,8 @@ ${js}`
6422
6435
  }
6423
6436
  ];
6424
6437
  }
6425
- let ref29;
6426
- Array.isArray(rest.delim) && (ref29 = rest.delim)[ref29.length - 1]?.token === "," && (rest.delim = rest.delim.slice(0, -1), rest.children = [...rest.children.slice(0, -1), rest.delim]);
6438
+ let ref30;
6439
+ Array.isArray(rest.delim) && (ref30 = rest.delim)[ref30.length - 1]?.token === "," && (rest.delim = rest.delim.slice(0, -1), rest.children = [...rest.children.slice(0, -1), rest.delim]);
6427
6440
  let children = [...props, ...after, rest];
6428
6441
  return restCount > 1 && children.push({
6429
6442
  type: "Error",
@@ -6614,6 +6627,7 @@ ${js}`
6614
6627
  ExplicitPropertyGlob,
6615
6628
  PropertyGlob,
6616
6629
  PropertyBind,
6630
+ PropertyBindExplicitArguments,
6617
6631
  SuperProperty,
6618
6632
  MetaProperty,
6619
6633
  ReturnValue,
@@ -7676,10 +7690,14 @@ ${js}`
7676
7690
  function IsLike(ctx, state2) {
7677
7691
  return (0, import_lib2.$EVENT)(ctx, state2, "IsLike", IsLike$0);
7678
7692
  }
7679
- 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) {
7693
+ var WRHS$0 = (0, import_lib2.$T)((0, import_lib2.$S)(NestedBulletedArray), function(value) {
7694
+ return [void 0, value[0]];
7695
+ }), WRHS$1 = (0, import_lib2.$T)((0, import_lib2.$S)(NestedImplicitObjectLiteral), function(value) {
7696
+ return [void 0, value[0]];
7697
+ }), WRHS$2 = (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) {
7680
7698
  var wrhs = $2;
7681
7699
  return wrhs || $skip;
7682
- }), WRHS$1 = (0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$S)(EOS, __), _), RHS), WRHS$$ = [WRHS$0, WRHS$1];
7700
+ }), WRHS$3 = (0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$S)(EOS, __), _), RHS), WRHS$$ = [WRHS$0, WRHS$1, WRHS$2, WRHS$3];
7683
7701
  function WRHS(ctx, state2) {
7684
7702
  return (0, import_lib2.$EVENT_C)(ctx, state2, "WRHS", WRHS$$);
7685
7703
  }
@@ -7774,11 +7792,12 @@ ${js}`
7774
7792
  function NWTypePostfix(ctx, state2) {
7775
7793
  return (0, import_lib2.$EVENT_C)(ctx, state2, "NWTypePostfix", NWTypePostfix$$);
7776
7794
  }
7777
- var UpdateExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UpdateExpressionSymbol, UnaryWithoutParenthesizedAssignment), function($skip, $loc, $0, $1, $2) {
7795
+ var UpdateExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UpdateExpressionSymbol, (0, import_lib2.$N)(Whitespace), UnaryWithoutParenthesizedAssignment), function($skip, $loc, $0, $1, $2, $3) {
7796
+ var symbol = $1, assigned = $3;
7778
7797
  return {
7779
7798
  type: "UpdateExpression",
7780
- assigned: $2,
7781
- children: $0
7799
+ assigned,
7800
+ children: [symbol, assigned]
7782
7801
  };
7783
7802
  }), 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) {
7784
7803
  return $2 ? {
@@ -8008,20 +8027,22 @@ ${js}`
8008
8027
  function PipelineHeadItem(ctx, state2) {
8009
8028
  return (0, import_lib2.$EVENT_C)(ctx, state2, "PipelineHeadItem", PipelineHeadItem$$);
8010
8029
  }
8011
- var PipelineTailItem$0 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$C)(AwaitOp, Yield, Return, Throw), (0, import_lib2.$N)(AccessStart), (0, import_lib2.$N)(MaybeParenNestedExpression)), function(value) {
8030
+ var PipelineTailItem$0 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$C)(AwaitOp, Return, Throw), (0, import_lib2.$N)(AccessStart), (0, import_lib2.$N)(MaybeParenNestedExpression)), function(value) {
8012
8031
  return value[0];
8013
- }), PipelineTailItem$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L15, 'PipelineTailItem "import"'), (0, import_lib2.$N)(AccessStart)), function($skip, $loc, $0, $1, $2) {
8032
+ }), PipelineTailItem$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$TEXT)((0, import_lib2.$S)(Yield, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$E)(_), Star)))), (0, import_lib2.$N)(AccessStart), (0, import_lib2.$N)(MaybeParenNestedExpression)), function($skip, $loc, $0, $1, $2, $3) {
8033
+ return { $loc, token: $1, type: "Yield" };
8034
+ }), PipelineTailItem$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L15, 'PipelineTailItem "import"'), (0, import_lib2.$N)(AccessStart)), function($skip, $loc, $0, $1, $2) {
8014
8035
  return {
8015
8036
  type: "Identifier",
8016
8037
  children: [$1]
8017
8038
  };
8018
- }), PipelineTailItem$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(NWTypePostfix, (0, import_lib2.$Q)(TypePostfix)), function($skip, $loc, $0, $1, $2) {
8039
+ }), PipelineTailItem$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(NWTypePostfix, (0, import_lib2.$Q)(TypePostfix)), function($skip, $loc, $0, $1, $2) {
8019
8040
  return makeAmpersandFunction({
8020
8041
  body: [" ", $1, ...$2]
8021
8042
  });
8022
- }), PipelineTailItem$3 = (0, import_lib2.$T)((0, import_lib2.$S)(PipelineHeadItem), function(value) {
8043
+ }), PipelineTailItem$4 = (0, import_lib2.$T)((0, import_lib2.$S)(PipelineHeadItem), function(value) {
8023
8044
  return value[0];
8024
- }), PipelineTailItem$$ = [PipelineTailItem$0, PipelineTailItem$1, PipelineTailItem$2, PipelineTailItem$3];
8045
+ }), PipelineTailItem$$ = [PipelineTailItem$0, PipelineTailItem$1, PipelineTailItem$2, PipelineTailItem$3, PipelineTailItem$4];
8025
8046
  function PipelineTailItem(ctx, state2) {
8026
8047
  return (0, import_lib2.$EVENT_C)(ctx, state2, "PipelineTailItem", PipelineTailItem$$);
8027
8048
  }
@@ -8822,6 +8843,20 @@ ${js}`
8822
8843
  function PropertyBind(ctx, state2) {
8823
8844
  return (0, import_lib2.$EVENT)(ctx, state2, "PropertyBind", PropertyBind$0);
8824
8845
  }
8846
+ var PropertyBindExplicitArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(PropertyAccessModifier), At, OptionalDot, (0, import_lib2.$C)(IdentifierName, PrivateIdentifier), (0, import_lib2.$E)(ExplicitArguments)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
8847
+ var modifier = $1, dot = $3, id = $4, args = $5;
8848
+ return {
8849
+ type: "PropertyBind",
8850
+ name: id.name,
8851
+ children: [modifier, dot, id],
8852
+ // omit `@` from children
8853
+ args: args?.children.slice(1, -1) ?? []
8854
+ // remove the parens from the arg list, or give an empty list
8855
+ };
8856
+ });
8857
+ function PropertyBindExplicitArguments(ctx, state2) {
8858
+ return (0, import_lib2.$EVENT)(ctx, state2, "PropertyBindExplicitArguments", PropertyBindExplicitArguments$0);
8859
+ }
8825
8860
  var SuperProperty$0 = (0, import_lib2.$S)(Super, MemberBracketContent), SuperProperty$1 = (0, import_lib2.$S)(Super, (0, import_lib2.$N)(PropertyAccessModifier), PropertyAccess), SuperProperty$$ = [SuperProperty$0, SuperProperty$1];
8826
8861
  function SuperProperty(ctx, state2) {
8827
8862
  return (0, import_lib2.$EVENT_C)(ctx, state2, "SuperProperty", SuperProperty$$);
@@ -9355,11 +9390,12 @@ ${js}`
9355
9390
  signature,
9356
9391
  ts: !0
9357
9392
  };
9358
- }), FunctionExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(ArrowFunction), OpenParen, BinaryOp, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4) {
9359
- var open = $2, op = $3, close = $4;
9393
+ }), FunctionExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(ArrowFunction), OpenParen, __, BinaryOp, __, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
9394
+ var open = $2, ws1 = $3, op = $4, ws2 = $5, close = $6;
9360
9395
  if (op.special && op.call && !op.negated) return op.call;
9396
+ ws1 || (ws1 = op.spaced ? [" "] : []), ws2 || (ws2 = op.spaced ? [" "] : []);
9361
9397
  let refA = makeRef("a"), refB = makeRef("b"), body = processBinaryOpExpression([refA, [
9362
- [[], op, [], refB]
9398
+ [ws1, op, ws2, refB]
9363
9399
  // BinaryOpRHS
9364
9400
  ]]), parameterList = [[refA, ","], refB], parameters = {
9365
9401
  type: "Parameters",
@@ -9382,6 +9418,7 @@ ${js}`
9382
9418
  };
9383
9419
  }), FunctionExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, NonPipelineAssignmentExpression, __, BinaryOp, __, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
9384
9420
  var open = $1, lhs = $2, ws1 = $3, op = $4, ws2 = $5, close = $6;
9421
+ ws1 || (ws1 = op.spaced ? [" "] : []), ws2 || (ws2 = op.spaced ? [" "] : []);
9385
9422
  let refB = makeRef("b"), fn = makeAmpersandFunction({
9386
9423
  ref: refB,
9387
9424
  body: processBinaryOpExpression([lhs, [
@@ -9429,6 +9466,7 @@ ${js}`
9429
9466
  };
9430
9467
  }), FunctionExpression$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, __, (0, import_lib2.$N)((0, import_lib2.$EXPECT)($R15, "FunctionExpression /\\+\\+|--|\u29FA|\u2014|[\\+\\-&]\\S/")), (0, import_lib2.$N)((0, import_lib2.$S)(Placeholder, (0, import_lib2.$C)(TypePostfix, BinaryOpRHS))), BinaryOp, __, NonPipelineAssignmentExpression, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
9431
9468
  var open = $1, ws1 = $2, op = $5, ws2 = $6, rhs = $7, close = $8;
9469
+ ws1 || (ws1 = op.spaced ? [" "] : []), ws2 || (ws2 = op.spaced ? [" "] : []);
9432
9470
  let refA = makeRef("a"), fn = makeAmpersandFunction({
9433
9471
  ref: refA,
9434
9472
  body: processBinaryOpExpression([refA, [
@@ -9447,10 +9485,7 @@ ${js}`
9447
9485
  }
9448
9486
  var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (0, import_lib2.$E)(OperatorBehavior), _, LexicalDeclaration), function($skip, $loc, $0, $1, $2, $3, $4) {
9449
9487
  var op = $1, behavior = $2, w = $3, decl = $4;
9450
- return decl.names.forEach((name) => state.operators.set(name, behavior)), {
9451
- ...decl,
9452
- children: [trimFirstSpace(w), ...decl.children]
9453
- };
9488
+ return decl.names.forEach((name) => state.operators.set(name, behavior)), behavior?.error && (decl = prepend(behavior.error, decl)), decl = prepend(trimFirstSpace(w), decl), decl;
9454
9489
  }), OperatorDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OperatorSignature, BracedBlock), function($skip, $loc, $0, $1, $2) {
9455
9490
  var signature = $1, block = $2;
9456
9491
  return state.operators.set(signature.id.name, signature.behavior), {
@@ -9463,9 +9498,12 @@ ${js}`
9463
9498
  };
9464
9499
  }), OperatorDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, _, Identifier, (0, import_lib2.$E)(OperatorBehavior), (0, import_lib2.$Q)((0, import_lib2.$S)(CommaDelimiter, (0, import_lib2.$E)(_), Identifier, (0, import_lib2.$E)(OperatorBehavior)))), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
9465
9500
  var op = $1, w1 = $2, id = $3, behavior = $4, ids = $5;
9466
- return state.operators.set(id.name, behavior), ids.forEach(([, , id2, behavior2]) => state.operators.set(id2.name, behavior2)), {
9501
+ let children = [];
9502
+ return state.operators.set(id.name, behavior), behavior?.error && children.push(behavior.error), ids.forEach(([, , id2, behavior2]) => {
9503
+ state.operators.set(id2.name, behavior2), behavior2?.error && children.push(behavior2.error);
9504
+ }), {
9467
9505
  id,
9468
- children: []
9506
+ children
9469
9507
  };
9470
9508
  }), OperatorDeclaration$$ = [OperatorDeclaration$0, OperatorDeclaration$1, OperatorDeclaration$2];
9471
9509
  function OperatorDeclaration(ctx, state2) {
@@ -9486,7 +9524,7 @@ ${js}`
9486
9524
  generator: !!generator.length
9487
9525
  },
9488
9526
  block: null,
9489
- children: [async, func, generator, w1, id, w2, parameters, returnType],
9527
+ children: [async, func, generator, w1, id, behavior?.error, w2, parameters, returnType],
9490
9528
  behavior
9491
9529
  };
9492
9530
  });
@@ -9503,16 +9541,19 @@ ${js}`
9503
9541
  }
9504
9542
  var OperatorPrecedence$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), (0, import_lib2.$C)((0, import_lib2.$EXPECT)($L27, 'OperatorPrecedence "tighter"'), (0, import_lib2.$EXPECT)($L28, 'OperatorPrecedence "looser"'), (0, import_lib2.$EXPECT)($L29, 'OperatorPrecedence "same"')), NonIdContinue, (0, import_lib2.$E)(_), (0, import_lib2.$C)(Identifier, (0, import_lib2.$S)(OpenParen, BinaryOp, CloseParen))), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
9505
9543
  var mod = $2, op = $5;
9506
- let prec = op.type === "Identifier" ? state.operators.get(op.name).prec : getPrecedence(op[1]);
9507
- switch (mod) {
9544
+ let prec, error;
9545
+ switch (op.type === "Identifier" ? state.operators.has(op.name) ? prec = state.operators.get(op.name).prec : (prec = precedenceCustomDefault, error = {
9546
+ type: "Error",
9547
+ message: `Precedence refers to unknown operator ${op.name}`
9548
+ }) : prec = getPrecedence(op[1]), mod) {
9508
9549
  case "tighter":
9509
- prec += 1 / 64;
9550
+ prec += precedenceStep;
9510
9551
  break;
9511
9552
  case "looser":
9512
- prec -= 1 / 64;
9553
+ prec -= precedenceStep;
9513
9554
  break;
9514
9555
  }
9515
- return { prec };
9556
+ return { prec, error };
9516
9557
  });
9517
9558
  function OperatorPrecedence(ctx, state2) {
9518
9559
  return (0, import_lib2.$EVENT)(ctx, state2, "OperatorPrecedence", OperatorPrecedence$0);
@@ -10926,6 +10967,7 @@ ${js}`
10926
10967
  return {
10927
10968
  $loc,
10928
10969
  token: "instanceof",
10970
+ spaced: !0,
10929
10971
  relational: !0,
10930
10972
  special: !0
10931
10973
  };
@@ -10933,6 +10975,7 @@ ${js}`
10933
10975
  return {
10934
10976
  $loc,
10935
10977
  token: "instanceof",
10978
+ spaced: !0,
10936
10979
  relational: !0,
10937
10980
  special: !0,
10938
10981
  negated: !0
@@ -10979,6 +11022,7 @@ ${js}`
10979
11022
  return {
10980
11023
  $loc,
10981
11024
  token: $1,
11025
+ spaced: !0,
10982
11026
  relational: !0,
10983
11027
  special: !0
10984
11028
  // for typeof shorthand
@@ -11058,6 +11102,7 @@ ${js}`
11058
11102
  return {
11059
11103
  $loc,
11060
11104
  token: "in",
11105
+ spaced: !0,
11061
11106
  special: !0,
11062
11107
  negated: !0
11063
11108
  };
@@ -11077,6 +11122,7 @@ ${js}`
11077
11122
  return {
11078
11123
  $loc,
11079
11124
  token: "instanceof",
11125
+ spaced: !0,
11080
11126
  relational: !0,
11081
11127
  special: !0,
11082
11128
  negated: !0
@@ -11085,6 +11131,7 @@ ${js}`
11085
11131
  return {
11086
11132
  $loc,
11087
11133
  token: "in",
11134
+ spaced: !0,
11088
11135
  special: !0,
11089
11136
  negated: !0
11090
11137
  };
@@ -12283,17 +12330,17 @@ ${js}`
12283
12330
  function Debugger(ctx, state2) {
12284
12331
  return (0, import_lib2.$EVENT)(ctx, state2, "Debugger", Debugger$0);
12285
12332
  }
12286
- var MaybeNestedNonPipelineExpression$0 = NestedBulletedArray, MaybeNestedNonPipelineExpression$1 = NestedImplicitObjectLiteral, 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) {
12287
- var expression = $2, trailing = $4;
12333
+ var MaybeNestedNonPipelineExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NestedBulletedArray), (0, import_lib2.$N)(NestedImplicitObjectLiteral), 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, $5, $6) {
12334
+ var expression = $4, trailing = $6;
12288
12335
  return expression ? trailing ? [expression, trailing] : expression : $skip;
12289
- }), MaybeNestedNonPipelineExpression$3 = NonPipelineExpression, MaybeNestedNonPipelineExpression$$ = [MaybeNestedNonPipelineExpression$0, MaybeNestedNonPipelineExpression$1, MaybeNestedNonPipelineExpression$2, MaybeNestedNonPipelineExpression$3];
12336
+ }), MaybeNestedNonPipelineExpression$1 = NonPipelineExpression, MaybeNestedNonPipelineExpression$$ = [MaybeNestedNonPipelineExpression$0, MaybeNestedNonPipelineExpression$1];
12290
12337
  function MaybeNestedNonPipelineExpression(ctx, state2) {
12291
12338
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedNonPipelineExpression", MaybeNestedNonPipelineExpression$$);
12292
12339
  }
12293
- var MaybeNestedPostfixedExpression$0 = NestedBulletedArray, MaybeNestedPostfixedExpression$1 = NestedImplicitObjectLiteral, 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) {
12294
- var expression = $2, trailing = $4;
12340
+ var MaybeNestedPostfixedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NestedBulletedArray), (0, import_lib2.$N)(NestedImplicitObjectLiteral), 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, $5, $6) {
12341
+ var expression = $4, trailing = $6;
12295
12342
  return expression ? trailing ? [expression, trailing] : expression : $skip;
12296
- }), MaybeNestedPostfixedExpression$3 = PostfixedExpression, MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeNestedPostfixedExpression$1, MaybeNestedPostfixedExpression$2, MaybeNestedPostfixedExpression$3];
12343
+ }), MaybeNestedPostfixedExpression$1 = PostfixedExpression, MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeNestedPostfixedExpression$1];
12297
12344
  function MaybeNestedPostfixedExpression(ctx, state2) {
12298
12345
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedPostfixedExpression", MaybeNestedPostfixedExpression$$);
12299
12346
  }
@@ -12304,10 +12351,10 @@ ${js}`
12304
12351
  function NestedPostfixedExpressionNoTrailing(ctx, state2) {
12305
12352
  return (0, import_lib2.$EVENT_C)(ctx, state2, "NestedPostfixedExpressionNoTrailing", NestedPostfixedExpressionNoTrailing$$);
12306
12353
  }
12307
- var MaybeNestedExpression$0 = NestedBulletedArray, MaybeNestedExpression$1 = NestedImplicitObjectLiteral, 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) {
12308
- var expression = $2, trailing = $4;
12354
+ var MaybeNestedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NestedBulletedArray), (0, import_lib2.$N)(NestedImplicitObjectLiteral), 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, $5, $6) {
12355
+ var expression = $4, trailing = $6;
12309
12356
  return expression ? trailing ? [expression, trailing] : expression : $skip;
12310
- }), MaybeNestedExpression$3 = Expression, MaybeNestedExpression$$ = [MaybeNestedExpression$0, MaybeNestedExpression$1, MaybeNestedExpression$2, MaybeNestedExpression$3];
12357
+ }), MaybeNestedExpression$1 = Expression, MaybeNestedExpression$$ = [MaybeNestedExpression$0, MaybeNestedExpression$1];
12311
12358
  function MaybeNestedExpression(ctx, state2) {
12312
12359
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedExpression", MaybeNestedExpression$$);
12313
12360
  }
@@ -12334,11 +12381,12 @@ ${js}`
12334
12381
  };
12335
12382
  }), ImportDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$C)((0, import_lib2.$S)(Import, __), ImpliedImport), Operator, (0, import_lib2.$E)(OperatorBehavior), __, OperatorNamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
12336
12383
  var i = $1, behavior = $3, ws1 = $4, imports = $5, ws2 = $6, from = $7;
12337
- return imports.specifiers.forEach((spec) => {
12338
- state.operators.set(spec.binding.name, spec.behavior ?? behavior);
12384
+ let errors = [];
12385
+ return behavior?.error && errors.push(behavior.error), imports.specifiers.forEach((spec) => {
12386
+ state.operators.set(spec.binding.name, spec.behavior ?? behavior), spec.behavior?.error && errors.push(spec.behavior.error);
12339
12387
  }), {
12340
12388
  type: "ImportDeclaration",
12341
- children: [i, trimFirstSpace(ws1), imports, ws2, from],
12389
+ children: [i, ...errors, trimFirstSpace(ws1), imports, ws2, from],
12342
12390
  // omit $2 = Operator and $3 = OperatorBehavior
12343
12391
  imports,
12344
12392
  from
@@ -12363,11 +12411,12 @@ ${js}`
12363
12411
  }, { type: "ImportDeclaration", ts: !!t, children: [i, t, imports, w, from], imports, from };
12364
12412
  }), ImportDeclaration$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(ImpliedFromClause, __, Import, __, Operator, (0, import_lib2.$E)(OperatorBehavior), __, OperatorNamedImports), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
12365
12413
  var from = $1, fws = $2, i = $3, iws = $4, behavior = $6, ows = $7, imports = $8;
12366
- return imports.specifiers.forEach((spec) => {
12367
- state.operators.set(spec.binding.name, spec.behavior ?? behavior);
12414
+ let errors = [];
12415
+ return behavior?.error && errors.push(behavior.error), imports.specifiers.forEach((spec) => {
12416
+ state.operators.set(spec.binding.name, spec.behavior ?? behavior), spec.behavior?.error && errors.push(spec.behavior.error);
12368
12417
  }), {
12369
12418
  type: "ImportDeclaration",
12370
- children: [i, iws, trimFirstSpace(ows), imports, fws, from],
12419
+ children: [i, iws, ...errors, trimFirstSpace(ows), imports, fws, from],
12371
12420
  // omit Operator and OperatorBehavior
12372
12421
  imports,
12373
12422
  from
@@ -12521,14 +12570,14 @@ ${js}`
12521
12570
  return {
12522
12571
  binding,
12523
12572
  behavior,
12524
- children: [$1, $2, $4, $5, $6, $7]
12573
+ children: [$1, $2, $3?.error, $4, $5, $6, $7]
12525
12574
  };
12526
12575
  }), OperatorImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, ImportedBinding, (0, import_lib2.$E)(OperatorBehavior), ObjectPropertyDelimiter), function($skip, $loc, $0, $1, $2, $3, $4) {
12527
12576
  var binding = $2, behavior = $3;
12528
12577
  return {
12529
12578
  binding,
12530
12579
  behavior,
12531
- children: [$1, $2, $4]
12580
+ children: [$1, $2, $3?.error, $4]
12532
12581
  };
12533
12582
  }), OperatorImportSpecifier$$ = [OperatorImportSpecifier$0, OperatorImportSpecifier$1];
12534
12583
  function OperatorImportSpecifier(ctx, state2) {
@@ -13501,7 +13550,7 @@ ${js}`
13501
13550
  return (0, import_lib2.$EVENT)(ctx, state2, "Import", Import$0);
13502
13551
  }
13503
13552
  var In$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($L180, 'In "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
13504
- return { $loc, token: $1 };
13553
+ return { $loc, token: $1, spaced: !0 };
13505
13554
  });
13506
13555
  function In(ctx, state2) {
13507
13556
  return (0, import_lib2.$EVENT)(ctx, state2, "In", In$0);
@@ -14180,7 +14229,7 @@ ${js}`
14180
14229
  var InlineJSXMemberExpressionRest$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), (0, import_lib2.$Q)(InlineComment), MemberBracketContent), function($skip, $loc, $0, $1, $2, $3) {
14181
14230
  var dot = $1, comments = $2, content = $3;
14182
14231
  return !dot && !comments.length ? content : dot ? dot.type === "Optional" && content.type === "SliceExpression" ? [...dot.children.slice(0, -1), ...comments, content] : [dot, ...comments, content] : [...comments, content];
14183
- }), InlineJSXMemberExpressionRest$1 = PropertyAccess, InlineJSXMemberExpressionRest$2 = PropertyGlob, InlineJSXMemberExpressionRest$3 = PropertyBind, InlineJSXMemberExpressionRest$4 = NonNullAssertion, InlineJSXMemberExpressionRest$$ = [InlineJSXMemberExpressionRest$0, InlineJSXMemberExpressionRest$1, InlineJSXMemberExpressionRest$2, InlineJSXMemberExpressionRest$3, InlineJSXMemberExpressionRest$4];
14232
+ }), InlineJSXMemberExpressionRest$1 = PropertyAccess, InlineJSXMemberExpressionRest$2 = PropertyGlob, InlineJSXMemberExpressionRest$3 = PropertyBindExplicitArguments, InlineJSXMemberExpressionRest$4 = NonNullAssertion, InlineJSXMemberExpressionRest$$ = [InlineJSXMemberExpressionRest$0, InlineJSXMemberExpressionRest$1, InlineJSXMemberExpressionRest$2, InlineJSXMemberExpressionRest$3, InlineJSXMemberExpressionRest$4];
14184
14233
  function InlineJSXMemberExpressionRest(ctx, state2) {
14185
14234
  return (0, import_lib2.$EVENT_C)(ctx, state2, "InlineJSXMemberExpressionRest", InlineJSXMemberExpressionRest$$);
14186
14235
  }