@danielx/civet 0.11.2 → 0.11.3

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
@@ -2932,20 +2932,7 @@ function wrapTypeInApplication(t, id, raw) {
2932
2932
  }
2933
2933
  function implicitFunctionBlock(f) {
2934
2934
  if (f.abstract || f.block || f.signature?.optional) return;
2935
- const { name, parent } = f;
2936
- let ancestor = parent;
2937
- let child = f;
2938
- if (ancestor?.type === "ExportDeclaration") {
2939
- child = ancestor;
2940
- ancestor = ancestor.parent;
2941
- }
2942
- const expressions = ancestor?.expressions ?? ancestor?.elements;
2943
- const currentIndex = expressions?.findIndex(([, def]) => def === child);
2944
- let following = currentIndex >= 0 && expressions[currentIndex + 1]?.[1];
2945
- if (following?.type === "ExportDeclaration") {
2946
- following = following.declaration;
2947
- }
2948
- if (f.type === following?.type && name != null && name === following.name) {
2935
+ if (followingOverloads(f).length) {
2949
2936
  f.ts = true;
2950
2937
  } else {
2951
2938
  const block = makeEmptyBlock();
@@ -2955,6 +2942,66 @@ function implicitFunctionBlock(f) {
2955
2942
  f.ts = false;
2956
2943
  }
2957
2944
  }
2945
+ function overloadsInDirection(f, direction) {
2946
+ if (!(f.name != null)) {
2947
+ return [];
2948
+ }
2949
+ let ancestor = f.parent;
2950
+ let child = f;
2951
+ if (ancestor?.type === "ExportDeclaration") {
2952
+ child = ancestor;
2953
+ ancestor = ancestor.parent;
2954
+ }
2955
+ if (!(ancestor?.type === "BlockStatement")) {
2956
+ return [];
2957
+ }
2958
+ const { expressions } = ancestor;
2959
+ let index = findChildIndex(expressions, child);
2960
+ if (!(index >= 0)) {
2961
+ return [];
2962
+ }
2963
+ if (direction < 0) {
2964
+ const results1 = [];
2965
+ while (--index >= 0) {
2966
+ let candidate = expressions[index][1];
2967
+ if (!candidate) {
2968
+ break;
2969
+ }
2970
+ if (candidate.type === "ExportDeclaration") {
2971
+ candidate = candidate.declaration;
2972
+ }
2973
+ if (!(candidate && candidate.type === f.type && candidate.name === f.name)) {
2974
+ break;
2975
+ }
2976
+ results1.push(candidate);
2977
+ }
2978
+ ;
2979
+ return results1;
2980
+ } else {
2981
+ const results2 = [];
2982
+ while (++index < expressions.length) {
2983
+ let candidate = expressions[index][1];
2984
+ if (!candidate) {
2985
+ break;
2986
+ }
2987
+ if (candidate.type === "ExportDeclaration") {
2988
+ candidate = candidate.declaration;
2989
+ }
2990
+ if (!(candidate && candidate.type === f.type && candidate.name === f.name)) {
2991
+ break;
2992
+ }
2993
+ results2.push(candidate);
2994
+ }
2995
+ ;
2996
+ return results2;
2997
+ }
2998
+ }
2999
+ function precedingOverloads(f) {
3000
+ return overloadsInDirection(f, -1);
3001
+ }
3002
+ function followingOverloads(f) {
3003
+ return overloadsInDirection(f, 1);
3004
+ }
2958
3005
  function processReturn(f, implicitReturns) {
2959
3006
  let { returnType } = f.signature;
2960
3007
  if (returnType && returnType.optional) {
@@ -3988,10 +4035,7 @@ function processParams(f) {
3988
4035
  const classExpressions = ancestor.body.expressions;
3989
4036
  let index2 = findChildIndex(classExpressions, f);
3990
4037
  assert.notEqual(index2, -1, "Could not find constructor in class");
3991
- let m7;
3992
- while (m7 = classExpressions[index2 - 1]?.[1], typeof m7 === "object" && m7 != null && "type" in m7 && m7.type === "MethodDefinition" && "name" in m7 && m7.name === "constructor") {
3993
- index2--;
3994
- }
4038
+ index2 -= precedingOverloads(f).length;
3995
4039
  const fStatement = classExpressions[index2];
3996
4040
  for (let ref20 = gatherRecursive(parameters, ($14) => $14.type === "Parameter"), i10 = 0, len9 = ref20.length; i10 < len9; i10++) {
3997
4041
  const parameter = ref20[i10];
@@ -4086,10 +4130,11 @@ function findSuperCall(block) {
4086
4130
  }
4087
4131
  function processSignature(f) {
4088
4132
  const { block, signature } = f;
4133
+ let addAsync = false;
4134
+ let addGenerator = false;
4089
4135
  if (!f.async?.length && hasAwait(block)) {
4090
4136
  if (f.async != null) {
4091
- f.async.push("async ");
4092
- signature.modifier.async = true;
4137
+ addAsync = true;
4093
4138
  } else {
4094
4139
  for (let ref23 = gatherRecursiveWithinFunction(block, ($17) => $17.type === "Await"), i13 = 0, len12 = ref23.length; i13 < len12; i13++) {
4095
4140
  const a = ref23[i13];
@@ -4103,8 +4148,7 @@ function processSignature(f) {
4103
4148
  }
4104
4149
  if (!f.generator?.length && hasYield(block)) {
4105
4150
  if (f.generator != null) {
4106
- f.generator.push("*");
4107
- signature.modifier.generator = true;
4151
+ addGenerator = true;
4108
4152
  } else {
4109
4153
  for (let ref24 = gatherRecursiveWithinFunction(block, ($18) => $18.type === "YieldExpression"), i14 = 0, len13 = ref24.length; i14 < len13; i14++) {
4110
4154
  const y = ref24[i14];
@@ -4116,17 +4160,28 @@ function processSignature(f) {
4116
4160
  }
4117
4161
  }
4118
4162
  }
4119
- if (signature.modifier.async && !signature.modifier.generator && signature.returnType && !isPromiseType(signature.returnType.t)) {
4120
- replaceNode(
4121
- signature.returnType.t,
4122
- wrapTypeInPromise(signature.returnType.t),
4123
- signature.returnType
4124
- );
4163
+ for (let ref25 = [f, ...precedingOverloads(f)], i15 = 0, len14 = ref25.length; i15 < len14; i15++) {
4164
+ const overload = ref25[i15];
4165
+ if (addAsync && overload.async != null && !overload.async.length) {
4166
+ overload.async.push("async ");
4167
+ overload.signature.modifier.async = true;
4168
+ }
4169
+ if (addGenerator && overload.generator != null && !overload.generator.length) {
4170
+ overload.generator.push("*");
4171
+ overload.signature.modifier.generator = true;
4172
+ }
4173
+ if (overload.signature.modifier.async && !overload.signature.modifier.generator && overload.signature.returnType && !isPromiseType(overload.signature.returnType.t)) {
4174
+ replaceNode(
4175
+ overload.signature.returnType.t,
4176
+ wrapTypeInPromise(overload.signature.returnType.t),
4177
+ overload.signature.returnType
4178
+ );
4179
+ }
4125
4180
  }
4126
4181
  }
4127
4182
  function processFunctions(statements, config2) {
4128
- for (let ref25 = gatherRecursiveAll(statements, ($20) => $20.type === "FunctionExpression" || $20.type === "ArrowFunction" || $20.type === "MethodDefinition"), i15 = 0, len14 = ref25.length; i15 < len14; i15++) {
4129
- const f = ref25[i15];
4183
+ for (let ref26 = gatherRecursiveAll(statements, ($20) => $20.type === "FunctionExpression" || $20.type === "ArrowFunction" || $20.type === "MethodDefinition"), i16 = 0, len15 = ref26.length; i16 < len15; i16++) {
4184
+ const f = ref26[i16];
4130
4185
  if (f.type === "FunctionExpression" || f.type === "MethodDefinition") {
4131
4186
  implicitFunctionBlock(f);
4132
4187
  }
@@ -4185,9 +4240,9 @@ function expressionizeIteration(exp) {
4185
4240
  }
4186
4241
  let done;
4187
4242
  if (!async) {
4188
- let ref26;
4189
- if ((ref26 = blockContainingStatement(exp)) && typeof ref26 === "object" && "block" in ref26 && "index" in ref26) {
4190
- const { block: parentBlock, index } = ref26;
4243
+ let ref27;
4244
+ if ((ref27 = blockContainingStatement(exp)) && typeof ref27 === "object" && "block" in ref27 && "index" in ref27) {
4245
+ const { block: parentBlock, index } = ref27;
4191
4246
  statements[0][0] = parentBlock.expressions[index][0];
4192
4247
  parentBlock.expressions.splice(index, index + 1 - index, ...statements);
4193
4248
  updateParentPointers(parentBlock);
@@ -4204,8 +4259,8 @@ function expressionizeIteration(exp) {
4204
4259
  }
4205
4260
  }
4206
4261
  function processIterationExpressions(statements) {
4207
- for (let ref27 = gatherRecursiveAll(statements, ($21) => $21.type === "IterationExpression"), i16 = 0, len15 = ref27.length; i16 < len15; i16++) {
4208
- const s = ref27[i16];
4262
+ for (let ref28 = gatherRecursiveAll(statements, ($21) => $21.type === "IterationExpression"), i17 = 0, len16 = ref28.length; i17 < len16; i17++) {
4263
+ const s = ref28[i17];
4209
4264
  expressionizeIteration(s);
4210
4265
  }
4211
4266
  }
@@ -4228,13 +4283,13 @@ function processCoffeeDo(ws, expression) {
4228
4283
  if (typeof expression === "object" && expression != null && "type" in expression && expression.type === "ArrowFunction" || typeof expression === "object" && expression != null && "type" in expression && expression.type === "FunctionExpression") {
4229
4284
  let { parameters } = expression;
4230
4285
  const parameterList = parameters.parameters;
4231
- const results1 = [];
4232
- for (let i17 = 0, len16 = parameterList.length; i17 < len16; i17++) {
4233
- let parameter = parameterList[i17];
4286
+ const results3 = [];
4287
+ for (let i18 = 0, len17 = parameterList.length; i18 < len17; i18++) {
4288
+ let parameter = parameterList[i18];
4234
4289
  if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
4235
- let ref28;
4236
- if (ref28 = parameter.initializer) {
4237
- const initializer = ref28;
4290
+ let ref29;
4291
+ if (ref29 = parameter.initializer) {
4292
+ const initializer = ref29;
4238
4293
  args.push(initializer.expression, parameter.delim);
4239
4294
  parameter = {
4240
4295
  ...parameter,
@@ -4247,10 +4302,10 @@ function processCoffeeDo(ws, expression) {
4247
4302
  ));
4248
4303
  }
4249
4304
  }
4250
- results1.push(parameter);
4305
+ results3.push(parameter);
4251
4306
  }
4252
4307
  ;
4253
- const newParameterList = results1;
4308
+ const newParameterList = results3;
4254
4309
  const newParameters = {
4255
4310
  ...parameters,
4256
4311
  parameters: newParameterList,
@@ -9186,12 +9241,16 @@ var grammar = {
9186
9241
  CommaDelimiter,
9187
9242
  OptionalCommaDelimiter,
9188
9243
  ArgumentList,
9244
+ PostfixedArgumentList,
9189
9245
  NestedArguments,
9190
9246
  NestedArgumentList,
9191
9247
  NestedArgument,
9192
9248
  SingleLineArgumentExpressions,
9193
9249
  WArgumentPart,
9250
+ SingleLinePostfixedArgumentExpressions,
9251
+ WPostfixedArgumentPart,
9194
9252
  ArgumentPart,
9253
+ PostfixedArgumentPart,
9195
9254
  BinaryOpExpression,
9196
9255
  BinaryOpNotDedented,
9197
9256
  BinaryOpRHS,
@@ -9574,6 +9633,7 @@ var grammar = {
9574
9633
  Debugger,
9575
9634
  MaybeNestedNonPipelineExpression,
9576
9635
  MaybeNestedPostfixedExpression,
9636
+ MaybeNestedPostfixedCommaExpression,
9577
9637
  NestedPostfixedExpressionNoTrailing,
9578
9638
  MaybeNestedExpression,
9579
9639
  MaybeParenNestedExpression,
@@ -10589,7 +10649,7 @@ var ImplicitArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ApplicationSt
10589
10649
  function ImplicitArguments(ctx, state2) {
10590
10650
  return (0, import_lib2.$EVENT)(ctx, state2, "ImplicitArguments", ImplicitArguments$0);
10591
10651
  }
10592
- var ExplicitArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(ArgumentList, (0, import_lib2.$E)((0, import_lib2.$S)(__, Comma)))), __, RestoreAll, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
10652
+ var ExplicitArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(PostfixedArgumentList, (0, import_lib2.$E)((0, import_lib2.$S)(__, Comma)))), __, RestoreAll, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
10593
10653
  var open = $1;
10594
10654
  var args = $3;
10595
10655
  var ws = $4;
@@ -10727,6 +10787,35 @@ var ArgumentList$$ = [ArgumentList$0, ArgumentList$1, ArgumentList$2];
10727
10787
  function ArgumentList(ctx, state2) {
10728
10788
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ArgumentList", ArgumentList$$);
10729
10789
  }
10790
+ var PostfixedArgumentList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(EOS), PostfixedArgumentPart, (0, import_lib2.$Q)((0, import_lib2.$S)(CommaDelimiter, (0, import_lib2.$N)(EOS), (0, import_lib2.$E)(_), PostfixedArgumentPart)), (0, import_lib2.$S)(CommaDelimiter, NestedArguments), (0, import_lib2.$Q)((0, import_lib2.$S)(OptionalCommaDelimiter, NestedArguments))), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
10791
+ return [
10792
+ $2,
10793
+ ...$3.flatMap(([comma, eos, ws, arg]) => [comma, prepend(ws, arg)]),
10794
+ ...Array.isArray($4[1]) ? [$4[0], ...$4[1]] : $4,
10795
+ ...$5.flatMap(
10796
+ ([comma, args]) => Array.isArray(args) ? [comma, ...args] : [comma, args]
10797
+ )
10798
+ ];
10799
+ });
10800
+ var PostfixedArgumentList$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(NestedArguments, (0, import_lib2.$Q)((0, import_lib2.$S)(OptionalCommaDelimiter, NestedArguments))), function($skip, $loc, $0, $1, $2) {
10801
+ if (!Array.isArray($1)) $1 = [$1];
10802
+ return [
10803
+ ...trimFirstSpace($1),
10804
+ ...$2.flatMap(
10805
+ ([comma, args]) => Array.isArray(args) ? [comma, ...args] : [comma, args]
10806
+ )
10807
+ ];
10808
+ });
10809
+ var PostfixedArgumentList$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixedArgumentPart, (0, import_lib2.$Q)((0, import_lib2.$S)(CommaDelimiter, (0, import_lib2.$E)(_), PostfixedArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
10810
+ return [
10811
+ prepend($1, $2),
10812
+ ...$3.flatMap(([comma, ws, arg]) => [comma, prepend(ws, arg)])
10813
+ ];
10814
+ });
10815
+ var PostfixedArgumentList$$ = [PostfixedArgumentList$0, PostfixedArgumentList$1, PostfixedArgumentList$2];
10816
+ function PostfixedArgumentList(ctx, state2) {
10817
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "PostfixedArgumentList", PostfixedArgumentList$$);
10818
+ }
10730
10819
  var NestedArguments$0 = NestedBulletedArray;
10731
10820
  var NestedArguments$1 = NestedImplicitObjectLiteral;
10732
10821
  var NestedArguments$2 = NestedArgumentList;
@@ -10742,7 +10831,7 @@ var NestedArgumentList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent,
10742
10831
  function NestedArgumentList(ctx, state2) {
10743
10832
  return (0, import_lib2.$EVENT)(ctx, state2, "NestedArgumentList", NestedArgumentList$0);
10744
10833
  }
10745
- 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) {
10834
+ var NestedArgument$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NestedImplicitPropertyDefinition), Nested, (0, import_lib2.$N)(Bullet), SingleLinePostfixedArgumentExpressions, ParameterElementDelimiter), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
10746
10835
  var indent = $2;
10747
10836
  var args = $4;
10748
10837
  var comma = $5;
@@ -10765,6 +10854,18 @@ var WArgumentPart$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$
10765
10854
  function WArgumentPart(ctx, state2) {
10766
10855
  return (0, import_lib2.$EVENT)(ctx, state2, "WArgumentPart", WArgumentPart$0);
10767
10856
  }
10857
+ var SingleLinePostfixedArgumentExpressions$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(WPostfixedArgumentPart, (0, import_lib2.$Q)((0, import_lib2.$S)((0, import_lib2.$S)((0, import_lib2.$E)(_), Comma), WPostfixedArgumentPart))), function($skip, $loc, $0, $1, $2) {
10858
+ return [$1, ...$2.flat()];
10859
+ });
10860
+ function SingleLinePostfixedArgumentExpressions(ctx, state2) {
10861
+ return (0, import_lib2.$EVENT)(ctx, state2, "SingleLinePostfixedArgumentExpressions", SingleLinePostfixedArgumentExpressions$0);
10862
+ }
10863
+ var WPostfixedArgumentPart$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixedArgumentPart), function($skip, $loc, $0, $1, $2) {
10864
+ return prepend($1, $2);
10865
+ });
10866
+ function WPostfixedArgumentPart(ctx, state2) {
10867
+ return (0, import_lib2.$EVENT)(ctx, state2, "WPostfixedArgumentPart", WPostfixedArgumentPart$0);
10868
+ }
10768
10869
  var ArgumentPart$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(DotDotDot, Expression), function($skip, $loc, $0, $1, $2) {
10769
10870
  var spread = $1;
10770
10871
  var expression = $2;
@@ -10789,6 +10890,30 @@ var ArgumentPart$$ = [ArgumentPart$0, ArgumentPart$1];
10789
10890
  function ArgumentPart(ctx, state2) {
10790
10891
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ArgumentPart", ArgumentPart$$);
10791
10892
  }
10893
+ var PostfixedArgumentPart$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(DotDotDot, PostfixedExpression), function($skip, $loc, $0, $1, $2) {
10894
+ var spread = $1;
10895
+ var expression = $2;
10896
+ return {
10897
+ type: "Argument",
10898
+ children: $0,
10899
+ expression,
10900
+ spread
10901
+ };
10902
+ });
10903
+ var PostfixedArgumentPart$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(PostfixedExpression, (0, import_lib2.$E)(DotDotDot)), function($skip, $loc, $0, $1, $2) {
10904
+ var expression = $1;
10905
+ var spread = $2;
10906
+ return {
10907
+ type: "Argument",
10908
+ children: spread ? [spread, expression] : [expression],
10909
+ expression,
10910
+ spread
10911
+ };
10912
+ });
10913
+ var PostfixedArgumentPart$$ = [PostfixedArgumentPart$0, PostfixedArgumentPart$1];
10914
+ function PostfixedArgumentPart(ctx, state2) {
10915
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "PostfixedArgumentPart", PostfixedArgumentPart$$);
10916
+ }
10792
10917
  var BinaryOpExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UnaryExpression, (0, import_lib2.$Q)(BinaryOpRHS)), function($skip, $loc, $0, $1, $2) {
10793
10918
  if (!$2.length) return $1;
10794
10919
  return processBinaryOpExpression($0);
@@ -10821,10 +10946,13 @@ var BinaryOpRHS$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(BinaryOp, RHS), fun
10821
10946
  var BinaryOpRHS$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(NewlineBinaryOpAllowed, NotDedentedBinaryOp, WRHS), function($skip, $loc, $0, $1, $2, $3) {
10822
10947
  var op = $2;
10823
10948
  var rhs = $3;
10949
+ if (op[1].token === ">" && op[0].length === 0) return $skip;
10824
10950
  return [...op, ...rhs];
10825
10951
  });
10826
- var BinaryOpRHS$3 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$N)(NewlineBinaryOpAllowed), SingleLineBinaryOpRHS), function(value) {
10827
- return value[1];
10952
+ var BinaryOpRHS$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NewlineBinaryOpAllowed), SingleLineBinaryOpRHS), function($skip, $loc, $0, $1, $2) {
10953
+ const [ws1, op] = $2;
10954
+ if (op.token === ">" && !ws1.length) return $skip;
10955
+ return $2;
10828
10956
  });
10829
10957
  var BinaryOpRHS$$ = [BinaryOpRHS$0, BinaryOpRHS$1, BinaryOpRHS$2, BinaryOpRHS$3];
10830
10958
  function BinaryOpRHS(ctx, state2) {
@@ -11779,7 +11907,7 @@ var FieldDefinition$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(CoffeeClassesEn
11779
11907
  };
11780
11908
  }
11781
11909
  });
11782
- var FieldDefinition$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertReadonly, ClassElementName, (0, import_lib2.$E)(TypeSuffix), __, ConstAssignment, MaybeNestedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
11910
+ var FieldDefinition$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertReadonly, ClassElementName, (0, import_lib2.$E)(TypeSuffix), __, ConstAssignment, MaybeNestedPostfixedCommaExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
11783
11911
  var readonly = $1;
11784
11912
  var id = $2;
11785
11913
  var typeSuffix = $3;
@@ -15547,26 +15675,37 @@ var PostfixedNoCommaStatement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(NoCom
15547
15675
  function PostfixedNoCommaStatement(ctx, state2) {
15548
15676
  return (0, import_lib2.$EVENT)(ctx, state2, "PostfixedNoCommaStatement", PostfixedNoCommaStatement$0);
15549
15677
  }
15550
- var PostfixedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Expression, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
15678
+ var PostfixedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(AssignmentExpressionSpread, (0, import_lib2.$E)(_), (0, import_lib2.$N)(IfClause), PostfixStatement), function($skip, $loc, $0, $1, $2, $3, $4) {
15679
+ var expression = $1;
15680
+ var ws = $2;
15681
+ var post = $4;
15682
+ return attachPostfixStatementAsExpression(expression, [ws, post]);
15683
+ });
15684
+ var PostfixedExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Expression, (0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement)), function($skip, $loc, $0, $1, $2) {
15551
15685
  var expression = $1;
15552
15686
  var post = $2;
15553
- if (post) return attachPostfixStatementAsExpression(expression, post);
15554
- return expression;
15687
+ return attachPostfixStatementAsExpression(expression, post);
15555
15688
  });
