@danielx/civet 0.5.75 → 0.5.77

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
@@ -849,6 +849,7 @@ ${input.slice(result.pos)}
849
849
  Import,
850
850
  In,
851
851
  LetOrConst,
852
+ Const,
852
853
  LetOrConstOrVar,
853
854
  Loop,
854
855
  New,
@@ -942,6 +943,7 @@ ${input.slice(result.pos)}
942
943
  InterfaceExtendsClause,
943
944
  InterfaceExtendsTarget,
944
945
  TypeKeyword,
946
+ Enum,
945
947
  Interface,
946
948
  Global,
947
949
  Module,
@@ -959,6 +961,11 @@ ${input.slice(result.pos)}
959
961
  NestedDeclareElements,
960
962
  NestedDeclareElement,
961
963
  DeclareElement,
964
+ EnumDeclaration,
965
+ EnumBlock,
966
+ NestedEnumProperties,
967
+ NestedEnumProperty,
968
+ EnumProperty,
962
969
  TypeIndexSignature,
963
970
  TypeIndex,
964
971
  TypeSuffix,
@@ -1217,15 +1224,16 @@ ${input.slice(result.pos)}
1217
1224
  var $L169 = $L("<!--");
1218
1225
  var $L170 = $L("-->");
1219
1226
  var $L171 = $L("type");
