@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.mjs CHANGED
@@ -1175,7 +1175,6 @@ var skipParens = /* @__PURE__ */ new Set([
1175
1175
  "JSXElement",
1176
1176
  "JSXFragment",
1177
1177
  "Literal",
1178
- "NewExpression",
1179
1178
  "ParenthesizedExpression",
1180
1179
  "Ref",
1181
1180
  "Placeholder",
@@ -1197,7 +1196,10 @@ function makeLeftHandSideExpression(expression) {
1197
1196
  if (skipParens.has(expression.type)) {
1198
1197
  return expression;
1199
1198
  }
1200
- if (expression.type === "MemberExpression" && !startsWithPredicate(expression, ($6) => $6.type === "ObjectExpression")) {
1199
+ if (expression.type === "NewExpression" && expression.expression.children.some(($6) => $6?.type === "Call")) {
1200
+ return expression;
1201
+ }
1202
+ if (expression.type === "MemberExpression" && !startsWithPredicate(expression, ($7) => $7.type === "ObjectExpression")) {
1201
1203
  return expression;
1202
1204
  }
1203
1205
  }
@@ -1733,13 +1735,14 @@ function gatherBindingCode(statements, opts) {
1733
1735
  return;
1734
1736
  }
1735
1737
  if (opts?.injectParamProps && n.type === "Parameter" && n.accessModifier) {
1736
- n.names.forEach((id) => ({
1737
- push: thisAssignments2.push({
1738
+ for (let ref1 = n.names, i2 = 0, len1 = ref1.length; i2 < len1; i2++) {
1739
+ const id = ref1[i2];
1740
+ thisAssignments2.push({
1738
1741
  type: "AssignmentExpression",
1739
1742
  children: [`this.${id} = `, id],
1740
1743
  js: true
1741
- })
1742
- }));
1744
+ });
1745
+ }
1743
1746
  return;
1744
1747
  }
1745
1748
  const { blockPrefix } = n;
@@ -1751,8 +1754,8 @@ function gatherBindingCode(statements, opts) {
1751
1754
  return [splices, thisAssignments];
1752
1755
  }
1753
1756
  function arrayElementHasTrailingComma(elementNode) {
1754
- let ref1;
1755
- const lastChild = (ref1 = elementNode.children)[ref1.length - 1];
1757
+ let ref2;
1758
+ const lastChild = (ref2 = elementNode.children)[ref2.length - 1];
1756
1759
  return lastChild && lastChild[lastChild.length - 1]?.token === ",";
1757
1760
  }
1758
1761
  function gatherBindingPatternTypeSuffix(pattern) {
@@ -1764,8 +1767,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
1764
1767
  case "ArrayBindingPattern": {
1765
1768
  {
1766
1769
  const results = [];
1767
- for (let ref2 = pattern.elements, i2 = 0, len1 = ref2.length; i2 < len1; i2++) {
1768
- const elem = ref2[i2];
1770
+ for (let ref3 = pattern.elements, i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
1771
+ const elem = ref3[i3];
1769
1772
  let { typeSuffix } = elem;
1770
1773
  typeSuffix ??= elem.binding?.typeSuffix;
1771
1774
  if (typeSuffix) {
@@ -1803,8 +1806,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
1803
1806
  {
1804
1807
  let restType;
1805
1808
  const results1 = [];
1806
- for (let ref3 = pattern.properties, i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
1807
- const prop = ref3[i3];
1809
+ for (let ref4 = pattern.properties, i4 = 0, len3 = ref4.length; i4 < len3; i4++) {
1810
+ const prop = ref4[i4];
1808
1811
  let { typeSuffix } = prop;
1809
1812
  typeSuffix ??= prop.value?.typeSuffix;
1810
1813
  if (typeSuffix) {
@@ -1956,8 +1959,14 @@ var declareHelper = {
1956
1959
  // [indent, statement]
1957
1960
  preludeVar,
1958
1961
  moduloRef,
1959
- ts(": (a: number, b: number) => number"),
1960
- " = (a, b) => (a % b + b) % b"
1962
+ " = ",
1963
+ ts("("),
1964
+ "(a",
1965
+ ts(": number"),
1966
+ ", b",
1967
+ ts(": number"),
1968
+ ") => (a % b + b) % b",
1969
+ ts(") as ((a: number, b: number) => number) & ((a: bigint, b: bigint) => bigint)")
1961
1970
  ], ";\n"]);
1962
1971
  },
1963
1972
  Falsy(FalsyRef) {
@@ -2522,7 +2531,7 @@ function getTypeArguments(args) {
2522
2531
  if (!Array.isArray(args)) {
2523
2532
  throw new Error("getTypeArguments could not find relevant array");
2524
2533
  }
2525
- return args.filter((a) => typeof a === "object" && a != null && "type" in a && a.type === "TypeArgument");
2534
+ return args.filter((a1) => typeof a1 === "object" && a1 != null && "type" in a1 && a1.type === "TypeArgument");
2526
2535
  }
2527
2536
  function isVoidType(t) {
2528
2537
  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";
@@ -3388,7 +3397,7 @@ function processParams(f) {
3388
3397
  if (isConstructor) {
3389
3398
  const { ancestor } = findAncestor(f, ($6) => $6.type === "ClassExpression");
3390
3399
  if (ancestor != null) {
3391
- 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));
3400
+ 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));
3392
3401
  const classExpressions = ancestor.body.expressions;
3393
3402
  let index = findChildIndex(classExpressions, f);
3394
3403
  assert.notEqual(index, -1, "Could not find constructor in class");
@@ -3399,15 +3408,20 @@ function processParams(f) {
3399
3408
  const fStatement = classExpressions[index];
3400
3409
  for (let ref16 = gatherRecursive(parameters, ($10) => $10.type === "Parameter"), i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
3401
3410
  const parameter = ref16[i8];
3402
- if (!parameter.typeSuffix) {
3411
+ const { accessModifier } = parameter;
3412
+ if (!(accessModifier || parameter.typeSuffix)) {
3403
3413
  continue;
3404
3414
  }
3405
3415
  for (let ref17 = gatherRecursive(parameter, ($11) => $11.type === "AtBinding"), i9 = 0, len8 = ref17.length; i9 < len8; i9++) {
3406
3416
  const binding = ref17[i9];
3407
3417
  const typeSuffix = binding.parent?.typeSuffix;
3408
- if (!typeSuffix) {
3418
+ if (!(accessModifier || typeSuffix)) {
3409
3419
  continue;
3410
3420
  }
3421
+ if (parameter.accessModifier) {
3422
+ replaceNode(parameter.accessModifier, void 0);
3423
+ parameter.accessModifier = void 0;
3424
+ }
3411
3425
  const id = binding.ref.id;
3412
3426
  if (fields.has(id)) {
3413
3427
  continue;
@@ -3416,7 +3430,7 @@ function processParams(f) {
3416
3430
  type: "FieldDefinition",
3417
3431
  id,
3418
3432
  typeSuffix,
3419
- children: [id, typeSuffix]
3433
+ children: [accessModifier, id, typeSuffix]
3420
3434
  }, ";"]);
3421
3435
  fStatement[0] = "";
3422
3436
  }
@@ -3440,10 +3454,10 @@ function processParams(f) {
3440
3454
  if (isConstructor) {
3441
3455
  const superCalls = gatherNodes(
3442
3456
  expressions,
3443
- (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"
3457
+ (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"
3444
3458
  );
3445
3459
  if (superCalls.length) {
3446
- const { child } = findAncestor(superCalls[0], (a3) => a3 === block);
3460
+ const { child } = findAncestor(superCalls[0], (a4) => a4 === block);
3447
3461
  const index = findChildIndex(expressions, child);
3448
3462
  if (index < 0) {
3449
3463
  throw new Error("Could not find super call within top-level expressions");
@@ -3458,21 +3472,33 @@ function processParams(f) {
3458
3472
  function processSignature(f) {
3459
3473
  const { block, signature } = f;
3460
3474
  if (!f.async?.length && hasAwait(block)) {
3461
- f.async.push("async ");
3462
- signature.modifier.async = true;
3463
- }
3464
- if (!f.generator?.length && hasYield(block)) {
3465
- if (f.type === "ArrowFunction") {
3466
- gatherRecursiveWithinFunction(block, ($12) => $12.type === "YieldExpression").forEach((y) => {
3467
- const i = y.children.findIndex(($13) => $13.type === "Yield");
3468
- return y.children.splice(i + 1, 0, {
3475
+ if (f.async != null) {
3476
+ f.async.push("async ");
3477
+ signature.modifier.async = true;
3478
+ } else {
3479
+ for (let ref18 = gatherRecursiveWithinFunction(block, ($12) => $12.type === "Await"), i10 = 0, len9 = ref18.length; i10 < len9; i10++) {
3480
+ const a = ref18[i10];
3481
+ const i = findChildIndex(a.parent, a);
3482
+ a.parent.children.splice(i + 1, 0, {
3469
3483
  type: "Error",
3470
- message: "Can't use yield inside of => arrow function"
3484
+ message: `await invalid in ${signature.modifier.get ? "getter" : signature.modifier.set ? "setter" : signature.name}`
3471
3485
  });
3472
- });
3473
- } else {
3486
+ }
3487
+ }
3488
+ }
3489
+ if (!f.generator?.length && hasYield(block)) {
3490
+ if (f.generator != null) {
3474
3491
  f.generator.push("*");
3475
3492
  signature.modifier.generator = true;
3493
+ } else {
3494
+ for (let ref19 = gatherRecursiveWithinFunction(block, ($13) => $13.type === "YieldExpression"), i11 = 0, len10 = ref19.length; i11 < len10; i11++) {
3495
+ const y = ref19[i11];
3496
+ const i = y.children.findIndex(($14) => $14.type === "Yield");
3497
+ y.children.splice(i + 1, 0, {
3498
+ type: "Error",
3499
+ message: `yield invalid in ${f.type === "ArrowFunction" ? "=> arrow function" : signature.modifier.get ? "getter" : signature.modifier.set ? "setter" : signature.name}`
3500
+ });
3501
+ }
3476
3502
  }
3477
3503
  }
3478
3504
  if (signature.modifier.async && !signature.modifier.generator && signature.returnType && !isPromiseType(signature.returnType.t)) {
@@ -3480,21 +3506,15 @@ function processSignature(f) {
3480
3506
  }
3481
3507
  }
3482
3508
  function processFunctions(statements, config2) {
3483
- for (let ref18 = gatherRecursiveAll(statements, ($14) => $14.type === "FunctionExpression" || $14.type === "ArrowFunction"), i10 = 0, len9 = ref18.length; i10 < len9; i10++) {
3484
- const f = ref18[i10];
3485
- if (f.type === "FunctionExpression") {
3509
+ for (let ref20 = gatherRecursiveAll(statements, ($15) => $15.type === "FunctionExpression" || $15.type === "ArrowFunction" || $15.type === "MethodDefinition"), i12 = 0, len11 = ref20.length; i12 < len11; i12++) {
3510
+ const f = ref20[i12];
3511
+ if (f.type === "FunctionExpression" || f.type === "MethodDefinition") {
3486
3512
  implicitFunctionBlock(f);
3487
3513
  }
3488
3514
  processSignature(f);
3489
3515
  processParams(f);
3490
3516
  processReturn(f, config2.implicitReturns);
3491
3517
  }
3492
- for (let ref19 = gatherRecursiveAll(statements, ($15) => $15.type === "MethodDefinition"), i11 = 0, len10 = ref19.length; i11 < len10; i11++) {
3493
- const f = ref19[i11];
3494
- implicitFunctionBlock(f);
3495
- processParams(f);
3496
- processReturn(f, config2.implicitReturns);
3497
- }
3498
3518
  }
3499
3519
  function expressionizeIteration(exp) {
3500
3520
  let { async, generator, block, children, statement } = exp;
@@ -3543,9 +3563,9 @@ function expressionizeIteration(exp) {
3543
3563
  }
3544
3564
  let done;
3545
3565
  if (!async) {
3546
- let ref20;
3547
- if ((ref20 = blockContainingStatement(exp)) && typeof ref20 === "object" && "block" in ref20 && "index" in ref20) {
3548
- const { block: parentBlock, index } = ref20;
3566
+ let ref21;
3567
+ if ((ref21 = blockContainingStatement(exp)) && typeof ref21 === "object" && "block" in ref21 && "index" in ref21) {
3568
+ const { block: parentBlock, index } = ref21;
3549
3569
  statements[0][0] = parentBlock.expressions[index][0];
3550
3570
  parentBlock.expressions.splice(index, index + 1 - index, ...statements);
3551
3571
  updateParentPointers(parentBlock);
@@ -3562,8 +3582,8 @@ function expressionizeIteration(exp) {
3562
3582
  }
3563
3583
  }
3564
3584
  function processIterationExpressions(statements) {
3565
- for (let ref21 = gatherRecursiveAll(statements, ($16) => $16.type === "IterationExpression"), i12 = 0, len11 = ref21.length; i12 < len11; i12++) {
3566
- const s = ref21[i12];
3585
+ for (let ref22 = gatherRecursiveAll(statements, ($16) => $16.type === "IterationExpression"), i13 = 0, len12 = ref22.length; i13 < len12; i13++) {
3586
+ const s = ref22[i13];
3567
3587
  expressionizeIteration(s);
3568
3588
  }
3569
3589
  }
@@ -3589,21 +3609,21 @@ function processCoffeeDo(ws, expression) {
3589
3609
  ...parameters,
3590
3610
  children: (() => {
3591
3611
  const results1 = [];
3592
- for (let ref22 = parameters.children, i13 = 0, len12 = ref22.length; i13 < len12; i13++) {
3593
- let parameter = ref22[i13];
3612
+ for (let ref23 = parameters.children, i14 = 0, len13 = ref23.length; i14 < len13; i14++) {
3613
+ let parameter = ref23[i14];
3594
3614
  if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
3595
- let ref23;
3596
- if (ref23 = parameter.initializer) {
3597
- const initializer = ref23;
3615
+ let ref24;
3616
+ if (ref24 = parameter.initializer) {
3617
+ const initializer = ref24;
3598
3618
  args.push(initializer.expression, parameter.delim);
3599
3619
  parameter = {
3600
3620
  ...parameter,
3601
3621
  initializer: void 0,
3602
- children: parameter.children.filter((a4) => a4 !== initializer)
3622
+ children: parameter.children.filter((a5) => a5 !== initializer)
3603
3623
  };
3604
3624
  } else {
3605
3625
  args.push(parameter.children.filter(
3606
- (a5) => a5 !== parameter.typeSuffix
3626
+ (a6) => a6 !== parameter.typeSuffix
3607
3627
  ));
3608
3628
  }
3609
3629
  }
@@ -3676,7 +3696,7 @@ function makeAmpersandFunction(rhs) {
3676
3696
  }
3677
3697
  if (gatherRecursiveWithinFunction(
3678
3698
  block,
3679
- (a6) => a6 === ref
3699
+ (a7) => a7 === ref
3680
3700
  ).length > 1) {
3681
3701
  fn.ampersandBlock = false;
3682
3702
  }
@@ -5353,7 +5373,6 @@ function processUnaryNestedExpression(pre, args, post) {
5353
5373
 
5354
5374
  // source/parser/pipe.civet
5355
5375
  function constructInvocation(fn, arg) {
5356
- const fnArr = [fn.leadingComment, fn.expr, fn.trailingComment];
5357
5376
  let expr = fn.expr;
5358
5377
  while (expr.type === "ParenthesizedExpression") {
5359
5378
  expr = expr.expression;
@@ -5370,22 +5389,46 @@ function constructInvocation(fn, arg) {
5370
5389
  });
5371
5390
  }
5372
5391
  expr = fn.expr;
5373
- const lhs = makeLeftHandSideExpression(expr);
5392
+ let lhs = expr;
5393
+ if (!(lhs.type === "NewExpression")) {
5394
+ lhs = makeLeftHandSideExpression(lhs);
5395
+ }
5374
5396
  let comment = skipIfOnlyWS(fn.trailingComment);
5375
5397
  if (comment)
5376
- lhs.children.splice(2, 0, comment);
5398
+ lhs.children.push(comment);
5377
5399
  comment = skipIfOnlyWS(fn.leadingComment);
5378
5400
  if (comment)
5379
5401
  lhs.children.splice(1, 0, comment);
5380
5402
  switch (arg.type) {
5381
- case "CommaExpression":
5403
+ case "CommaExpression": {
5382
5404
  arg = makeLeftHandSideExpression(arg);
5383
5405
  break;
5406
+ }
5384
5407
  }
5385
- return {
5386
- type: "CallExpression",
5387
- children: [lhs, "(", arg, ")"]
5408
+ const args = [arg];
5409
+ const call = {
5410
+ type: "Call",
5411
+ args,
5412
+ children: ["(", args, ")"]
5388
5413
  };
5414
+ if (lhs.type === "NewExpression") {
5415
+ let { expression } = lhs;
5416
+ expression = {
5417
+ ...expression,
5418
+ type: "CallExpression",
5419
+ children: [...expression.children, call]
5420
+ };
5421
+ return {
5422
+ ...lhs,
5423
+ expression,
5424
+ children: lhs.children.map(($) => $ === lhs.expression ? expression : $)
5425
+ };
5426
+ } else {
5427
+ return {
5428
+ type: "CallExpression",
5429
+ children: [lhs, call]
5430
+ };
5431
+ }
5389
5432
  }
5390
5433
  function constructPipeStep(fn, arg, returning) {
5391
5434
  if (!returning) {
@@ -5432,21 +5475,24 @@ function processPipelineExpressions(statements) {
5432
5475
  let i = 0, l = body.length;
5433
5476
  const children = [ws];
5434
5477
  let usingRef = null;
5435
- for (i = 0; i < l; i++) {
5436
- const step = body[i];
5478
+ for (let i1 = 0, len3 = body.length; i1 < len3; i1++) {
5479
+ const i2 = i1;
5480
+ const step = body[i1];
5437
5481
  const [leadingComment, pipe, trailingComment, expr] = step;
5438
5482
  const returns = pipe.token === "||>";
5439
5483
  let ref, result, returning = returns ? arg : null;
5440
5484
  if (pipe.token === "|>=") {
5441
5485
  let initRef;
5442
- if (i === 0) {
5486
+ if (i2 === 0) {
5443
5487
  checkValidLHS(arg);
5444
5488
  outer:
5445
5489
  switch (arg.type) {
5446
- case "MemberExpression":
5447
- if (arg.children.length <= 2)
5490
+ case "MemberExpression": {
5491
+ if (arg.children.length <= 2) {
5448
5492
  break;
5449
- case "CallExpression":
5493
+ }
5494
+ }
5495
+ case "CallExpression": {
5450
5496
  const access = arg.children.pop();
5451
5497
  usingRef = makeRef();
5452
5498
  initRef = {
@@ -5458,6 +5504,7 @@ function processPipelineExpressions(statements) {
5458
5504
  children: [usingRef, access]
5459
5505
  };
5460
5506
  break;
5507
+ }
5461
5508
  }
5462
5509
  const lhs = [[
5463
5510
  [initRef],
@@ -5486,7 +5533,7 @@ function processPipelineExpressions(statements) {
5486
5533
  });
5487
5534
  }
5488
5535
  } else {
5489
- if (i === 0)
5536
+ if (i2 === 0)
5490
5537
  s.children = children;
5491
5538
  }
5492
5539
  if (returns && (ref = needsRef(arg))) {
@@ -5511,7 +5558,7 @@ function processPipelineExpressions(statements) {
5511
5558
  returning
5512
5559
  );
5513
5560
  if (result.type === "ReturnStatement") {
5514
- if (i < l - 1) {
5561
+ if (i2 < l - 1) {
5515
5562
  result.children.push({
5516
5563
  type: "Error",
5517
5564
  message: "Can't continue a pipeline after returning"
@@ -5539,7 +5586,7 @@ function processPipelineExpressions(statements) {
5539
5586
  };
5540
5587
  }
5541
5588
  children.push(arg);
5542
- if (!children.some(($) => $?.type === "ReturnStatement") && children.some(($1) => $1 === ",")) {
5589
+ if (!children.some(($1) => $1?.type === "ReturnStatement") && children.some(($2) => $2 === ",")) {
5543
5590
  const { parent } = s;
5544
5591
  const parenthesizedExpression = makeLeftHandSideExpression({ ...s });
5545
5592
  Object.assign(s, parenthesizedExpression, {
@@ -5825,7 +5872,8 @@ function processForInOf($0) {
5825
5872
  blockPrefix.push(["", {
5826
5873
  type: "Declaration",
5827
5874
  children: [declaration, " = ", trimFirstSpace(expRef2), "[", counterRef, "]"],
5828
- names: assignmentNames
5875
+ names: assignmentNames,
5876
+ implicitLift: true
5829
5877
  }, ";"]);
5830
5878
  declaration = {
5831
5879
  type: "Declaration",
@@ -6913,19 +6961,19 @@ function lastAccessInCallExpression(exp) {
6913
6961
  }
6914
6962
  function convertMethodToFunction(method) {
6915
6963
  const { signature, block } = method;
6916
- let { modifier, optional } = signature;
6917
- if (optional)
6964
+ const { async, modifier, optional } = signature;
6965
+ if (optional) {
6918
6966
  return;
6919
- if (modifier) {
6920
- if (modifier.get || modifier.set) {
6921
- return;
6922
- } else if (modifier.async) {
6923
- modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
6924
- } else {
6925
- modifier = ["function ", ...modifier.children || []];
6967
+ }
6968
+ if (modifier?.get || modifier?.set) {
6969
+ return;
6970
+ }
6971
+ const func = ["function "];
6972
+ if (async != null) {
6973
+ func.unshift(async);
6974
+ if (async.length && !async[async.length - 1]?.length) {
6975
+ async.push(" ");
6926
6976
  }
6927
- } else {
6928
- modifier = "function ";
6929
6977
  }
6930
6978
  return {
6931
6979
  ...signature,
@@ -6933,7 +6981,7 @@ function convertMethodToFunction(method) {
6933
6981
  signature,
6934
6982
  type: "FunctionExpression",
6935
6983
  children: [
6936
- [modifier, ...signature.children.slice(1)],
6984
+ [...func, ...signature.children.slice(1)],
6937
6985
  block
6938
6986
  ],
6939
6987
  block
@@ -7047,7 +7095,8 @@ function makeGetterMethod(name, ws, value, returnType, block, kind = { token: "g
7047
7095
  block = {
7048
7096
  type: "BlockStatement",
7049
7097
  expressions,
7050
- children: ["{ ", expressions, " }"]
7098
+ children: ["{ ", expressions, " }"],
7099
+ bare: false
7051
7100
  };
7052
7101
  }
7053
7102
  if (autoReturn) {
@@ -7760,7 +7809,13 @@ function processPlaceholders(statements) {
7760
7809
  }
7761
7810
  } else {
7762
7811
  let child;
7812
+ let implicitLift;
7763
7813
  ({ ancestor, child } = findAncestor(exp, (ancestor2, child2) => {
7814
+ const prevImplicitLift = implicitLift;
7815
+ ({ implicitLift } = ancestor2);
7816
+ if (prevImplicitLift) {
7817
+ return;
7818
+ }
7764
7819
  const { type } = ancestor2;
7765
7820
  if (type === "IfStatement") {
7766
7821
  liftedIfs.add(ancestor2);
@@ -7846,7 +7901,7 @@ function processPlaceholders(statements) {
7846
7901
  const placeholder = placeholders[i15];
7847
7902
  typeSuffix ??= placeholder.typeSuffix;
7848
7903
  let ref26;
7849
- replaceNode((ref26 = placeholder.children)[ref26.length - 1], ref);
7904
+ (ref26 = placeholder.children)[ref26.length - 1] = ref;
7850
7905
  }
7851
7906
  const { parent } = ancestor;
7852
7907
  const body = maybeUnwrap(ancestor);
@@ -8136,6 +8191,7 @@ var grammar = {
8136
8191
  LeftHandSideExpression,
8137
8192
  CallExpression,
8138
8193
  CallExpressionRest,
8194
+ ExplicitCallExpressionRest,
8139
8195
  OptionalShorthand,
8140
8196
  OptionalDot,
8141
8197
  NonNullAssertion,
@@ -8419,8 +8475,8 @@ var grammar = {
8419
8475
  Debugger,
8420
8476
  MaybeNestedNonPipelineExpression,
8421
8477
  MaybeNestedPostfixedExpression,
8478
+ NestedPostfixedExpressionNoTrailing,
8422
8479
  MaybeNestedExpression,
8423
- NestedExpression,
8424
8480
  MaybeParenNestedExpression,
8425
8481
  ImportDeclaration,
8426
8482
  ImpliedImport,
@@ -9433,7 +9489,7 @@ var ArgumentsWithTrailingCallExpressions$0 = (0, import_lib2.$TS)((0, import_lib
9433
9489
  function ArgumentsWithTrailingCallExpressions(ctx, state2) {
9434
9490
  return (0, import_lib2.$EVENT)(ctx, state2, "ArgumentsWithTrailingCallExpressions", ArgumentsWithTrailingCallExpressions$0);
9435
9491
  }
9436
- 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) {
9492
+ 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) {
9437
9493
  $1 = $1.flat();
9438
9494
  if (!$1.length && !$2)
9439
9495
  return $skip;
@@ -9529,10 +9585,10 @@ var NestedArgumentList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent,
9529
9585
  function NestedArgumentList(ctx, state2) {
9530
9586
  return (0, import_lib2.$EVENT)(ctx, state2, "NestedArgumentList", NestedArgumentList$0);
9531
9587
  }
9532
- 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) {
9533
- var indent = $1;
9534
- var args = $3;
9535
- var comma = $4;
9588
+ 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) {
9589
+ var indent = $2;
9590
+ var args = $4;
9591
+ var comma = $5;
9536
9592
  let [arg0, ...rest] = args;
9537
9593
  arg0 = prepend(indent, arg0);
9538
9594
  return [arg0, ...rest, comma];
@@ -10722,6 +10778,32 @@ var CallExpressionRest$$ = [CallExpressionRest$0, CallExpressionRest$1, CallExpr
10722
10778
  function CallExpressionRest(ctx, state2) {
10723
10779
  return (0, import_lib2.$EVENT_C)(ctx, state2, "CallExpressionRest", CallExpressionRest$$);
10724
10780
  }
10781
+ var ExplicitCallExpressionRest$0 = MemberExpressionRest;
10782
+ var ExplicitCallExpressionRest$1 = (0, import_lib2.$T)((0, import_lib2.$S)(TypeArguments, (0, import_lib2.$N)((0, import_lib2.$C)(IdentifierName, NumericLiteral))), function(value) {
10783
+ return value[0];
10784
+ });
10785
+ 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) {
10786
+ var literal = $2;
10787
+ if (literal.type === "StringLiteral") {
10788
+ literal = "`" + literal.token.slice(1, -1).replace(/(`|\$\{)/g, "\\$1") + "`";
10789
+ }
10790
+ return literal;
10791
+ });
10792
+ var ExplicitCallExpressionRest$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(OptionalShorthand), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
10793
+ var optional = $1;
10794
+ var call = $2;
10795
+ if (!optional)
10796
+ return call;
10797
+ return {
10798
+ ...call,
10799
+ children: [optional, ...call.children],
10800
+ optional
10801
+ };
10802
+ });
10803
+ var ExplicitCallExpressionRest$$ = [ExplicitCallExpressionRest$0, ExplicitCallExpressionRest$1, ExplicitCallExpressionRest$2, ExplicitCallExpressionRest$3];
10804
+ function ExplicitCallExpressionRest(ctx, state2) {
10805
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "ExplicitCallExpressionRest", ExplicitCallExpressionRest$$);
10806
+ }
10725
10807
  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) {
10726
10808
  var comments = $2;
10727
10809
  var q = $3;
@@ -11359,7 +11441,8 @@ var NWBindingIdentifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(At, AtIdent
11359
11441
  return {
11360
11442
  type: "AtBinding",
11361
11443
  children: [ref],
11362
- ref
11444
+ ref,
11445
+ names: []
11363
11446
  };
11364
11447
  });
11365
11448
  var NWBindingIdentifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Hash, AtIdentifierRef), function($skip, $loc, $0, $1, $2) {
@@ -11368,7 +11451,8 @@ var NWBindingIdentifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Hash, AtIde
11368
11451
  return {
11369
11452
  type: "AtBinding",
11370
11453
  children: [ref],
11371
- ref
11454
+ ref,
11455
+ names: []
11372
11456
  };
11373
11457
  });
11374
11458
  var NWBindingIdentifier$2 = Identifier;
@@ -13484,52 +13568,23 @@ var MethodDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Abstract, __,
13484
13568
  abstract: true,
13485
13569
  signature,
13486
13570
  parameters: signature.parameters,
13571
+ async: signature.async,
13572
+ generator: signature.generator,
13487
13573
  ts: true
13488
13574
  };
13489
13575
  });
13490
13576
  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) {
13491
13577
  var signature = $1;
13492
13578
  var block = $3;
13493
- let children = $0;
13494
- let generatorPos = 0;
13495
- let { modifier } = signature;
13496
- if (hasAwait(block)) {
13497
- generatorPos++;
13498
- children = children.slice();
13499
- if (modifier?.get || modifier?.set) {
13500
- children.push({
13501
- type: "Error",
13502
- message: "Getters and setters cannot be async"
13503
- });
13504
- } else if (modifier?.async) {
13505
- } else {
13506
- children.unshift("async ");
13507
- modifier = { ...modifier, async: true };
13508
- signature = { ...signature, modifier };
13509
- }
13510
- }
13511
- if (hasYield(block)) {
13512
- if (children === $0)
13513
- children = children.slice();
13514
- if (modifier?.get || modifier?.set) {
13515
- children.push({
13516
- type: "Error",
13517
- message: "Getters and setters cannot be generators"
13518
- });
13519
- } else if (modifier?.generator) {
13520
- } else {
13521
- children.splice(generatorPos, 0, "*");
13522
- modifier = { ...modifier, generator: true };
13523
- signature = { ...signature, modifier };
13524
- }
13525
- }
13526
13579
  return {
13527
13580
  type: "MethodDefinition",
13528
- children,
13581
+ children: $0,
13529
13582
  name: signature.name,
13530
13583
  signature,
13531
13584
  block,
13532
- parameters: signature.parameters
13585
+ parameters: signature.parameters,
13586
+ async: signature.async,
13587
+ generator: signature.generator
13533
13588
  };
13534
13589
  });
13535
13590
  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) {
@@ -13612,36 +13667,38 @@ function MethodDefinition(ctx, state2) {
13612
13667
  }
13613
13668
  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) {
13614
13669
  var kind = $1;
13670
+ var ws = $2;
13615
13671
  return {
13616
- type: "MethodModifier",
13617
- async: false,
13618
- generator: false,
13619
- get: kind.token === "get",
13620
- set: kind.token === "set",
13621
- children: $0
13622
- };
13623
- });
13624
- 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) {
13625
- return {
13626
- type: "MethodModifier",
13627
- async: true,
13628
- get: false,
13629
- set: false,
13630
- generator: !!$2,
13631
- children: $0
13672
+ // no async or generator, because getters and setters can't be
13673
+ modifier: {
13674
+ async: false,
13675
+ generator: false,
13676
+ get: kind.token === "get",
13677
+ set: kind.token === "set"
13678
+ },
13679
+ children: [kind, ws]
13632
13680
  };
13633
13681
  });
13634
- var MethodModifier$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Star, __), function($skip, $loc, $0, $1, $2) {
13682
+ 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) {
13683
+ var async = $1;
13684
+ var generator = $2;
13685
+ if (!async)
13686
+ async = [];
13687
+ if (!generator)
13688
+ generator = [];
13635
13689
  return {
13636
- type: "MethodModifier",
13637
- async: false,
13638
- get: false,
13639
- set: false,
13640
- generator: true,
13641
- children: $0
13690
+ async,
13691
+ generator,
13692
+ modifier: {
13693
+ async: !!async.length,
13694
+ get: false,
13695
+ set: false,
13696
+ generator: !!generator.length
13697
+ },
13698
+ children: [async, generator]
13642
13699
  };
13643
13700
  });
13644
- var MethodModifier$$ = [MethodModifier$0, MethodModifier$1, MethodModifier$2];
13701
+ var MethodModifier$$ = [MethodModifier$0, MethodModifier$1];
13645
13702
  function MethodModifier(ctx, state2) {
13646
13703
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MethodModifier", MethodModifier$$);
13647
13704
  }
@@ -13656,10 +13713,12 @@ var MethodSignature$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ConstructorShor
13656
13713
  parameters
13657
13714
  };
13658
13715
  });
13659
- 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) {
13716
+ 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) {
13660
13717
  var modifier = $1;
13661
13718
  var name = $2;
13719
+ var ws1 = $3;
13662
13720
  var optional = $4;
13721
+ var ws2 = $5;
13663
13722
  var parameters = $6;
13664
13723
  var returnType = $7;
13665
13724
  if (name.name) {
@@ -13668,14 +13727,15 @@ var MethodSignature$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
13668
13727
  name = name.token.match(/^(?:"|')/) ? name.token.slice(1, -1) : name.token;
13669
13728
  }
13670
13729
  if (optional)
13671
- $0[3] = optional = { ...optional, ts: true };
13672
- modifier = modifier || {};
13730
+ optional = { ...optional, ts: true };
13673
13731
  return {
13674
13732
  type: "MethodSignature",
13675
- children: $0,
13733
+ children: [...modifier.children, name, ws1, optional, ws2, parameters, returnType],
13734
+ async: modifier.async,
13735
+ generator: modifier.generator,
13676
13736
  name,
13677
13737
  optional,
13678
- modifier,
13738
+ modifier: modifier.modifier,
13679
13739
  // get/set/async/generator
13680
13740
  returnType,
13681
13741
  parameters
@@ -15676,48 +15736,65 @@ function Debugger(ctx, state2) {
15676
15736
  return (0, import_lib2.$EVENT)(ctx, state2, "Debugger", Debugger$0);
15677
15737
  }
15678
15738
  var MaybeNestedNonPipelineExpression$0 = NestedBulletedArray;
15679
- 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) {
15680
- if ($3)
15681
- return $3;
15682
- return $skip;
15739
+ var MaybeNestedNonPipelineExpression$1 = NestedImplicitObjectLiteral;
15740
+ 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) {
15741
+ var expression = $2;
15742
+ var trailing = $4;
15743
+ if (!expression)
15744
+ return $skip;
15745
+ if (!trailing)
15746
+ return expression;
15747
+ return [expression, trailing];
15683
15748
  });
15684
- var MaybeNestedNonPipelineExpression$2 = NonPipelineExpression;
15685
- var MaybeNestedNonPipelineExpression$$ = [MaybeNestedNonPipelineExpression$0, MaybeNestedNonPipelineExpression$1, MaybeNestedNonPipelineExpression$2];
15749
+ var MaybeNestedNonPipelineExpression$3 = NonPipelineExpression;
15750
+ var MaybeNestedNonPipelineExpression$$ = [MaybeNestedNonPipelineExpression$0, MaybeNestedNonPipelineExpression$1, MaybeNestedNonPipelineExpression$2, MaybeNestedNonPipelineExpression$3];
15686
15751
  function MaybeNestedNonPipelineExpression(ctx, state2) {
15687
15752
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedNonPipelineExpression", MaybeNestedNonPipelineExpression$$);
15688
15753
  }
15689
15754
  var MaybeNestedPostfixedExpression$0 = NestedBulletedArray;
15690
- 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) {
15691
- if ($3)
15692
- return $3;
15693
- return $skip;
15755
+ var MaybeNestedPostfixedExpression$1 = NestedImplicitObjectLiteral;
15756
+ 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) {
15757
+ var expression = $2;
15758
+ var trailing = $4;
15759
+ if (!expression)
15760
+ return $skip;
15761
+ if (!trailing)
15762
+ return expression;
15763
+ return [expression, trailing];
15694
15764
  });
15695
- var MaybeNestedPostfixedExpression$2 = PostfixedExpression;
15696
- var MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeNestedPostfixedExpression$1, MaybeNestedPostfixedExpression$2];
15765
+ var MaybeNestedPostfixedExpression$3 = PostfixedExpression;
15766
+ var MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeNestedPostfixedExpression$1, MaybeNestedPostfixedExpression$2, MaybeNestedPostfixedExpression$3];
15697
15767
  function MaybeNestedPostfixedExpression(ctx, state2) {
15698
15768
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedPostfixedExpression", MaybeNestedPostfixedExpression$$);
15699
15769
  }
15770
+ var NestedPostfixedExpressionNoTrailing$0 = NestedBulletedArray;
15771
+ var NestedPostfixedExpressionNoTrailing$1 = NestedImplicitObjectLiteral;
15772
+ 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) {
15773
+ var expression = $2;
15774
+ if (!expression)
15775
+ return $skip;
15776
+ return expression;
15777
+ });
15778
+ var NestedPostfixedExpressionNoTrailing$$ = [NestedPostfixedExpressionNoTrailing$0, NestedPostfixedExpressionNoTrailing$1, NestedPostfixedExpressionNoTrailing$2];
15779
+ function NestedPostfixedExpressionNoTrailing(ctx, state2) {
15780
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "NestedPostfixedExpressionNoTrailing", NestedPostfixedExpressionNoTrailing$$);
15781
+ }
15700
15782
  var MaybeNestedExpression$0 = NestedBulletedArray;
15701
- 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) {
15702
- if ($3)
15703
- return $3;
15704
- return $skip;
15783
+ var MaybeNestedExpression$1 = NestedImplicitObjectLiteral;
15784
+ 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) {
15785
+ var expression = $2;
15786
+ var trailing = $4;
15787
+ if (!expression)
15788
+ return $skip;
15789
+ if (!trailing)
15790
+ return expression;
15791
+ return [expression, trailing];
15705
15792
  });
15706
- var MaybeNestedExpression$2 = Expression;
15707
- var MaybeNestedExpression$$ = [MaybeNestedExpression$0, MaybeNestedExpression$1, MaybeNestedExpression$2];
15793
+ var MaybeNestedExpression$3 = Expression;
15794
+ var MaybeNestedExpression$$ = [MaybeNestedExpression$0, MaybeNestedExpression$1, MaybeNestedExpression$2, MaybeNestedExpression$3];
15708
15795
  function MaybeNestedExpression(ctx, state2) {
15709
15796
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedExpression", MaybeNestedExpression$$);
15710
15797
  }
15711
- var NestedExpression$0 = NestedBulletedArray;
15712
- 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) {
15713
- if ($3)
15714
- return $3;
15715
- return $skip;
15716
- });
15717
- var NestedExpression$$ = [NestedExpression$0, NestedExpression$1];
15718
- function NestedExpression(ctx, state2) {
15719
- return (0, import_lib2.$EVENT_C)(ctx, state2, "NestedExpression", NestedExpression$$);
15720
- }
15721
15798
  var MaybeParenNestedExpression$0 = (0, import_lib2.$T)((0, import_lib2.$Y)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement, NoBlock)), function(value) {
15722
15799
  return "";
15723
15800
  });
@@ -15727,7 +15804,7 @@ var MaybeParenNestedExpression$1 = (0, import_lib2.$T)((0, import_lib2.$S)((0, i
15727
15804
  var MaybeParenNestedExpression$2 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$Y)(EOS), (0, import_lib2.$C)(ArrayLiteral, ObjectLiteral)), function(value) {
15728
15805
  return value[1];
15729
15806
  });
15730
- 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) {
15807
+ 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) {
15731
15808
  var exp = $5;
15732
15809
  if (!exp)
15733
15810
  return $skip;
@@ -17819,17 +17896,13 @@ var JSXAttributeName$$ = [JSXAttributeName$0, JSXAttributeName$1];
17819
17896
  function JSXAttributeName(ctx, state2) {
17820
17897
  return (0, import_lib2.$EVENT_C)(ctx, state2, "JSXAttributeName", JSXAttributeName$$);
17821
17898
  }
17822
- 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) {
17899
+ 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) {
17823
17900
  var ws1 = $2;
17824
17901
  var equals = $3;
17825
- var ws2 = $4;
17826
17902
  var open = $5;
17827
- var indent = $6;
17828
- var expression = $7;
17829
- var close = $9;
17830
- if (!expression)
17831
- return $skip;
17832
- return [ws1, equals, ws2, open, indent, expression, close];
17903
+ var expression = $6;
17904
+ var close = $7;
17905
+ return [ws1, equals, open, trimFirstSpace(expression), close];
17833
17906
  });
17834
17907
  var JSXAttributeInitializer$1 = (0, import_lib2.$S)((0, import_lib2.$E)(Whitespace), Equals, (0, import_lib2.$E)(Whitespace), JSXAttributeValue);
17835
17908
  var JSXAttributeInitializer$$ = [JSXAttributeInitializer$0, JSXAttributeInitializer$1];