15689
+ var PostfixedExpression$2 = Expression;
15690
+ var PostfixedExpression$$ = [PostfixedExpression$0, PostfixedExpression$1, PostfixedExpression$2];
15556
15691
  function PostfixedExpression(ctx, state2) {
15557
- return (0, import_lib2.$EVENT)(ctx, state2, "PostfixedExpression", PostfixedExpression$0);
15692
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "PostfixedExpression", PostfixedExpression$$);
15558
15693
  }
15559
- var PostfixedCommaExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PostfixedExpression, (0, import_lib2.$C)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement), (0, import_lib2.$Q)((0, import_lib2.$S)(CommaDelimiter, AssignmentExpression)))), function($skip, $loc, $0, $1, $2) {
15694
+ var PostfixedCommaExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(CommaExpressionSpread, (0, import_lib2.$E)(_), (0, import_lib2.$N)(IfClause), PostfixStatement), function($skip, $loc, $0, $1, $2, $3, $4) {
15695
+ var expression = $1;
15696
+ var ws = $2;
15697
+ var post = $4;
15698
+ return attachPostfixStatementAsExpression(expression, [ws, post]);
15699
+ });
15700
+ var PostfixedCommaExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Expression, (0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement)), function($skip, $loc, $0, $1, $2) {
15560
15701
  var expression = $1;
15561
15702
  var post = $2;
15562
- if (!post.length) return $1;
15563
- if (post.length === 2 && !Array.isArray(post[1])) {
15564
- return attachPostfixStatementAsExpression(expression, post);
15565
- }
15566
- return $0;
15703
+ return attachPostfixStatementAsExpression(expression, post);
15567
15704
  });