1220
- var $L172 = $L("interface");
1221
- var $L173 = $L("global");
1222
- var $L174 = $L("module");
1223
- var $L175 = $L("namespace");
1224
- var $L176 = $L("asserts");
1225
- var $L177 = $L("keyof");
1226
- var $L178 = $L("infer");
1227
- var $L179 = $L("[]");
1228
- var $L180 = $L("civet");
1227
+ var $L172 = $L("enum");
1228
+ var $L173 = $L("interface");
1229
+ var $L174 = $L("global");
1230
+ var $L175 = $L("module");
1231
+ var $L176 = $L("namespace");
1232
+ var $L177 = $L("asserts");
1233
+ var $L178 = $L("keyof");
1234
+ var $L179 = $L("infer");
1235
+ var $L180 = $L("[]");
1236
+ var $L181 = $L("civet");
1229
1237
  var $R0 = $R(new RegExp("(as|for|while|until|of|satisfies|then|when|implements|xor|xnor)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
1230
1238
  var $R1 = $R(new RegExp("[0-9]", "suy"));
1231
1239
  var $R2 = $R(new RegExp("[)}]", "suy"));
@@ -1279,18 +1287,19 @@ ${input.slice(result.pos)}
1279
1287
  var $R50 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
1280
1288
  var $R51 = $R(new RegExp("[\\s>]", "suy"));
1281
1289
  var $R52 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
1282
- var $R53 = $R(new RegExp("[<>]", "suy"));
1283
- var $R54 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
1284
- var $R55 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
1285
- var $R56 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
1286
- var $R57 = $R(new RegExp("[+-]?", "suy"));
1287
- var $R58 = $R(new RegExp("[+-]", "suy"));
1288
- var $R59 = $R(new RegExp("#![^\\r\\n]*", "suy"));
1289
- var $R60 = $R(new RegExp("[\\t ]*", "suy"));
1290
- var $R61 = $R(new RegExp("[\\s]*", "suy"));
1291
- var $R62 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
1292
- var $R63 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
1293
- var $R64 = $R(new RegExp("[ \\t]*", "suy"));
1290
+ var $R53 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
1291
+ var $R54 = $R(new RegExp("[<>]", "suy"));
1292
+ var $R55 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
1293
+ var $R56 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
1294
+ var $R57 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
1295
+ var $R58 = $R(new RegExp("[+-]?", "suy"));
1296
+ var $R59 = $R(new RegExp("[+-]", "suy"));
1297
+ var $R60 = $R(new RegExp("#![^\\r\\n]*", "suy"));
1298
+ var $R61 = $R(new RegExp("[\\t ]*", "suy"));
1299
+ var $R62 = $R(new RegExp("[\\s]*", "suy"));
1300
+ var $R63 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
1301
+ var $R64 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
1302
+ var $R65 = $R(new RegExp("[ \\t]*", "suy"));
1294
1303
  var Program$0 = $TS($S(Reset, Init, __, $Q(TopLevelStatement), __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
1295
1304
  var statements = $4;
1296
1305
  module2.processProgram(statements);
@@ -5471,26 +5480,27 @@ ${input.slice(result.pos)}
5471
5480
  var rhs = $3;
5472
5481
  if (!prefix && !rhs)
5473
5482
  return $skip;
5483
+ let body, ref;
5474
5484
  if (!rhs) {
5475
- const ref2 = {
5485
+ ref = {
5476
5486
  type: "Ref",
5477
5487
  base: "$",
5478
5488
  id: "$"
5479
5489
  };
5480
- return {
5481
- type: "ArrowFunction",
5482
- children: [ref2, " => ", prefix, ref2],
5483
- ampersandBlock: true
5484
- };
5490
+ body = [prefix, ref];
5491
+ } else {
5492
+ ({ ref } = rhs);
5493
+ body = [prefix, rhs];
5485
5494
  }
5486
- const { ref } = rhs;
5487
- const children = [ref, " => ", prefix, rhs];
5488
- if (module2.hasAwait(rhs)) {
5495
+ const children = [ref, " => ", ...body];
5496
+ if (module2.hasAwait(body)) {
5489
5497
  children.unshift("async ");
5490
5498
  }
5491
5499
  return {
5492
5500
  type: "ArrowFunction",
5493
5501
  children,
5502
+ ref,
5503
+ body,
5494
5504
  ampersandBlock: true
5495
5505
  };
5496
5506
  });
@@ -6283,6 +6293,7 @@ ${input.slice(result.pos)}
6283
6293
  var Literal$0 = $TS($S(LiteralContent), function($skip, $loc, $0, $1) {
6284
6294
  return {
6285
6295
  type: "Literal",
6296
+ subtype: $1.type,
6286
6297
  children: $0,
6287
6298
  raw: $1.token
6288
6299
  };
@@ -8992,12 +9003,15 @@ ${input.slice(result.pos)}
8992
9003
  return result;
8993
9004
  }
8994
9005
  }
8995
- var IterationExpression$0 = $TS($S(IterationStatement), function($skip, $loc, $0, $1) {
9006
+ var IterationExpression$0 = $TS($S($E($S(Async, __)), IterationStatement), function($skip, $loc, $0, $1, $2) {
9007
+ var async = $1;
9008
+ var statement = $2;
8996
9009
  return {
8997
9010
  type: "IterationExpression",
8998
- subtype: $1.type,
8999
- children: [$1],
9000
- block: $1.block
9011
+ subtype: statement.type,
9012
+ children: [statement],
9013
+ block: statement.block,
9014
+ async
9001
9015
  };
9002
9016
  });
9003
9017
  function IterationExpression(state) {
@@ -10682,7 +10696,8 @@ ${input.slice(result.pos)}
10682
10696
  return result;
10683
10697
  }
10684
10698
  }
10685
- var ExpressionStatement$0 = Expression;
10699
+ var ExpressionStatement$0 = IterationExpression;
10700
+ var ExpressionStatement$1 = Expression;
10686
10701
  function ExpressionStatement(state) {
10687
10702
  let eventData;
10688
10703
  if (state.events) {
@@ -10694,12 +10709,12 @@ ${input.slice(result.pos)}
10694
10709
  }
10695
10710
  }
10696
10711
  if (state.tokenize) {
10697
- const result = $TOKEN("ExpressionStatement", state, ExpressionStatement$0(state));
10712
+ const result = $TOKEN("ExpressionStatement", state, ExpressionStatement$0(state) || ExpressionStatement$1(state));
10698
10713
  if (state.events)
10699
10714
  state.events.exit?.("ExpressionStatement", state, result, eventData);
10700
10715
  return result;
10701
10716
  } else {
10702
- const result = ExpressionStatement$0(state);
10717
+ const result = ExpressionStatement$0(state) || ExpressionStatement$1(state);
10703
10718
  if (state.events)
10704
10719
  state.events.exit?.("ExpressionStatement", state, result, eventData);
10705
10720
  return result;
@@ -11560,7 +11575,8 @@ ${input.slice(result.pos)}
11560
11575
  var Declaration$1 = ClassDeclaration;
11561
11576
  var Declaration$2 = LexicalDeclaration;
11562
11577
  var Declaration$3 = TypeDeclaration;
11563
- var Declaration$4 = OperatorDeclaration;
11578
+ var Declaration$4 = EnumDeclaration;
11579
+ var Declaration$5 = OperatorDeclaration;
11564
11580
  function Declaration(state) {
11565
11581
  let eventData;
11566
11582
  if (state.events) {
@@ -11572,12 +11588,12 @@ ${input.slice(result.pos)}
11572
11588
  }
11573
11589
  }
11574
11590
  if (state.tokenize) {
11575
- const result = $TOKEN("Declaration", state, Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state));
11591
+ const result = $TOKEN("Declaration", state, Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state) || Declaration$5(state));
11576
11592
  if (state.events)
11577
11593
  state.events.exit?.("Declaration", state, result, eventData);
11578
11594
  return result;
11579
11595
  } else {
11580
- const result = Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state);
11596
+ const result = Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state) || Declaration$5(state);
11581
11597
  if (state.events)
11582
11598
  state.events.exit?.("Declaration", state, result, eventData);
11583
11599
  return result;
@@ -14470,6 +14486,31 @@ ${input.slice(result.pos)}
14470
14486
  return result;
14471
14487
  }
14472
14488
  }
14489
+ var Const$0 = $TS($S($EXPECT($L129, fail, 'Const "const"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
14490
+ return { $loc, token: $1 };
14491
+ });
14492
+ function Const(state) {
14493
+ let eventData;
14494
+ if (state.events) {
14495
+ const result = state.events.enter?.("Const", state);
14496
+ if (result) {
14497
+ if (result.cache)
14498
+ return result.cache;
14499
+ eventData = result.data;
14500
+ }
14501
+ }
14502
+ if (state.tokenize) {
14503
+ const result = $TOKEN("Const", state, Const$0(state));
14504
+ if (state.events)
14505
+ state.events.exit?.("Const", state, result, eventData);
14506
+ return result;
14507
+ } else {
14508
+ const result = Const$0(state);
14509
+ if (state.events)
14510
+ state.events.exit?.("Const", state, result, eventData);
14511
+ return result;
14512
+ }
14513
+ }
14473
14514
  var LetOrConstOrVar$0 = LetOrConst;
14474
14515
  var LetOrConstOrVar$1 = Var;
14475
14516
  function LetOrConstOrVar(state) {
@@ -16241,11 +16282,11 @@ ${input.slice(result.pos)}
16241
16282
  var JSXAttributeValue$2 = JSXFragment;
16242
16283
  var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
16243
16284
  if ($2.children?.length === 1 && $2.children[0].type === "StringLiteral") {
16244
- return $2.children[0];
16285
+ return $skip;
16245
16286
  }
16246
16287
  return $0;
16247
16288
  });
16248
- var JSXAttributeValue$4 = StringLiteral;
16289
+ var JSXAttributeValue$4 = $R$0($EXPECT($R53, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
16249
16290
  function JSXAttributeValue(state) {
16250
16291
  let eventData;
16251
16292
  if (state.events) {
@@ -16295,7 +16336,7 @@ ${input.slice(result.pos)}
16295
16336
  return result;
16296
16337
  }
16297
16338
  }
16298
- var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R53, fail, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
16339
+ var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R54, fail, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
16299
16340
  var op = $2;
16300
16341
  var rhs = $3;
16301
16342
  return [[], op, [], rhs];
@@ -16350,7 +16391,7 @@ ${input.slice(result.pos)}
16350
16391
  return result;
16351
16392
  }
16352
16393
  }
16353
- var InlineJSXUnaryOp$0 = $TR($EXPECT($R54, fail, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16394
+ var InlineJSXUnaryOp$0 = $TR($EXPECT($R55, fail, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16354
16395
  return { $loc, token: $0 };
16355
16396
  });
16356
16397
  function InlineJSXUnaryOp(state) {
@@ -16795,7 +16836,7 @@ ${input.slice(result.pos)}
16795
16836
  return result;
16796
16837
  }
16797
16838
  }
16798
- var JSXCommentContent$0 = $TR($EXPECT($R55, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16839
+ var JSXCommentContent$0 = $TR($EXPECT($R56, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16799
16840
  return { $loc, token: $0.replace(/\*\//g, "* /") };
16800
16841
  });
16801
16842
  function JSXCommentContent(state) {
@@ -16820,7 +16861,7 @@ ${input.slice(result.pos)}
16820
16861
  return result;
16821
16862
  }
16822
16863
  }
16823
- var JSXText$0 = $TR($EXPECT($R56, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16864
+ var JSXText$0 = $TR($EXPECT($R57, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16824
16865
  return {
16825
16866
  type: "JSXText",
16826
16867
  token: $0,
@@ -17097,7 +17138,32 @@ ${input.slice(result.pos)}
17097
17138
  return result;
17098
17139
  }
17099
17140
  }
17100
- var Interface$0 = $TS($S($EXPECT($L172, fail, 'Interface "interface"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17141
+ var Enum$0 = $TS($S($EXPECT($L172, fail, 'Enum "enum"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17142
+ return { $loc, token: $1 };
17143
+ });
17144
+ function Enum(state) {
17145
+ let eventData;
17146
+ if (state.events) {
17147
+ const result = state.events.enter?.("Enum", state);
17148
+ if (result) {
17149
+ if (result.cache)
17150
+ return result.cache;
17151
+ eventData = result.data;
17152
+ }
17153
+ }
17154
+ if (state.tokenize) {
17155
+ const result = $TOKEN("Enum", state, Enum$0(state));
17156
+ if (state.events)
17157
+ state.events.exit?.("Enum", state, result, eventData);
17158
+ return result;
17159
+ } else {
17160
+ const result = Enum$0(state);
17161
+ if (state.events)
17162
+ state.events.exit?.("Enum", state, result, eventData);
17163
+ return result;
17164
+ }
17165
+ }
17166
+ var Interface$0 = $TS($S($EXPECT($L173, fail, 'Interface "interface"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17101
17167
  return { $loc, token: $1 };
17102
17168
  });
17103
17169
  function Interface(state) {
@@ -17122,7 +17188,7 @@ ${input.slice(result.pos)}
17122
17188
  return result;
17123
17189
  }
17124
17190
  }
17125
- var Global$0 = $TS($S($EXPECT($L173, fail, 'Global "global"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17191
+ var Global$0 = $TS($S($EXPECT($L174, fail, 'Global "global"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17126
17192
  return { $loc, token: $1 };
17127
17193
  });
17128
17194
  function Global(state) {
@@ -17147,7 +17213,7 @@ ${input.slice(result.pos)}
17147
17213
  return result;
17148
17214
  }
17149
17215
  }
17150
- var Module$0 = $TS($S($EXPECT($L174, fail, 'Module "module"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17216
+ var Module$0 = $TS($S($EXPECT($L175, fail, 'Module "module"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17151
17217
  return { $loc, token: $1 };
17152
17218
  });
17153
17219
  function Module(state) {
@@ -17172,7 +17238,7 @@ ${input.slice(result.pos)}
17172
17238
  return result;
17173
17239
  }
17174
17240
  }
17175
- var Namespace$0 = $TS($S($EXPECT($L175, fail, 'Namespace "namespace"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17241
+ var Namespace$0 = $TS($S($EXPECT($L176, fail, 'Namespace "namespace"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17176
17242
  return { $loc, token: $1 };
17177
17243
  });
17178
17244
  function Namespace(state) {
@@ -17321,7 +17387,7 @@ ${input.slice(result.pos)}
17321
17387
  return result;
17322
17388
  }
17323
17389
  }
17324
- var InterfacePropertyDelimiter$0 = $S($Q(_), $C(Semicolon, Comma));
17390
+ var InterfacePropertyDelimiter$0 = $S($E(_), $C(Semicolon, Comma));
17325
17391
  var InterfacePropertyDelimiter$1 = $Y($S(__, CloseBrace));
17326
17392
  var InterfacePropertyDelimiter$2 = $Y(EOS);
17327
17393
  function InterfacePropertyDelimiter(state) {
@@ -17525,7 +17591,221 @@ ${input.slice(result.pos)}
17525
17591
  return result;
17526
17592
  }
17527
17593
  }
17528
- var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R57, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L141, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R58, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
17594
+ var EnumDeclaration$0 = $TS($S($E($S(Const, _)), Enum, $Q(TrailingComment), IdentifierName, EnumBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17595
+ var isConst = $1;
17596
+ var id = $4;
17597
+ var block = $5;
17598
+ const ts = {
17599
+ ts: true,
17600
+ children: $0
17601
+ };
17602
+ if (isConst)
17603
+ return ts;
17604
+ const names = new Set(block.properties.map((p) => p.name.name));
17605
+ return [
17606
+ ts,
17607
+ {
17608
+ js: true,
17609
+ children: [
17610
+ ["let ", id, " = {};\n"],
17611
+ ...block.properties.map((property, i) => {
17612
+ let init, isString;
17613
+ if (property.init) {
17614
+ init = module2.replaceNodes(
17615
+ structuredClone(property.init),
17616
+ (n) => n.type === "Identifier" && names.has(n.name),
17617
+ (n) => [id, '["', n.name, '"]']
17618
+ );
17619
+ const value = init[init.length - 1];
17620
+ isString = value.type === "TemplateLiteral" || value.type === "Literal" && value.subtype === "StringLiteral";
17621
+ } else {
17622
+ init = i === 0 ? " = 0" : [" = ", id, '["', block.properties[i - 1].name, '"] + 1'];
17623
+ }
17624
+ if (isString) {
17625
+ return [
17626
+ id,
17627
+ '["',
17628
+ property.name,
17629
+ '"]',
17630
+ init,
17631
+ ";\n"
17632
+ ];
17633
+ } else {
17634
+ return [
17635
+ id,
17636
+ "[",
17637
+ id,
17638
+ '["',
17639
+ property.name,
17640
+ '"]',
17641
+ init,
17642
+ '] = "',
17643
+ property.name,
17644
+ '";\n'
17645
+ ];
17646
+ }
17647
+ })
17648
+ ]
17649
+ }
17650
+ ];
17651
+ });
17652
+ function EnumDeclaration(state) {
17653
+ let eventData;
17654
+ if (state.events) {
17655
+ const result = state.events.enter?.("EnumDeclaration", state);
17656
+ if (result) {
17657
+ if (result.cache)
17658
+ return result.cache;
17659
+ eventData = result.data;
17660
+ }
17661
+ }
17662
+ if (state.tokenize) {
17663
+ const result = $TOKEN("EnumDeclaration", state, EnumDeclaration$0(state));
17664
+ if (state.events)
17665
+ state.events.exit?.("EnumDeclaration", state, result, eventData);
17666
+ return result;
17667
+ } else {
17668
+ const result = EnumDeclaration$0(state);
17669
+ if (state.events)
17670
+ state.events.exit?.("EnumDeclaration", state, result, eventData);
17671
+ return result;
17672
+ }
17673
+ }
17674
+ var EnumBlock$0 = $TS($S(__, OpenBrace, NestedEnumProperties, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17675
+ var props2 = $3;
17676
+ return {
17677
+ properties: props2.properties,
17678
+ children: $0
17679
+ };
17680
+ });
17681
+ var EnumBlock$1 = $TS($S(__, OpenBrace, $Q($S(__, EnumProperty)), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17682
+ var props2 = $3;
17683
+ return {
17684
+ properties: props2.map((p) => p[1]),
17685
+ children: $0
17686
+ };
17687
+ });
17688
+ var EnumBlock$2 = $TS($S(InsertOpenBrace, NestedEnumProperties, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17689
+ var props2 = $2;
17690
+ return {
17691
+ properties: props2.properties,
17692
+ children: $0
17693
+ };
17694
+ });
17695
+ function EnumBlock(state) {
17696
+ let eventData;
17697
+ if (state.events) {
17698
+ const result = state.events.enter?.("EnumBlock", state);
17699
+ if (result) {
17700
+ if (result.cache)
17701
+ return result.cache;
17702
+ eventData = result.data;
17703
+ }
17704
+ }
17705
+ if (state.tokenize) {
17706
+ const result = $TOKEN("EnumBlock", state, EnumBlock$0(state) || EnumBlock$1(state) || EnumBlock$2(state));
17707
+ if (state.events)
17708
+ state.events.exit?.("EnumBlock", state, result, eventData);
17709
+ return result;
17710
+ } else {
17711
+ const result = EnumBlock$0(state) || EnumBlock$1(state) || EnumBlock$2(state);
17712
+ if (state.events)
17713
+ state.events.exit?.("EnumBlock", state, result, eventData);
17714
+ return result;
17715
+ }
17716
+ }
17717
+ var NestedEnumProperties$0 = $TS($S(PushIndent, $Q(NestedEnumProperty), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
17718
+ var props2 = $2;
17719
+ if (!props2.length)
17720
+ return $skip;
17721
+ return {
17722
+ properties: props2.map((p) => p.property),
17723
+ children: $0
17724
+ };
17725
+ });
17726
+ function NestedEnumProperties(state) {
17727
+ let eventData;
17728
+ if (state.events) {
17729
+ const result = state.events.enter?.("NestedEnumProperties", state);
17730
+ if (result) {
17731
+ if (result.cache)
17732
+ return result.cache;
17733
+ eventData = result.data;
17734
+ }
17735
+ }
17736
+ if (state.tokenize) {
17737
+ const result = $TOKEN("NestedEnumProperties", state, NestedEnumProperties$0(state));
17738
+ if (state.events)
17739
+ state.events.exit?.("NestedEnumProperties", state, result, eventData);
17740
+ return result;
17741
+ } else {
17742
+ const result = NestedEnumProperties$0(state);
17743
+ if (state.events)
17744
+ state.events.exit?.("NestedEnumProperties", state, result, eventData);
17745
+ return result;
17746
+ }
17747
+ }
17748
+ var NestedEnumProperty$0 = $TS($S(Nested, EnumProperty), function($skip, $loc, $0, $1, $2) {
17749
+ return {
17750
+ property: $2,
17751
+ children: $0
17752
+ };
17753
+ });
17754
+ function NestedEnumProperty(state) {
17755
+ let eventData;
17756
+ if (state.events) {
17757
+ const result = state.events.enter?.("NestedEnumProperty", state);
17758
+ if (result) {
17759
+ if (result.cache)
17760
+ return result.cache;
17761
+ eventData = result.data;
17762
+ }
17763
+ }
17764
+ if (state.tokenize) {
17765
+ const result = $TOKEN("NestedEnumProperty", state, NestedEnumProperty$0(state));
17766
+ if (state.events)
17767
+ state.events.exit?.("NestedEnumProperty", state, result, eventData);
17768
+ return result;
17769
+ } else {
17770
+ const result = NestedEnumProperty$0(state);
17771
+ if (state.events)
17772
+ state.events.exit?.("NestedEnumProperty", state, result, eventData);
17773
+ return result;
17774
+ }
17775
+ }
17776
+ var EnumProperty$0 = $TS($S(Identifier, $E($S(__, Equals, ExtendedExpression)), ObjectPropertyDelimiter), function($skip, $loc, $0, $1, $2, $3) {
17777
+ var name = $1;
17778
+ var init = $2;
17779
+ return {
17780
+ type: "EnumProperty",
17781
+ name,
17782
+ init,
17783
+ children: $0
17784
+ };
17785
+ });
17786
+ function EnumProperty(state) {
17787
+ let eventData;
17788
+ if (state.events) {
17789
+ const result = state.events.enter?.("EnumProperty", state);
17790
+ if (result) {
17791
+ if (result.cache)
17792
+ return result.cache;
17793
+ eventData = result.data;
17794
+ }
17795
+ }
17796
+ if (state.tokenize) {
17797
+ const result = $TOKEN("EnumProperty", state, EnumProperty$0(state));
17798
+ if (state.events)
17799
+ state.events.exit?.("EnumProperty", state, result, eventData);
17800
+ return result;
17801
+ } else {
17802
+ const result = EnumProperty$0(state);
17803
+ if (state.events)
17804
+ state.events.exit?.("EnumProperty", state, result, eventData);
17805
+ return result;
17806
+ }
17807
+ }
17808
+ var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R58, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L141, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R59, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
17529
17809
  function TypeIndexSignature(state) {
17530
17810
  let eventData;
17531
17811
  if (state.events) {
@@ -17603,7 +17883,7 @@ ${input.slice(result.pos)}
17603
17883
  return result;
17604
17884
  }
17605
17885
  }
17606
- var ReturnTypeSuffix$0 = $TS($S($E(_), Colon, $E($S(__, $EXPECT($L176, fail, 'ReturnTypeSuffix "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2, $3, $4) {
17886
+ var ReturnTypeSuffix$0 = $TS($S($E(_), Colon, $E($S(__, $EXPECT($L177, fail, 'ReturnTypeSuffix "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2, $3, $4) {
17607
17887
  var asserts = $3;
17608
17888
  var t = $4;
17609
17889
  if (asserts) {
@@ -17777,9 +18057,9 @@ ${input.slice(result.pos)}
17777
18057
  return result;
17778
18058
  }
17779
18059
  }
17780
- var TypeUnaryOp$0 = $S($EXPECT($L177, fail, 'TypeUnaryOp "keyof"'), NonIdContinue);
18060
+ var TypeUnaryOp$0 = $S($EXPECT($L178, fail, 'TypeUnaryOp "keyof"'), NonIdContinue);
17781
18061
  var TypeUnaryOp$1 = $S($EXPECT($L157, fail, 'TypeUnaryOp "typeof"'), NonIdContinue);
17782
- var TypeUnaryOp$2 = $S($EXPECT($L178, fail, 'TypeUnaryOp "infer"'), NonIdContinue);
18062
+ var TypeUnaryOp$2 = $S($EXPECT($L179, fail, 'TypeUnaryOp "infer"'), NonIdContinue);
17783
18063
  var TypeUnaryOp$3 = $S($EXPECT($L141, fail, 'TypeUnaryOp "readonly"'), NonIdContinue);
17784
18064
  function TypeUnaryOp(state) {
17785
18065
  let eventData;
@@ -18025,7 +18305,7 @@ ${input.slice(result.pos)}
18025
18305
  var TypeLiteral$2 = $TS($S($EXPECT($L161, fail, 'TypeLiteral "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
18026
18306
  return { type: "VoidType", $loc, token: $1 };
18027
18307
  });
18028
- var TypeLiteral$3 = $TV($EXPECT($L179, fail, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
18308
+ var TypeLiteral$3 = $TV($EXPECT($L180, fail, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
18029
18309
  return { $loc, token: "[]" };
18030
18310
  });
18031
18311
  function TypeLiteral(state) {
@@ -18432,7 +18712,7 @@ ${input.slice(result.pos)}
18432
18712
  return result;
18433
18713
  }
18434
18714
  }
18435
- var Shebang$0 = $S($R$0($EXPECT($R59, fail, "Shebang /#![^\\r\\n]*/")), EOL);
18715
+ var Shebang$0 = $S($R$0($EXPECT($R60, fail, "Shebang /#![^\\r\\n]*/")), EOL);
18436
18716
  function Shebang(state) {
18437
18717
  let eventData;
18438
18718
  if (state.events) {
@@ -18455,11 +18735,11 @@ ${input.slice(result.pos)}
18455
18735
  return result;
18456
18736
  }
18457
18737
  }
18458
- var CivetPrologue$0 = $T($S($EXPECT($R60, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
18738
+ var CivetPrologue$0 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
18459
18739
  var content = value[2];
18460
18740
  return content;
18461
18741
  });
18462
- var CivetPrologue$1 = $T($S($EXPECT($R60, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
18742
+ var CivetPrologue$1 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
18463
18743
  var content = value[2];
18464
18744
  return content;
18465
18745
  });
@@ -18485,7 +18765,7 @@ ${input.slice(result.pos)}
18485
18765
  return result;
18486
18766
  }
18487
18767
  }
18488
- var CivetPrologueContent$0 = $TS($S($EXPECT($L180, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R61, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
18768
+ var CivetPrologueContent$0 = $TS($S($EXPECT($L181, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R62, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
18489
18769
  var options = $3;
18490
18770
  return {
18491
18771
  type: "CivetPrologue",
@@ -18515,7 +18795,7 @@ ${input.slice(result.pos)}
18515
18795
  return result;
18516
18796
  }
18517
18797
  }
18518
- var CivetOption$0 = $TR($EXPECT($R62, fail, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
18798
+ var CivetOption$0 = $TR($EXPECT($R63, fail, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
18519
18799
  const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
18520
18800
  if (l)
18521
18801
  return l.toUpperCase();
@@ -18551,7 +18831,7 @@ ${input.slice(result.pos)}
18551
18831
  return result;
18552
18832
  }
18553
18833
  }
18554
- var UnknownPrologue$0 = $S($R$0($EXPECT($R60, fail, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
18834
+ var UnknownPrologue$0 = $S($R$0($EXPECT($R61, fail, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
18555
18835
  function UnknownPrologue(state) {
18556
18836
  let eventData;
18557
18837
  if (state.events) {
@@ -18621,7 +18901,7 @@ ${input.slice(result.pos)}
18621
18901
  return result;
18622
18902
  }
18623
18903
  }
18624
- var EOL$0 = $TR($EXPECT($R63, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
18904
+ var EOL$0 = $TR($EXPECT($R64, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
18625
18905
  return { $loc, token: $0 };
18626
18906
  });
18627
18907
  function EOL(state) {
@@ -19775,6 +20055,9 @@ ${input.slice(result.pos)}
19775
20055
  module2.modifyString = function(str) {
19776
20056
  return str.replace(/(^.?|[^\\]{2})(\\\\)*\n/g, "$1$2\\n");
19777
20057
  };
20058
+ module2.unmodifyString = function(str) {
20059
+ return str.replace(/\\n/g, "\n");
20060
+ };
19778
20061
  module2.quoteString = function(str) {
19779
20062
  str = str.replace(/\\/g, "\\\\");
19780
20063
  if (str.includes('"') && !str.includes("'")) {
@@ -19926,6 +20209,20 @@ ${input.slice(result.pos)}
19926
20209
  return { children };
19927
20210
  }
19928
20211
  };
20212
+ module2.needsRef = function(expression, base = "ref") {
20213
+ switch (expression.type) {
20214
+ case "Ref":
20215
+ case "Identifier":
20216
+ case "Literal":
20217
+ return;
20218
+ default:
20219
+ return {
20220
+ type: "Ref",
20221
+ base,
20222
+ id: base
20223
+ };
20224
+ }
20225
+ };
19929
20226
  module2.literalValue = function(literal) {
19930
20227
  let { raw } = literal;
19931
20228
  switch (raw) {
@@ -20005,7 +20302,7 @@ ${input.slice(result.pos)}
20005
20302
  const i = exp.children.indexOf(exp.block);
20006
20303
  if (exp.subtype === "DoStatement") {
20007
20304
  insertReturn(exp.block);
20008
- exp.children.splice(i, 1, ...module2.wrapIIFE(exp.children));
20305
+ exp.children.splice(i, 1, ...module2.wrapIIFE(exp.children, exp.async));
20009
20306
  return;
20010
20307
  }
20011
20308
  const resultsRef = {
@@ -20014,16 +20311,28 @@ ${input.slice(result.pos)}
20014
20311
  id: "results"
20015
20312
  };
20016
20313
  insertPush(exp.block, resultsRef);
20017
- exp.children.splice(i, 1, module2.wrapIIFE(
20018
- ["const ", resultsRef, "=[];", ...exp.children, "; return ", resultsRef]
20019
- ));
20314
+ exp.children.splice(
20315
+ i,
20316
+ 1,
20317
+ module2.wrapIIFE([
20318
+ "const ",
20319
+ resultsRef,
20320
+ "=[];",
20321
+ ...exp.children,
20322
+ "; return ",
20323
+ resultsRef
20324
+ ], exp.async)
20325
+ );
20020
20326
  }
20021
20327
  module2.hasAwait = (exp) => {
20022
20328
  return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
20023
20329
  };
20024
- module2.wrapIIFE = (exp) => {
20330
+ module2.wrapIIFE = (exp, async) => {
20025
20331
  let prefix, suffix;
20026
- if (module2.hasAwait(exp)) {
20332
+ if (async) {
20333
+ prefix = "(async ()=>{";
20334
+ suffix = "})()";
20335
+ } else if (module2.hasAwait(exp)) {
20027
20336
  prefix = "(await (async ()=>{";
20028
20337
  suffix = "})())";
20029
20338
  } else {
@@ -20231,6 +20540,7 @@ ${input.slice(result.pos)}
20231
20540
  }
20232
20541
  module2.makeLeftHandSideExpression = function(expression) {
20233
20542
  switch (expression.type) {
20543
+ case "Ref":
20234
20544
  case "Identifier":
20235
20545
  case "Literal":
20236
20546
  case "CallExpression":
@@ -20615,14 +20925,14 @@ ${input.slice(result.pos)}
20615
20925
  if (node == null)
20616
20926
  return [];
20617
20927
  if (Array.isArray(node)) {
20618
- return node.flatMap((n) => gatherRecursive(n, predicate));
20928
+ return node.flatMap((n) => gatherRecursive(n, predicate, skipPredicate));
20619
20929
  }
20620
20930
  if (skipPredicate?.(node))
20621
20931
  return [];
20622
20932
  if (predicate(node)) {
20623
20933
  return [node];
20624
20934
  }
20625
- return gatherRecursive(node.children, predicate);
20935
+ return gatherRecursive(node.children, predicate, skipPredicate);
20626
20936
  }
20627
20937
  function gatherRecursiveAll(node, predicate) {
20628
20938
  if (node == null)
@@ -20636,8 +20946,9 @@ ${input.slice(result.pos)}
20636
20946
  }
20637
20947
  return nodes;
20638
20948
  }
20639
- function isFunction({ type }) {
20640
- return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition";
20949
+ function isFunction(node) {
20950
+ const { type } = node;
20951
+ return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition" || node.async;
20641
20952
  }
20642
20953
  function gatherRecursiveWithinFunction(node, predicate) {
20643
20954
  return gatherRecursive(node, predicate, isFunction);
@@ -20660,6 +20971,28 @@ ${input.slice(result.pos)}
20660
20971
  }
20661
20972
  }
20662
20973
  }
20974
+ function removeParentPointers(node) {
20975
+ if (node == null)
20976
+ return;
20977
+ if (typeof node !== "object")
20978
+ return;
20979
+ if (Array.isArray(node)) {
20980
+ for (const child of node) {
20981
+ removeParentPointers(child);
20982
+ }
20983
+ return;
20984
+ }
20985
+ node.parent = null;
20986
+ if (node.children) {
20987
+ for (const child of node.children) {
20988
+ removeParentPointers(child);
20989
+ }
20990
+ }
20991
+ }
20992
+ function clone(node) {
20993
+ removeParentPointers(node);
20994
+ return structuredClone(node);
20995
+ }
20663
20996
  function findAncestor(node, predicate, stopPredicate) {
20664
20997
  node = node.parent;
20665
20998
  while (node && !stopPredicate?.(node)) {
@@ -20668,6 +21001,23 @@ ${input.slice(result.pos)}
20668
21001
  node = node.parent;
20669
21002
  }
20670
21003
  }
21004
+ module2.replaceNodes = (root, predicate, replacer) => {
21005
+ if (root == null)
21006
+ return root;
21007
+ const array = Array.isArray(root) ? root : root.children;
21008
+ if (!array)
21009
+ return root;
21010
+ array.forEach((node, i) => {
21011
+ if (node == null)
21012
+ return;
21013
+ if (predicate(node)) {
21014
+ array[i] = replacer(node, root);
21015
+ } else {
21016
+ module2.replaceNodes(node, predicate, replacer);
21017
+ }
21018
+ });
21019
+ return root;
21020
+ };
20671
21021
  function processParams(f) {
20672
21022
  const { type, parameters, block } = f;
20673
21023
  if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
@@ -21160,6 +21510,22 @@ ${input.slice(result.pos)}
21160
21510
  }
21161
21511
  }
21162
21512
  propsGroupedByName.forEach((shared, key) => {
21513
+ if (!key)
21514
+ return;
21515
+ if (ReservedWord({
21516
+ pos: 0,
21517
+ input: key
21518
+ })) {
21519
+ shared.forEach((p) => {
21520
+ const ref = {
21521
+ type: "Ref",
21522
+ base: `_${key}`,
21523
+ id: key
21524
+ };
21525
+ p.children.push(": ", ref);
21526
+ });
21527
+ return;
21528
+ }
21163
21529
  if (shared.length === 1)
21164
21530
  return;
21165
21531
  const refs = shared.map((p) => {
@@ -21201,19 +21567,7 @@ ${input.slice(result.pos)}
21201
21567
  if (expression.type === "ParenthesizedExpression") {
21202
21568
  expression = expression.expression;
21203
21569
  }
21204
- let ref;
21205
- switch (expression.type) {
21206
- case "Identifier":
21207
- case "Literal":
21208
- ref = expression;
21209
- break;
21210
- default:
21211
- ref = {
21212
- type: "Ref",
21213
- base: "m",
21214
- id: "m"
21215
- };
21216
- }
21570
+ let ref = module2.needsRef(expression, "m") || expression;
21217
21571
  let prev = [], root = prev;
21218
21572
  const l = clauses.length;
21219
21573
  clauses.forEach((c, i) => {
@@ -21284,29 +21638,96 @@ ${input.slice(result.pos)}
21284
21638
  const [ws, , body] = s.children;
21285
21639
  let [, arg] = s.children;
21286
21640
  let i = 0, l = body.length;
21287
- const children = [ws];
21641
+ const refDec = [];
21642
+ const children = [ws, refDec];
21643
+ let usingRef = null;
21288
21644
  for (i = 0; i < l; i++) {
21289
21645
  const step = body[i];
21290
21646
  const [leadingComment, pipe, trailingComment, expr] = step;
21291
21647
  const returns = pipe.token === "||>";
21648
+ let ref, result, returning = returns ? arg : null;
21292
21649
  if (pipe.token === "|>=") {
21650
+ let initRef;
21293
21651
  if (i === 0) {
21294
- children.push(arg, " = ");
21652
+ outer:
21653
+ switch (arg.type) {
21654
+ case "MemberExpression":
21655
+ if (arg.children.length <= 2)
21656
+ break;
21657
+ case "CallExpression":
21658
+ const access = arg.children.pop();
21659
+ switch (access.type) {
21660
+ case "PropertyAccess":
21661
+ case "SliceExpression":
21662
+ break;
21663
+ default:
21664
+ children.unshift({
21665
+ type: "Error",
21666
+ $loc: pipe.token.$loc,
21667
+ message: `Can't assign to ${access.type}`
21668
+ });
21669
+ arg.children.push(access);
21670
+ break outer;
21671
+ }
21672
+ usingRef = module2.needsRef({});
21673
+ initRef = {
21674
+ type: "AssignmentExpression",
21675
+ children: [usingRef, " = ", arg, ","]
21676
+ };
21677
+ arg = {
21678
+ type: "MemberExpression",
21679
+ children: [usingRef, access]
21680
+ };
21681
+ break;
21682
+ }
21683
+ children.pop();
21684
+ const lhs = [[
21685
+ [refDec, initRef],
21686
+ arg,
21687
+ [],
21688
+ { token: "=", children: [" = "] }
21689
+ ]];
21690
+ Object.assign(s, {
21691
+ type: "AssignmentExpression",
21692
+ children: [lhs, children],
21693
+ names: null,
21694
+ lhs,
21695
+ assigned: arg,
21696
+ exp: children
21697
+ });
21698
+ arg = clone(arg);
21699
+ if (arg.children[0].type === "Ref") {
21700
+ arg.children[0] = usingRef;
21701
+ }
21295
21702
  } else {
21296
- children.push({
21703
+ children.unshift({
21297
21704
  type: "Error",
21705
+ $loc: pipe.token.$loc,
21298
21706
  message: "Can't use |>= in the middle of a pipeline"
21299
21707
  });
21300
21708
  }
21709
+ } else {
21710
+ s.children = children;
21301
21711
  }
21302
- const [result, returning] = module2.constructPipeStep(
21712
+ if (returns && (ref = module2.needsRef(arg))) {
21713
+ usingRef = usingRef || ref;
21714
+ arg = {
21715
+ type: "ParenthesizedExpression",
21716
+ children: ["(", {
21717
+ type: "AssignmentExpression",
21718
+ children: [usingRef, " = ", arg]
21719
+ }, ")"]
21720
+ };
21721
+ returning = usingRef;
21722
+ }
21723
+ [result, returning] = module2.constructPipeStep(
21303
21724
  {
21304
21725
  leadingComment: module2.skipIfOnlyWS(leadingComment),
21305
21726
  trailingComment: module2.skipIfOnlyWS(trailingComment),
21306
21727
  expr
21307
21728
  },
21308
21729
  arg,
21309
- returns ? arg : null
21730
+ returning
21310
21731
  );
21311
21732
  if (result.type === "ReturnStatement") {
21312
21733
  if (i < l - 1) {
@@ -21329,8 +21750,10 @@ ${input.slice(result.pos)}
21329
21750
  arg = result;
21330
21751
  }
21331
21752
  }
21753
+ if (usingRef) {
21754
+ refDec.unshift("let ", usingRef, ";");
21755
+ }
21332
21756
  children.push(arg);
21333
- s.children = children;
21334
21757
  addParentPointers(s, s.parent);
21335
21758
  });
21336
21759
  }
@@ -21541,12 +21964,12 @@ ${input.slice(result.pos)}
21541
21964
  module2.constructInvocation = function(fn, arg) {
21542
21965
  const fnArr = [fn.leadingComment, fn.expr, fn.trailingComment];
21543
21966
  if (fn.expr.ampersandBlock) {
21544
- const [ref, , prefix, rhs] = fn.expr.children;
21967
+ const { ref, body } = fn.expr;
21545
21968
  ref.type = "PipedExpression";
21546
21969
  ref.children = [module2.makeLeftHandSideExpression(arg)];
21547
21970
  return {
21548
21971
  type: "UnwrappedExpression",
21549
- children: [module2.skipIfOnlyWS(fn.leadingComment), prefix, rhs, module2.skipIfOnlyWS(fn.trailingComment)]
21972
+ children: [module2.skipIfOnlyWS(fn.leadingComment), ...body, module2.skipIfOnlyWS(fn.trailingComment)]
21550
21973
  };
21551
21974
  }
21552
21975
  const lhs = module2.makeLeftHandSideExpression(fn.expr);
@@ -21619,7 +22042,7 @@ ${input.slice(result.pos)}
21619
22042
  return result;
21620
22043
  }
21621
22044
  }
21622
- var Indent$0 = $TR($EXPECT($R64, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
22045
+ var Indent$0 = $TR($EXPECT($R65, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
21623
22046
  let level;
21624
22047
  if (module2.config.tab) {
21625
22048
  const tabs = $0.match(/\t/g);