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