15705
+ var PostfixedCommaExpression$2 = CommaExpression;
15706
+ var PostfixedCommaExpression$$ = [PostfixedCommaExpression$0, PostfixedCommaExpression$1, PostfixedCommaExpression$2];
15568
15707
  function PostfixedCommaExpression(ctx, state2) {
15569
- return (0, import_lib2.$EVENT)(ctx, state2, "PostfixedCommaExpression", PostfixedCommaExpression$0);
15708
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "PostfixedCommaExpression", PostfixedCommaExpression$$);
15570
15709
  }
15571
15710
  var PostfixStatement$0 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R31, "PostfixStatement /(?=for|if|loop|unless|until|while)/"), _PostfixStatement), function(value) {
15572
15711
  return value[1];
@@ -17018,6 +17157,22 @@ var MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeN
17018
17157
  function MaybeNestedPostfixedExpression(ctx, state2) {
17019
17158
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedPostfixedExpression", MaybeNestedPostfixedExpression$$);
17020
17159
  }
17160
+ var MaybeNestedPostfixedCommaExpression$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, PostfixedCommaExpression)), PopIndent, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
17161
+ var expression = $4;
17162
+ var trailing = $6;
17163
+ if (!expression) return $skip;
17164
+ if (!trailing) return expression;
17165
+ return [expression, trailing];
17166
+ });
17167
+ var MaybeNestedPostfixedCommaExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidImplicitFragment, (0, import_lib2.$E)(PostfixedCommaExpression), RestoreImplicitFragment), function($skip, $loc, $0, $1, $2, $3) {
17168
+ var expression = $2;
17169
+ if (!expression) return $skip;
17170
+ return expression;
17171
+ });
17172
+ var MaybeNestedPostfixedCommaExpression$$ = [MaybeNestedPostfixedCommaExpression$0, MaybeNestedPostfixedCommaExpression$1];
17173
+ function MaybeNestedPostfixedCommaExpression(ctx, state2) {
17174
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedPostfixedCommaExpression", MaybeNestedPostfixedCommaExpression$$);
17175
+ }
17021
17176
  var NestedPostfixedExpressionNoTrailing$0 = NestedBulletedArray;
