@danielx/civet 0.8.16 → 0.8.17

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
@@ -1195,7 +1195,6 @@ var skipParens = /* @__PURE__ */ new Set([
1195
1195
  "JSXElement",
1196
1196
  "JSXFragment",
1197
1197
  "Literal",
1198
- "NewExpression",
1199
1198
  "ParenthesizedExpression",
1200
1199
  "Ref",
1201
1200
  "Placeholder",
@@ -1217,7 +1216,10 @@ function makeLeftHandSideExpression(expression) {
1217
1216
  if (skipParens.has(expression.type)) {
1218
1217
  return expression;
1219
1218
  }
1220
- if (expression.type === "MemberExpression" && !startsWithPredicate(expression, ($6) => $6.type === "ObjectExpression")) {
1219
+ if (expression.type === "NewExpression" && expression.expression.children.some(($6) => $6?.type === "Call")) {
1220
+ return expression;
1221
+ }
1222
+ if (expression.type === "MemberExpression" && !startsWithPredicate(expression, ($7) => $7.type === "ObjectExpression")) {
1221
1223
  return expression;
1222
1224
  }
1223
1225
  }
@@ -1753,13 +1755,14 @@ function gatherBindingCode(statements, opts) {
1753
1755
  return;
1754
1756
  }
1755
1757
  if (opts?.injectParamProps && n.type === "Parameter" && n.accessModifier) {
1756
- n.names.forEach((id) => ({
1757
- push: thisAssignments2.push({
1758
+ for (let ref1 = n.names, i2 = 0, len1 = ref1.length; i2 < len1; i2++) {
1759
+ const id = ref1[i2];
1760
+ thisAssignments2.push({
1758
1761
  type: "AssignmentExpression",
1759
1762
  children: [`this.${id} = `, id],
1760
1763
  js: true
1761
- })
1762
- }));
1764
+ });
1765
+ }
1763
1766
  return;
1764
1767
  }
1765
1768
  const { blockPrefix } = n;
@@ -1771,8 +1774,8 @@ function gatherBindingCode(statements, opts) {
1771
1774
  return [splices, thisAssignments];
1772
1775
  }
1773
1776
  function arrayElementHasTrailingComma(elementNode) {
1774
- let ref1;
1775
- const lastChild = (ref1 = elementNode.children)[ref1.length - 1];
1777
+ let ref2;
1778
+ const lastChild = (ref2 = elementNode.children)[ref2.length - 1];
1776
1779
  return lastChild && lastChild[lastChild.length - 1]?.token === ",";
1777
1780
  }
1778
1781
  function gatherBindingPatternTypeSuffix(pattern) {
@@ -1784,8 +1787,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
1784
1787
  case "ArrayBindingPattern": {
1785
1788
  {
1786
1789
  const results = [];
1787
- for (let ref2 = pattern.elements, i2 = 0, len1 = ref2.length; i2 < len1; i2++) {
1788
- const elem = ref2[i2];
1790
+ for (let ref3 = pattern.elements, i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
1791
+ const elem = ref3[i3];
1789
1792
  let { typeSuffix } = elem;
1790
1793
  typeSuffix ??= elem.binding?.typeSuffix;
1791
1794
  if (typeSuffix) {
@@ -1823,8 +1826,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
1823
1826
  {
1824
1827
  let restType;
1825
1828
  const results1 = [];
1826
- for (let ref3 = pattern.properties, i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
1827
- const prop = ref3[i3];
1829
+ for (let ref4 = pattern.properties, i4 = 0, len3 = ref4.length; i4 < len3; i4++) {
1830
+ const prop = ref4[i4];
1828
1831
  let { typeSuffix } = prop;
1829
1832
  typeSuffix ??= prop.value?.typeSuffix;
1830
1833
  if (typeSuffix) {
@@ -1976,8 +1979,14 @@ var declareHelper = {
1976
1979
  // [indent, statement]
1977
1980
  preludeVar,
1978
1981
  moduloRef,
1979
- ts(": (a: number, b: number) => number"),
1980
- " = (a, b) => (a % b + b) % b"
1982
+ " = ",
1983
+ ts("("),
1984
+ "(a",
1985
+ ts(": number"),
1986
+ ", b",
1987
+ ts(": number"),
1988
+ ") => (a % b + b) % b",
1989
+ ts(") as ((a: number, b: number) => number) & ((a: bigint, b: bigint) => bigint)")
1981
1990
  ], ";\n"]);
1982
1991
  },
1983
1992
  Falsy(FalsyRef) {
@@ -2542,7 +2551,7 @@ function getTypeArguments(args) {
2542
2551
  if (!Array.isArray(args)) {
2543
2552
  throw new Error("getTypeArguments could not find relevant array");
2544
2553
  }
2545
- return args.filter((a) => typeof a === "object" && a != null && "type" in a && a.type === "TypeArgument");
2554
+ return args.filter((a1) => typeof a1 === "object" && a1 != null && "type" in a1 && a1.type === "TypeArgument");
2546
2555
  }
2547
2556
  function isVoidType(t) {
2548
2557
  return typeof t === "object" && t != null && "type" in t && t.type === "TypeLiteral" && "t" in t && typeof t.t === "object" && t.t != null && "type" in t.t && t.t.type === "VoidType";
@@ -3408,7 +3417,7 @@ function processParams(f) {
3408
3417
  if (isConstructor) {
3409
3418
  const { ancestor } = findAncestor(f, ($6) => $6.type === "ClassExpression");
3410
3419
  if (ancestor != null) {
3411
- const fields = new Set(gatherRecursiveWithinFunction(ancestor, ($7) => $7.type === "FieldDefinition").map(($8) => $8.id).filter((a1) => typeof a1 === "object" && a1 != null && "type" in a1 && a1.type === "Identifier").map(($9) => $9.name));
3420
+ 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));
3412
3421
  const classExpressions = ancestor.body.expressions;
3413
3422
  let index = findChildIndex(classExpressions, f);
3414
3423
  assert.notEqual(index, -1, "Could not find constructor in class");
@@ -3419,15 +3428,20 @@ function processParams(f) {
3419
3428
  const fStatement = classExpressions[index];
3420
3429
  for (let ref16 = gatherRecursive(parameters, ($10) => $10.type === "Parameter"), i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
3421
3430
  const parameter = ref16[i8];
3422
- if (!parameter.typeSuffix) {
3431
+ const { accessModifier } = parameter;
3432
+ if (!(accessModifier || parameter.typeSuffix)) {
3423
3433
  continue;
3424
3434
  }
3425
3435
  for (let ref17 = gatherRecursive(parameter, ($11) => $11.type === "AtBinding"), i9 = 0, len8 = ref17.length; i9 < len8; i9++) {
3426
3436
  const binding = ref17[i9];
3427
3437
  const typeSuffix = binding.parent?.typeSuffix;
3428
- if (!typeSuffix) {
3438
+ if (!(accessModifier || typeSuffix)) {
3429
3439
  continue;
3430
3440
  }
3441
+ if (parameter.accessModifier) {
3442
+ replaceNode(parameter.accessModifier, void 0);
3443
+ parameter.accessModifier = void 0;
3444
+ }
3431
3445
  const id = binding.ref.id;
3432
3446
  if (fields.has(id)) {
3433
3447
  continue;
@@ -3436,7 +3450,7 @@ function processParams(f) {
3436
3450
  type: "FieldDefinition",
3437
3451
  id,
3438
3452
  typeSuffix,
3439
- children: [id, typeSuffix]
3453
+ children: [accessModifier, id, typeSuffix]
3440
3454
  }, ";"]);
3441
3455
  fStatement[0] = "";
3442
3456
  }
@@ -3460,10 +3474,10 @@ function processParams(f) {
3460
3474
  if (isConstructor) {
3461
3475
  const superCalls = gatherNodes(
3462
3476
  expressions,
3463
- (a2) => typeof a2 === "object" && a2 != null && "type" in a2 && a2.type === "CallExpression" && "children" in a2 && Array.isArray(a2.children) && a2.children.length >= 1 && typeof a2.children[0] === "object" && a2.children[0] != null && "token" in a2.children[0] && a2.children[0].token === "super"
3477
+ (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"
3464
3478
  );
3465
3479
  if (superCalls.length) {
3466
- const { child } = findAncestor(superCalls[0], (a3) => a3 === block);
3480
+ const { child } = findAncestor(superCalls[0], (a4) => a4 === block);
3467
3481
  const index = findChildIndex(expressions, child);
3468
3482
  if (index < 0) {
3469
3483
  throw new Error("Could not find super call within top-level expressions");
@@ -3478,21 +3492,33 @@ function processParams(f) {
3478
3492
  function processSignature(f) {
3479
3493
  const { block, signature } = f;
3480
3494
  if (!f.async?.length && hasAwait(block)) {
3481
- f.async.push("async ");
3482
- signature.modifier.async = true;
3483
- }
3484
- if (!f.generator?.length && hasYield(block)) {
3485
- if (f.type === "ArrowFunction") {
3486
- gatherRecursiveWithinFunction(block, ($12) => $12.type === "YieldExpression").forEach((y) => {
3487
- const i = y.children.findIndex(($13) => $13.type === "Yield");
3488
- return y.children.splice(i + 1, 0, {
3495
+ if (f.async != null) {
3496
+ f.async.push("async ");
3497
+ signature.modifier.async = true;
3498
+ } else {
3499
+ for (let ref18 = gatherRecursiveWithinFunction(block, ($12) => $12.type === "Await"), i10 = 0, len9 = ref18.length; i10 < len9; i10++) {
3500
+ const a = ref18[i10];
3501
+ const i = findChildIndex(a.parent, a);
3502
+ a.parent.children.splice(i + 1, 0, {
3489
3503
  type: "Error",
3490
- message: "Can't use yield inside of => arrow function"
3504
+ message: `await invalid in ${signature.modifier.get ? "getter" : signature.modifier.set ? "setter" : signature.name}`
3491
3505
  });
3492
- });
3493
- } else {
3506
+ }
3507
+ }
3508
+ }
3509
+ if (!f.generator?.length && hasYield(block)) {
3510
+ if (f.generator != null) {
3494
3511
  f.generator.push("*");
3495
3512
  signature.modifier.generator = true;
3513
+ } else {
3514
+ for (let ref19 = gatherRecursiveWithinFunction(block, ($13) => $13.type === "YieldExpression"), i11 = 0, len10 = ref19.length; i11 < len10; i11++) {
3515
+ const y = ref19[i11];
3516
+ const i = y.children.findIndex(($14) => $14.type === "Yield");
3517
+ y.children.splice(i + 1, 0, {
3518
+ type: "Error",
3519
+ message: `yield invalid in ${f.type === "ArrowFunction" ? "=> arrow function" : signature.modifier.get ? "getter" : signature.modifier.set ? "setter" : signature.name}`
3520
+ });
3521
+ }
3496
3522
  }
3497
3523
  }
3498
3524
  if (signature.modifier.async && !signature.modifier.generator && signature.returnType && !isPromiseType(signature.returnType.t)) {
@@ -3500,21 +3526,15 @@ function processSignature(f) {
3500
3526
  }
3501
3527
  }
3502
3528
  function processFunctions(statements, config2) {
3503
- for (let ref18 = gatherRecursiveAll(statements, ($14) => $14.type === "FunctionExpression" || $14.type === "ArrowFunction"), i10 = 0, len9 = ref18.length; i10 < len9; i10++) {
3504
- const f = ref18[i10];
3505
- if (f.type === "FunctionExpression") {
3529
+ for (let ref20 = gatherRecursiveAll(statements, ($15) => $15.type === "FunctionExpression" || $15.type === "ArrowFunction" || $15.type === "MethodDefinition"), i12 = 0, len11 = ref20.length; i12 < len11; i12++) {
3530
+ const f = ref20[i12];
3531
+ if (f.type === "FunctionExpression" || f.type === "MethodDefinition") {
3506
3532
  implicitFunctionBlock(f);
3507
3533
  }
3508
3534
  processSignature(f);
3509
3535
  processParams(f);
3510
3536
  processReturn(f, config2.implicitReturns);
3511
3537
  }
3512
- for (let ref19 = gatherRecursiveAll(statements, ($15) => $15.type === "MethodDefinition"), i11 = 0, len10 = ref19.length; i11 < len10; i11++) {
3513
- const f = ref19[i11];
3514
- implicitFunctionBlock(f);
3515
- processParams(f);
3516
- processReturn(f, config2.implicitReturns);
3517
- }
3518
3538
  }
3519
3539
  function expressionizeIteration(exp) {
3520
3540
  let { async, generator, block, children, statement } = exp;
@@ -3563,9 +3583,9 @@ function expressionizeIteration(exp) {
3563
3583
  }
3564
3584
  let done;
3565
3585
  if (!async) {
3566
- let ref20;
3567
- if ((ref20 = blockContainingStatement(exp)) && typeof ref20 === "object" && "block" in ref20 && "index" in ref20) {
3568
- const { block: parentBlock, index } = ref20;
3586
+ let ref21;
3587
+ if ((ref21 = blockContainingStatement(exp)) && typeof ref21 === "object" && "block" in ref21 && "index" in ref21) {
3588
+ const { block: parentBlock, index } = ref21;
3569
3589
  statements[0][0] = parentBlock.expressions[index][0];
3570
3590
  parentBlock.expressions.splice(index, index + 1 - index, ...statements);
3571
3591
  updateParentPointers(parentBlock);
@@ -3582,8 +3602,8 @@ function expressionizeIteration(exp) {
3582
3602
  }
3583
3603
  }
3584
3604
  function processIterationExpressions(statements) {
3585
- for (let ref21 = gatherRecursiveAll(statements, ($16) => $16.type === "IterationExpression"), i12 = 0, len11 = ref21.length; i12 < len11; i12++) {
3586
- const s = ref21[i12];
3605
+ for (let ref22 = gatherRecursiveAll(statements, ($16) => $16.type === "IterationExpression"), i13 = 0, len12 = ref22.length; i13 < len12; i13++) {
3606
+ const s = ref22[i13];
3587
3607
  expressionizeIteration(s);
3588
3608
  }
3589
3609
  }
@@ -3609,21 +3629,21 @@ function processCoffeeDo(ws, expression) {
3609
3629
  ...parameters,
3610
3630
  children: (() => {
3611
3631
  const results1 = [];
3612
- for (let ref22 = parameters.children, i13 = 0, len12 = ref22.length; i13 < len12; i13++) {
3613
- let parameter = ref22[i13];
3632
+ for (let ref23 = parameters.children, i14 = 0, len13 = ref23.length; i14 < len13; i14++) {
3633
+ let parameter = ref23[i14];
3614
3634
  if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
3615
- let ref23;
3616
- if (ref23 = parameter.initializer) {
3617
- const initializer = ref23;
3635
+ let ref24;
3636
+ if (ref24 = parameter.initializer) {
3637
+ const initializer = ref24;
3618
3638
  args.push(initializer.expression, parameter.delim);
3619
3639
  parameter = {
3620
3640
  ...parameter,
3621
3641
  initializer: void 0,
3622
- children: parameter.children.filter((a4) => a4 !== initializer)
3642
+ children: parameter.children.filter((a5) => a5 !== initializer)
3623
3643
  };
3624
3644
  } else {
3625
3645
  args.push(parameter.children.filter(
3626
- (a5) => a5 !== parameter.typeSuffix
3646
+ (a6) => a6 !== parameter.typeSuffix
3627
3647
  ));
3628
3648
  }
3629
3649
  }
@@ -3696,7 +3716,7 @@ function makeAmpersandFunction(rhs) {
3696
3716
  }
3697
3717
  if (gatherRecursiveWithinFunction(
3698
3718
  block,
3699
- (a6) => a6 === ref
3719
+ (a7) => a7 === ref
3700
3720
  ).length > 1) {
3701
3721
  fn.ampersandBlock = false;
3702
3722
  }
@@ -5373,7 +5393,6 @@ function processUnaryNestedExpression(pre, args, post) {
5373
5393
 
5374
5394
  // source/parser/pipe.civet
5375
5395
  function constructInvocation(fn, arg) {
5376
- const fnArr = [fn.leadingComment, fn.expr, fn.trailingComment];
5377
5396
  let expr = fn.expr;
5378
5397
  while (expr.type === "ParenthesizedExpression") {
5379
5398
  expr = expr.expression;
@@ -5390,22 +5409,46 @@ function constructInvocation(fn, arg) {
5390
5409
  });
5391
5410
  }
5392
5411
  expr = fn.expr;
5393
- const lhs = makeLeftHandSideExpression(expr);
5412
+ let lhs = expr;
5413
+ if (!(lhs.type === "NewExpression")) {
5414
+ lhs = makeLeftHandSideExpression(lhs);
5415
+ }
5394
5416
  let comment = skipIfOnlyWS(fn.trailingComment);
5395
5417
  if (comment)
5396
- lhs.children.splice(2, 0, comment);
5418
+ lhs.children.push(comment);
5397
5419
  comment = skipIfOnlyWS(fn.leadingComment);
5398
5420
  if (comment)
5399
5421
  lhs.children.splice(1, 0, comment);
5400
5422
  switch (arg.type) {
5401
- case "CommaExpression":
5423
+ case "CommaExpression": {
5402
5424
  arg = makeLeftHandSideExpression(arg);
5403
5425
  break;
5426
+ }
5404
5427
  }
5405
- return {
5406
- type: "CallExpression",
5407
- children: [lhs, "(", arg, ")"]
5428
+ const args = [arg];
5429
+ const call = {
5430
+ type: "Call",
5431
+ args,
5432
+ children: ["(", args, ")"]
5408
5433
  };
5434
+ if (lhs.type === "NewExpression") {
5435
+ let { expression } = lhs;
5436
+ expression = {
5437
+ ...expression,
5438
+ type: "CallExpression",
5439
+ children: [...expression.children, call]
5440
+ };
5441
+ return {
5442
+ ...lhs,
5443
+ expression,
5444
+ children: lhs.children.map(($) => $ === lhs.expression ? expression : $)
5445
+ };
5446
+ } else {
5447
+ return {
5448
+ type: "CallExpression",
5449
+ children: [lhs, call]
5450
+ };
5451
+ }
5409
5452
  }
5410
5453
  function constructPipeStep(fn, arg, returning) {
5411
5454
  if (!returning) {
@@ -5452,21 +5495,24 @@ function processPipelineExpressions(statements) {
5452
5495
  let i = 0, l = body.length;
5453
5496
  const children = [ws];
5454
5497
  let usingRef = null;
5455
- for (i = 0; i < l; i++) {
5456
- const step = body[i];
5498
+ for (let i1 = 0, len3 = body.length; i1 < len3; i1++) {
5499
+ const i2 = i1;
5500
+ const step = body[i1];
5457
5501
  const [leadingComment, pipe, trailingComment, expr] = step;
5458
5502
  const returns = pipe.token === "||>";
5459
5503
  let ref, result, returning = returns ? arg : null;
5460
5504
  if (pipe.token === "|>=") {
5461
5505
  let initRef;
5462
- if (i === 0) {
5506
+ if (i2 === 0) {
5463
5507
  checkValidLHS(arg);
5464
5508
  outer:
5465
5509
  switch (arg.type) {
5466
- case "MemberExpression":
5467
- if (arg.children.length <= 2)
5510
+ case "MemberExpression": {
5511
+ if (arg.children.length <= 2) {
5468
5512
  break;
5469
- case "CallExpression":
5513
+ }
5514
+ }
5515
+ case "CallExpression": {
5470
5516
  const access = arg.children.pop();
5471
5517
  usingRef = makeRef();
5472
5518
  initRef = {
@@ -5478,6 +5524,7 @@ function processPipelineExpressions(statements) {
5478
5524
  children: [usingRef, access]
5479
5525
  };
5480
5526
  break;
5527
+ }
5481
5528
  }
5482
5529
  const lhs = [[
5483
5530
  [initRef],
@@ -5506,7 +5553,7 @@ function processPipelineExpressions(statements) {
5506
5553
  });
5507
5554
  }
5508
5555
  } else {
5509
- if (i === 0)
5556
+ if (i2 === 0)
5510
5557
  s.children = children;
5511
5558
  }
5512
5559
  if (returns && (ref = needsRef(arg))) {
@@ -5531,7 +5578,7 @@ function processPipelineExpressions(statements) {
5531
5578
  returning
5532
5579
  );
5533
5580
  if (result.type === "ReturnStatement") {
5534
- if (i < l - 1) {
5581
+ if (i2 < l - 1) {
5535
5582
  result.children.push({
5536
5583
  type: "Error",
5537
5584
  message: "Can't continue a pipeline after returning"
@@ -5559,7 +5606,7 @@ function processPipelineExpressions(statements) {
5559
5606
  };
5560
5607
  }
5561
5608
  children.push(arg);
5562
- if (!children.some(($) => $?.type === "ReturnStatement") && children.some(($1) => $1 === ",")) {
5609
+ if (!children.some(($1) => $1?.type === "ReturnStatement") && children.some(($2) => $2 === ",")) {
5563
5610
  const { parent } = s;
5564
5611
  const parenthesizedExpression = makeLeftHandSideExpression({ ...s });
5565
5612
  Object.assign(s, parenthesizedExpression, {
@@ -5845,7 +5892,8 @@ function processForInOf($0) {
5845
5892
  blockPrefix.push(["", {
5846
5893
  type: "Declaration",
5847
5894
  children: [declaration, " = ", trimFirstSpace(expRef2), "[", counterRef, "]"],
5848
- names: assignmentNames
5895
+ names: assignmentNames,
5896
+ implicitLift: true
5849
5897
  }, ";"]);
5850
5898
  declaration = {
5851
5899
  type: "Declaration",
@@ -6933,19 +6981,19 @@ function lastAccessInCallExpression(exp) {
6933
6981
  }
6934
6982
  function convertMethodToFunction(method) {
6935
6983
  const { signature, block } = method;
6936
- let { modifier, optional } = signature;
6937
- if (optional)
6984
+ const { async, modifier, optional } = signature;
6985
+ if (optional) {
6938
6986
  return;
6939
- if (modifier) {
6940
- if (modifier.get || modifier.set) {
6941
- return;
6942
- } else if (modifier.async) {
6943
- modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
6944
- } else {
6945
- modifier = ["function ", ...modifier.children || []];
6987
+ }
6988
+ if (modifier?.get || modifier?.set) {
6989
+ return;
6990
+ }
6991
+ const func = ["function "];
6992
+ if (async != null) {
6993
+ func.unshift(async);
6994
+ if (async.length && !async[async.length - 1]?.length) {
6995
+ async.push(" ");
6946
6996
  }
6947
- } else {
6948
- modifier = "function ";
6949
6997
  }
6950
6998
  return {
6951
6999
  ...signature,
@@ -6953,7 +7001,7 @@ function convertMethodToFunction(method) {
6953
7001
  signature,
6954
7002
  type: "FunctionExpression",
6955
7003
  children: [
6956
- [modifier, ...signature.children.slice(1)],
7004
+ [...func, ...signature.children.slice(1)],
6957
7005
  block
6958
7006
  ],
6959
7007
  block
@@ -7067,7 +7115,8 @@ function makeGetterMethod(name, ws, value, returnType, block, kind = { token: "g
7067
7115
  block = {
7068
7116
  type: "BlockStatement",
7069
7117
  expressions,
7070
- children: ["{ ", expressions, " }"]
7118
+ children: ["{ ", expressions, " }"],
7119
+ bare: false
7071
7120
  };
7072
7121
  }
7073
7122
  if (autoReturn) {
@@ -7780,7 +7829,13 @@ function processPlaceholders(statements) {
7780
7829
  }
7781
7830
  } else {
7782
7831
  let child;
7832
+ let implicitLift;
7783
7833
  ({ ancestor, child } = findAncestor(exp, (ancestor2, child2) => {
7834
+ const prevImplicitLift = implicitLift;
7835
+ ({ implicitLift } = ancestor2);
7836
+ if (prevImplicitLift) {
7837
+ return;
7838
+ }
7784
7839
  const { type } = ancestor2;
7785
7840
  if (type === "IfStatement") {
7786
7841
  liftedIfs.add(ancestor2);
@@ -7866,7 +7921,7 @@ function processPlaceholders(statements) {
7866
7921
  const placeholder = placeholders[i15];
7867
7922
  typeSuffix ??= placeholder.typeSuffix;
7868
7923
  let ref26;
7869
- replaceNode((ref26 = placeholder.children)[ref26.length - 1], ref);
7924
+ (ref26 = placeholder.children)[ref26.length - 1] = ref;
7870
7925
  }
7871
7926
  const { parent } = ancestor;
7872
7927
  const body = maybeUnwrap(ancestor);
@@ -8156,6 +8211,7 @@ var grammar = {
8156
8211
  LeftHandSideExpression,
8157
8212
  CallExpression,
8158
8213
  CallExpressionRest,
8214
+ ExplicitCallExpressionRest,
8159
8215
  OptionalShorthand,
8160
8216
  OptionalDot,
8161
8217
  NonNullAssertion,
@@ -8439,8 +8495,8 @@ var grammar = {
8439
8495
  Debugger,
8440
8496
  MaybeNestedNonPipelineExpression,
8441
8497
  MaybeNestedPostfixedExpression,
8498
+ NestedPostfixedExpressionNoTrailing,
8442
8499
  MaybeNestedExpression,
8443
- NestedExpression,
8444
8500
  MaybeParenNestedExpression,
8445
8501
  ImportDeclaration,
8446
8502
  ImpliedImport,
@@ -9453,7 +9509,7 @@ var ArgumentsWithTrailingCallExpressions$0 = (0, import_lib2.$TS)((0, import_lib
9453
9509
  function ArgumentsWithTrailingCallExpressions(ctx, state2) {
9454
9510
  return (0, import_lib2.$EVENT)(ctx, state2, "ArgumentsWithTrailingCallExpressions", ArgumentsWithTrailingCallExpressions$0);
9455
9511
  }
9456
- var TrailingCallExpressions$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Q)(CallExpressionRest), (0, import_lib2.$E)(IndentedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2) {
9512
+ 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) {
9457
9513
  $1 = $1.flat();
9458
9514
  if (!$1.length && !$2)
9459
9515
  return $skip;
@@ -9549,10 +9605,10 @@ var NestedArgumentList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent,
9549
9605
  function NestedArgumentList(ctx, state2) {
9550
9606
  return (0, import_lib2.$EVENT)(ctx, state2, "NestedArgumentList", NestedArgumentList$0);
9551
9607
  }
9552
- var NestedArgument$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Nested, (0, import_lib2.$N)(Bullet), SingleLineArgumentExpressions, ParameterElementDelimiter), function($skip, $loc, $0, $1, $2, $3, $4) {
9553
- var indent = $1;
9554
- var args = $3;
9555
- var comma = $4;
9608
+ var NestedArgument$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NestedImplicitPropertyDefinition), Nested, (0, import_lib2.$N)(Bullet), SingleLineArgumentExpressions, ParameterElementDelimiter), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
9609
+ var indent = $2;
9610
+ var args = $4;
9611
+ var comma = $5;
9556
9612
  let [arg0, ...rest] = args;
9557
9613
  arg0 = prepend(indent, arg0);
9558
9614
  return [arg0, ...rest, comma];
@@ -10742,6 +10798,32 @@ var CallExpressionRest$$ = [CallExpressionRest$0, CallExpressionRest$1, CallExpr
10742
10798
  function CallExpressionRest(ctx, state2) {
10743
10799
  return (0, import_lib2.$EVENT_C)(ctx, state2, "CallExpressionRest", CallExpressionRest$$);
10744
10800
  }
10801
+ var ExplicitCallExpressionRest$0 = MemberExpressionRest;
10802
+ var ExplicitCallExpressionRest$1 = (0, import_lib2.$T)((0, import_lib2.$S)(TypeArguments, (0, import_lib2.$N)((0, import_lib2.$C)(IdentifierName, NumericLiteral))), function(value) {
10803
+ return value[0];
10804
+ });
10805
+ var ExplicitCallExpressionRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R8, "ExplicitCallExpressionRest /(?=['\"`])/"), (0, import_lib2.$C)(TemplateLiteral, StringLiteral)), function($skip, $loc, $0, $1, $2) {
10806
+ var literal = $2;
10807
+ if (literal.type === "StringLiteral") {
10808
+ literal = "`" + literal.token.slice(1, -1).replace(/(`|\$\{)/g, "\\$1") + "`";
10809
+ }
10810
+ return literal;
10811
+ });
10812
+ var ExplicitCallExpressionRest$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
10813
+ var optional = $1;
10814
+ var call = $2;
10815
+ if (!optional)
10816
+ return call;
10817
+ return {
10818
+ ...call,
10819
+ children: [optional, ...call.children],
10820
+ optional
10821
+ };
10822
+ });
10823
+ var ExplicitCallExpressionRest$$ = [ExplicitCallExpressionRest$0, ExplicitCallExpressionRest$1, ExplicitCallExpressionRest$2, ExplicitCallExpressionRest$3];
10824
+ function ExplicitCallExpressionRest(ctx, state2) {
10825
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "ExplicitCallExpressionRest", ExplicitCallExpressionRest$$);
10826
+ }
10745
10827
  var OptionalShorthand$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R9, "OptionalShorthand /(?=[\\/?])/"), (0, import_lib2.$Q)(InlineComment), QuestionMark, OptionalDot), function($skip, $loc, $0, $1, $2, $3, $4) {
10746
10828
  var comments = $2;
10747
10829
  var q = $3;
@@ -11379,7 +11461,8 @@ var NWBindingIdentifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(At, AtIdent
11379
11461
  return {
11380
11462
  type: "AtBinding",
11381
11463
  children: [ref],
11382
- ref
11464
+ ref,
11465
+ names: []
11383
11466
  };
11384
11467
  });
11385
11468
  var NWBindingIdentifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Hash, AtIdentifierRef), function($skip, $loc, $0, $1, $2) {
@@ -11388,7 +11471,8 @@ var NWBindingIdentifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Hash, AtIde
11388
11471
  return {
11389
11472
  type: "AtBinding",
11390
11473
  children: [ref],
11391
- ref
11474
+ ref,
11475
+ names: []
11392
11476
  };
11393
11477
  });
11394
11478
  var NWBindingIdentifier$2 = Identifier;
@@ -13504,52 +13588,23 @@ var MethodDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Abstract, __,
13504
13588
  abstract: true,
13505
13589
  signature,
13506
13590
  parameters: signature.parameters,
13591
+ async: signature.async,
13592
+ generator: signature.generator,
13507
13593
  ts: true
13508
13594
  };
13509
13595
  });
13510
13596
  var MethodDefinition$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(MethodSignature, (0, import_lib2.$N)((0, import_lib2.$C)(PropertyAccess, ExplicitPropertyGlob, UnaryPostfix, NonNullAssertion)), (0, import_lib2.$E)(BracedBlock)), function($skip, $loc, $0, $1, $2, $3) {
13511
13597
  var signature = $1;
13512
13598
  var block = $3;
13513
- let children = $0;
13514
- let generatorPos = 0;
13515
- let { modifier } = signature;
13516
- if (hasAwait(block)) {
13517
- generatorPos++;
13518
- children = children.slice();
13519
- if (modifier?.get || modifier?.set) {
13520
- children.push({
13521
- type: "Error",
13522
- message: "Getters and setters cannot be async"
13523
- });
13524
- } else if (modifier?.async) {
13525
- } else {
13526
- children.unshift("async ");
13527
- modifier = { ...modifier, async: true };
13528
- signature = { ...signature, modifier };
13529
- }
13530
- }
13531
- if (hasYield(block)) {
13532
- if (children === $0)
13533
- children = children.slice();
13534
- if (modifier?.get || modifier?.set) {
13535
- children.push({
13536
- type: "Error",
13537
- message: "Getters and setters cannot be generators"
13538
- });
13539
- } else if (modifier?.generator) {
13540
- } else {
13541
- children.splice(generatorPos, 0, "*");
13542
- modifier = { ...modifier, generator: true };
13543
- signature = { ...signature, modifier };
13544
- }
13545
- }
13546
13599
  return {
13547
13600
  type: "MethodDefinition",
13548
- children,
13601
+ children: $0,
13549
13602
  name: signature.name,
13550
13603
  signature,
13551
13604
  block,
13552
- parameters: signature.parameters
13605
+ parameters: signature.parameters,
13606
+ async: signature.async,
13607
+ generator: signature.generator
13553
13608
  };
13554
13609
  });
13555
13610
  var MethodDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0, import_lib2.$E)(_), ForbidIndentedApplication, (0, import_lib2.$E)((0, import_lib2.$S)(MemberBase, (0, import_lib2.$Q)(CallExpressionRest), (0, import_lib2.$E)(ReturnTypeSuffix))), RestoreIndentedApplication, (0, import_lib2.$E)(BracedBlock)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
@@ -13632,36 +13687,38 @@ function MethodDefinition(ctx, state2) {
13632
13687
  }
13633
13688
  var MethodModifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0, import_lib2.$E)(_), (0, import_lib2.$Y)(ClassElementName)), function($skip, $loc, $0, $1, $2, $3) {
13634
13689
  var kind = $1;
13690
+ var ws = $2;
13635
13691
  return {
13636
- type: "MethodModifier",
13637
- async: false,
13638
- generator: false,
13639
- get: kind.token === "get",
13640
- set: kind.token === "set",
13641
- children: $0
13642
- };
13643
- });
13644
- var MethodModifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$S)(Async, __), (0, import_lib2.$E)((0, import_lib2.$S)(Star, __))), function($skip, $loc, $0, $1, $2) {
13645
- return {
13646
- type: "MethodModifier",
13647
- async: true,
13648
- get: false,
13649
- set: false,
13650
- generator: !!$2,
13651
- children: $0
13692
+ // no async or generator, because getters and setters can't be
13693
+ modifier: {
13694
+ async: false,
13695
+ generator: false,
13696
+ get: kind.token === "get",
13697
+ set: kind.token === "set"
13698
+ },
13699
+ children: [kind, ws]
13652
13700
  };
13653
13701
  });
13654
- var MethodModifier$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Star, __), function($skip, $loc, $0, $1, $2) {
13702
+ 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) {
13703
+ var async = $1;
13704
+ var generator = $2;
13705
+ if (!async)
13706
+ async = [];
13707
+ if (!generator)
13708
+ generator = [];
13655
13709
  return {
13656
- type: "MethodModifier",
13657
- async: false,
13658
- get: false,
13659
- set: false,
13660
- generator: true,
13661
- children: $0
13710
+ async,
13711
+ generator,
13712
+ modifier: {
13713
+ async: !!async.length,
13714
+ get: false,
13715
+ set: false,
13716
+ generator: !!generator.length
13717
+ },
13718
+ children: [async, generator]
13662
13719
  };
13663
13720
  });
13664
- var MethodModifier$$ = [MethodModifier$0, MethodModifier$1, MethodModifier$2];
13721
+ var MethodModifier$$ = [MethodModifier$0, MethodModifier$1];
13665
13722
  function MethodModifier(ctx, state2) {
13666
13723
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MethodModifier", MethodModifier$$);
13667
13724
  }
@@ -13676,10 +13733,12 @@ var MethodSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ConstructorShor
13676
13733
  parameters
13677
13734
  };
13678
13735
  });
13679
- var MethodSignature$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(MethodModifier), ClassElementName, (0, import_lib2.$E)(_), (0, import_lib2.$E)(QuestionMark), (0, import_lib2.$E)(_), NonEmptyParameters, (0, import_lib2.$E)(ReturnTypeSuffix)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
13736
+ var MethodSignature$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(MethodModifier, ClassElementName, (0, import_lib2.$E)(_), (0, import_lib2.$E)(QuestionMark), (0, import_lib2.$E)(_), NonEmptyParameters, (0, import_lib2.$E)(ReturnTypeSuffix)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
13680
13737
  var modifier = $1;
13681
13738
  var name = $2;
13739
+ var ws1 = $3;
13682
13740
  var optional = $4;
13741
+ var ws2 = $5;
13683
13742
  var parameters = $6;
13684
13743
  var returnType = $7;
13685
13744
  if (name.name) {
@@ -13688,14 +13747,15 @@ var MethodSignature$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
13688
13747
  name = name.token.match(/^(?:"|')/) ? name.token.slice(1, -1) : name.token;
13689
13748
  }
13690
13749
  if (optional)
13691
- $0[3] = optional = { ...optional, ts: true };
13692
- modifier = modifier || {};
13750
+ optional = { ...optional, ts: true };
13693
13751
  return {
13694
13752
  type: "MethodSignature",
13695
- children: $0,
13753
+ children: [...modifier.children, name, ws1, optional, ws2, parameters, returnType],
13754
+ async: modifier.async,
13755
+ generator: modifier.generator,
13696
13756
  name,
13697
13757
  optional,
13698
- modifier,
13758
+ modifier: modifier.modifier,
13699
13759
  // get/set/async/generator
13700
13760
  returnType,
13701
13761
  parameters
@@ -15696,48 +15756,65 @@ function Debugger(ctx, state2) {
15696
15756
  return (0, import_lib2.$EVENT)(ctx, state2, "Debugger", Debugger$0);
15697
15757
  }
15698
15758
  var MaybeNestedNonPipelineExpression$0 = NestedBulletedArray;
15699
- var MaybeNestedNonPipelineExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, NonPipelineExpression)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
15700
- if ($3)
15701
- return $3;
15702
- return $skip;
15759
+ var MaybeNestedNonPipelineExpression$1 = NestedImplicitObjectLiteral;
15760
+ 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) {
15761
+ var expression = $2;
15762
+ var trailing = $4;
15763
+ if (!expression)
15764
+ return $skip;
15765
+ if (!trailing)
15766
+ return expression;
15767
+ return [expression, trailing];
15703
15768
  });
15704
- var MaybeNestedNonPipelineExpression$2 = NonPipelineExpression;
15705
- var MaybeNestedNonPipelineExpression$$ = [MaybeNestedNonPipelineExpression$0, MaybeNestedNonPipelineExpression$1, MaybeNestedNonPipelineExpression$2];
15769
+ var MaybeNestedNonPipelineExpression$3 = NonPipelineExpression;
15770
+ var MaybeNestedNonPipelineExpression$$ = [MaybeNestedNonPipelineExpression$0, MaybeNestedNonPipelineExpression$1, MaybeNestedNonPipelineExpression$2, MaybeNestedNonPipelineExpression$3];
15706
15771
  function MaybeNestedNonPipelineExpression(ctx, state2) {
15707
15772
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedNonPipelineExpression", MaybeNestedNonPipelineExpression$$);
15708
15773
  }
15709
15774
  var MaybeNestedPostfixedExpression$0 = NestedBulletedArray;
15710
- var MaybeNestedPostfixedExpression$1 = (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) {
15711
- if ($3)
15712
- return $3;
15713
- return $skip;
15775
+ var MaybeNestedPostfixedExpression$1 = NestedImplicitObjectLiteral;
15776
+ 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) {
15777
+ var expression = $2;
15778
+ var trailing = $4;
15779
+ if (!expression)
15780
+ return $skip;
15781
+ if (!trailing)
15782
+ return expression;
15783
+ return [expression, trailing];
15714
15784
  });
15715
- var MaybeNestedPostfixedExpression$2 = PostfixedExpression;
15716
- var MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeNestedPostfixedExpression$1, MaybeNestedPostfixedExpression$2];
15785
+ var MaybeNestedPostfixedExpression$3 = PostfixedExpression;
15786
+ var MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeNestedPostfixedExpression$1, MaybeNestedPostfixedExpression$2, MaybeNestedPostfixedExpression$3];
15717
15787
  function MaybeNestedPostfixedExpression(ctx, state2) {
15718
15788
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedPostfixedExpression", MaybeNestedPostfixedExpression$$);
15719
15789
  }
15790
+ var NestedPostfixedExpressionNoTrailing$0 = NestedBulletedArray;
15791
+ var NestedPostfixedExpressionNoTrailing$1 = NestedImplicitObjectLiteral;
15792
+ 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) {
15793
+ var expression = $2;
15794
+ if (!expression)
15795
+ return $skip;
15796
+ return expression;
15797
+ });
15798
+ var NestedPostfixedExpressionNoTrailing$$ = [NestedPostfixedExpressionNoTrailing$0, NestedPostfixedExpressionNoTrailing$1, NestedPostfixedExpressionNoTrailing$2];
15799
+ function NestedPostfixedExpressionNoTrailing(ctx, state2) {
15800
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "NestedPostfixedExpressionNoTrailing", NestedPostfixedExpressionNoTrailing$$);
15801
+ }
15720
15802
  var MaybeNestedExpression$0 = NestedBulletedArray;
15721
- var MaybeNestedExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Expression)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
15722
- if ($3)
15723
- return $3;
15724
- return $skip;
15803
+ var MaybeNestedExpression$1 = NestedImplicitObjectLiteral;
15804
+ 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) {
15805
+ var expression = $2;
15806
+ var trailing = $4;
15807
+ if (!expression)
15808
+ return $skip;
15809
+ if (!trailing)
15810
+ return expression;
15811
+ return [expression, trailing];
15725
15812
  });
15726
- var MaybeNestedExpression$2 = Expression;
15727
- var MaybeNestedExpression$$ = [MaybeNestedExpression$0, MaybeNestedExpression$1, MaybeNestedExpression$2];
15813
+ var MaybeNestedExpression$3 = Expression;
15814
+ var MaybeNestedExpression$$ = [MaybeNestedExpression$0, MaybeNestedExpression$1, MaybeNestedExpression$2, MaybeNestedExpression$3];
15728
15815
  function MaybeNestedExpression(ctx, state2) {
15729
15816
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedExpression", MaybeNestedExpression$$);
15730
15817
  }
15731
- var NestedExpression$0 = NestedBulletedArray;
15732
- var NestedExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Expression)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
15733
- if ($3)
15734
- return $3;
15735
- return $skip;
15736
- });
15737
- var NestedExpression$$ = [NestedExpression$0, NestedExpression$1];
15738
- function NestedExpression(ctx, state2) {
15739
- return (0, import_lib2.$EVENT_C)(ctx, state2, "NestedExpression", NestedExpression$$);
15740
- }
15741
15818
  var MaybeParenNestedExpression$0 = (0, import_lib2.$T)((0, import_lib2.$Y)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement, NoBlock)), function(value) {
15742
15819
  return "";
15743
15820
  });
@@ -15747,7 +15824,7 @@ var MaybeParenNestedExpression$1 = (0, import_lib2.$T)((0, import_lib2.$S)((0, i
15747
15824
  var MaybeParenNestedExpression$2 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$Y)(EOS), (0, import_lib2.$C)(ArrayLiteral, ObjectLiteral)), function(value) {
15748
15825
  return value[1];
15749
15826
  });
15750
- 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, InsertNewline, InsertIndent, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
15827
+ 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) {
15751
15828
  var exp = $5;
15752
15829
  if (!exp)
15753
15830
  return $skip;
@@ -17839,17 +17916,13 @@ var JSXAttributeName$$ = [JSXAttributeName$0, JSXAttributeName$1];
17839
17916
  function JSXAttributeName(ctx, state2) {
17840
17917
  return (0, import_lib2.$EVENT_C)(ctx, state2, "JSXAttributeName", JSXAttributeName$$);
17841
17918
  }
17842
- var JSXAttributeInitializer$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(CoffeeJSXEnabled), (0, import_lib2.$E)(Whitespace), Equals, (0, import_lib2.$Y)((0, import_lib2.$S)((0, import_lib2.$Q)(NonNewlineWhitespace), EOL)), InsertInlineOpenBrace, PushIndent, (0, import_lib2.$E)(PostfixedExpression), PopIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
17919
+ var JSXAttributeInitializer$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(CoffeeJSXEnabled), (0, import_lib2.$E)(Whitespace), Equals, (0, import_lib2.$Y)((0, import_lib2.$S)((0, import_lib2.$Q)(NonNewlineWhitespace), EOL)), InsertInlineOpenBrace, NestedPostfixedExpressionNoTrailing, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
17843
17920
  var ws1 = $2;
17844
17921
  var equals = $3;
17845
- var ws2 = $4;
17846
17922
  var open = $5;
17847
- var indent = $6;
17848
- var expression = $7;
17849
- var close = $9;
17850
- if (!expression)
17851
- return $skip;
17852
- return [ws1, equals, ws2, open, indent, expression, close];
17923
+ var expression = $6;
17924
+ var close = $7;
17925
+ return [ws1, equals, open, trimFirstSpace(expression), close];
17853
17926
  });
17854
17927
  var JSXAttributeInitializer$1 = (0, import_lib2.$S)((0, import_lib2.$E)(Whitespace), Equals, (0, import_lib2.$E)(Whitespace), JSXAttributeValue);
17855
17928
  var JSXAttributeInitializer$$ = [JSXAttributeInitializer$0, JSXAttributeInitializer$1];