17022
17177
  var NestedPostfixedExpressionNoTrailing$1 = NestedImplicitObjectLiteral;
17023
17178
  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) {
@@ -17468,7 +17623,7 @@ var ExportDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
17468
17623
  }
17469
17624
  ];
17470
17625
  });
17471
- var ExportDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Decorators), Export, __, Default, __, (0, import_lib2.$C)(HoistableDeclaration, ClassDeclaration, InterfaceDeclaration, MaybeNestedExpression)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
17626
+ var ExportDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Decorators), Export, __, Default, __, (0, import_lib2.$C)(HoistableDeclaration, ClassDeclaration, InterfaceDeclaration, MaybeNestedPostfixedExpression)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
17472
17627
  var declaration = $6;
17473
17628
  return { type: "ExportDeclaration", declaration, ts: declaration.ts, children: $0 };
17474
17629
  });
@@ -17591,7 +17746,7 @@ var LexicalDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(LetOrConst,
17591
17746
  thisAssignments: bindings.flatMap((b) => b.thisAssignments)
17592
17747
  };
17593
17748
  });
17594
- var LexicalDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Loc, (0, import_lib2.$C)(BindingPattern, BindingIdentifier), (0, import_lib2.$E)(TypeSuffix), __, (0, import_lib2.$C)(ConstAssignment, LetAssignment), MaybeNestedPostfixedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
17749
+ var LexicalDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Loc, (0, import_lib2.$C)(BindingPattern, BindingIdentifier), (0, import_lib2.$E)(TypeSuffix), __, (0, import_lib2.$C)(ConstAssignment, LetAssignment), MaybeNestedPostfixedCommaExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
17595
17750
  var loc = $1;
17596
17751
  var assign = $5;
17597
17752
  return processAssignmentDeclaration(
@@ -17657,7 +17812,7 @@ var LexicalBinding$$ = [LexicalBinding$0, LexicalBinding$1];
17657
17812
  function LexicalBinding(ctx, state2) {
17658
17813
  return (0, import_lib2.$EVENT_C)(ctx, state2, "LexicalBinding", LexicalBinding$$);
17659
17814
  }
17660
- var Initializer$0 = (0, import_lib2.$T)((0, import_lib2.$S)(__, Equals, MaybeNestedExpression), function(value) {
17815
+ var Initializer$0 = (0, import_lib2.$T)((0, import_lib2.$S)(__, Equals, MaybeNestedPostfixedExpression), function(value) {
17661
17816
  var expression = value[2];
17662
17817
  return { "type": "Initializer", "expression": expression, "children": value };
17663
17818
  });