firefly-compiler 0.4.20 → 0.4.22

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.
Files changed (72) hide show
  1. package/compiler/Builder.ff +23 -13
  2. package/compiler/Dictionaries.ff +10 -10
  3. package/compiler/Inference.ff +167 -148
  4. package/compiler/JsEmitter.ff +122 -78
  5. package/compiler/LspHook.ff +6 -3
  6. package/compiler/Main.ff +24 -10
  7. package/compiler/Patterns.ff +1 -1
  8. package/compiler/Resolver.ff +167 -159
  9. package/compiler/Substitution.ff +2 -2
  10. package/compiler/Syntax.ff +1 -0
  11. package/compiler/Unification.ff +1 -1
  12. package/core/Array.ff +6 -4
  13. package/core/Int.ff +12 -12
  14. package/core/List.ff +6 -4
  15. package/core/Map.ff +8 -0
  16. package/core/Set.ff +7 -0
  17. package/experimental/benchmarks/ListGrab.ff +23 -0
  18. package/experimental/benchmarks/ListGrab.java +55 -0
  19. package/experimental/benchmarks/Pyrotek45.ff +30 -0
  20. package/experimental/benchmarks/Pyrotek45.java +64 -0
  21. package/experimental/tests/TestJson.ff +26 -0
  22. package/lsp/Handler.ff +65 -61
  23. package/lsp/SignatureHelpHandler.ff +5 -4
  24. package/lsp/TestReferences.ff +15 -0
  25. package/lsp/TestReferencesCase.ff +8 -0
  26. package/output/js/ff/compiler/Builder.mjs +50 -44
  27. package/output/js/ff/compiler/Dependencies.mjs +0 -2
  28. package/output/js/ff/compiler/Deriver.mjs +16 -140
  29. package/output/js/ff/compiler/Dictionaries.mjs +24 -238
  30. package/output/js/ff/compiler/Environment.mjs +12 -154
  31. package/output/js/ff/compiler/Inference.mjs +207 -1069
  32. package/output/js/ff/compiler/JsEmitter.mjs +434 -2342
  33. package/output/js/ff/compiler/JsImporter.mjs +0 -12
  34. package/output/js/ff/compiler/LspHook.mjs +20 -446
  35. package/output/js/ff/compiler/Main.mjs +110 -553
  36. package/output/js/ff/compiler/Parser.mjs +36 -356
  37. package/output/js/ff/compiler/Patterns.mjs +24 -204
  38. package/output/js/ff/compiler/Resolver.mjs +428 -554
  39. package/output/js/ff/compiler/Substitution.mjs +6 -164
  40. package/output/js/ff/compiler/Syntax.mjs +449 -3293
  41. package/output/js/ff/compiler/Token.mjs +9 -1095
  42. package/output/js/ff/compiler/Tokenizer.mjs +4 -2
  43. package/output/js/ff/compiler/Unification.mjs +30 -364
  44. package/output/js/ff/compiler/Wildcards.mjs +0 -86
  45. package/output/js/ff/compiler/Workspace.mjs +8 -96
  46. package/output/js/ff/core/Array.mjs +15 -8
  47. package/output/js/ff/core/AssetSystem.mjs +4 -14
  48. package/output/js/ff/core/Bool.mjs +0 -12
  49. package/output/js/ff/core/Core.mjs +0 -30
  50. package/output/js/ff/core/Int.mjs +24 -24
  51. package/output/js/ff/core/IntMap.mjs +0 -8
  52. package/output/js/ff/core/Json.mjs +0 -40
  53. package/output/js/ff/core/List.mjs +23 -32
  54. package/output/js/ff/core/Lock.mjs +0 -10
  55. package/output/js/ff/core/Map.mjs +26 -24
  56. package/output/js/ff/core/Option.mjs +10 -286
  57. package/output/js/ff/core/Ordering.mjs +16 -158
  58. package/output/js/ff/core/Pair.mjs +2 -34
  59. package/output/js/ff/core/Path.mjs +2 -28
  60. package/output/js/ff/core/Random.mjs +4 -4
  61. package/output/js/ff/core/RbMap.mjs +56 -644
  62. package/output/js/ff/core/Set.mjs +16 -0
  63. package/output/js/ff/core/Show.mjs +0 -16
  64. package/output/js/ff/core/Stream.mjs +14 -144
  65. package/output/js/ff/core/StringMap.mjs +0 -8
  66. package/output/js/ff/core/Try.mjs +4 -108
  67. package/output/js/ff/core/Unit.mjs +2 -16
  68. package/package.json +1 -1
  69. package/postgresql/Pg.ff +23 -23
  70. package/vscode/package.json +1 -1
  71. package/bin/firefly.mjs +0 -2
  72. package/guide/Main.ff +0 -22
@@ -140,39 +140,18 @@ return ff_core_Core.panic_(((message_ + " ") + ff_compiler_Syntax.Location_show(
140
140
  }
141
141
 
142
142
  export function detectIfElse_(term_) {
143
- {
144
143
  const term_a = term_;
145
- {
146
- if(term_a.ECall) {
144
+ if(term_a.ECall && term_a.target_.StaticCall && term_a.target_.name_ === "ff:core/Core.if" && term_a.arguments_.length === 2) {
147
145
  const at_ = term_a.at_;
148
- if(term_a.target_.StaticCall) {
149
- if(term_a.target_.name_ === "ff:core/Core.if") {
150
- if(term_a.arguments_.length > 0) {
151
146
  const condition_ = term_a.arguments_[0];
152
- if(term_a.arguments_.length > 1) {
153
147
  const body_ = term_a.arguments_[1];
154
- if(term_a.arguments_.length === 2) {
155
148
  return [ff_core_Pair.Pair(condition_.value_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_))]
156
- return
157
- }
158
- }
159
- }
160
- }
161
- }
162
149
  }
163
- }
164
- {
165
- if(term_a.ECall) {
150
+ if(term_a.ECall && term_a.target_.StaticCall && term_a.target_.name_ === "ff:core/Option.Option_elseIf" && term_a.arguments_.length === 3) {
166
151
  const at_ = term_a.at_;
167
- if(term_a.target_.StaticCall) {
168
- if(term_a.target_.name_ === "ff:core/Option.Option_elseIf") {
169
- if(term_a.arguments_.length > 0) {
170
152
  const option_ = term_a.arguments_[0];
171
- if(term_a.arguments_.length > 1) {
172
153
  const condition_ = term_a.arguments_[1];
173
- if(term_a.arguments_.length > 2) {
174
154
  const body_ = term_a.arguments_[2];
175
- if(term_a.arguments_.length === 3) {
176
155
  const list_ = ff_compiler_JsEmitter.detectIfElse_(option_.value_);
177
156
  if(ff_core_List.List_isEmpty(list_)) {
178
157
  return []
@@ -181,23 +160,10 @@ return [ff_core_Pair.Pair(ff_compiler_JsEmitter.invokeImmediately_(condition_.va
181
160
  }
182
161
  return
183
162
  }
184
- }
185
- }
186
- }
187
- }
188
- }
189
- }
190
- }
191
- {
192
- if(term_a.ECall) {
163
+ if(term_a.ECall && term_a.target_.StaticCall && term_a.target_.name_ === "ff:core/Option.Option_else" && term_a.arguments_.length === 2) {
193
164
  const at_ = term_a.at_;
194
- if(term_a.target_.StaticCall) {
195
- if(term_a.target_.name_ === "ff:core/Option.Option_else") {
196
- if(term_a.arguments_.length > 0) {
197
165
  const option_ = term_a.arguments_[0];
198
- if(term_a.arguments_.length > 1) {
199
166
  const body_ = term_a.arguments_[1];
200
- if(term_a.arguments_.length === 2) {
201
167
  const list_ = ff_compiler_JsEmitter.detectIfElse_(option_.value_);
202
168
  if(ff_core_List.List_isEmpty(list_)) {
203
169
  return []
@@ -206,84 +172,49 @@ return [ff_core_Pair.Pair(ff_compiler_Syntax.EVariant(at_, "ff:core/Bool.True",
206
172
  }
207
173
  return
208
174
  }
209
- }
210
- }
211
- }
212
- }
213
- }
214
- }
215
175
  {
216
176
  return []
217
- return
218
- }
219
177
  }
220
178
  }
221
179
 
222
180
  export function invokeImmediately_(function_) {
223
- {
224
181
  const function_a = function_;
225
- {
226
- if(function_a.ELambda) {
182
+ if(function_a.ELambda && function_a.lambda_.cases_.length === 1 && function_a.lambda_.cases_[0].patterns_.length === 0 && function_a.lambda_.cases_[0].guards_.length === 0) {
227
183
  const effect_ = function_a.lambda_.effect_;
228
- if(function_a.lambda_.cases_.length > 0) {
229
- if(function_a.lambda_.cases_[0].patterns_.length === 0) {
230
- if(function_a.lambda_.cases_[0].guards_.length === 0) {
231
184
  const body_ = function_a.lambda_.cases_[0].body_;
232
- if(function_a.lambda_.cases_.length === 1) {
233
185
  return body_
234
- return
235
- }
236
- }
237
- }
238
- }
239
- }
240
186
  }
241
187
  {
242
188
  const effect_ = ff_compiler_Syntax.TConstructor(function_.at_, "Q$", []);
243
189
  return ff_compiler_Syntax.ECall(function_.at_, ff_compiler_Syntax.DynamicCall(function_, false), effect_, [], [], [])
244
- return
245
- }
246
190
  }
247
191
  }
248
192
 
249
193
  export function extractTypeName_(type_) {
250
- {
251
194
  const type_a = type_;
252
- {
253
195
  if(type_a.TVariable) {
254
196
  const at_ = type_a.at_;
255
197
  const index_ = type_a.index_;
256
198
  return ff_compiler_JsEmitter.fail_(at_, ("Unexpected type variable: $" + index_))
257
- return
258
- }
259
199
  }
260
- {
261
200
  if(type_a.TConstructor) {
262
201
  const t_ = type_a;
263
202
  return t_.name_
264
- return
265
- }
266
- }
267
203
  }
268
204
  }
269
205
 
270
206
  export function firstTypeName_(types_) {
271
- return (((_1) => {
272
207
  {
208
+ const _1 = ff_core_List.List_grabFirst(types_);
273
209
  if(_1.TConstructor) {
274
210
  const t_ = _1;
275
- return t_
276
- return
277
- }
211
+ return t_.name_
278
212
  }
279
- {
280
213
  if(_1.TVariable) {
281
214
  const t_ = _1;
282
215
  return ff_compiler_JsEmitter.fail_(t_.at_, " is still a unification variable")
283
- return
284
216
  }
285
217
  }
286
- }))(ff_core_List.List_grabFirst(types_)).name_
287
218
  }
288
219
 
289
220
  export function makeDictionaryName_(traitName_, typeName_) {
@@ -291,43 +222,25 @@ return ((ff_core_String.String_replace(ff_core_String.String_replace(ff_core_Str
291
222
  }
292
223
 
293
224
  export function charLiteralToNumber_(charLiteral_) {
294
- {
295
225
  const charLiteral_a = charLiteral_;
296
- {
297
226
  if(charLiteral_a === "'\\t'") {
298
227
  return "9"
299
- return
300
228
  }
301
- }
302
- {
303
229
  if(charLiteral_a === "'\\n'") {
304
230
  return "10"
305
- return
306
- }
307
231
  }
308
- {
309
232
  if(charLiteral_a === "'\\r'") {
310
233
  return "13"
311
- return
312
234
  }
313
- }
314
- {
315
235
  if(charLiteral_a === "'\\\"'") {
316
236
  return "34"
317
- return
318
- }
319
237
  }
320
- {
321
238
  if(charLiteral_a === "'\\''") {
322
239
  return "39"
323
- return
324
- }
325
240
  }
326
241
  {
327
242
  const value_ = charLiteral_a;
328
243
  return ("" + ff_core_String.String_grab(value_, 1))
329
- return
330
- }
331
244
  }
332
245
  }
333
246
 
@@ -350,20 +263,12 @@ return word_
350
263
  }
351
264
 
352
265
  export function effectTypeIsAsync_(effect_) {
353
- {
354
266
  const effect_a = effect_;
355
- {
356
- if(effect_a.TConstructor) {
357
- if(effect_a.name_ === "Q$") {
267
+ if(effect_a.TConstructor && effect_a.name_ === "Q$") {
358
268
  return true
359
- return
360
- }
361
- }
362
269
  }
363
270
  {
364
271
  return false
365
- return
366
- }
367
272
  }
368
273
  }
369
274
 
@@ -379,39 +284,18 @@ return ff_core_Core.panic_(((message_ + " ") + ff_compiler_Syntax.Location_show(
379
284
  }
380
285
 
381
286
  export async function detectIfElse_$(term_, $task) {
382
- {
383
287
  const term_a = term_;
384
- {
385
- if(term_a.ECall) {
288
+ if(term_a.ECall && term_a.target_.StaticCall && term_a.target_.name_ === "ff:core/Core.if" && term_a.arguments_.length === 2) {
386
289
  const at_ = term_a.at_;
387
- if(term_a.target_.StaticCall) {
388
- if(term_a.target_.name_ === "ff:core/Core.if") {
389
- if(term_a.arguments_.length > 0) {
390
290
  const condition_ = term_a.arguments_[0];
391
- if(term_a.arguments_.length > 1) {
392
291
  const body_ = term_a.arguments_[1];
393
- if(term_a.arguments_.length === 2) {
394
292
  return [ff_core_Pair.Pair(condition_.value_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_))]
395
- return
396
- }
397
- }
398
- }
399
293
  }
400
- }
401
- }
402
- }
403
- {
404
- if(term_a.ECall) {
294
+ if(term_a.ECall && term_a.target_.StaticCall && term_a.target_.name_ === "ff:core/Option.Option_elseIf" && term_a.arguments_.length === 3) {
405
295
  const at_ = term_a.at_;
406
- if(term_a.target_.StaticCall) {
407
- if(term_a.target_.name_ === "ff:core/Option.Option_elseIf") {
408
- if(term_a.arguments_.length > 0) {
409
296
  const option_ = term_a.arguments_[0];
410
- if(term_a.arguments_.length > 1) {
411
297
  const condition_ = term_a.arguments_[1];
412
- if(term_a.arguments_.length > 2) {
413
298
  const body_ = term_a.arguments_[2];
414
- if(term_a.arguments_.length === 3) {
415
299
  const list_ = ff_compiler_JsEmitter.detectIfElse_(option_.value_);
416
300
  if(ff_core_List.List_isEmpty(list_)) {
417
301
  return []
@@ -420,23 +304,10 @@ return [ff_core_Pair.Pair(ff_compiler_JsEmitter.invokeImmediately_(condition_.va
420
304
  }
421
305
  return
422
306
  }
423
- }
424
- }
425
- }
426
- }
427
- }
428
- }
429
- }
430
- {
431
- if(term_a.ECall) {
307
+ if(term_a.ECall && term_a.target_.StaticCall && term_a.target_.name_ === "ff:core/Option.Option_else" && term_a.arguments_.length === 2) {
432
308
  const at_ = term_a.at_;
433
- if(term_a.target_.StaticCall) {
434
- if(term_a.target_.name_ === "ff:core/Option.Option_else") {
435
- if(term_a.arguments_.length > 0) {
436
309
  const option_ = term_a.arguments_[0];
437
- if(term_a.arguments_.length > 1) {
438
310
  const body_ = term_a.arguments_[1];
439
- if(term_a.arguments_.length === 2) {
440
311
  const list_ = ff_compiler_JsEmitter.detectIfElse_(option_.value_);
441
312
  if(ff_core_List.List_isEmpty(list_)) {
442
313
  return []
@@ -445,84 +316,49 @@ return [ff_core_Pair.Pair(ff_compiler_Syntax.EVariant(at_, "ff:core/Bool.True",
445
316
  }
446
317
  return
447
318
  }
448
- }
449
- }
450
- }
451
- }
452
- }
453
- }
454
319
  {
455
320
  return []
456
- return
457
- }
458
321
  }
459
322
  }
460
323
 
461
324
  export async function invokeImmediately_$(function_, $task) {
462
- {
463
325
  const function_a = function_;
464
- {
465
- if(function_a.ELambda) {
326
+ if(function_a.ELambda && function_a.lambda_.cases_.length === 1 && function_a.lambda_.cases_[0].patterns_.length === 0 && function_a.lambda_.cases_[0].guards_.length === 0) {
466
327
  const effect_ = function_a.lambda_.effect_;
467
- if(function_a.lambda_.cases_.length > 0) {
468
- if(function_a.lambda_.cases_[0].patterns_.length === 0) {
469
- if(function_a.lambda_.cases_[0].guards_.length === 0) {
470
328
  const body_ = function_a.lambda_.cases_[0].body_;
471
- if(function_a.lambda_.cases_.length === 1) {
472
329
  return body_
473
- return
474
- }
475
- }
476
- }
477
- }
478
- }
479
330
  }
480
331
  {
481
332
  const effect_ = ff_compiler_Syntax.TConstructor(function_.at_, "Q$", []);
482
333
  return ff_compiler_Syntax.ECall(function_.at_, ff_compiler_Syntax.DynamicCall(function_, false), effect_, [], [], [])
483
- return
484
- }
485
334
  }
486
335
  }
487
336
 
488
337
  export async function extractTypeName_$(type_, $task) {
489
- {
490
338
  const type_a = type_;
491
- {
492
339
  if(type_a.TVariable) {
493
340
  const at_ = type_a.at_;
494
341
  const index_ = type_a.index_;
495
342
  return ff_compiler_JsEmitter.fail_(at_, ("Unexpected type variable: $" + index_))
496
- return
497
- }
498
343
  }
499
- {
500
344
  if(type_a.TConstructor) {
501
345
  const t_ = type_a;
502
346
  return t_.name_
503
- return
504
- }
505
- }
506
347
  }
507
348
  }
508
349
 
509
350
  export async function firstTypeName_$(types_, $task) {
510
- return (((_1) => {
511
351
  {
352
+ const _1 = ff_core_List.List_grabFirst(types_);
512
353
  if(_1.TConstructor) {
513
354
  const t_ = _1;
514
- return t_
515
- return
516
- }
355
+ return t_.name_
517
356
  }
518
- {
519
357
  if(_1.TVariable) {
520
358
  const t_ = _1;
521
359
  return ff_compiler_JsEmitter.fail_(t_.at_, " is still a unification variable")
522
- return
523
360
  }
524
361
  }
525
- }))(ff_core_List.List_grabFirst(types_)).name_
526
362
  }
527
363
 
528
364
  export async function makeDictionaryName_$(traitName_, typeName_, $task) {
@@ -530,43 +366,25 @@ return ((ff_core_String.String_replace(ff_core_String.String_replace(ff_core_Str
530
366
  }
531
367
 
532
368
  export async function charLiteralToNumber_$(charLiteral_, $task) {
533
- {
534
369
  const charLiteral_a = charLiteral_;
535
- {
536
370
  if(charLiteral_a === "'\\t'") {
537
371
  return "9"
538
- return
539
372
  }
540
- }
541
- {
542
373
  if(charLiteral_a === "'\\n'") {
543
374
  return "10"
544
- return
545
- }
546
375
  }
547
- {
548
376
  if(charLiteral_a === "'\\r'") {
549
377
  return "13"
550
- return
551
378
  }
552
- }
553
- {
554
379
  if(charLiteral_a === "'\\\"'") {
555
380
  return "34"
556
- return
557
- }
558
381
  }
559
- {
560
382
  if(charLiteral_a === "'\\''") {
561
383
  return "39"
562
- return
563
- }
564
384
  }
565
385
  {
566
386
  const value_ = charLiteral_a;
567
387
  return ("" + ff_core_String.String_grab(value_, 1))
568
- return
569
- }
570
388
  }
571
389
  }
572
390
 
@@ -589,20 +407,12 @@ return word_
589
407
  }
590
408
 
591
409
  export async function effectTypeIsAsync_$(effect_, $task) {
592
- {
593
410
  const effect_a = effect_;
594
- {
595
- if(effect_a.TConstructor) {
596
- if(effect_a.name_ === "Q$") {
411
+ if(effect_a.TConstructor && effect_a.name_ === "Q$") {
597
412
  return true
598
- return
599
- }
600
- }
601
413
  }
602
414
  {
603
415
  return false
604
- return
605
- }
606
416
  }
607
417
  }
608
418
 
@@ -689,30 +499,17 @@ return [ff_core_List.List_join(["export async function $run$(fireflyPath_, argum
689
499
  : []), "} finally {", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
690
500
  ? ["ff_core_Task.Task_abort$($task)", "clearInterval(interval)"]
691
501
  : []), "}", "}", ...(((_1) => {
692
- {
693
502
  if(_1.EmitBrowser) {
694
503
  return ["queueMicrotask(async () => {", "await $run$(null, [])", "})"]
695
- return
696
504
  }
697
- }
698
- {
699
- if(_1.EmitNode) {
700
- const _guard1 = bootstrapping_;
701
- if(_guard1) {
505
+ if(_1.EmitNode && bootstrapping_) {
702
506
  return ["import * as path from 'node:path'", "queueMicrotask(async () => {", "let fireflyPath_ = path.dirname(path.dirname(path.dirname(path.dirname(path.dirname(process.argv[1])))))", "await $run$(fireflyPath_, process.argv.slice(2))", "})"]
703
- return
704
- }
705
507
  }
706
- }
707
- {
708
508
  if(_1.EmitExecutable) {
709
509
  return ["queueMicrotask(async () => {", "await $run$(null, process.argv.slice(2))", "})"]
710
- return
711
- }
712
510
  }
713
511
  {
714
512
  return []
715
- return
716
513
  }
717
514
  }))(self_.emitTarget_)], "\n")]
718
515
  })), (() => {
@@ -776,11 +573,8 @@ return ("async " + ff_core_String.String_dropFirst(_w1, ff_core_String.String_si
776
573
  const body_ = (("{\n" + ff_core_List.List_join([...methods_, ...asyncMethods_], ",\n")) + "\n}");
777
574
  {
778
575
  const _1 = definition_.constraints_;
779
- {
780
576
  if(_1.length === 0) {
781
577
  return (((("export const " + name_) + " = ") + body_) + ";")
782
- return
783
- }
784
578
  }
785
579
  {
786
580
  const constraints_ = _1;
@@ -788,7 +582,6 @@ const dictionaries_ = ff_core_List.List_map(constraints_, ((c_) => {
788
582
  return ff_compiler_JsEmitter.makeDictionaryName_(c_.name_, ff_compiler_JsEmitter.firstTypeName_(c_.generics_))
789
583
  }));
790
584
  return (((((("export function " + name_) + "(") + ff_core_List.List_join(dictionaries_, ", ")) + ") { return ") + body_) + "}")
791
- return
792
585
  }
793
586
  }
794
587
  }
@@ -797,80 +590,39 @@ export function JsEmitter_emitFunctionDefinition(self_, definition_, async_, suf
797
590
  const signature_ = ff_compiler_JsEmitter.JsEmitter_emitSignature(self_, definition_.signature_, async_, suffix_);
798
591
  {
799
592
  const _1 = ff_core_Pair.Pair(async_, definition_.body_);
800
- {
801
- if(!_1.first_) {
802
- if(_1.second_.ForeignTarget) {
803
- if(_1.second_.syncCode_.None) {
593
+ if(!_1.first_ && _1.second_.ForeignTarget && _1.second_.syncCode_.None) {
804
594
  return (((signature_ + " {\nthrow new Error('Function ") + definition_.signature_.name_) + " is missing on this target in sync context.');\n}")
805
- return
806
- }
807
- }
808
- }
809
595
  }
810
- {
811
- if(_1.first_) {
812
- if(_1.second_.ForeignTarget) {
813
- if(_1.second_.asyncCode_.None) {
596
+ if(_1.first_ && _1.second_.ForeignTarget && _1.second_.asyncCode_.None) {
814
597
  return (((signature_ + " {\nthrow new Error('Function ") + definition_.signature_.name_) + " is missing on this target in async context.');\n}")
815
- return
816
- }
817
- }
818
598
  }
819
- }
820
- {
821
- if(!_1.first_) {
822
- if(_1.second_.ForeignTarget) {
823
- if(_1.second_.syncCode_.Some) {
599
+ if(!_1.first_ && _1.second_.ForeignTarget && _1.second_.syncCode_.Some) {
824
600
  const code_ = _1.second_.syncCode_.value_;
825
601
  return (((signature_ + " {\n") + ff_compiler_JsImporter.JsImporter_process(self_.jsImporter_, definition_.at_, code_)) + "\n}")
826
- return
827
- }
828
602
  }
829
- }
830
- }
831
- {
832
- if(_1.first_) {
833
- if(_1.second_.ForeignTarget) {
834
- if(_1.second_.asyncCode_.Some) {
603
+ if(_1.first_ && _1.second_.ForeignTarget && _1.second_.asyncCode_.Some) {
835
604
  const code_ = _1.second_.asyncCode_.value_;
836
605
  return (((signature_ + " {\n") + ff_compiler_JsImporter.JsImporter_process(self_.jsImporter_, definition_.at_, code_)) + "\n}")
837
- return
838
606
  }
839
- }
840
- }
841
- }
842
- {
843
607
  if(_1.second_.FireflyTarget) {
844
608
  const lambda_ = _1.second_.lambda_;
845
609
  {
846
610
  const _1 = lambda_;
847
- {
611
+ if(_1.cases_.length === 1) {
848
612
  const effect_ = _1.effect_;
849
- if(_1.cases_.length > 0) {
850
613
  const matchCase_ = _1.cases_[0];
851
- if(_1.cases_.length === 1) {
852
- const _guard1 = ff_core_List.List_all(matchCase_.patterns_, ((_1) => {
853
- {
854
- if(_1.PVariable) {
855
- if(_1.name_.None) {
614
+ if(ff_core_List.List_all(matchCase_.patterns_, ((_1) => {
615
+ if(_1.PVariable && _1.name_.None) {
856
616
  return true
857
- return
858
- }
859
- }
860
617
  }
861
618
  {
862
619
  return false
863
- return
864
620
  }
865
- }));
866
- if(_guard1) {
621
+ }))) {
867
622
  const body_ = ff_compiler_JsEmitter.JsEmitter_emitTailCall(self_, (() => {
868
623
  return ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, matchCase_.body_, true, async_)
869
624
  }));
870
625
  return (((signature_ + " {\n") + body_) + "\n}")
871
- return
872
- }
873
- }
874
626
  }
875
627
  }
876
628
  {
@@ -885,19 +637,17 @@ return (((("const " + p_.name_) + "_a = ") + ff_compiler_JsEmitter.escapeKeyword
885
637
  })), "\n");
886
638
  const body_ = ff_compiler_JsEmitter.JsEmitter_emitTailCall(self_, (() => {
887
639
  const casesString_ = ff_core_List.List_join(ff_core_List.List_map(cases_, ((_w1) => {
888
- return (("{\n" + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, escapedArguments_, _w1, true, true, async_)) + "\n}")
640
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, escapedArguments_, _w1, [], [], true, true, async_)
889
641
  })), "\n");
890
- return (((("{\n" + shadowingWorkaround_) + "\n") + casesString_) + "\n}")
642
+ return ((shadowingWorkaround_ + "\n") + casesString_)
891
643
  }));
892
644
  return (((signature_ + " {\n") + body_) + "\n}")
893
- return
894
645
  }
895
646
  }
896
647
  return
897
648
  }
898
649
  }
899
650
  }
900
- }
901
651
 
902
652
  export function JsEmitter_emitTailCall(self_, body_) {
903
653
  const outerTailCallUsed_ = self_.tailCallUsed_;
@@ -968,93 +718,55 @@ return (((((((((("export function " + definition_.name_) + "(") + fields_) + ")
968
718
  export function JsEmitter_emitTerm(self_, term_, async_) {
969
719
  {
970
720
  const _1 = term_;
971
- {
972
721
  if(_1.EString) {
973
722
  const at_ = _1.at_;
974
723
  const value_ = _1.value_;
975
- const _guard1 = ff_core_String.String_startsWith(value_, "\"\"\"", 0);
976
- if(_guard1) {
724
+ if(ff_core_String.String_startsWith(value_, "\"\"\"", 0)) {
977
725
  return (("`" + ff_core_String.String_replace(ff_core_String.String_dropLast(ff_core_String.String_dropFirst(value_, 3), 3), "`", "\\`")) + "`")
978
- return
979
- }
980
726
  }
981
727
  }
982
- {
983
728
  if(_1.EString) {
984
729
  const at_ = _1.at_;
985
730
  const value_ = _1.value_;
986
731
  return value_
987
- return
988
732
  }
989
- }
990
- {
991
733
  if(_1.EChar) {
992
734
  const at_ = _1.at_;
993
735
  const value_ = _1.value_;
994
736
  return ff_compiler_JsEmitter.charLiteralToNumber_(value_)
995
- return
996
- }
997
737
  }
998
- {
999
738
  if(_1.EInt) {
1000
739
  const at_ = _1.at_;
1001
740
  const value_ = _1.value_;
1002
741
  return value_
1003
- return
1004
742
  }
1005
- }
1006
- {
1007
743
  if(_1.EFloat) {
1008
744
  const at_ = _1.at_;
1009
745
  const value_ = _1.value_;
1010
746
  return value_
1011
- return
1012
- }
1013
747
  }
1014
- {
1015
748
  if(_1.EVariable) {
1016
749
  const at_ = _1.at_;
1017
750
  const name_ = _1.name_;
1018
751
  return ff_compiler_JsEmitter.escapeResolved_(name_)
1019
- return
1020
752
  }
1021
- }
1022
- {
1023
753
  if(_1.EList) {
1024
754
  const at_ = _1.at_;
1025
755
  const items_ = _1.items_;
1026
756
  return ff_compiler_JsEmitter.JsEmitter_emitList(self_, items_, async_)
1027
- return
1028
- }
1029
757
  }
1030
- {
1031
- if(_1.EVariant) {
758
+ if(_1.EVariant && _1.name_ === "ff:core/Bool.False") {
1032
759
  const at_ = _1.at_;
1033
- if(_1.name_ === "ff:core/Bool.False") {
1034
760
  return "false"
1035
- return
1036
- }
1037
761
  }
1038
- }
1039
- {
1040
- if(_1.EVariant) {
762
+ if(_1.EVariant && _1.name_ === "ff:core/Bool.True") {
1041
763
  const at_ = _1.at_;
1042
- if(_1.name_ === "ff:core/Bool.True") {
1043
764
  return "true"
1044
- return
1045
765
  }
1046
- }
1047
- }
1048
- {
1049
- if(_1.EVariant) {
766
+ if(_1.EVariant && _1.name_ === "ff:core/Unit.Unit") {
1050
767
  const at_ = _1.at_;
1051
- if(_1.name_ === "ff:core/Unit.Unit") {
1052
768
  return "(void 0)"
1053
- return
1054
- }
1055
769
  }
1056
- }
1057
- {
1058
770
  if(_1.EVariant) {
1059
771
  const at_ = _1.at_;
1060
772
  const name_ = _1.name_;
@@ -1070,35 +782,18 @@ return (((ff_compiler_JsEmitter.escapeResolved_(name_) + "(") + argumentsString_
1070
782
  }
1071
783
  return
1072
784
  }
1073
- }
1074
- {
1075
- if(_1.EVariantIs) {
785
+ if(_1.EVariantIs && _1.name_ === "ff:core/Bool.False") {
1076
786
  const at_ = _1.at_;
1077
- if(_1.name_ === "ff:core/Bool.False") {
1078
787
  return "function(_v) { return !_v ? ff_core_Option.Some(_v) : ff_core_Option.None(); }"
1079
- return
1080
788
  }
1081
- }
1082
- }
1083
- {
1084
- if(_1.EVariantIs) {
789
+ if(_1.EVariantIs && _1.name_ === "ff:core/Bool.True") {
1085
790
  const at_ = _1.at_;
1086
- if(_1.name_ === "ff:core/Bool.True") {
1087
791
  return "function(_v) { return _v ? ff_core_Option.Some(_v) : ff_core_Option.None(); }"
1088
- return
1089
- }
1090
792
  }
1091
- }
1092
- {
1093
- if(_1.EVariantIs) {
793
+ if(_1.EVariantIs && _1.name_ === "ff:core/Unit.Unit") {
1094
794
  const at_ = _1.at_;
1095
- if(_1.name_ === "ff:core/Unit.Unit") {
1096
795
  return "function(_v) { return ff_core_Option.Some(_v); }"
1097
- return
1098
- }
1099
- }
1100
796
  }
1101
- {
1102
797
  if(_1.EVariantIs) {
1103
798
  const at_ = _1.at_;
1104
799
  const name_ = _1.name_;
@@ -1106,10 +801,7 @@ const n_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core
1106
801
  return (_w1 !== 46)
1107
802
  })));
1108
803
  return (((("(function(_v) { " + "return _v.") + ff_compiler_JsEmitter.escapeResolved_(n_)) + " ? ff_core_Option.Some(_v) : ff_core_Option.None();") + "})")
1109
- return
1110
804
  }
1111
- }
1112
- {
1113
805
  if(_1.ECopy) {
1114
806
  const at_ = _1.at_;
1115
807
  const name_ = _1.name_;
@@ -1119,10 +811,7 @@ const fieldCode_ = ff_core_List.List_join(ff_core_List.List_map(fields_, ((f_) =
1119
811
  return ((ff_compiler_JsEmitter.escapeKeyword_(f_.name_) + " = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, f_.value_, async_))
1120
812
  })), ", ");
1121
813
  return (((("{..." + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, record_, async_)) + ", ") + fieldCode_) + "}")
1122
- return
1123
- }
1124
814
  }
1125
- {
1126
815
  if(_1.EField) {
1127
816
  const at_ = _1.at_;
1128
817
  const newtype_ = _1.newtype_;
@@ -1135,32 +824,21 @@ return ((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, record_, async_) + ".")
1135
824
  }
1136
825
  return
1137
826
  }
1138
- }
1139
- {
1140
- if(_1.ELambda) {
827
+ if(_1.ELambda && _1.lambda_.cases_.length === 1 && _1.lambda_.cases_[0].guards_.length === 0) {
1141
828
  const at_ = _1.at_;
1142
829
  const effect_ = _1.lambda_.effect_;
1143
- if(_1.lambda_.cases_.length > 0) {
1144
830
  const patterns_ = _1.lambda_.cases_[0].patterns_;
1145
- if(_1.lambda_.cases_[0].guards_.length === 0) {
1146
831
  const body_ = _1.lambda_.cases_[0].body_;
1147
- if(_1.lambda_.cases_.length === 1) {
1148
- const _guard1 = ff_core_List.List_all(patterns_, ((_1) => {
1149
- {
832
+ if(ff_core_List.List_all(patterns_, ((_1) => {
1150
833
  if(_1.PVariable) {
1151
834
  return true
1152
- return
1153
- }
1154
835
  }
1155
836
  {
1156
837
  return false
1157
- return
1158
838
  }
1159
- }));
1160
- if(_guard1) {
839
+ }))) {
1161
840
  const newAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
1162
841
  const patternParameters_ = ff_core_List.List_map(patterns_, ((_1) => {
1163
- {
1164
842
  if(_1.PVariable) {
1165
843
  const p_ = _1;
1166
844
  return ff_core_Option.Option_else(ff_core_Option.Option_map(p_.name_, ((word_) => {
@@ -1170,10 +848,8 @@ return "_"
1170
848
  }))
1171
849
  return
1172
850
  }
1173
- }
1174
851
  {
1175
852
  return ff_core_Core.panic_("!")
1176
- return
1177
853
  }
1178
854
  }));
1179
855
  const controller_ = (newAsync_
@@ -1184,14 +860,8 @@ const prefix_ = (newAsync_
1184
860
  ? "async "
1185
861
  : "");
1186
862
  return (((((("(" + prefix_) + "(") + parameters_) + ") => {\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, true, newAsync_)) + "\n})")
1187
- return
1188
- }
1189
863
  }
1190
864
  }
1191
- }
1192
- }
1193
- }
1194
- {
1195
865
  if(_1.ELambda) {
1196
866
  const at_ = _1.at_;
1197
867
  const effect_ = _1.lambda_.effect_;
@@ -1208,16 +878,13 @@ const escapedArguments_ = ff_core_List.List_map(arguments_, ((word_) => {
1208
878
  return ff_compiler_JsEmitter.escapeKeyword_(word_)
1209
879
  }));
1210
880
  const caseStrings_ = ff_core_List.List_map(cases_, ((_w1) => {
1211
- return (("{\n" + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, escapedArguments_, _w1, true, true, newAsync_)) + "\n}")
881
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, escapedArguments_, _w1, [], [], true, true, newAsync_)
1212
882
  }));
1213
883
  const prefix_ = (newAsync_
1214
884
  ? "async "
1215
885
  : "");
1216
886
  return ((((((("(" + prefix_) + "(") + ff_core_List.List_join([...escapedArguments_, ...controller_], ", ")) + ") => ") + "{\n") + ff_core_List.List_join(caseStrings_, "\n")) + "\n})")
1217
- return
1218
- }
1219
887
  }
1220
- {
1221
888
  if(_1.EPipe) {
1222
889
  const at_ = _1.at_;
1223
890
  const value_ = _1.value_;
@@ -1235,76 +902,43 @@ return call_
1235
902
  }
1236
903
  return
1237
904
  }
1238
- }
1239
- {
1240
- if(_1.ECall) {
905
+ if(_1.ECall && _1.target_.StaticCall && _1.typeArguments_.length === 0 && _1.arguments_.length === 1) {
1241
906
  const at_ = _1.at_;
1242
- if(_1.target_.StaticCall) {
1243
907
  const operator_ = _1.target_.name_;
1244
- if(_1.typeArguments_.length === 0) {
1245
- if(_1.arguments_.length > 0) {
1246
908
  const value_ = _1.arguments_[0];
1247
- if(_1.arguments_.length === 1) {
1248
- const _guard1 = (!ff_core_Char.Char_isAsciiLetter(ff_core_String.String_grabFirst(operator_)));
1249
- if(_guard1) {
909
+ if((!ff_core_Char.Char_isAsciiLetter(ff_core_String.String_grabFirst(operator_)))) {
1250
910
  return ((("(" + operator_) + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, value_, async_)) + ")")
1251
- return
1252
- }
1253
- }
1254
911
  }
1255
912
  }
1256
- }
1257
- }
1258
- }
1259
- {
1260
- if(_1.ECall) {
913
+ if(_1.ECall && _1.target_.StaticCall && _1.typeArguments_.length === 0 && _1.arguments_.length === 2) {
1261
914
  const at_ = _1.at_;
1262
- if(_1.target_.StaticCall) {
1263
915
  const operator_ = _1.target_.name_;
1264
- if(_1.typeArguments_.length === 0) {
1265
- if(_1.arguments_.length > 0) {
1266
916
  const left_ = _1.arguments_[0];
1267
- if(_1.arguments_.length > 1) {
1268
917
  const right_ = _1.arguments_[1];
1269
- if(_1.arguments_.length === 2) {
1270
- const _guard1 = (!ff_core_Char.Char_isAsciiLetter(ff_core_String.String_grabFirst(operator_)));
1271
- if(_guard1) {
918
+ if((!ff_core_Char.Char_isAsciiLetter(ff_core_String.String_grabFirst(operator_)))) {
1272
919
  return (((((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " ") + operator_) + " ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
1273
- return
1274
- }
1275
- }
1276
- }
1277
- }
1278
920
  }
1279
921
  }
922
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_grab" && _1.arguments_.length === 2 && _1.arguments_[0].value_.EVariable && _1.arguments_[1].value_.EVariable) {
923
+ const at_ = _1.at_;
924
+ const x1_ = _1.arguments_[0].value_.name_;
925
+ const x2_ = _1.arguments_[1].value_.name_;
926
+ return ((((((((("(" + ff_compiler_JsEmitter.escapeResolved_(x1_)) + "[") + ff_compiler_JsEmitter.escapeResolved_(x2_)) + "] ?? ") + "ff_core_List.internalGrab_(") + ff_compiler_JsEmitter.escapeResolved_(x1_)) + ", ") + ff_compiler_JsEmitter.escapeResolved_(x2_)) + "))")
1280
927
  }
928
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Array.Array_grab" && _1.arguments_.length === 2 && _1.arguments_[0].value_.EVariable && _1.arguments_[1].value_.EVariable) {
929
+ const at_ = _1.at_;
930
+ const x1_ = _1.arguments_[0].value_.name_;
931
+ const x2_ = _1.arguments_[1].value_.name_;
932
+ return ((((((((("(" + ff_compiler_JsEmitter.escapeResolved_(x1_)) + ".array[") + ff_compiler_JsEmitter.escapeResolved_(x2_)) + "] ?? ") + "ff_core_Array.internalGrab_(") + ff_compiler_JsEmitter.escapeResolved_(x1_)) + ", ") + ff_compiler_JsEmitter.escapeResolved_(x2_)) + "))")
1281
933
  }
1282
- {
1283
- if(_1.ECall) {
934
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:unsafejs/UnsafeJs.import" && _1.arguments_.length === 1 && _1.arguments_[0].value_.EString) {
1284
935
  const at_ = _1.at_;
1285
- if(_1.target_.StaticCall) {
1286
- if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.import") {
1287
- if(_1.arguments_.length > 0) {
1288
- if(_1.arguments_[0].value_.EString) {
1289
936
  const url_ = _1.arguments_[0].value_.value_;
1290
- if(_1.arguments_.length === 1) {
1291
937
  return ff_compiler_JsImporter.JsImporter_add(self_.jsImporter_, ff_core_String.String_replace(url_, "\"", ""))
1292
- return
1293
- }
1294
- }
1295
- }
1296
938
  }
1297
- }
1298
- }
1299
- }
1300
- {
1301
- if(_1.ECall) {
939
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:unsafejs/UnsafeJs.await" && _1.arguments_.length === 1) {
1302
940
  const at_ = _1.at_;
1303
- if(_1.target_.StaticCall) {
1304
- if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.await") {
1305
- if(_1.arguments_.length > 0) {
1306
941
  const body_ = _1.arguments_[0].value_;
1307
- if(_1.arguments_.length === 1) {
1308
942
  const emittedBody_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, body_, async_);
1309
943
  if(async_) {
1310
944
  return (("(await " + emittedBody_) + "($task))")
@@ -1313,17 +947,8 @@ return (("(" + emittedBody_) + "())")
1313
947
  }
1314
948
  return
1315
949
  }
1316
- }
1317
- }
1318
- }
1319
- }
1320
- }
1321
- {
1322
- if(_1.ECall) {
950
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:unsafejs/UnsafeJs.cancelled" && _1.arguments_.length === 0) {
1323
951
  const at_ = _1.at_;
1324
- if(_1.target_.StaticCall) {
1325
- if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.cancelled") {
1326
- if(_1.arguments_.length === 0) {
1327
952
  if(async_) {
1328
953
  return "$task.controller.signal.aborted"
1329
954
  } else {
@@ -1331,16 +956,8 @@ return "false"
1331
956
  }
1332
957
  return
1333
958
  }
1334
- }
1335
- }
1336
- }
1337
- }
1338
- {
1339
- if(_1.ECall) {
959
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:unsafejs/UnsafeJs.throwIfCancelled" && _1.arguments_.length === 0) {
1340
960
  const at_ = _1.at_;
1341
- if(_1.target_.StaticCall) {
1342
- if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.throwIfCancelled") {
1343
- if(_1.arguments_.length === 0) {
1344
961
  if(async_) {
1345
962
  return "((() => ff_core_Task.Task_throwIfAborted($task))())"
1346
963
  } else {
@@ -1348,207 +965,69 @@ return ""
1348
965
  }
1349
966
  return
1350
967
  }
1351
- }
1352
- }
1353
- }
1354
- }
1355
- {
1356
- if(_1.ECall) {
968
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Equal.equals" && _1.arguments_.length === 2 && _1.dictionaries_.length === 1 && _1.dictionaries_[0].dictionaries_.length === 0) {
1357
969
  const at_ = _1.at_;
1358
- if(_1.target_.StaticCall) {
1359
- if(_1.target_.name_ === "ff:core/Equal.equals") {
1360
- if(_1.arguments_.length > 0) {
1361
970
  const left_ = _1.arguments_[0];
1362
- if(_1.arguments_.length > 1) {
1363
971
  const right_ = _1.arguments_[1];
1364
- if(_1.arguments_.length === 2) {
1365
- if(_1.dictionaries_.length > 0) {
1366
972
  const typeName_ = _1.dictionaries_[0].typeName_;
1367
- if(_1.dictionaries_[0].dictionaries_.length === 0) {
1368
- if(_1.dictionaries_.length === 1) {
1369
- const _guard1 = (ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || (typeName_ === "ff:core/Ordering.Ordering"));
1370
- if(_guard1) {
973
+ if((ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || (typeName_ === "ff:core/Ordering.Ordering"))) {
1371
974
  return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " === ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
1372
- return
1373
- }
1374
- }
1375
- }
1376
- }
1377
- }
1378
- }
1379
- }
1380
975
  }
1381
976
  }
1382
- }
1383
- }
1384
- {
1385
- if(_1.ECall) {
977
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Equal.notEquals" && _1.arguments_.length === 2 && _1.dictionaries_.length === 1 && _1.dictionaries_[0].dictionaries_.length === 0) {
1386
978
  const at_ = _1.at_;
1387
- if(_1.target_.StaticCall) {
1388
- if(_1.target_.name_ === "ff:core/Equal.notEquals") {
1389
- if(_1.arguments_.length > 0) {
1390
979
  const left_ = _1.arguments_[0];
1391
- if(_1.arguments_.length > 1) {
1392
980
  const right_ = _1.arguments_[1];
1393
- if(_1.arguments_.length === 2) {
1394
- if(_1.dictionaries_.length > 0) {
1395
981
  const typeName_ = _1.dictionaries_[0].typeName_;
1396
- if(_1.dictionaries_[0].dictionaries_.length === 0) {
1397
- if(_1.dictionaries_.length === 1) {
1398
- const _guard1 = (ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || (typeName_ === "ff:core/Ordering.Ordering"));
1399
- if(_guard1) {
982
+ if((ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || (typeName_ === "ff:core/Ordering.Ordering"))) {
1400
983
  return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " !== ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
1401
- return
1402
- }
1403
- }
1404
- }
1405
- }
1406
984
  }
1407
985
  }
1408
- }
1409
- }
1410
- }
1411
- }
1412
- }
1413
- {
1414
- if(_1.ECall) {
986
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Ordering.before" && _1.arguments_.length === 2 && _1.dictionaries_.length === 1 && _1.dictionaries_[0].dictionaries_.length === 0) {
1415
987
  const at_ = _1.at_;
1416
- if(_1.target_.StaticCall) {
1417
- if(_1.target_.name_ === "ff:core/Ordering.before") {
1418
- if(_1.arguments_.length > 0) {
1419
988
  const left_ = _1.arguments_[0];
1420
- if(_1.arguments_.length > 1) {
1421
989
  const right_ = _1.arguments_[1];
1422
- if(_1.arguments_.length === 2) {
1423
- if(_1.dictionaries_.length > 0) {
1424
990
  const typeName_ = _1.dictionaries_[0].typeName_;
1425
- if(_1.dictionaries_[0].dictionaries_.length === 0) {
1426
- if(_1.dictionaries_.length === 1) {
1427
- const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
1428
- if(_guard1) {
991
+ if(ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
1429
992
  return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " < ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
1430
- return
1431
- }
1432
- }
1433
- }
1434
- }
1435
- }
1436
- }
1437
- }
1438
- }
1439
- }
1440
993
  }
1441
994
  }
1442
- {
1443
- if(_1.ECall) {
995
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Ordering.notBefore" && _1.arguments_.length === 2 && _1.dictionaries_.length === 1 && _1.dictionaries_[0].dictionaries_.length === 0) {
1444
996
  const at_ = _1.at_;
1445
- if(_1.target_.StaticCall) {
1446
- if(_1.target_.name_ === "ff:core/Ordering.notBefore") {
1447
- if(_1.arguments_.length > 0) {
1448
997
  const left_ = _1.arguments_[0];
1449
- if(_1.arguments_.length > 1) {
1450
998
  const right_ = _1.arguments_[1];
1451
- if(_1.arguments_.length === 2) {
1452
- if(_1.dictionaries_.length > 0) {
1453
999
  const typeName_ = _1.dictionaries_[0].typeName_;
1454
- if(_1.dictionaries_[0].dictionaries_.length === 0) {
1455
- if(_1.dictionaries_.length === 1) {
1456
- const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
1457
- if(_guard1) {
1000
+ if(ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
1458
1001
  return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " >= ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
1459
- return
1460
- }
1461
- }
1462
- }
1463
- }
1464
- }
1465
- }
1466
1002
  }
1467
1003
  }
1468
- }
1469
- }
1470
- }
1471
- {
1472
- if(_1.ECall) {
1004
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Ordering.after" && _1.arguments_.length === 2 && _1.dictionaries_.length === 1 && _1.dictionaries_[0].dictionaries_.length === 0) {
1473
1005
  const at_ = _1.at_;
1474
- if(_1.target_.StaticCall) {
1475
- if(_1.target_.name_ === "ff:core/Ordering.after") {
1476
- if(_1.arguments_.length > 0) {
1477
1006
  const left_ = _1.arguments_[0];
1478
- if(_1.arguments_.length > 1) {
1479
1007
  const right_ = _1.arguments_[1];
1480
- if(_1.arguments_.length === 2) {
1481
- if(_1.dictionaries_.length > 0) {
1482
1008
  const typeName_ = _1.dictionaries_[0].typeName_;
1483
- if(_1.dictionaries_[0].dictionaries_.length === 0) {
1484
- if(_1.dictionaries_.length === 1) {
1485
- const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
1486
- if(_guard1) {
1009
+ if(ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
1487
1010
  return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " > ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
1488
- return
1489
- }
1490
- }
1491
- }
1492
1011
  }
1493
1012
  }
1494
- }
1495
- }
1496
- }
1497
- }
1498
- }
1499
- }
1500
- {
1501
- if(_1.ECall) {
1013
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Ordering.notAfter" && _1.arguments_.length === 2 && _1.dictionaries_.length === 1 && _1.dictionaries_[0].dictionaries_.length === 0) {
1502
1014
  const at_ = _1.at_;
1503
- if(_1.target_.StaticCall) {
1504
- if(_1.target_.name_ === "ff:core/Ordering.notAfter") {
1505
- if(_1.arguments_.length > 0) {
1506
1015
  const left_ = _1.arguments_[0];
1507
- if(_1.arguments_.length > 1) {
1508
1016
  const right_ = _1.arguments_[1];
1509
- if(_1.arguments_.length === 2) {
1510
- if(_1.dictionaries_.length > 0) {
1511
1017
  const typeName_ = _1.dictionaries_[0].typeName_;
1512
- if(_1.dictionaries_[0].dictionaries_.length === 0) {
1513
- if(_1.dictionaries_.length === 1) {
1514
- const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
1515
- if(_guard1) {
1018
+ if(ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
1516
1019
  return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " <= ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
1517
- return
1518
- }
1519
- }
1520
- }
1521
- }
1522
- }
1523
- }
1524
- }
1525
- }
1526
1020
  }
1527
1021
  }
1528
- }
1529
- {
1530
- if(_1.ECall) {
1531
- if(_1.target_.StaticCall) {
1532
- if(_1.target_.name_ === "ff:core/List.fillBy") {
1022
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.fillBy" && _1.arguments_.length === 2 && _1.arguments_[1].value_.ELambda && _1.arguments_[1].value_.lambda_.cases_.length === 1 && _1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 1 && _1.arguments_[1].value_.lambda_.cases_[0].patterns_[0].PVariable && _1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
1533
1023
  const effect_ = _1.effect_;
1534
- if(_1.arguments_.length > 0) {
1535
1024
  const size_ = _1.arguments_[0];
1536
- if(_1.arguments_.length > 1) {
1537
- if(_1.arguments_[1].value_.ELambda) {
1538
1025
  const at_ = _1.arguments_[1].value_.at_;
1539
1026
  const l_ = _1.arguments_[1].value_.lambda_;
1540
- if(_1.arguments_[1].value_.lambda_.cases_.length > 0) {
1541
1027
  const c_ = _1.arguments_[1].value_.lambda_.cases_[0];
1542
- if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length > 0) {
1543
- if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_[0].PVariable) {
1544
1028
  const name_ = _1.arguments_[1].value_.lambda_.cases_[0].patterns_[0].name_;
1545
- if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 1) {
1546
- if(_1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
1547
1029
  const body_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
1548
- if(_1.arguments_[1].value_.lambda_.cases_.length === 1) {
1549
- if(_1.arguments_.length === 2) {
1550
- const _guard1 = (!ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
1551
- if(_guard1) {
1030
+ if((!ff_compiler_JsEmitter.effectTypeIsAsync_(effect_))) {
1552
1031
  const n_ = ff_core_Option.Option_else(ff_core_Option.Option_map(name_, ((_w1) => {
1553
1032
  return ff_compiler_JsEmitter.escapeResolved_(_w1)
1554
1033
  })), (() => {
@@ -1559,28 +1038,11 @@ const await_ = (newAsync_
1559
1038
  ? "await "
1560
1039
  : "");
1561
1040
  return ((((((((((((((((((await_ + "((() => {\n") + "const size = ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, size_, async_)) + ";\n") + "const result = [];\n") + "for(let ") + n_) + " = 0; ") + n_) + " < size; ") + n_) + "++) {\n") + "result.push(") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, body_, newAsync_)) + ");\n") + "}\n") + "return result;\n") + "})())")
1562
- return
1563
- }
1564
- }
1565
- }
1566
- }
1567
- }
1568
- }
1569
- }
1570
- }
1571
- }
1572
- }
1573
- }
1574
- }
1575
- }
1576
1041
  }
1577
1042
  }
1578
- {
1579
- if(_1.ECall) {
1043
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.instanceCall_) {
1580
1044
  const at_ = _1.at_;
1581
- if(_1.target_.StaticCall) {
1582
1045
  const name_ = _1.target_.name_;
1583
- if(_1.target_.instanceCall_) {
1584
1046
  const effect_ = _1.effect_;
1585
1047
  const typeArguments_ = _1.typeArguments_;
1586
1048
  const arguments_ = _1.arguments_;
@@ -1611,13 +1073,8 @@ return call_
1611
1073
  }
1612
1074
  return
1613
1075
  }
1614
- }
1615
- }
1616
- }
1617
- {
1618
- if(_1.ECall) {
1076
+ if(_1.ECall && _1.target_.StaticCall) {
1619
1077
  const at_ = _1.at_;
1620
- if(_1.target_.StaticCall) {
1621
1078
  const name_ = _1.target_.name_;
1622
1079
  const effect_ = _1.effect_;
1623
1080
  const typeArguments_ = _1.typeArguments_;
@@ -1633,7 +1090,6 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.G
1633
1090
  };
1634
1091
  {
1635
1092
  const _1 = ff_compiler_JsEmitter.detectIfElse_(term_);
1636
- {
1637
1093
  if(_1.length === 0) {
1638
1094
  const await_ = (async_ && ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
1639
1095
  const ds_ = ff_core_List.List_map(dictionaries_, ((_w1) => {
@@ -1656,11 +1112,7 @@ return call_
1656
1112
  }
1657
1113
  return
1658
1114
  }
1659
- }
1660
- {
1661
- if(_1.length > 0) {
1662
- if(_1[0].first_.EVariant) {
1663
- if(_1[0].first_.name_ === "ff:core/Bool.True") {
1115
+ if(_1.length >= 1 && _1[0].first_.EVariant && _1[0].first_.name_ === "ff:core/Bool.True") {
1664
1116
  const elseBody_ = _1[0].second_;
1665
1117
  const list_ = _1.slice(1);
1666
1118
  return (("(" + ff_core_List.List_foldLeft(list_, ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, elseBody_, async_), ((_1, _2) => {
@@ -1669,14 +1121,10 @@ const otherwise_ = _1;
1669
1121
  const condition_ = _2.first_;
1670
1122
  const body_ = _2.second_;
1671
1123
  return ((((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, condition_, async_) + "\n? ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, body_, async_)) + "\n: ") + otherwise_)
1672
- return
1673
1124
  }
1674
1125
  }))) + ")")
1675
1126
  return
1676
1127
  }
1677
- }
1678
- }
1679
- }
1680
1128
  {
1681
1129
  const list_ = _1;
1682
1130
  return (("(" + ff_core_List.List_foldLeft(list_, "ff_core_Option.None()", ((_1, _2) => {
@@ -1685,7 +1133,6 @@ const otherwise_ = _1;
1685
1133
  const condition_ = _2.first_;
1686
1134
  const body_ = _2.second_;
1687
1135
  return ((((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, condition_, async_) + "\n? ff_core_Option.Some(") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, body_, async_)) + ")\n: ") + otherwise_)
1688
- return
1689
1136
  }
1690
1137
  }))) + ")")
1691
1138
  return
@@ -1693,12 +1140,8 @@ return
1693
1140
  }
1694
1141
  return
1695
1142
  }
1696
- }
1697
- }
1698
- {
1699
- if(_1.ECall) {
1143
+ if(_1.ECall && _1.target_.DynamicCall) {
1700
1144
  const at_ = _1.at_;
1701
- if(_1.target_.DynamicCall) {
1702
1145
  const function_ = _1.target_.function_;
1703
1146
  const effect_ = _1.effect_;
1704
1147
  const typeArguments_ = _1.typeArguments_;
@@ -1723,9 +1166,6 @@ return call_
1723
1166
  }
1724
1167
  return
1725
1168
  }
1726
- }
1727
- }
1728
- {
1729
1169
  if(_1.ERecord) {
1730
1170
  const at_ = _1.at_;
1731
1171
  const fields_ = _1.fields_;
@@ -1739,8 +1179,6 @@ return (("{\n" + ff_core_List.List_join(list_, ",\n")) + "\n}")
1739
1179
  }
1740
1180
  return
1741
1181
  }
1742
- }
1743
- {
1744
1182
  if(_1.EWildcard) {
1745
1183
  const at_ = _1.at_;
1746
1184
  const index_ = _1.index_;
@@ -1748,19 +1186,12 @@ if((index_ === 0)) {
1748
1186
  ff_compiler_JsEmitter.fail_(at_, "Unbound wildcard")
1749
1187
  };
1750
1188
  return ("_w" + index_)
1751
- return
1752
1189
  }
1753
- }
1754
- {
1755
- const _guard1 = async_;
1756
- if(_guard1) {
1190
+ if(async_) {
1757
1191
  return (("(await (async function() {\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, term_, true, async_)) + "\n})())")
1758
- return
1759
- }
1760
1192
  }
1761
1193
  {
1762
1194
  return (("(function() {\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, term_, true, async_)) + "\n})()")
1763
- return
1764
1195
  }
1765
1196
  }
1766
1197
  }
@@ -1782,7 +1213,6 @@ return ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, _w1)
1782
1213
  export function JsEmitter_emitStatements(self_, term_, last_, async_) {
1783
1214
  {
1784
1215
  const _1 = term_;
1785
- {
1786
1216
  if(_1.EFunctions) {
1787
1217
  const at_ = _1.at_;
1788
1218
  const functions_ = _1.functions_;
@@ -1792,10 +1222,7 @@ const newAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsy
1792
1222
  return ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_, f_, newAsync_, "")
1793
1223
  }));
1794
1224
  return ((ff_core_List.List_join(functionStrings_, "\n") + "\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, last_, async_))
1795
- return
1796
1225
  }
1797
- }
1798
- {
1799
1226
  if(_1.ELet) {
1800
1227
  const at_ = _1.at_;
1801
1228
  const mutable_ = _1.mutable_;
@@ -1804,64 +1231,32 @@ const valueType_ = _1.valueType_;
1804
1231
  const value_ = _1.value_;
1805
1232
  const body_ = _1.body_;
1806
1233
  return ((ff_compiler_JsEmitter.JsEmitter_emitLetDefinition(self_, ff_compiler_Syntax.DLet(at_, name_, valueType_, value_), mutable_, async_) + "\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, last_, async_))
1807
- return
1808
- }
1809
1234
  }
1810
- {
1811
- if(_1.EVariant) {
1235
+ if(_1.EVariant && _1.name_ === "ff:core/Unit.Unit") {
1812
1236
  const at_ = _1.at_;
1813
- if(_1.name_ === "ff:core/Unit.Unit") {
1814
1237
  return ""
1815
- return
1816
- }
1817
1238
  }
1818
- }
1819
- {
1820
- if(_1.ESequential) {
1821
- const at_ = _1.at_;
1822
- if(_1.before_.EVariant) {
1823
- const at_ = _1.before_.at_;
1824
- if(_1.before_.name_ === "ff:core/Unit.Unit") {
1239
+ if(_1.ESequential && _1.before_.EVariant && _1.before_.name_ === "ff:core/Unit.Unit") {
1825
1240
  const after_ = _1.after_;
1826
1241
  return ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, after_, last_, async_)
1827
- return
1828
- }
1829
1242
  }
1830
- }
1831
- }
1832
- {
1833
- if(_1.ESequential) {
1834
- const at_ = _1.at_;
1243
+ if(_1.ESequential && _1.after_.EVariant && _1.after_.name_ === "ff:core/Unit.Unit") {
1835
1244
  const before_ = _1.before_;
1836
- if(_1.after_.EVariant) {
1837
- const at_ = _1.after_.at_;
1838
- if(_1.after_.name_ === "ff:core/Unit.Unit") {
1839
1245
  return ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, before_, false, async_)
1840
- return
1841
- }
1842
- }
1843
1246
  }
1844
- }
1845
- {
1846
1247
  if(_1.ESequential) {
1847
1248
  const at_ = _1.at_;
1848
1249
  const before_ = _1.before_;
1849
1250
  const after_ = _1.after_;
1850
1251
  return ((ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, before_, false, async_) + ";\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, after_, last_, async_))
1851
- return
1852
- }
1853
1252
  }
1854
- {
1855
1253
  if(_1.EAssign) {
1856
1254
  const at_ = _1.at_;
1857
1255
  const operator_ = _1.operator_;
1858
1256
  const name_ = _1.variable_;
1859
1257
  const value_ = _1.value_;
1860
1258
  return ((((ff_compiler_JsEmitter.escapeKeyword_(name_) + " ") + operator_) + "= ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, value_, async_))
1861
- return
1862
1259
  }
1863
- }
1864
- {
1865
1260
  if(_1.EAssignField) {
1866
1261
  const at_ = _1.at_;
1867
1262
  const operator_ = _1.operator_;
@@ -1869,235 +1264,102 @@ const record_ = _1.record_;
1869
1264
  const field_ = _1.field_;
1870
1265
  const value_ = _1.value_;
1871
1266
  return ((((((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, record_, async_) + ".") + ff_compiler_JsEmitter.escapeKeyword_(field_)) + " ") + operator_) + "= ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, value_, async_))
1872
- return
1873
- }
1874
1267
  }
1875
- {
1876
- if(_1.ECall) {
1268
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Core.while" && _1.arguments_.length === 2) {
1877
1269
  const at_ = _1.at_;
1878
- if(_1.target_.StaticCall) {
1879
- if(_1.target_.name_ === "ff:core/Core.while") {
1880
- if(_1.arguments_.length > 0) {
1881
1270
  const condition_ = _1.arguments_[0];
1882
- if(_1.arguments_.length > 1) {
1883
1271
  const body_ = _1.arguments_[1];
1884
- if(_1.arguments_.length === 2) {
1885
1272
  return (((("while(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, ff_compiler_JsEmitter.invokeImmediately_(condition_.value_), async_)) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_), false, async_)) + "\n}")
1886
- return
1887
1273
  }
1888
- }
1889
- }
1890
- }
1891
- }
1892
- }
1893
- }
1894
- {
1895
- if(_1.ECall) {
1274
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Core.doWhile" && _1.arguments_.length === 1) {
1896
1275
  const at_ = _1.at_;
1897
- if(_1.target_.StaticCall) {
1898
- if(_1.target_.name_ === "ff:core/Core.doWhile") {
1899
- if(_1.arguments_.length > 0) {
1900
1276
  const doWhileBody_ = _1.arguments_[0].value_;
1901
- if(_1.arguments_.length === 1) {
1902
1277
  const _guard1 = ff_compiler_JsEmitter.invokeImmediately_(doWhileBody_);
1903
1278
  if(_guard1.ESequential) {
1904
1279
  const body_ = _guard1.before_;
1905
1280
  const condition_ = _guard1.after_;
1906
1281
  return ((((("while(true) {\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, false, async_)) + "\nif(!") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, condition_, async_)) + ") break") + "\n}")
1907
- return
1908
1282
  }
1909
1283
  }
1910
- }
1911
- }
1912
- }
1913
- }
1914
- }
1915
- {
1916
- if(_1.ECall) {
1284
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Core.doWhile" && _1.arguments_.length === 1) {
1917
1285
  const at_ = _1.at_;
1918
- if(_1.target_.StaticCall) {
1919
- if(_1.target_.name_ === "ff:core/Core.doWhile") {
1920
- if(_1.arguments_.length > 0) {
1921
1286
  const doWhileBody_ = _1.arguments_[0].value_;
1922
- if(_1.arguments_.length === 1) {
1923
1287
  const _guard1 = ff_compiler_JsEmitter.invokeImmediately_(doWhileBody_);
1288
+ {
1924
1289
  const body_ = _guard1;
1925
1290
  return (("while(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, body_, async_)) + ") {}")
1926
- return
1927
1291
  }
1928
1292
  }
1929
- }
1930
- }
1931
- }
1932
- }
1933
- {
1934
- if(_1.ECall) {
1293
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Core.if" && _1.arguments_.length === 2) {
1935
1294
  const at_ = _1.at_;
1936
- if(_1.target_.StaticCall) {
1937
- if(_1.target_.name_ === "ff:core/Core.if") {
1938
- if(_1.arguments_.length > 0) {
1939
1295
  const condition_ = _1.arguments_[0];
1940
- if(_1.arguments_.length > 1) {
1941
1296
  const body_ = _1.arguments_[1];
1942
- if(_1.arguments_.length === 2) {
1943
1297
  return ((("if(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, condition_.value_, async_)) + ") {\n") + (last_
1944
1298
  ? (("return ff_core_Option.Some(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_), async_)) + ")\n} else return ff_core_Option.None()")
1945
1299
  : (ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_), false, async_) + "\n}")))
1946
1300
  return
1947
1301
  }
1948
- }
1949
- }
1950
- }
1951
- }
1952
- }
1953
- }
1954
- {
1955
- if(_1.ECall) {
1302
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Core.throw" && _1.arguments_.length === 1 && _1.dictionaries_.length === 1) {
1956
1303
  const at_ = _1.at_;
1957
- if(_1.target_.StaticCall) {
1958
- if(_1.target_.name_ === "ff:core/Core.throw") {
1959
- if(_1.arguments_.length > 0) {
1960
1304
  const argument_ = _1.arguments_[0];
1961
- if(_1.arguments_.length === 1) {
1962
- if(_1.dictionaries_.length > 0) {
1963
1305
  const dictionary_ = _1.dictionaries_[0];
1964
- if(_1.dictionaries_.length === 1) {
1965
1306
  const d_ = ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, dictionary_);
1966
1307
  const a_ = ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, argument_, async_);
1967
1308
  return (((("throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(" + a_) + ", ") + d_) + ")})")
1968
- return
1969
- }
1970
1309
  }
1310
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Core.try") {
1311
+ const at_ = _1.at_;
1312
+ if((!last_)) {
1313
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a try without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1971
1314
  }
1972
1315
  }
1316
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_map") {
1317
+ const at_ = _1.at_;
1318
+ if((!last_)) {
1319
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a map without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1973
1320
  }
1974
1321
  }
1322
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_flatMap") {
1323
+ const at_ = _1.at_;
1324
+ if((!last_)) {
1325
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a flatMap without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1975
1326
  }
1976
1327
  }
1977
- {
1978
- if(_1.ECall) {
1328
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_flatten") {
1979
1329
  const at_ = _1.at_;
1980
- if(_1.target_.StaticCall) {
1981
- if(_1.target_.name_ === "ff:core/Core.try") {
1982
- const _guard1 = (!last_);
1983
- if(_guard1) {
1984
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a try without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1985
- return
1986
- }
1330
+ if((!last_)) {
1331
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a flatten without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1987
1332
  }
1988
1333
  }
1334
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_catch") {
1335
+ const at_ = _1.at_;
1336
+ if((!last_)) {
1337
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a catch without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1989
1338
  }
1990
1339
  }
1991
- {
1992
- if(_1.ECall) {
1340
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_catchAny") {
1993
1341
  const at_ = _1.at_;
1994
- if(_1.target_.StaticCall) {
1995
- if(_1.target_.name_ === "ff:core/Try.Try_map") {
1996
- const _guard1 = (!last_);
1997
- if(_guard1) {
1998
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a map without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1999
- return
2000
- }
1342
+ if((!last_)) {
1343
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a catchAny without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2001
1344
  }
2002
1345
  }
2003
- }
2004
- }
2005
- {
2006
- if(_1.ECall) {
2007
- const at_ = _1.at_;
2008
- if(_1.target_.StaticCall) {
2009
- if(_1.target_.name_ === "ff:core/Try.Try_flatMap") {
2010
- const _guard1 = (!last_);
2011
- if(_guard1) {
2012
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a flatMap without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2013
- return
2014
- }
2015
- }
2016
- }
2017
- }
2018
- }
2019
- {
2020
- if(_1.ECall) {
2021
- const at_ = _1.at_;
2022
- if(_1.target_.StaticCall) {
2023
- if(_1.target_.name_ === "ff:core/Try.Try_flatten") {
2024
- const _guard1 = (!last_);
2025
- if(_guard1) {
2026
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a flatten without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2027
- return
2028
- }
2029
- }
2030
- }
2031
- }
2032
- }
2033
- {
2034
- if(_1.ECall) {
2035
- const at_ = _1.at_;
2036
- if(_1.target_.StaticCall) {
2037
- if(_1.target_.name_ === "ff:core/Try.Try_catch") {
2038
- const _guard1 = (!last_);
2039
- if(_guard1) {
2040
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a catch without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2041
- return
2042
- }
2043
- }
2044
- }
2045
- }
2046
- }
2047
- {
2048
- if(_1.ECall) {
2049
- const at_ = _1.at_;
2050
- if(_1.target_.StaticCall) {
2051
- if(_1.target_.name_ === "ff:core/Try.Try_catchAny") {
2052
- const _guard1 = (!last_);
2053
- if(_guard1) {
2054
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a catchAny without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2055
- return
2056
- }
2057
- }
2058
- }
2059
- }
2060
- }
2061
- {
2062
- if(_1.ECall) {
1346
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_finally") {
2063
1347
  const at_ = _1.at_;
2064
- if(_1.target_.StaticCall) {
2065
- if(_1.target_.name_ === "ff:core/Try.Try_finally") {
2066
- const _guard1 = (!last_);
2067
- if(_guard1) {
1348
+ if((!last_)) {
2068
1349
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a finally without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2069
- return
2070
1350
  }
2071
1351
  }
2072
- }
2073
- }
2074
- }
2075
- {
2076
- if(_1.ECall) {
1352
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_grab" && _1.arguments_.length === 1) {
2077
1353
  const at_ = _1.at_;
2078
- if(_1.target_.StaticCall) {
2079
- if(_1.target_.name_ === "ff:core/Try.Try_grab") {
2080
- if(_1.arguments_.length > 0) {
2081
1354
  const argument_ = _1.arguments_[0];
2082
- if(_1.arguments_.length === 1) {
2083
1355
  const _guard1 = ff_compiler_JsEmitter.JsEmitter_emitTryCatchFinally(self_, argument_.value_, last_, async_);
2084
1356
  if(_guard1.Some) {
2085
1357
  const code_ = _guard1.value_;
2086
1358
  return code_
2087
- return
2088
- }
2089
- }
2090
- }
2091
1359
  }
2092
1360
  }
2093
- }
2094
- }
2095
- {
2096
- if(_1.ECall) {
1361
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:unsafejs/UnsafeJs.throwIfCancelled" && _1.arguments_.length === 0) {
2097
1362
  const at_ = _1.at_;
2098
- if(_1.target_.StaticCall) {
2099
- if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.throwIfCancelled") {
2100
- if(_1.arguments_.length === 0) {
2101
1363
  if(async_) {
2102
1364
  return "ff_core_Task.Task_throwIfAborted($task)"
2103
1365
  } else {
@@ -2105,16 +1367,9 @@ return ""
2105
1367
  }
2106
1368
  return
2107
1369
  }
2108
- }
2109
- }
2110
- }
2111
- }
2112
- {
2113
- if(_1.ECall) {
1370
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.tailCall_) {
2114
1371
  const at_ = _1.at_;
2115
- if(_1.target_.StaticCall) {
2116
1372
  const name_ = _1.target_.name_;
2117
- if(_1.target_.tailCall_) {
2118
1373
  const instanceCall_ = _1.target_.instanceCall_;
2119
1374
  const effect_ = _1.effect_;
2120
1375
  const arguments_ = _1.arguments_;
@@ -2128,33 +1383,24 @@ return ff_core_Option.Some(ff_core_Pair.Pair((((("const " + ff_compiler_JsEmitte
2128
1383
  return _w1
2129
1384
  })));
2130
1385
  return (((("{\n" + ff_core_List.List_join(pair_.first_, "\n")) + "\n") + ff_core_List.List_join(pair_.second_, "\n")) + "\ncontinue _tailcall\n}")
2131
- return
2132
- }
2133
- }
2134
- }
2135
1386
  }
2136
- {
2137
- if(_1.EPipe) {
1387
+ if(_1.EPipe && _1.function_.ELambda) {
2138
1388
  const at_ = _1.at_;
2139
1389
  const value_ = _1.value_;
2140
- if(_1.function_.ELambda) {
2141
1390
  const cases_ = _1.function_.lambda_.cases_;
2142
1391
  ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
2143
1392
  return ((((((((!last_)
2144
1393
  ? "do "
2145
1394
  : "") + "{\nconst _1 = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, value_, async_)) + ";\n") + ff_core_List.List_join(ff_core_List.List_map(cases_, ((_w1) => {
2146
- return (("{\n" + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, ["_1"], _w1, true, last_, async_)) + "\n}")
1395
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, ["_1"], _w1, [], [], true, last_, async_)
2147
1396
  })), "\n")) + "\n}") + ((!last_)
2148
1397
  ? " while(false)"
2149
1398
  : ""))
2150
1399
  return
2151
1400
  }
2152
- }
2153
- }
2154
1401
  {
2155
1402
  {
2156
1403
  const _1 = ff_compiler_JsEmitter.detectIfElse_(term_);
2157
- {
2158
1404
  if(_1.length === 0) {
2159
1405
  if(last_) {
2160
1406
  return ("return " + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, term_, async_))
@@ -2163,11 +1409,7 @@ return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, term_, async_)
2163
1409
  }
2164
1410
  return
2165
1411
  }
2166
- }
2167
- {
2168
- if(_1.length > 0) {
2169
- if(_1[0].first_.EVariant) {
2170
- if(_1[0].first_.name_ === "ff:core/Bool.True") {
1412
+ if(_1.length >= 1 && _1[0].first_.EVariant && _1[0].first_.name_ === "ff:core/Bool.True") {
2171
1413
  const elseBody_ = _1[0].second_;
2172
1414
  const list_ = _1.slice(1);
2173
1415
  const initial_ = (("{\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, elseBody_, last_, async_)) + "\n}");
@@ -2177,25 +1419,19 @@ const otherwise_ = _1;
2177
1419
  const condition_ = _2.first_;
2178
1420
  const body_ = _2.second_;
2179
1421
  return ((((("if(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, condition_, async_)) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, last_, async_)) + "\n} else ") + otherwise_)
2180
- return
2181
1422
  }
2182
1423
  }))
2183
1424
  return
2184
1425
  }
2185
- }
2186
- }
2187
- }
2188
1426
  {
2189
1427
  const list_ = _1;
2190
- const _guard1 = (!last_);
2191
- if(_guard1) {
1428
+ if((!last_)) {
2192
1429
  return ff_core_List.List_foldLeft(list_, "{}", ((_1, _2) => {
2193
1430
  {
2194
1431
  const otherwise_ = _1;
2195
1432
  const condition_ = _2.first_;
2196
1433
  const body_ = _2.second_;
2197
1434
  return ((((("if(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, condition_, async_)) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, last_, async_)) + "\n} else ") + otherwise_)
2198
- return
2199
1435
  }
2200
1436
  }))
2201
1437
  return
@@ -2209,7 +1445,6 @@ const otherwise_ = _1;
2209
1445
  const condition_ = _2.first_;
2210
1446
  const body_ = _2.second_;
2211
1447
  return (((((("if(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, condition_, async_)) + ") {\n") + "return ff_core_Option.Some(") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, body_, async_)) + ")\n} else ") + otherwise_)
2212
- return
2213
1448
  }
2214
1449
  }))
2215
1450
  return
@@ -2227,19 +1462,14 @@ ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
2227
1462
  const arguments_ = ["_exception.value_", "_error"];
2228
1463
  {
2229
1464
  const _1 = cases_;
2230
- {
2231
- if(_1.length > 0) {
2232
- const case_ = _1[0];
2233
1465
  if(_1.length === 1) {
2234
- return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, case_, false, last_, catchAsync_)
2235
- return
2236
- }
2237
- }
1466
+ const case_ = _1[0];
1467
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, case_, [], [], false, last_, catchAsync_)
2238
1468
  }
2239
1469
  {
2240
1470
  const cs_ = _1;
2241
1471
  const caseStrings_ = ff_core_List.List_map(cases_, ((_w1) => {
2242
- return (("{\n" + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, _w1, true, last_, catchAsync_)) + "\n}")
1472
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, _w1, [], [], true, last_, catchAsync_)
2243
1473
  }));
2244
1474
  if(last_) {
2245
1475
  return ff_core_List.List_join(caseStrings_, "\n")
@@ -2252,344 +1482,181 @@ return
2252
1482
  }
2253
1483
  {
2254
1484
  const _1 = term_;
2255
- {
2256
- if(_1.ECall) {
2257
- const at_ = _1.at_;
2258
- if(_1.target_.StaticCall) {
2259
- if(_1.target_.name_ === "ff:core/Try.Try_finally") {
2260
- if(_1.arguments_.length > 0) {
2261
- if(_1.arguments_[0].value_.ECall) {
2262
- const at_ = _1.arguments_[0].value_.at_;
2263
- if(_1.arguments_[0].value_.target_.StaticCall) {
2264
- if(_1.arguments_[0].value_.target_.name_ === "ff:core/Core.try") {
2265
- if(_1.arguments_[0].value_.arguments_.length > 0) {
2266
- if(_1.arguments_[0].value_.arguments_[0].value_.ELambda) {
1485
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_finally" && _1.arguments_.length === 2 && _1.arguments_[0].value_.ECall && _1.arguments_[0].value_.target_.StaticCall && _1.arguments_[0].value_.target_.name_ === "ff:core/Core.try" && _1.arguments_[0].value_.arguments_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.ELambda && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0 && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0 && _1.arguments_[1].value_.ELambda && _1.arguments_[1].value_.lambda_.cases_.length === 1 && _1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 0 && _1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
2267
1486
  const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
2268
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length > 0) {
2269
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0) {
2270
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0) {
2271
1487
  const tryBody_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].body_;
2272
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1) {
2273
- if(_1.arguments_[0].value_.arguments_.length === 1) {
2274
- if(_1.arguments_.length > 1) {
2275
- if(_1.arguments_[1].value_.ELambda) {
2276
1488
  const finallyEffect_ = _1.arguments_[1].value_.lambda_.effect_;
2277
- if(_1.arguments_[1].value_.lambda_.cases_.length > 0) {
2278
- if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 0) {
2279
- if(_1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
2280
1489
  const finallyBody_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
2281
- if(_1.arguments_[1].value_.lambda_.cases_.length === 1) {
2282
- if(_1.arguments_.length === 2) {
2283
1490
  const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
2284
1491
  const finallyAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(finallyEffect_));
2285
1492
  return ff_core_Option.Some((((("try {\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, tryBody_, last_, tryAsync_)) + "\n} finally {\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, finallyBody_, last_, finallyAsync_)) + "\n}"))
2286
- return
2287
- }
2288
- }
2289
- }
2290
- }
2291
- }
2292
- }
2293
- }
2294
- }
2295
- }
2296
- }
2297
- }
2298
- }
2299
- }
2300
- }
2301
1493
  }
2302
- }
2303
- }
2304
- }
2305
- }
2306
- }
2307
- }
2308
- }
2309
- {
2310
- if(_1.ECall) {
2311
- const at_ = _1.at_;
2312
- if(_1.target_.StaticCall) {
2313
- if(_1.target_.name_ === "ff:core/Try.Try_catch") {
2314
- if(_1.arguments_.length > 0) {
2315
- if(_1.arguments_[0].value_.ECall) {
2316
- const at_ = _1.arguments_[0].value_.at_;
2317
- if(_1.arguments_[0].value_.target_.StaticCall) {
2318
- if(_1.arguments_[0].value_.target_.name_ === "ff:core/Core.try") {
2319
- if(_1.arguments_[0].value_.arguments_.length > 0) {
2320
- if(_1.arguments_[0].value_.arguments_[0].value_.ELambda) {
1494
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_catch" && _1.arguments_.length === 2 && _1.arguments_[0].value_.ECall && _1.arguments_[0].value_.target_.StaticCall && _1.arguments_[0].value_.target_.name_ === "ff:core/Core.try" && _1.arguments_[0].value_.arguments_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.ELambda && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0 && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0 && _1.arguments_[1].value_.ELambda && _1.dictionaries_.length === 1) {
2321
1495
  const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
2322
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length > 0) {
2323
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0) {
2324
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0) {
2325
1496
  const tryBody_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].body_;
2326
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1) {
2327
- if(_1.arguments_[0].value_.arguments_.length === 1) {
2328
- if(_1.arguments_.length > 1) {
2329
- if(_1.arguments_[1].value_.ELambda) {
2330
1497
  const catchEffect_ = _1.arguments_[1].value_.lambda_.effect_;
2331
1498
  const cases_ = _1.arguments_[1].value_.lambda_.cases_;
2332
- if(_1.arguments_.length === 2) {
2333
- if(_1.dictionaries_.length > 0) {
2334
1499
  const dictionary_ = _1.dictionaries_[0];
2335
- if(_1.dictionaries_.length === 1) {
2336
1500
  const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
2337
1501
  const d_ = ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, dictionary_);
2338
1502
  return ff_core_Option.Some(((((((((("try {\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, tryBody_, last_, tryAsync_)) + "\n} catch(_error) {\n") + "if(!_error.ffException) throw _error\n") + "const _exception = ff_core_Any.fromAny_(_error.ffException, ") + d_) + ")\n") + "if(!_exception.Some) throw _error\n") + emitCatch_(catchEffect_, cases_)) + "\n}"))
2339
- return
2340
- }
2341
- }
2342
- }
2343
- }
2344
- }
2345
- }
2346
1503
  }
2347
- }
2348
- }
2349
- }
2350
- }
2351
- }
2352
- }
2353
- }
2354
- }
2355
- }
2356
- }
2357
- }
2358
- }
2359
- }
2360
- {
2361
- if(_1.ECall) {
2362
- const at_ = _1.at_;
2363
- if(_1.target_.StaticCall) {
2364
- if(_1.target_.name_ === "ff:core/Try.Try_finally") {
2365
- if(_1.arguments_.length > 0) {
2366
- if(_1.arguments_[0].value_.ECall) {
2367
- const at_ = _1.arguments_[0].value_.at_;
2368
- if(_1.arguments_[0].value_.target_.StaticCall) {
2369
- if(_1.arguments_[0].value_.target_.name_ === "ff:core/Try.Try_catch") {
2370
- if(_1.arguments_[0].value_.arguments_.length > 0) {
2371
- if(_1.arguments_[0].value_.arguments_[0].value_.ECall) {
2372
- const at_ = _1.arguments_[0].value_.arguments_[0].value_.at_;
2373
- if(_1.arguments_[0].value_.arguments_[0].value_.target_.StaticCall) {
2374
- if(_1.arguments_[0].value_.arguments_[0].value_.target_.name_ === "ff:core/Core.try") {
2375
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_.length > 0) {
2376
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.ELambda) {
1504
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_finally" && _1.arguments_.length === 2 && _1.arguments_[0].value_.ECall && _1.arguments_[0].value_.target_.StaticCall && _1.arguments_[0].value_.target_.name_ === "ff:core/Try.Try_catch" && _1.arguments_[0].value_.arguments_.length === 2 && _1.arguments_[0].value_.arguments_[0].value_.ECall && _1.arguments_[0].value_.arguments_[0].value_.target_.StaticCall && _1.arguments_[0].value_.arguments_[0].value_.target_.name_ === "ff:core/Core.try" && _1.arguments_[0].value_.arguments_[0].value_.arguments_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.ELambda && _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0 && _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0 && _1.arguments_[0].value_.arguments_[1].value_.ELambda && _1.arguments_[0].value_.dictionaries_.length === 1 && _1.arguments_[1].value_.ELambda && _1.arguments_[1].value_.lambda_.cases_.length === 1 && _1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 0 && _1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
2377
1505
  const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
2378
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length > 0) {
2379
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0) {
2380
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0) {
2381
1506
  const tryBody_ = _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].body_;
2382
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1) {
2383
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_.length === 1) {
2384
- if(_1.arguments_[0].value_.arguments_.length > 1) {
2385
- if(_1.arguments_[0].value_.arguments_[1].value_.ELambda) {
2386
1507
  const catchEffect_ = _1.arguments_[0].value_.arguments_[1].value_.lambda_.effect_;
2387
1508
  const cases_ = _1.arguments_[0].value_.arguments_[1].value_.lambda_.cases_;
2388
- if(_1.arguments_[0].value_.arguments_.length === 2) {
2389
- if(_1.arguments_[0].value_.dictionaries_.length > 0) {
2390
1509
  const dictionary_ = _1.arguments_[0].value_.dictionaries_[0];
2391
- if(_1.arguments_[0].value_.dictionaries_.length === 1) {
2392
- if(_1.arguments_.length > 1) {
2393
- if(_1.arguments_[1].value_.ELambda) {
2394
1510
  const finallyEffect_ = _1.arguments_[1].value_.lambda_.effect_;
2395
- if(_1.arguments_[1].value_.lambda_.cases_.length > 0) {
2396
- if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 0) {
2397
- if(_1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
2398
1511
  const finallyBody_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
2399
- if(_1.arguments_[1].value_.lambda_.cases_.length === 1) {
2400
- if(_1.arguments_.length === 2) {
2401
1512
  const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
2402
1513
  const finallyAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(finallyEffect_));
2403
1514
  const d_ = ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, dictionary_);
2404
1515
  return ff_core_Option.Some(((((((((((("try {\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, tryBody_, last_, tryAsync_)) + "\n} catch(_error) {\n") + "if(!_error.ffException) throw _error\n") + "const _exception = ff_core_Any.fromAny_(_error.ffException, ") + d_) + ")\n") + "if(!_exception.Some) throw _error\n") + emitCatch_(catchEffect_, cases_)) + "\n} finally {\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, finallyBody_, last_, finallyAsync_)) + "\n}"))
2405
- return
2406
- }
2407
- }
2408
- }
2409
- }
2410
- }
2411
- }
2412
- }
2413
- }
2414
- }
2415
- }
2416
- }
2417
- }
2418
- }
2419
- }
2420
- }
2421
- }
2422
- }
2423
- }
2424
- }
2425
- }
2426
- }
2427
- }
2428
- }
2429
- }
2430
- }
2431
- }
2432
- }
2433
- }
2434
- }
2435
- }
2436
1516
  }
2437
1517
  {
2438
1518
  return ff_core_Option.None()
2439
- return
2440
1519
  }
2441
1520
  }
2442
1521
  }
2443
1522
 
2444
- export function JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_) {
1523
+ export function JsEmitter_emitCase(self_, arguments_, matchCase_, conditions_, variables_, jump_, last_, async_) {
1524
+ function emitWrapper_(code_) {
1525
+ return ((((ff_core_List.List_isEmpty(conditions_)
1526
+ ? "{\n"
1527
+ : (("if(" + ff_core_List.List_join(conditions_, " && ")) + ") {\n")) + ff_core_List.List_join(variables_, "")) + code_) + "\n}")
1528
+ }
2445
1529
  {
2446
1530
  const _1 = ff_core_Pair.Pair(matchCase_.patterns_, matchCase_.guards_);
2447
- {
2448
- if(_1.first_.length > 0) {
1531
+ if(_1.first_.length >= 1) {
2449
1532
  const p_ = _1.first_[0];
2450
1533
  const ps_ = _1.first_.slice(1);
2451
1534
  return ff_compiler_JsEmitter.JsEmitter_emitPattern(self_, ff_core_List.List_grab(arguments_, 0), p_, ff_core_List.List_dropFirst(arguments_, 1), (((_c) => {
2452
1535
  return ff_compiler_Syntax.MatchCase(_c.at_, ps_, _c.guards_, _c.body_)
2453
- }))(matchCase_), jump_, last_, async_)
1536
+ }))(matchCase_), conditions_, variables_, jump_, last_, async_)
2454
1537
  return
2455
1538
  }
1539
+ if(_1.first_.length === 0 && _1.second_.length === 1 && _1.second_[0].pattern_.PVariant && _1.second_[0].pattern_.name_ === "ff:core/Bool.True") {
1540
+ const e_ = _1.second_[0].term_;
1541
+ if(ff_core_List.List_isEmpty(variables_)) {
1542
+ const newCase_ = (((_c) => {
1543
+ return ff_compiler_Syntax.MatchCase(_c.at_, [], [], _c.body_)
1544
+ }))(matchCase_);
1545
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, [], newCase_, [...conditions_, ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_)], [], jump_, last_, async_)
1546
+ }
2456
1547
  }
2457
- {
2458
- if(_1.first_.length === 0) {
2459
- if(_1.second_.length > 0) {
1548
+ if(_1.first_.length === 0 && _1.second_.length === 1 && _1.second_[0].pattern_.PVariant && _1.second_[0].pattern_.name_ === "ff:core/Bool.True") {
1549
+ const e_ = _1.second_[0].term_;
1550
+ const newCase_ = (((_c) => {
1551
+ return ff_compiler_Syntax.MatchCase(_c.at_, [], [], _c.body_)
1552
+ }))(matchCase_);
1553
+ const code_ = ff_compiler_JsEmitter.JsEmitter_emitCase(self_, [], newCase_, [ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_)], [], jump_, last_, async_);
1554
+ return emitWrapper_(code_)
1555
+ }
1556
+ if(_1.first_.length === 0 && _1.second_.length >= 1) {
2460
1557
  const guard_ = _1.second_[0];
2461
1558
  const guards_ = _1.second_.slice(1);
2462
1559
  const guardName_ = ("_guard" + (ff_core_List.List_size(guards_) + 1));
2463
1560
  const newCase_ = (((_c) => {
2464
1561
  return ff_compiler_Syntax.MatchCase(_c.at_, [guard_.pattern_], guards_, _c.body_)
2465
1562
  }))(matchCase_);
2466
- return ((((("const " + guardName_) + " = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, guard_.term_, async_)) + ";\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, [guardName_], newCase_, jump_, last_, async_))
2467
- return
2468
- }
2469
- }
1563
+ const code_ = ((((("const " + guardName_) + " = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, guard_.term_, async_)) + ";\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, [guardName_], newCase_, [], [], jump_, last_, async_));
1564
+ return emitWrapper_(code_)
2470
1565
  }
2471
- {
2472
- if(_1.first_.length === 0) {
2473
- if(_1.second_.length === 0) {
2474
- return (ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, matchCase_.body_, last_, async_) + ((jump_ && last_)
1566
+ if(_1.first_.length === 0 && _1.second_.length === 0) {
1567
+ const statementsCode_ = ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, matchCase_.body_, last_, async_);
1568
+ const lastLine_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(statementsCode_), ((_w1) => {
1569
+ return (_w1 !== 10)
1570
+ })));
1571
+ const returns_ = ((((((ff_core_String.String_startsWith(lastLine_, "return ", 0) || ff_core_String.String_startsWith(lastLine_, "break ", 0)) || ff_core_String.String_startsWith(lastLine_, "continue ", 0)) || ff_core_String.String_startsWith(lastLine_, "return;", 0)) || ff_core_String.String_startsWith(lastLine_, "break;", 0)) || ff_core_String.String_startsWith(lastLine_, "continue;", 0)) || ff_core_String.String_startsWith(lastLine_, "throw ", 0));
1572
+ const code_ = (statementsCode_ + (((jump_ && last_) && (!returns_))
2475
1573
  ? "\nreturn"
2476
- : jump_
1574
+ : (jump_ && (!returns_))
2477
1575
  ? "\nbreak"
2478
- : ""))
2479
- return
2480
- }
2481
- }
1576
+ : ""));
1577
+ return emitWrapper_(code_)
2482
1578
  }
2483
1579
  }
2484
1580
  }
2485
1581
 
2486
- export function JsEmitter_emitPattern(self_, argument_, pattern_, arguments_, matchCase_, jump_, last_, async_) {
1582
+ export function JsEmitter_emitPattern(self_, argument_, pattern_, arguments_, matchCase_, conditions_, variables_, jump_, last_, async_) {
2487
1583
  {
2488
1584
  const _1 = pattern_;
2489
- {
2490
1585
  if(_1.PString) {
2491
1586
  const value_ = _1.value_;
2492
- return (((((("if(" + argument_) + " === ") + value_) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)) + "\n}")
2493
- return
2494
- }
1587
+ const newConditions_ = [...conditions_, ((argument_ + " === ") + value_)];
1588
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, newConditions_, variables_, jump_, last_, async_)
2495
1589
  }
2496
- {
2497
1590
  if(_1.PInt) {
2498
1591
  const value_ = _1.value_;
2499
- return (((((("if(" + argument_) + " === ") + value_) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)) + "\n}")
2500
- return
1592
+ const newConditions_ = [...conditions_, ((argument_ + " === ") + value_)];
1593
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, newConditions_, variables_, jump_, last_, async_)
2501
1594
  }
2502
- }
2503
- {
2504
1595
  if(_1.PChar) {
2505
1596
  const value_ = _1.value_;
2506
- return (((((("if(" + argument_) + " === ") + ff_compiler_JsEmitter.charLiteralToNumber_(value_)) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)) + "\n}")
2507
- return
2508
- }
2509
- }
2510
- {
2511
- if(_1.PVariable) {
2512
- if(_1.name_.None) {
2513
- return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)
2514
- return
1597
+ const newConditions_ = [...conditions_, ((argument_ + " === ") + ff_compiler_JsEmitter.charLiteralToNumber_(value_))];
1598
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, newConditions_, variables_, jump_, last_, async_)
2515
1599
  }
1600
+ if(_1.PVariable && _1.name_.None) {
1601
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, conditions_, variables_, jump_, last_, async_)
2516
1602
  }
2517
- }
2518
- {
2519
- if(_1.PVariable) {
2520
- if(_1.name_.Some) {
1603
+ if(_1.PVariable && _1.name_.Some) {
2521
1604
  const name_ = _1.name_.value_;
2522
1605
  const escaped_ = ff_compiler_JsEmitter.escapeKeyword_(name_);
2523
- return (((escaped_ !== argument_)
2524
- ? (((("const " + escaped_) + " = ") + argument_) + ";\n")
2525
- : "") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_))
2526
- return
1606
+ const newVariables_ = ((escaped_ !== argument_)
1607
+ ? [...variables_, (((("const " + escaped_) + " = ") + argument_) + ";\n")]
1608
+ : variables_);
1609
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, conditions_, newVariables_, jump_, last_, async_)
2527
1610
  }
1611
+ if(_1.PVariant && _1.name_ === "ff:core/Bool.False" && _1.patterns_.length === 0) {
1612
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, [...conditions_, ("!" + argument_)], variables_, jump_, last_, async_)
2528
1613
  }
1614
+ if(_1.PVariant && _1.name_ === "ff:core/Bool.True" && _1.patterns_.length === 0) {
1615
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, [...conditions_, argument_], variables_, jump_, last_, async_)
2529
1616
  }
2530
- {
2531
1617
  if(_1.PVariant) {
2532
- if(_1.name_ === "ff:core/Bool.False") {
2533
- if(_1.patterns_.length === 0) {
2534
- return (((("if(!" + argument_) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)) + "\n}")
2535
- return
2536
- }
2537
- }
1618
+ const emptyOrLink_ = _1.name_;
1619
+ if(((emptyOrLink_ === "List$Empty") || (emptyOrLink_ === "List$Link"))) {
1620
+ let restPattern_ = ff_core_Option.None();
1621
+ function listPatterns_(matchPattern_) {
1622
+ const matchPattern_a = matchPattern_;
1623
+ if(matchPattern_a.PVariant && matchPattern_a.name_ === "List$Empty" && matchPattern_a.patterns_.length === 0) {
1624
+ return []
2538
1625
  }
1626
+ if(matchPattern_a.PVariant && matchPattern_a.name_ === "List$Link" && matchPattern_a.patterns_.length === 2) {
1627
+ const head_ = matchPattern_a.patterns_[0];
1628
+ const tail_ = matchPattern_a.patterns_[1];
1629
+ return [head_, ...listPatterns_(tail_)]
2539
1630
  }
2540
1631
  {
2541
- if(_1.PVariant) {
2542
- if(_1.name_ === "ff:core/Bool.True") {
2543
- if(_1.patterns_.length === 0) {
2544
- return (((("if(" + argument_) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)) + "\n}")
2545
- return
2546
- }
2547
- }
1632
+ const p_ = matchPattern_a;
1633
+ restPattern_ = ff_core_Option.Some(p_);
1634
+ return []
2548
1635
  }
2549
1636
  }
1637
+ const patterns_ = listPatterns_(pattern_);
1638
+ const itemArguments_ = ff_core_List.List_map(ff_core_List.List_pairs(patterns_), ((_1) => {
2550
1639
  {
2551
- if(_1.PVariant) {
2552
- if(_1.name_ === "List$Empty") {
2553
- if(_1.patterns_.length === 0) {
2554
- let shortArgument_ = argument_;
2555
- let shortCount_ = 0;
2556
- while(ff_core_String.String_endsWith(shortArgument_, ".slice(1)")) {
2557
- shortArgument_ = ff_core_String.String_dropLast(shortArgument_, ff_core_String.String_size(".slice(1)"));
2558
- shortCount_ += 1
2559
- };
2560
- return (((((("if(" + shortArgument_) + ".length === ") + shortCount_) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)) + "\n}")
2561
- return
2562
- }
2563
- }
2564
- }
1640
+ const i_ = _1.first_;
1641
+ return (((argument_ + "[") + i_) + "]")
2565
1642
  }
2566
- {
2567
- if(_1.PVariant) {
2568
- if(_1.name_ === "List$Link") {
2569
- if(_1.patterns_.length > 0) {
2570
- const head_ = _1.patterns_[0];
2571
- if(_1.patterns_.length > 1) {
2572
- const tail_ = _1.patterns_[1];
2573
- if(_1.patterns_.length === 2) {
2574
- let shortArgument_ = argument_;
2575
- let shortCount_ = 0;
2576
- while(ff_core_String.String_endsWith(shortArgument_, ".slice(1)")) {
2577
- shortArgument_ = ff_core_String.String_dropLast(shortArgument_, ff_core_String.String_size(".slice(1)"));
2578
- shortCount_ += 1
2579
- };
2580
- const newArguments_ = [(((shortArgument_ + "[") + shortCount_) + "]"), (argument_ + ".slice(1)"), ...arguments_];
1643
+ }));
1644
+ const restArgument_ = ff_core_Option.Option_map(restPattern_, ((_) => {
1645
+ return (((argument_ + ".slice(") + ff_core_List.List_size(patterns_)) + ")")
1646
+ }));
1647
+ const newArguments_ = [...itemArguments_, ...ff_core_Option.Option_toList(restArgument_), ...arguments_];
2581
1648
  const newMatchCase_ = (((_c) => {
2582
- return ff_compiler_Syntax.MatchCase(_c.at_, [head_, tail_, ...matchCase_.patterns_], _c.guards_, _c.body_)
1649
+ return ff_compiler_Syntax.MatchCase(_c.at_, [...patterns_, ...ff_core_Option.Option_toList(restPattern_), ...matchCase_.patterns_], _c.guards_, _c.body_)
2583
1650
  }))(matchCase_);
2584
- return (((((("if(" + shortArgument_) + ".length > ") + shortCount_) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, newArguments_, newMatchCase_, jump_, last_, async_)) + "\n}")
2585
- return
2586
- }
2587
- }
2588
- }
2589
- }
1651
+ const operator_ = ff_core_Option.Option_else(ff_core_Option.Option_map(restPattern_, ((_) => {
1652
+ return ">="
1653
+ })), (() => {
1654
+ return "==="
1655
+ }));
1656
+ const newConditions_ = [...conditions_, ((((argument_ + ".length ") + operator_) + " ") + ff_core_List.List_size(patterns_))];
1657
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, newArguments_, newMatchCase_, newConditions_, variables_, jump_, last_, async_)
2590
1658
  }
2591
1659
  }
2592
- {
2593
1660
  if(_1.PVariant) {
2594
1661
  const name_ = _1.name_;
2595
1662
  const patterns_ = _1.patterns_;
@@ -2597,77 +1664,58 @@ const processed_ = ff_compiler_JsEmitter.JsEmitter_processVariantCase(self_, nam
2597
1664
  const newMatchCase_ = (((_c) => {
2598
1665
  return ff_compiler_Syntax.MatchCase(_c.at_, [...patterns_, ...matchCase_.patterns_], _c.guards_, _c.body_)
2599
1666
  }))(matchCase_);
2600
- return (((processed_.loneVariant_
2601
- ? ""
2602
- : (((("if(" + argument_) + ".") + processed_.variantName_) + ") {\n")) + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, [...processed_.arguments_, ...arguments_], newMatchCase_, jump_, last_, async_)) + (processed_.loneVariant_
2603
- ? ""
2604
- : "\n}"))
2605
- return
1667
+ const newConditions_ = (processed_.loneVariant_
1668
+ ? conditions_
1669
+ : [...conditions_, ((argument_ + ".") + processed_.variantName_)]);
1670
+ const newArguments_ = [...processed_.arguments_, ...arguments_];
1671
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, newArguments_, newMatchCase_, newConditions_, variables_, jump_, last_, async_)
2606
1672
  }
2607
- }
2608
- {
2609
1673
  if(_1.PVariantAs) {
2610
1674
  const at_ = _1.at_;
2611
1675
  const name_ = _1.name_;
2612
1676
  const variableAt_ = _1.variableAt_;
2613
1677
  const variable_ = _1.variable_;
2614
1678
  const processed_ = ff_compiler_JsEmitter.JsEmitter_processVariantCase(self_, name_, argument_);
2615
- return ((((processed_.loneVariant_
2616
- ? ""
2617
- : (((("if(" + argument_) + ".") + processed_.variantName_) + ") {\n")) + ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Option.Option_filter(ff_core_Option.Option_map(variable_, ((word_) => {
1679
+ const newConditions_ = (processed_.loneVariant_
1680
+ ? conditions_
1681
+ : [...conditions_, ((argument_ + ".") + processed_.variantName_)]);
1682
+ const newVariables_ = ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Option.Option_filter(ff_core_Option.Option_map(variable_, ((word_) => {
2618
1683
  return ff_compiler_JsEmitter.escapeKeyword_(word_)
2619
1684
  })), ((_w1) => {
2620
1685
  return (_w1 !== argument_)
2621
1686
  })), ((_w1) => {
2622
- return (((("const " + _w1) + " = ") + argument_) + ";\n")
1687
+ return [...variables_, (((("const " + _w1) + " = ") + argument_) + ";\n")]
2623
1688
  })), (() => {
2624
- return ""
2625
- }))) + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)) + (processed_.loneVariant_
2626
- ? ""
2627
- : "\n}"))
2628
- return
2629
- }
1689
+ return []
1690
+ }));
1691
+ return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, newConditions_, newVariables_, jump_, last_, async_)
2630
1692
  }
2631
- {
2632
1693
  if(_1.PAlias) {
2633
1694
  const pattern_ = _1.pattern_;
2634
1695
  const variable_ = _1.variable_;
2635
1696
  const escaped_ = ff_compiler_JsEmitter.escapeKeyword_(variable_);
2636
- return (((escaped_ !== argument_)
2637
- ? (((("const " + escaped_) + " = ") + argument_) + ";\n")
2638
- : "") + ff_compiler_JsEmitter.JsEmitter_emitPattern(self_, argument_, pattern_, arguments_, matchCase_, jump_, last_, async_))
2639
- return
2640
- }
1697
+ const newVariables_ = ((escaped_ !== argument_)
1698
+ ? [...variables_, (((("const " + escaped_) + " = ") + argument_) + ";\n")]
1699
+ : variables_);
1700
+ return ff_compiler_JsEmitter.JsEmitter_emitPattern(self_, argument_, pattern_, arguments_, matchCase_, conditions_, newVariables_, jump_, last_, async_)
2641
1701
  }
2642
1702
  }
2643
1703
  }
2644
1704
 
2645
1705
  export function JsEmitter_emitList(self_, items_, async_) {
2646
1706
  return (("[" + ff_core_List.List_join(ff_core_List.List_map(items_, ((_1) => {
2647
- {
2648
- const item_ = _1.first_;
2649
1707
  if(!_1.second_) {
1708
+ const item_ = _1.first_;
2650
1709
  return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, item_, async_)
2651
- return
2652
1710
  }
2653
- }
2654
- {
2655
- const item_ = _1.first_;
2656
1711
  if(_1.second_) {
1712
+ const item_ = _1.first_;
2657
1713
  return ("..." + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, item_, async_))
2658
- return
2659
- }
2660
1714
  }
2661
1715
  })), ", ")) + "]")
2662
1716
  }
2663
1717
 
2664
1718
  export function JsEmitter_processVariantCase(self_, name_, argument_) {
2665
- if((name_ === "List$Empty")) {
2666
- return ff_compiler_JsEmitter.ProcessedVariantCase(name_, false, false, [])
2667
- } else {
2668
- if((name_ === "List$Link")) {
2669
- return ff_compiler_JsEmitter.ProcessedVariantCase(name_, false, false, [(argument_ + "[0]"), (argument_ + ".slice(1)")])
2670
- } else {
2671
1719
  const variantNameUnqualified_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(name_), ((_w1) => {
2672
1720
  return (_w1 !== 46)
2673
1721
  })));
@@ -2697,8 +1745,6 @@ return ((argument_ + ".") + ff_compiler_JsEmitter.escapeKeyword_(field_))
2697
1745
  }));
2698
1746
  return ff_compiler_JsEmitter.ProcessedVariantCase(variantName_, newtype_, loneVariant_, newArguments_)
2699
1747
  }
2700
- }
2701
- }
2702
1748
 
2703
1749
  export function JsEmitter_processVariant(self_, name_) {
2704
1750
  if(ff_core_String.String_startsWith(name_, "List$", 0)) {
@@ -2725,20 +1771,12 @@ return newtype_
2725
1771
  export function JsEmitter_emitArgument(self_, callAt_, argument_, async_) {
2726
1772
  {
2727
1773
  const _1 = argument_.value_;
2728
- {
2729
- if(_1.ECall) {
2730
- if(_1.target_.StaticCall) {
2731
- if(_1.target_.name_ === "ff:core/SourceLocation.callSite") {
1774
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/SourceLocation.callSite") {
2732
1775
  return (((((((((("\"" + self_.moduleName_) + ":") + callAt_.line_) + ":") + callAt_.column_) + ",") + self_.packagePair_.group_) + ",") + self_.packagePair_.name_) + "\"")
2733
- return
2734
- }
2735
- }
2736
- }
2737
1776
  }
2738
1777
  {
2739
1778
  const value_ = _1;
2740
1779
  return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, value_, async_)
2741
- return
2742
1780
  }
2743
1781
  }
2744
1782
  }
@@ -2826,30 +1864,17 @@ return [ff_core_List.List_join(["export async function $run$(fireflyPath_, argum
2826
1864
  : []), "} finally {", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
2827
1865
  ? ["ff_core_Task.Task_abort$($task)", "clearInterval(interval)"]
2828
1866
  : []), "}", "}", ...(((_1) => {
2829
- {
2830
1867
  if(_1.EmitBrowser) {
2831
1868
  return ["queueMicrotask(async () => {", "await $run$(null, [])", "})"]
2832
- return
2833
- }
2834
1869
  }
2835
- {
2836
- if(_1.EmitNode) {
2837
- const _guard1 = bootstrapping_;
2838
- if(_guard1) {
1870
+ if(_1.EmitNode && bootstrapping_) {
2839
1871
  return ["import * as path from 'node:path'", "queueMicrotask(async () => {", "let fireflyPath_ = path.dirname(path.dirname(path.dirname(path.dirname(path.dirname(process.argv[1])))))", "await $run$(fireflyPath_, process.argv.slice(2))", "})"]
2840
- return
2841
- }
2842
- }
2843
1872
  }
2844
- {
2845
1873
  if(_1.EmitExecutable) {
2846
1874
  return ["queueMicrotask(async () => {", "await $run$(null, process.argv.slice(2))", "})"]
2847
- return
2848
- }
2849
1875
  }
2850
1876
  {
2851
1877
  return []
2852
- return
2853
1878
  }
2854
1879
  }))(self_.emitTarget_)], "\n")]
2855
1880
  })), (() => {
@@ -2913,11 +1938,8 @@ return ("async " + ff_core_String.String_dropFirst(_w1, ff_core_String.String_si
2913
1938
  const body_ = (("{\n" + ff_core_List.List_join([...methods_, ...asyncMethods_], ",\n")) + "\n}");
2914
1939
  {
2915
1940
  const _1 = definition_.constraints_;
2916
- {
2917
1941
  if(_1.length === 0) {
2918
1942
  return (((("export const " + name_) + " = ") + body_) + ";")
2919
- return
2920
- }
2921
1943
  }
2922
1944
  {
2923
1945
  const constraints_ = _1;
@@ -2925,7 +1947,6 @@ const dictionaries_ = ff_core_List.List_map(constraints_, ((c_) => {
2925
1947
  return ff_compiler_JsEmitter.makeDictionaryName_(c_.name_, ff_compiler_JsEmitter.firstTypeName_(c_.generics_))
2926
1948
  }));
2927
1949
  return (((((("export function " + name_) + "(") + ff_core_List.List_join(dictionaries_, ", ")) + ") { return ") + body_) + "}")
2928
- return
2929
1950
  }
2930
1951
  }
2931
1952
  }
@@ -2934,80 +1955,39 @@ export async function JsEmitter_emitFunctionDefinition$(self_, definition_, asyn
2934
1955
  const signature_ = (await ff_compiler_JsEmitter.JsEmitter_emitSignature$(self_, definition_.signature_, async_, suffix_, $task));
2935
1956
  {
2936
1957
  const _1 = ff_core_Pair.Pair(async_, definition_.body_);
2937
- {
2938
- if(!_1.first_) {
2939
- if(_1.second_.ForeignTarget) {
2940
- if(_1.second_.syncCode_.None) {
1958
+ if(!_1.first_ && _1.second_.ForeignTarget && _1.second_.syncCode_.None) {
2941
1959
  return (((signature_ + " {\nthrow new Error('Function ") + definition_.signature_.name_) + " is missing on this target in sync context.');\n}")
2942
- return
2943
- }
2944
- }
2945
1960
  }
2946
- }
2947
- {
2948
- if(_1.first_) {
2949
- if(_1.second_.ForeignTarget) {
2950
- if(_1.second_.asyncCode_.None) {
1961
+ if(_1.first_ && _1.second_.ForeignTarget && _1.second_.asyncCode_.None) {
2951
1962
  return (((signature_ + " {\nthrow new Error('Function ") + definition_.signature_.name_) + " is missing on this target in async context.');\n}")
2952
- return
2953
- }
2954
1963
  }
2955
- }
2956
- }
2957
- {
2958
- if(!_1.first_) {
2959
- if(_1.second_.ForeignTarget) {
2960
- if(_1.second_.syncCode_.Some) {
1964
+ if(!_1.first_ && _1.second_.ForeignTarget && _1.second_.syncCode_.Some) {
2961
1965
  const code_ = _1.second_.syncCode_.value_;
2962
1966
  return (((signature_ + " {\n") + ff_compiler_JsImporter.JsImporter_process(self_.jsImporter_, definition_.at_, code_)) + "\n}")
2963
- return
2964
1967
  }
2965
- }
2966
- }
2967
- }
2968
- {
2969
- if(_1.first_) {
2970
- if(_1.second_.ForeignTarget) {
2971
- if(_1.second_.asyncCode_.Some) {
1968
+ if(_1.first_ && _1.second_.ForeignTarget && _1.second_.asyncCode_.Some) {
2972
1969
  const code_ = _1.second_.asyncCode_.value_;
2973
1970
  return (((signature_ + " {\n") + ff_compiler_JsImporter.JsImporter_process(self_.jsImporter_, definition_.at_, code_)) + "\n}")
2974
- return
2975
- }
2976
- }
2977
- }
2978
1971
  }
2979
- {
2980
1972
  if(_1.second_.FireflyTarget) {
2981
1973
  const lambda_ = _1.second_.lambda_;
2982
1974
  {
2983
1975
  const _1 = lambda_;
2984
- {
1976
+ if(_1.cases_.length === 1) {
2985
1977
  const effect_ = _1.effect_;
2986
- if(_1.cases_.length > 0) {
2987
1978
  const matchCase_ = _1.cases_[0];
2988
- if(_1.cases_.length === 1) {
2989
- const _guard1 = ff_core_List.List_all(matchCase_.patterns_, ((_1) => {
2990
- {
2991
- if(_1.PVariable) {
2992
- if(_1.name_.None) {
1979
+ if(ff_core_List.List_all(matchCase_.patterns_, ((_1) => {
1980
+ if(_1.PVariable && _1.name_.None) {
2993
1981
  return true
2994
- return
2995
- }
2996
- }
2997
1982
  }
2998
1983
  {
2999
1984
  return false
3000
- return
3001
1985
  }
3002
- }));
3003
- if(_guard1) {
1986
+ }))) {
3004
1987
  const body_ = (await ff_compiler_JsEmitter.JsEmitter_emitTailCall$(self_, (async ($task) => {
3005
1988
  return (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, matchCase_.body_, true, async_, $task))
3006
1989
  }), $task));
3007
1990
  return (((signature_ + " {\n") + body_) + "\n}")
3008
- return
3009
- }
3010
- }
3011
1991
  }
3012
1992
  }
3013
1993
  {
@@ -3022,19 +2002,17 @@ return (((("const " + p_.name_) + "_a = ") + ff_compiler_JsEmitter.escapeKeyword
3022
2002
  })), "\n");
3023
2003
  const body_ = (await ff_compiler_JsEmitter.JsEmitter_emitTailCall$(self_, (async ($task) => {
3024
2004
  const casesString_ = ff_core_List.List_join((await ff_core_List.List_map$(cases_, (async (_w1, $task) => {
3025
- return (("{\n" + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, escapedArguments_, _w1, true, true, async_, $task))) + "\n}")
2005
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, escapedArguments_, _w1, [], [], true, true, async_, $task))
3026
2006
  }), $task)), "\n");
3027
- return (((("{\n" + shadowingWorkaround_) + "\n") + casesString_) + "\n}")
2007
+ return ((shadowingWorkaround_ + "\n") + casesString_)
3028
2008
  }), $task));
3029
2009
  return (((signature_ + " {\n") + body_) + "\n}")
3030
- return
3031
2010
  }
3032
2011
  }
3033
2012
  return
3034
2013
  }
3035
2014
  }
3036
2015
  }
3037
- }
3038
2016
 
3039
2017
  export async function JsEmitter_emitTailCall$(self_, body_, $task) {
3040
2018
  const outerTailCallUsed_ = self_.tailCallUsed_;
@@ -3105,93 +2083,55 @@ return (((((((((("export function " + definition_.name_) + "(") + fields_) + ")
3105
2083
  export async function JsEmitter_emitTerm$(self_, term_, async_, $task) {
3106
2084
  {
3107
2085
  const _1 = term_;
3108
- {
3109
2086
  if(_1.EString) {
3110
2087
  const at_ = _1.at_;
3111
2088
  const value_ = _1.value_;
3112
- const _guard1 = ff_core_String.String_startsWith(value_, "\"\"\"", 0);
3113
- if(_guard1) {
2089
+ if(ff_core_String.String_startsWith(value_, "\"\"\"", 0)) {
3114
2090
  return (("`" + ff_core_String.String_replace(ff_core_String.String_dropLast(ff_core_String.String_dropFirst(value_, 3), 3), "`", "\\`")) + "`")
3115
- return
3116
2091
  }
3117
2092
  }
3118
- }
3119
- {
3120
2093
  if(_1.EString) {
3121
2094
  const at_ = _1.at_;
3122
2095
  const value_ = _1.value_;
3123
2096
  return value_
3124
- return
3125
- }
3126
2097
  }
3127
- {
3128
2098
  if(_1.EChar) {
3129
2099
  const at_ = _1.at_;
3130
2100
  const value_ = _1.value_;
3131
2101
  return ff_compiler_JsEmitter.charLiteralToNumber_(value_)
3132
- return
3133
2102
  }
3134
- }
3135
- {
3136
2103
  if(_1.EInt) {
3137
2104
  const at_ = _1.at_;
3138
2105
  const value_ = _1.value_;
3139
2106
  return value_
3140
- return
3141
- }
3142
2107
  }
3143
- {
3144
2108
  if(_1.EFloat) {
3145
2109
  const at_ = _1.at_;
3146
2110
  const value_ = _1.value_;
3147
2111
  return value_
3148
- return
3149
2112
  }
3150
- }
3151
- {
3152
2113
  if(_1.EVariable) {
3153
2114
  const at_ = _1.at_;
3154
2115
  const name_ = _1.name_;
3155
2116
  return ff_compiler_JsEmitter.escapeResolved_(name_)
3156
- return
3157
- }
3158
2117
  }
3159
- {
3160
2118
  if(_1.EList) {
3161
2119
  const at_ = _1.at_;
3162
2120
  const items_ = _1.items_;
3163
2121
  return (await ff_compiler_JsEmitter.JsEmitter_emitList$(self_, items_, async_, $task))
3164
- return
3165
2122
  }
3166
- }
3167
- {
3168
- if(_1.EVariant) {
2123
+ if(_1.EVariant && _1.name_ === "ff:core/Bool.False") {
3169
2124
  const at_ = _1.at_;
3170
- if(_1.name_ === "ff:core/Bool.False") {
3171
2125
  return "false"
3172
- return
3173
2126
  }
3174
- }
3175
- }
3176
- {
3177
- if(_1.EVariant) {
2127
+ if(_1.EVariant && _1.name_ === "ff:core/Bool.True") {
3178
2128
  const at_ = _1.at_;
3179
- if(_1.name_ === "ff:core/Bool.True") {
3180
2129
  return "true"
3181
- return
3182
- }
3183
2130
  }
3184
- }
3185
- {
3186
- if(_1.EVariant) {
2131
+ if(_1.EVariant && _1.name_ === "ff:core/Unit.Unit") {
3187
2132
  const at_ = _1.at_;
3188
- if(_1.name_ === "ff:core/Unit.Unit") {
3189
2133
  return "(void 0)"
3190
- return
3191
- }
3192
- }
3193
2134
  }
3194
- {
3195
2135
  if(_1.EVariant) {
3196
2136
  const at_ = _1.at_;
3197
2137
  const name_ = _1.name_;
@@ -3207,35 +2147,18 @@ return (((ff_compiler_JsEmitter.escapeResolved_(name_) + "(") + argumentsString_
3207
2147
  }
3208
2148
  return
3209
2149
  }
3210
- }
3211
- {
3212
- if(_1.EVariantIs) {
2150
+ if(_1.EVariantIs && _1.name_ === "ff:core/Bool.False") {
3213
2151
  const at_ = _1.at_;
3214
- if(_1.name_ === "ff:core/Bool.False") {
3215
2152
  return "function(_v) { return !_v ? ff_core_Option.Some(_v) : ff_core_Option.None(); }"
3216
- return
3217
- }
3218
2153
  }
3219
- }
3220
- {
3221
- if(_1.EVariantIs) {
2154
+ if(_1.EVariantIs && _1.name_ === "ff:core/Bool.True") {
3222
2155
  const at_ = _1.at_;
3223
- if(_1.name_ === "ff:core/Bool.True") {
3224
2156
  return "function(_v) { return _v ? ff_core_Option.Some(_v) : ff_core_Option.None(); }"
3225
- return
3226
- }
3227
- }
3228
2157
  }
3229
- {
3230
- if(_1.EVariantIs) {
2158
+ if(_1.EVariantIs && _1.name_ === "ff:core/Unit.Unit") {
3231
2159
  const at_ = _1.at_;
3232
- if(_1.name_ === "ff:core/Unit.Unit") {
3233
2160
  return "function(_v) { return ff_core_Option.Some(_v); }"
3234
- return
3235
- }
3236
2161
  }
3237
- }
3238
- {
3239
2162
  if(_1.EVariantIs) {
3240
2163
  const at_ = _1.at_;
3241
2164
  const name_ = _1.name_;
@@ -3243,10 +2166,7 @@ const n_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core
3243
2166
  return (_w1 !== 46)
3244
2167
  })));
3245
2168
  return (((("(function(_v) { " + "return _v.") + ff_compiler_JsEmitter.escapeResolved_(n_)) + " ? ff_core_Option.Some(_v) : ff_core_Option.None();") + "})")
3246
- return
3247
- }
3248
2169
  }
3249
- {
3250
2170
  if(_1.ECopy) {
3251
2171
  const at_ = _1.at_;
3252
2172
  const name_ = _1.name_;
@@ -3256,10 +2176,7 @@ const fieldCode_ = ff_core_List.List_join((await ff_core_List.List_map$(fields_,
3256
2176
  return ((ff_compiler_JsEmitter.escapeKeyword_(f_.name_) + " = ") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, f_.value_, async_, $task)))
3257
2177
  }), $task)), ", ");
3258
2178
  return (((("{..." + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, record_, async_, $task))) + ", ") + fieldCode_) + "}")
3259
- return
3260
2179
  }
3261
- }
3262
- {
3263
2180
  if(_1.EField) {
3264
2181
  const at_ = _1.at_;
3265
2182
  const newtype_ = _1.newtype_;
@@ -3272,32 +2189,21 @@ return (((await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, record_, async_
3272
2189
  }
3273
2190
  return
3274
2191
  }
3275
- }
3276
- {
3277
- if(_1.ELambda) {
2192
+ if(_1.ELambda && _1.lambda_.cases_.length === 1 && _1.lambda_.cases_[0].guards_.length === 0) {
3278
2193
  const at_ = _1.at_;
3279
2194
  const effect_ = _1.lambda_.effect_;
3280
- if(_1.lambda_.cases_.length > 0) {
3281
2195
  const patterns_ = _1.lambda_.cases_[0].patterns_;
3282
- if(_1.lambda_.cases_[0].guards_.length === 0) {
3283
2196
  const body_ = _1.lambda_.cases_[0].body_;
3284
- if(_1.lambda_.cases_.length === 1) {
3285
- const _guard1 = ff_core_List.List_all(patterns_, ((_1) => {
3286
- {
2197
+ if(ff_core_List.List_all(patterns_, ((_1) => {
3287
2198
  if(_1.PVariable) {
3288
2199
  return true
3289
- return
3290
- }
3291
2200
  }
3292
2201
  {
3293
2202
  return false
3294
- return
3295
2203
  }
3296
- }));
3297
- if(_guard1) {
2204
+ }))) {
3298
2205
  const newAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
3299
2206
  const patternParameters_ = ff_core_List.List_map(patterns_, ((_1) => {
3300
- {
3301
2207
  if(_1.PVariable) {
3302
2208
  const p_ = _1;
3303
2209
  return ff_core_Option.Option_else(ff_core_Option.Option_map(p_.name_, ((word_) => {
@@ -3307,10 +2213,8 @@ return "_"
3307
2213
  }))
3308
2214
  return
3309
2215
  }
3310
- }
3311
2216
  {
3312
2217
  return ff_core_Core.panic_("!")
3313
- return
3314
2218
  }
3315
2219
  }));
3316
2220
  const controller_ = (newAsync_
@@ -3321,14 +2225,8 @@ const prefix_ = (newAsync_
3321
2225
  ? "async "
3322
2226
  : "");
3323
2227
  return (((((("(" + prefix_) + "(") + parameters_) + ") => {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, body_, true, newAsync_, $task))) + "\n})")
3324
- return
3325
- }
3326
- }
3327
- }
3328
2228
  }
3329
2229
  }
3330
- }
3331
- {
3332
2230
  if(_1.ELambda) {
3333
2231
  const at_ = _1.at_;
3334
2232
  const effect_ = _1.lambda_.effect_;
@@ -3345,16 +2243,13 @@ const escapedArguments_ = ff_core_List.List_map(arguments_, ((word_) => {
3345
2243
  return ff_compiler_JsEmitter.escapeKeyword_(word_)
3346
2244
  }));
3347
2245
  const caseStrings_ = (await ff_core_List.List_map$(cases_, (async (_w1, $task) => {
3348
- return (("{\n" + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, escapedArguments_, _w1, true, true, newAsync_, $task))) + "\n}")
2246
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, escapedArguments_, _w1, [], [], true, true, newAsync_, $task))
3349
2247
  }), $task));
3350
2248
  const prefix_ = (newAsync_
3351
2249
  ? "async "
3352
2250
  : "");
3353
2251
  return ((((((("(" + prefix_) + "(") + ff_core_List.List_join([...escapedArguments_, ...controller_], ", ")) + ") => ") + "{\n") + ff_core_List.List_join(caseStrings_, "\n")) + "\n})")
3354
- return
3355
- }
3356
2252
  }
3357
- {
3358
2253
  if(_1.EPipe) {
3359
2254
  const at_ = _1.at_;
3360
2255
  const value_ = _1.value_;
@@ -3372,76 +2267,43 @@ return call_
3372
2267
  }
3373
2268
  return
3374
2269
  }
3375
- }
3376
- {
3377
- if(_1.ECall) {
2270
+ if(_1.ECall && _1.target_.StaticCall && _1.typeArguments_.length === 0 && _1.arguments_.length === 1) {
3378
2271
  const at_ = _1.at_;
3379
- if(_1.target_.StaticCall) {
3380
2272
  const operator_ = _1.target_.name_;
3381
- if(_1.typeArguments_.length === 0) {
3382
- if(_1.arguments_.length > 0) {
3383
2273
  const value_ = _1.arguments_[0];
3384
- if(_1.arguments_.length === 1) {
3385
- const _guard1 = (!ff_core_Char.Char_isAsciiLetter(ff_core_String.String_grabFirst(operator_)));
3386
- if(_guard1) {
2274
+ if((!ff_core_Char.Char_isAsciiLetter(ff_core_String.String_grabFirst(operator_)))) {
3387
2275
  return ((("(" + operator_) + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, value_, async_, $task))) + ")")
3388
- return
3389
2276
  }
3390
2277
  }
3391
- }
3392
- }
3393
- }
3394
- }
3395
- }
3396
- {
3397
- if(_1.ECall) {
2278
+ if(_1.ECall && _1.target_.StaticCall && _1.typeArguments_.length === 0 && _1.arguments_.length === 2) {
3398
2279
  const at_ = _1.at_;
3399
- if(_1.target_.StaticCall) {
3400
2280
  const operator_ = _1.target_.name_;
3401
- if(_1.typeArguments_.length === 0) {
3402
- if(_1.arguments_.length > 0) {
3403
2281
  const left_ = _1.arguments_[0];
3404
- if(_1.arguments_.length > 1) {
3405
2282
  const right_ = _1.arguments_[1];
3406
- if(_1.arguments_.length === 2) {
3407
- const _guard1 = (!ff_core_Char.Char_isAsciiLetter(ff_core_String.String_grabFirst(operator_)));
3408
- if(_guard1) {
2283
+ if((!ff_core_Char.Char_isAsciiLetter(ff_core_String.String_grabFirst(operator_)))) {
3409
2284
  return (((((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " ") + operator_) + " ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
3410
- return
3411
- }
3412
- }
3413
- }
3414
- }
3415
2285
  }
3416
2286
  }
2287
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_grab" && _1.arguments_.length === 2 && _1.arguments_[0].value_.EVariable && _1.arguments_[1].value_.EVariable) {
2288
+ const at_ = _1.at_;
2289
+ const x1_ = _1.arguments_[0].value_.name_;
2290
+ const x2_ = _1.arguments_[1].value_.name_;
2291
+ return ((((((((("(" + ff_compiler_JsEmitter.escapeResolved_(x1_)) + "[") + ff_compiler_JsEmitter.escapeResolved_(x2_)) + "] ?? ") + "ff_core_List.internalGrab_(") + ff_compiler_JsEmitter.escapeResolved_(x1_)) + ", ") + ff_compiler_JsEmitter.escapeResolved_(x2_)) + "))")
3417
2292
  }
2293
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Array.Array_grab" && _1.arguments_.length === 2 && _1.arguments_[0].value_.EVariable && _1.arguments_[1].value_.EVariable) {
2294
+ const at_ = _1.at_;
2295
+ const x1_ = _1.arguments_[0].value_.name_;
2296
+ const x2_ = _1.arguments_[1].value_.name_;
2297
+ return ((((((((("(" + ff_compiler_JsEmitter.escapeResolved_(x1_)) + ".array[") + ff_compiler_JsEmitter.escapeResolved_(x2_)) + "] ?? ") + "ff_core_Array.internalGrab_(") + ff_compiler_JsEmitter.escapeResolved_(x1_)) + ", ") + ff_compiler_JsEmitter.escapeResolved_(x2_)) + "))")
3418
2298
  }
3419
- {
3420
- if(_1.ECall) {
2299
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:unsafejs/UnsafeJs.import" && _1.arguments_.length === 1 && _1.arguments_[0].value_.EString) {
3421
2300
  const at_ = _1.at_;
3422
- if(_1.target_.StaticCall) {
3423
- if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.import") {
3424
- if(_1.arguments_.length > 0) {
3425
- if(_1.arguments_[0].value_.EString) {
3426
2301
  const url_ = _1.arguments_[0].value_.value_;
3427
- if(_1.arguments_.length === 1) {
3428
2302
  return ff_compiler_JsImporter.JsImporter_add(self_.jsImporter_, ff_core_String.String_replace(url_, "\"", ""))
3429
- return
3430
- }
3431
2303
  }
3432
- }
3433
- }
3434
- }
3435
- }
3436
- }
3437
- {
3438
- if(_1.ECall) {
2304
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:unsafejs/UnsafeJs.await" && _1.arguments_.length === 1) {
3439
2305
  const at_ = _1.at_;
3440
- if(_1.target_.StaticCall) {
3441
- if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.await") {
3442
- if(_1.arguments_.length > 0) {
3443
2306
  const body_ = _1.arguments_[0].value_;
3444
- if(_1.arguments_.length === 1) {
3445
2307
  const emittedBody_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, body_, async_, $task));
3446
2308
  if(async_) {
3447
2309
  return (("(await " + emittedBody_) + "($task))")
@@ -3450,17 +2312,8 @@ return (("(" + emittedBody_) + "())")
3450
2312
  }
3451
2313
  return
3452
2314
  }
3453
- }
3454
- }
3455
- }
3456
- }
3457
- }
3458
- {
3459
- if(_1.ECall) {
2315
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:unsafejs/UnsafeJs.cancelled" && _1.arguments_.length === 0) {
3460
2316
  const at_ = _1.at_;
3461
- if(_1.target_.StaticCall) {
3462
- if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.cancelled") {
3463
- if(_1.arguments_.length === 0) {
3464
2317
  if(async_) {
3465
2318
  return "$task.controller.signal.aborted"
3466
2319
  } else {
@@ -3468,16 +2321,8 @@ return "false"
3468
2321
  }
3469
2322
  return
3470
2323
  }
3471
- }
3472
- }
3473
- }
3474
- }
3475
- {
3476
- if(_1.ECall) {
2324
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:unsafejs/UnsafeJs.throwIfCancelled" && _1.arguments_.length === 0) {
3477
2325
  const at_ = _1.at_;
3478
- if(_1.target_.StaticCall) {
3479
- if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.throwIfCancelled") {
3480
- if(_1.arguments_.length === 0) {
3481
2326
  if(async_) {
3482
2327
  return "((() => ff_core_Task.Task_throwIfAborted($task))())"
3483
2328
  } else {
@@ -3485,207 +2330,69 @@ return ""
3485
2330
  }
3486
2331
  return
3487
2332
  }
3488
- }
3489
- }
3490
- }
3491
- }
3492
- {
3493
- if(_1.ECall) {
2333
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Equal.equals" && _1.arguments_.length === 2 && _1.dictionaries_.length === 1 && _1.dictionaries_[0].dictionaries_.length === 0) {
3494
2334
  const at_ = _1.at_;
3495
- if(_1.target_.StaticCall) {
3496
- if(_1.target_.name_ === "ff:core/Equal.equals") {
3497
- if(_1.arguments_.length > 0) {
3498
2335
  const left_ = _1.arguments_[0];
3499
- if(_1.arguments_.length > 1) {
3500
2336
  const right_ = _1.arguments_[1];
3501
- if(_1.arguments_.length === 2) {
3502
- if(_1.dictionaries_.length > 0) {
3503
2337
  const typeName_ = _1.dictionaries_[0].typeName_;
3504
- if(_1.dictionaries_[0].dictionaries_.length === 0) {
3505
- if(_1.dictionaries_.length === 1) {
3506
- const _guard1 = (ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || (typeName_ === "ff:core/Ordering.Ordering"));
3507
- if(_guard1) {
2338
+ if((ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || (typeName_ === "ff:core/Ordering.Ordering"))) {
3508
2339
  return (((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " === ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
3509
- return
3510
- }
3511
2340
  }
3512
2341
  }
3513
- }
3514
- }
3515
- }
3516
- }
3517
- }
3518
- }
3519
- }
3520
- }
3521
- {
3522
- if(_1.ECall) {
2342
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Equal.notEquals" && _1.arguments_.length === 2 && _1.dictionaries_.length === 1 && _1.dictionaries_[0].dictionaries_.length === 0) {
3523
2343
  const at_ = _1.at_;
3524
- if(_1.target_.StaticCall) {
3525
- if(_1.target_.name_ === "ff:core/Equal.notEquals") {
3526
- if(_1.arguments_.length > 0) {
3527
2344
  const left_ = _1.arguments_[0];
3528
- if(_1.arguments_.length > 1) {
3529
2345
  const right_ = _1.arguments_[1];
3530
- if(_1.arguments_.length === 2) {
3531
- if(_1.dictionaries_.length > 0) {
3532
2346
  const typeName_ = _1.dictionaries_[0].typeName_;
3533
- if(_1.dictionaries_[0].dictionaries_.length === 0) {
3534
- if(_1.dictionaries_.length === 1) {
3535
- const _guard1 = (ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || (typeName_ === "ff:core/Ordering.Ordering"));
3536
- if(_guard1) {
2347
+ if((ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || (typeName_ === "ff:core/Ordering.Ordering"))) {
3537
2348
  return (((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " !== ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
3538
- return
3539
- }
3540
- }
3541
- }
3542
- }
3543
- }
3544
- }
3545
2349
  }
3546
2350
  }
3547
- }
3548
- }
3549
- }
3550
- {
3551
- if(_1.ECall) {
2351
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Ordering.before" && _1.arguments_.length === 2 && _1.dictionaries_.length === 1 && _1.dictionaries_[0].dictionaries_.length === 0) {
3552
2352
  const at_ = _1.at_;
3553
- if(_1.target_.StaticCall) {
3554
- if(_1.target_.name_ === "ff:core/Ordering.before") {
3555
- if(_1.arguments_.length > 0) {
3556
2353
  const left_ = _1.arguments_[0];
3557
- if(_1.arguments_.length > 1) {
3558
2354
  const right_ = _1.arguments_[1];
3559
- if(_1.arguments_.length === 2) {
3560
- if(_1.dictionaries_.length > 0) {
3561
2355
  const typeName_ = _1.dictionaries_[0].typeName_;
3562
- if(_1.dictionaries_[0].dictionaries_.length === 0) {
3563
- if(_1.dictionaries_.length === 1) {
3564
- const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
3565
- if(_guard1) {
2356
+ if(ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
3566
2357
  return (((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " < ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
3567
- return
3568
- }
3569
- }
3570
- }
3571
2358
  }
3572
2359
  }
3573
- }
3574
- }
3575
- }
3576
- }
3577
- }
3578
- }
3579
- {
3580
- if(_1.ECall) {
2360
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Ordering.notBefore" && _1.arguments_.length === 2 && _1.dictionaries_.length === 1 && _1.dictionaries_[0].dictionaries_.length === 0) {
3581
2361
  const at_ = _1.at_;
3582
- if(_1.target_.StaticCall) {
3583
- if(_1.target_.name_ === "ff:core/Ordering.notBefore") {
3584
- if(_1.arguments_.length > 0) {
3585
2362
  const left_ = _1.arguments_[0];
3586
- if(_1.arguments_.length > 1) {
3587
2363
  const right_ = _1.arguments_[1];
3588
- if(_1.arguments_.length === 2) {
3589
- if(_1.dictionaries_.length > 0) {
3590
2364
  const typeName_ = _1.dictionaries_[0].typeName_;
3591
- if(_1.dictionaries_[0].dictionaries_.length === 0) {
3592
- if(_1.dictionaries_.length === 1) {
3593
- const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
3594
- if(_guard1) {
2365
+ if(ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
3595
2366
  return (((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " >= ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
3596
- return
3597
2367
  }
3598
2368
  }
3599
- }
3600
- }
3601
- }
3602
- }
3603
- }
3604
- }
3605
- }
3606
- }
3607
- }
3608
- {
3609
- if(_1.ECall) {
2369
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Ordering.after" && _1.arguments_.length === 2 && _1.dictionaries_.length === 1 && _1.dictionaries_[0].dictionaries_.length === 0) {
3610
2370
  const at_ = _1.at_;
3611
- if(_1.target_.StaticCall) {
3612
- if(_1.target_.name_ === "ff:core/Ordering.after") {
3613
- if(_1.arguments_.length > 0) {
3614
2371
  const left_ = _1.arguments_[0];
3615
- if(_1.arguments_.length > 1) {
3616
2372
  const right_ = _1.arguments_[1];
3617
- if(_1.arguments_.length === 2) {
3618
- if(_1.dictionaries_.length > 0) {
3619
2373
  const typeName_ = _1.dictionaries_[0].typeName_;
3620
- if(_1.dictionaries_[0].dictionaries_.length === 0) {
3621
- if(_1.dictionaries_.length === 1) {
3622
- const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
3623
- if(_guard1) {
2374
+ if(ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
3624
2375
  return (((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " > ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
3625
- return
3626
- }
3627
- }
3628
- }
3629
- }
3630
- }
3631
2376
  }
3632
2377
  }
3633
- }
3634
- }
3635
- }
3636
- }
3637
- {
3638
- if(_1.ECall) {
2378
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Ordering.notAfter" && _1.arguments_.length === 2 && _1.dictionaries_.length === 1 && _1.dictionaries_[0].dictionaries_.length === 0) {
3639
2379
  const at_ = _1.at_;
3640
- if(_1.target_.StaticCall) {
3641
- if(_1.target_.name_ === "ff:core/Ordering.notAfter") {
3642
- if(_1.arguments_.length > 0) {
3643
2380
  const left_ = _1.arguments_[0];
3644
- if(_1.arguments_.length > 1) {
3645
2381
  const right_ = _1.arguments_[1];
3646
- if(_1.arguments_.length === 2) {
3647
- if(_1.dictionaries_.length > 0) {
3648
2382
  const typeName_ = _1.dictionaries_[0].typeName_;
3649
- if(_1.dictionaries_[0].dictionaries_.length === 0) {
3650
- if(_1.dictionaries_.length === 1) {
3651
- const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
3652
- if(_guard1) {
2383
+ if(ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
3653
2384
  return (((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " <= ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
3654
- return
3655
- }
3656
- }
3657
2385
  }
3658
2386
  }
3659
- }
3660
- }
3661
- }
3662
- }
3663
- }
3664
- }
3665
- }
3666
- {
3667
- if(_1.ECall) {
3668
- if(_1.target_.StaticCall) {
3669
- if(_1.target_.name_ === "ff:core/List.fillBy") {
2387
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.fillBy" && _1.arguments_.length === 2 && _1.arguments_[1].value_.ELambda && _1.arguments_[1].value_.lambda_.cases_.length === 1 && _1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 1 && _1.arguments_[1].value_.lambda_.cases_[0].patterns_[0].PVariable && _1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
3670
2388
  const effect_ = _1.effect_;
3671
- if(_1.arguments_.length > 0) {
3672
2389
  const size_ = _1.arguments_[0];
3673
- if(_1.arguments_.length > 1) {
3674
- if(_1.arguments_[1].value_.ELambda) {
3675
2390
  const at_ = _1.arguments_[1].value_.at_;
3676
2391
  const l_ = _1.arguments_[1].value_.lambda_;
3677
- if(_1.arguments_[1].value_.lambda_.cases_.length > 0) {
3678
2392
  const c_ = _1.arguments_[1].value_.lambda_.cases_[0];
3679
- if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length > 0) {
3680
- if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_[0].PVariable) {
3681
2393
  const name_ = _1.arguments_[1].value_.lambda_.cases_[0].patterns_[0].name_;
3682
- if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 1) {
3683
- if(_1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
3684
2394
  const body_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
3685
- if(_1.arguments_[1].value_.lambda_.cases_.length === 1) {
3686
- if(_1.arguments_.length === 2) {
3687
- const _guard1 = (!ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
3688
- if(_guard1) {
2395
+ if((!ff_compiler_JsEmitter.effectTypeIsAsync_(effect_))) {
3689
2396
  const n_ = ff_core_Option.Option_else(ff_core_Option.Option_map(name_, ((_w1) => {
3690
2397
  return ff_compiler_JsEmitter.escapeResolved_(_w1)
3691
2398
  })), (() => {
@@ -3696,28 +2403,11 @@ const await_ = (newAsync_
3696
2403
  ? "await "
3697
2404
  : "");
3698
2405
  return ((((((((((((((((((await_ + "((() => {\n") + "const size = ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, size_, async_, $task))) + ";\n") + "const result = [];\n") + "for(let ") + n_) + " = 0; ") + n_) + " < size; ") + n_) + "++) {\n") + "result.push(") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, body_, newAsync_, $task))) + ");\n") + "}\n") + "return result;\n") + "})())")
3699
- return
3700
- }
3701
- }
3702
- }
3703
- }
3704
- }
3705
- }
3706
- }
3707
2406
  }
3708
2407
  }
3709
- }
3710
- }
3711
- }
3712
- }
3713
- }
3714
- }
3715
- {
3716
- if(_1.ECall) {
2408
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.instanceCall_) {
3717
2409
  const at_ = _1.at_;
3718
- if(_1.target_.StaticCall) {
3719
2410
  const name_ = _1.target_.name_;
3720
- if(_1.target_.instanceCall_) {
3721
2411
  const effect_ = _1.effect_;
3722
2412
  const typeArguments_ = _1.typeArguments_;
3723
2413
  const arguments_ = _1.arguments_;
@@ -3748,13 +2438,8 @@ return call_
3748
2438
  }
3749
2439
  return
3750
2440
  }
3751
- }
3752
- }
3753
- }
3754
- {
3755
- if(_1.ECall) {
2441
+ if(_1.ECall && _1.target_.StaticCall) {
3756
2442
  const at_ = _1.at_;
3757
- if(_1.target_.StaticCall) {
3758
2443
  const name_ = _1.target_.name_;
3759
2444
  const effect_ = _1.effect_;
3760
2445
  const typeArguments_ = _1.typeArguments_;
@@ -3770,7 +2455,6 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.G
3770
2455
  };
3771
2456
  {
3772
2457
  const _1 = ff_compiler_JsEmitter.detectIfElse_(term_);
3773
- {
3774
2458
  if(_1.length === 0) {
3775
2459
  const await_ = (async_ && ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
3776
2460
  const ds_ = (await ff_core_List.List_map$(dictionaries_, (async (_w1, $task) => {
@@ -3793,11 +2477,7 @@ return call_
3793
2477
  }
3794
2478
  return
3795
2479
  }
3796
- }
3797
- {
3798
- if(_1.length > 0) {
3799
- if(_1[0].first_.EVariant) {
3800
- if(_1[0].first_.name_ === "ff:core/Bool.True") {
2480
+ if(_1.length >= 1 && _1[0].first_.EVariant && _1[0].first_.name_ === "ff:core/Bool.True") {
3801
2481
  const elseBody_ = _1[0].second_;
3802
2482
  const list_ = _1.slice(1);
3803
2483
  return (("(" + (await ff_core_List.List_foldLeft$(list_, (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, elseBody_, async_, $task)), (async (_1, _2, $task) => {
@@ -3806,14 +2486,10 @@ const otherwise_ = _1;
3806
2486
  const condition_ = _2.first_;
3807
2487
  const body_ = _2.second_;
3808
2488
  return (((((await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, condition_, async_, $task)) + "\n? ") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, body_, async_, $task))) + "\n: ") + otherwise_)
3809
- return
3810
2489
  }
3811
2490
  }), $task))) + ")")
3812
2491
  return
3813
2492
  }
3814
- }
3815
- }
3816
- }
3817
2493
  {
3818
2494
  const list_ = _1;
3819
2495
  return (("(" + (await ff_core_List.List_foldLeft$(list_, "ff_core_Option.None()", (async (_1, _2, $task) => {
@@ -3822,7 +2498,6 @@ const otherwise_ = _1;
3822
2498
  const condition_ = _2.first_;
3823
2499
  const body_ = _2.second_;
3824
2500
  return (((((await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, condition_, async_, $task)) + "\n? ff_core_Option.Some(") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, body_, async_, $task))) + ")\n: ") + otherwise_)
3825
- return
3826
2501
  }
3827
2502
  }), $task))) + ")")
3828
2503
  return
@@ -3830,12 +2505,8 @@ return
3830
2505
  }
3831
2506
  return
3832
2507
  }
3833
- }
3834
- }
3835
- {
3836
- if(_1.ECall) {
2508
+ if(_1.ECall && _1.target_.DynamicCall) {
3837
2509
  const at_ = _1.at_;
3838
- if(_1.target_.DynamicCall) {
3839
2510
  const function_ = _1.target_.function_;
3840
2511
  const effect_ = _1.effect_;
3841
2512
  const typeArguments_ = _1.typeArguments_;
@@ -3860,9 +2531,6 @@ return call_
3860
2531
  }
3861
2532
  return
3862
2533
  }
3863
- }
3864
- }
3865
- {
3866
2534
  if(_1.ERecord) {
3867
2535
  const at_ = _1.at_;
3868
2536
  const fields_ = _1.fields_;
@@ -3876,8 +2544,6 @@ return (("{\n" + ff_core_List.List_join(list_, ",\n")) + "\n}")
3876
2544
  }
3877
2545
  return
3878
2546
  }
3879
- }
3880
- {
3881
2547
  if(_1.EWildcard) {
3882
2548
  const at_ = _1.at_;
3883
2549
  const index_ = _1.index_;
@@ -3885,19 +2551,12 @@ if((index_ === 0)) {
3885
2551
  ff_compiler_JsEmitter.fail_(at_, "Unbound wildcard")
3886
2552
  };
3887
2553
  return ("_w" + index_)
3888
- return
3889
- }
3890
2554
  }
3891
- {
3892
- const _guard1 = async_;
3893
- if(_guard1) {
2555
+ if(async_) {
3894
2556
  return (("(await (async function() {\n" + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, term_, true, async_, $task))) + "\n})())")
3895
- return
3896
- }
3897
2557
  }
3898
2558
  {
3899
2559
  return (("(function() {\n" + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, term_, true, async_, $task))) + "\n})()")
3900
- return
3901
2560
  }
3902
2561
  }
3903
2562
  }
@@ -3919,7 +2578,6 @@ return (await ff_compiler_JsEmitter.JsEmitter_emitDictionary$(self_, _w1, $task)
3919
2578
  export async function JsEmitter_emitStatements$(self_, term_, last_, async_, $task) {
3920
2579
  {
3921
2580
  const _1 = term_;
3922
- {
3923
2581
  if(_1.EFunctions) {
3924
2582
  const at_ = _1.at_;
3925
2583
  const functions_ = _1.functions_;
@@ -3929,10 +2587,7 @@ const newAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsy
3929
2587
  return (await ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition$(self_, f_, newAsync_, "", $task))
3930
2588
  }), $task));
3931
2589
  return ((ff_core_List.List_join(functionStrings_, "\n") + "\n") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, body_, last_, async_, $task)))
3932
- return
3933
- }
3934
2590
  }
3935
- {
3936
2591
  if(_1.ELet) {
3937
2592
  const at_ = _1.at_;
3938
2593
  const mutable_ = _1.mutable_;
@@ -3941,64 +2596,32 @@ const valueType_ = _1.valueType_;
3941
2596
  const value_ = _1.value_;
3942
2597
  const body_ = _1.body_;
3943
2598
  return (((await ff_compiler_JsEmitter.JsEmitter_emitLetDefinition$(self_, ff_compiler_Syntax.DLet(at_, name_, valueType_, value_), mutable_, async_, $task)) + "\n") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, body_, last_, async_, $task)))
3944
- return
3945
2599
  }
3946
- }
3947
- {
3948
- if(_1.EVariant) {
2600
+ if(_1.EVariant && _1.name_ === "ff:core/Unit.Unit") {
3949
2601
  const at_ = _1.at_;
3950
- if(_1.name_ === "ff:core/Unit.Unit") {
3951
2602
  return ""
3952
- return
3953
2603
  }
3954
- }
3955
- }
3956
- {
3957
- if(_1.ESequential) {
3958
- const at_ = _1.at_;
3959
- if(_1.before_.EVariant) {
3960
- const at_ = _1.before_.at_;
3961
- if(_1.before_.name_ === "ff:core/Unit.Unit") {
2604
+ if(_1.ESequential && _1.before_.EVariant && _1.before_.name_ === "ff:core/Unit.Unit") {
3962
2605
  const after_ = _1.after_;
3963
2606
  return (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, after_, last_, async_, $task))
3964
- return
3965
- }
3966
- }
3967
2607
  }
3968
- }
3969
- {
3970
- if(_1.ESequential) {
3971
- const at_ = _1.at_;
2608
+ if(_1.ESequential && _1.after_.EVariant && _1.after_.name_ === "ff:core/Unit.Unit") {
3972
2609
  const before_ = _1.before_;
3973
- if(_1.after_.EVariant) {
3974
- const at_ = _1.after_.at_;
3975
- if(_1.after_.name_ === "ff:core/Unit.Unit") {
3976
2610
  return (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, before_, false, async_, $task))
3977
- return
3978
- }
3979
- }
3980
- }
3981
2611
  }
3982
- {
3983
2612
  if(_1.ESequential) {
3984
2613
  const at_ = _1.at_;
3985
2614
  const before_ = _1.before_;
3986
2615
  const after_ = _1.after_;
3987
2616
  return (((await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, before_, false, async_, $task)) + ";\n") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, after_, last_, async_, $task)))
3988
- return
3989
2617
  }
3990
- }
3991
- {
3992
2618
  if(_1.EAssign) {
3993
2619
  const at_ = _1.at_;
3994
2620
  const operator_ = _1.operator_;
3995
2621
  const name_ = _1.variable_;
3996
2622
  const value_ = _1.value_;
3997
2623
  return ((((ff_compiler_JsEmitter.escapeKeyword_(name_) + " ") + operator_) + "= ") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, value_, async_, $task)))
3998
- return
3999
- }
4000
2624
  }
4001
- {
4002
2625
  if(_1.EAssignField) {
4003
2626
  const at_ = _1.at_;
4004
2627
  const operator_ = _1.operator_;
@@ -4006,235 +2629,102 @@ const record_ = _1.record_;
4006
2629
  const field_ = _1.field_;
4007
2630
  const value_ = _1.value_;
4008
2631
  return (((((((await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, record_, async_, $task)) + ".") + ff_compiler_JsEmitter.escapeKeyword_(field_)) + " ") + operator_) + "= ") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, value_, async_, $task)))
4009
- return
4010
2632
  }
4011
- }
4012
- {
4013
- if(_1.ECall) {
2633
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Core.while" && _1.arguments_.length === 2) {
4014
2634
  const at_ = _1.at_;
4015
- if(_1.target_.StaticCall) {
4016
- if(_1.target_.name_ === "ff:core/Core.while") {
4017
- if(_1.arguments_.length > 0) {
4018
2635
  const condition_ = _1.arguments_[0];
4019
- if(_1.arguments_.length > 1) {
4020
2636
  const body_ = _1.arguments_[1];
4021
- if(_1.arguments_.length === 2) {
4022
2637
  return (((("while(" + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, ff_compiler_JsEmitter.invokeImmediately_(condition_.value_), async_, $task))) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_), false, async_, $task))) + "\n}")
4023
- return
4024
- }
4025
2638
  }
4026
- }
4027
- }
4028
- }
4029
- }
4030
- }
4031
- {
4032
- if(_1.ECall) {
2639
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Core.doWhile" && _1.arguments_.length === 1) {
4033
2640
  const at_ = _1.at_;
4034
- if(_1.target_.StaticCall) {
4035
- if(_1.target_.name_ === "ff:core/Core.doWhile") {
4036
- if(_1.arguments_.length > 0) {
4037
2641
  const doWhileBody_ = _1.arguments_[0].value_;
4038
- if(_1.arguments_.length === 1) {
4039
2642
  const _guard1 = ff_compiler_JsEmitter.invokeImmediately_(doWhileBody_);
4040
2643
  if(_guard1.ESequential) {
4041
2644
  const body_ = _guard1.before_;
4042
2645
  const condition_ = _guard1.after_;
4043
2646
  return ((((("while(true) {\n" + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, body_, false, async_, $task))) + "\nif(!") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, condition_, async_, $task))) + ") break") + "\n}")
4044
- return
4045
- }
4046
2647
  }
4047
2648
  }
4048
- }
4049
- }
4050
- }
4051
- }
4052
- {
4053
- if(_1.ECall) {
2649
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Core.doWhile" && _1.arguments_.length === 1) {
4054
2650
  const at_ = _1.at_;
4055
- if(_1.target_.StaticCall) {
4056
- if(_1.target_.name_ === "ff:core/Core.doWhile") {
4057
- if(_1.arguments_.length > 0) {
4058
2651
  const doWhileBody_ = _1.arguments_[0].value_;
4059
- if(_1.arguments_.length === 1) {
4060
2652
  const _guard1 = ff_compiler_JsEmitter.invokeImmediately_(doWhileBody_);
2653
+ {
4061
2654
  const body_ = _guard1;
4062
2655
  return (("while(" + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, body_, async_, $task))) + ") {}")
4063
- return
4064
- }
4065
2656
  }
4066
2657
  }
4067
- }
4068
- }
4069
- }
4070
- {
4071
- if(_1.ECall) {
2658
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Core.if" && _1.arguments_.length === 2) {
4072
2659
  const at_ = _1.at_;
4073
- if(_1.target_.StaticCall) {
4074
- if(_1.target_.name_ === "ff:core/Core.if") {
4075
- if(_1.arguments_.length > 0) {
4076
2660
  const condition_ = _1.arguments_[0];
4077
- if(_1.arguments_.length > 1) {
4078
2661
  const body_ = _1.arguments_[1];
4079
- if(_1.arguments_.length === 2) {
4080
2662
  return ((("if(" + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, condition_.value_, async_, $task))) + ") {\n") + (last_
4081
2663
  ? (("return ff_core_Option.Some(" + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_), async_, $task))) + ")\n} else return ff_core_Option.None()")
4082
2664
  : ((await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_), false, async_, $task)) + "\n}")))
4083
2665
  return
4084
2666
  }
4085
- }
4086
- }
4087
- }
4088
- }
4089
- }
4090
- }
4091
- {
4092
- if(_1.ECall) {
2667
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Core.throw" && _1.arguments_.length === 1 && _1.dictionaries_.length === 1) {
4093
2668
  const at_ = _1.at_;
4094
- if(_1.target_.StaticCall) {
4095
- if(_1.target_.name_ === "ff:core/Core.throw") {
4096
- if(_1.arguments_.length > 0) {
4097
2669
  const argument_ = _1.arguments_[0];
4098
- if(_1.arguments_.length === 1) {
4099
- if(_1.dictionaries_.length > 0) {
4100
2670
  const dictionary_ = _1.dictionaries_[0];
4101
- if(_1.dictionaries_.length === 1) {
4102
2671
  const d_ = (await ff_compiler_JsEmitter.JsEmitter_emitDictionary$(self_, dictionary_, $task));
4103
2672
  const a_ = (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, argument_, async_, $task));
4104
2673
  return (((("throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(" + a_) + ", ") + d_) + ")})")
4105
- return
4106
- }
4107
- }
4108
- }
4109
- }
4110
2674
  }
4111
- }
4112
- }
4113
- }
4114
- {
4115
- if(_1.ECall) {
2675
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Core.try") {
4116
2676
  const at_ = _1.at_;
4117
- if(_1.target_.StaticCall) {
4118
- if(_1.target_.name_ === "ff:core/Core.try") {
4119
- const _guard1 = (!last_);
4120
- if(_guard1) {
2677
+ if((!last_)) {
4121
2678
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a try without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
4122
- return
4123
- }
4124
- }
4125
- }
4126
2679
  }
4127
2680
  }
4128
- {
4129
- if(_1.ECall) {
2681
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_map") {
4130
2682
  const at_ = _1.at_;
4131
- if(_1.target_.StaticCall) {
4132
- if(_1.target_.name_ === "ff:core/Try.Try_map") {
4133
- const _guard1 = (!last_);
4134
- if(_guard1) {
2683
+ if((!last_)) {
4135
2684
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a map without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
4136
- return
4137
- }
4138
- }
4139
2685
  }
4140
2686
  }
4141
- }
4142
- {
4143
- if(_1.ECall) {
2687
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_flatMap") {
4144
2688
  const at_ = _1.at_;
4145
- if(_1.target_.StaticCall) {
4146
- if(_1.target_.name_ === "ff:core/Try.Try_flatMap") {
4147
- const _guard1 = (!last_);
4148
- if(_guard1) {
2689
+ if((!last_)) {
4149
2690
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a flatMap without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
4150
- return
4151
- }
4152
2691
  }
4153
2692
  }
4154
- }
4155
- }
4156
- {
4157
- if(_1.ECall) {
2693
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_flatten") {
4158
2694
  const at_ = _1.at_;
4159
- if(_1.target_.StaticCall) {
4160
- if(_1.target_.name_ === "ff:core/Try.Try_flatten") {
4161
- const _guard1 = (!last_);
4162
- if(_guard1) {
2695
+ if((!last_)) {
4163
2696
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a flatten without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
4164
- return
4165
2697
  }
4166
2698
  }
4167
- }
4168
- }
4169
- }
4170
- {
4171
- if(_1.ECall) {
2699
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_catch") {
4172
2700
  const at_ = _1.at_;
4173
- if(_1.target_.StaticCall) {
4174
- if(_1.target_.name_ === "ff:core/Try.Try_catch") {
4175
- const _guard1 = (!last_);
4176
- if(_guard1) {
2701
+ if((!last_)) {
4177
2702
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a catch without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
4178
- return
4179
- }
4180
- }
4181
- }
4182
2703
  }
4183
2704
  }
4184
- {
4185
- if(_1.ECall) {
2705
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_catchAny") {
4186
2706
  const at_ = _1.at_;
4187
- if(_1.target_.StaticCall) {
4188
- if(_1.target_.name_ === "ff:core/Try.Try_catchAny") {
4189
- const _guard1 = (!last_);
4190
- if(_guard1) {
2707
+ if((!last_)) {
4191
2708
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a catchAny without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
4192
- return
4193
- }
4194
- }
4195
2709
  }
4196
2710
  }
4197
- }
4198
- {
4199
- if(_1.ECall) {
2711
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_finally") {
4200
2712
  const at_ = _1.at_;
4201
- if(_1.target_.StaticCall) {
4202
- if(_1.target_.name_ === "ff:core/Try.Try_finally") {
4203
- const _guard1 = (!last_);
4204
- if(_guard1) {
2713
+ if((!last_)) {
4205
2714
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a finally without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
4206
- return
4207
- }
4208
2715
  }
4209
2716
  }
4210
- }
4211
- }
4212
- {
4213
- if(_1.ECall) {
2717
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_grab" && _1.arguments_.length === 1) {
4214
2718
  const at_ = _1.at_;
4215
- if(_1.target_.StaticCall) {
4216
- if(_1.target_.name_ === "ff:core/Try.Try_grab") {
4217
- if(_1.arguments_.length > 0) {
4218
2719
  const argument_ = _1.arguments_[0];
4219
- if(_1.arguments_.length === 1) {
4220
2720
  const _guard1 = (await ff_compiler_JsEmitter.JsEmitter_emitTryCatchFinally$(self_, argument_.value_, last_, async_, $task));
4221
2721
  if(_guard1.Some) {
4222
2722
  const code_ = _guard1.value_;
4223
2723
  return code_
4224
- return
4225
2724
  }
4226
2725
  }
4227
- }
4228
- }
4229
- }
4230
- }
4231
- }
4232
- {
4233
- if(_1.ECall) {
2726
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:unsafejs/UnsafeJs.throwIfCancelled" && _1.arguments_.length === 0) {
4234
2727
  const at_ = _1.at_;
4235
- if(_1.target_.StaticCall) {
4236
- if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.throwIfCancelled") {
4237
- if(_1.arguments_.length === 0) {
4238
2728
  if(async_) {
4239
2729
  return "ff_core_Task.Task_throwIfAborted($task)"
4240
2730
  } else {
@@ -4242,16 +2732,9 @@ return ""
4242
2732
  }
4243
2733
  return
4244
2734
  }
4245
- }
4246
- }
4247
- }
4248
- }
4249
- {
4250
- if(_1.ECall) {
2735
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.tailCall_) {
4251
2736
  const at_ = _1.at_;
4252
- if(_1.target_.StaticCall) {
4253
2737
  const name_ = _1.target_.name_;
4254
- if(_1.target_.tailCall_) {
4255
2738
  const instanceCall_ = _1.target_.instanceCall_;
4256
2739
  const effect_ = _1.effect_;
4257
2740
  const arguments_ = _1.arguments_;
@@ -4265,33 +2748,24 @@ return ff_core_Option.Some(ff_core_Pair.Pair((((("const " + ff_compiler_JsEmitte
4265
2748
  return _w1
4266
2749
  })));
4267
2750
  return (((("{\n" + ff_core_List.List_join(pair_.first_, "\n")) + "\n") + ff_core_List.List_join(pair_.second_, "\n")) + "\ncontinue _tailcall\n}")
4268
- return
4269
2751
  }
4270
- }
4271
- }
4272
- }
4273
- {
4274
- if(_1.EPipe) {
2752
+ if(_1.EPipe && _1.function_.ELambda) {
4275
2753
  const at_ = _1.at_;
4276
2754
  const value_ = _1.value_;
4277
- if(_1.function_.ELambda) {
4278
2755
  const cases_ = _1.function_.lambda_.cases_;
4279
2756
  ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
4280
2757
  return ((((((((!last_)
4281
2758
  ? "do "
4282
2759
  : "") + "{\nconst _1 = ") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, value_, async_, $task))) + ";\n") + ff_core_List.List_join((await ff_core_List.List_map$(cases_, (async (_w1, $task) => {
4283
- return (("{\n" + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, ["_1"], _w1, true, last_, async_, $task))) + "\n}")
2760
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, ["_1"], _w1, [], [], true, last_, async_, $task))
4284
2761
  }), $task)), "\n")) + "\n}") + ((!last_)
4285
2762
  ? " while(false)"
4286
2763
  : ""))
4287
2764
  return
4288
2765
  }
4289
- }
4290
- }
4291
2766
  {
4292
2767
  {
4293
2768
  const _1 = ff_compiler_JsEmitter.detectIfElse_(term_);
4294
- {
4295
2769
  if(_1.length === 0) {
4296
2770
  if(last_) {
4297
2771
  return ("return " + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, term_, async_, $task)))
@@ -4300,11 +2774,7 @@ return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, term_, async_, $t
4300
2774
  }
4301
2775
  return
4302
2776
  }
4303
- }
4304
- {
4305
- if(_1.length > 0) {
4306
- if(_1[0].first_.EVariant) {
4307
- if(_1[0].first_.name_ === "ff:core/Bool.True") {
2777
+ if(_1.length >= 1 && _1[0].first_.EVariant && _1[0].first_.name_ === "ff:core/Bool.True") {
4308
2778
  const elseBody_ = _1[0].second_;
4309
2779
  const list_ = _1.slice(1);
4310
2780
  const initial_ = (("{\n" + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, elseBody_, last_, async_, $task))) + "\n}");
@@ -4314,25 +2784,19 @@ const otherwise_ = _1;
4314
2784
  const condition_ = _2.first_;
4315
2785
  const body_ = _2.second_;
4316
2786
  return ((((("if(" + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, condition_, async_, $task))) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, body_, last_, async_, $task))) + "\n} else ") + otherwise_)
4317
- return
4318
2787
  }
4319
2788
  }), $task))
4320
2789
  return
4321
2790
  }
4322
- }
4323
- }
4324
- }
4325
2791
  {
4326
2792
  const list_ = _1;
4327
- const _guard1 = (!last_);
4328
- if(_guard1) {
2793
+ if((!last_)) {
4329
2794
  return (await ff_core_List.List_foldLeft$(list_, "{}", (async (_1, _2, $task) => {
4330
2795
  {
4331
2796
  const otherwise_ = _1;
4332
2797
  const condition_ = _2.first_;
4333
2798
  const body_ = _2.second_;
4334
2799
  return ((((("if(" + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, condition_, async_, $task))) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, body_, last_, async_, $task))) + "\n} else ") + otherwise_)
4335
- return
4336
2800
  }
4337
2801
  }), $task))
4338
2802
  return
@@ -4346,7 +2810,6 @@ const otherwise_ = _1;
4346
2810
  const condition_ = _2.first_;
4347
2811
  const body_ = _2.second_;
4348
2812
  return (((((("if(" + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, condition_, async_, $task))) + ") {\n") + "return ff_core_Option.Some(") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, body_, async_, $task))) + ")\n} else ") + otherwise_)
4349
- return
4350
2813
  }
4351
2814
  }), $task))
4352
2815
  return
@@ -4364,19 +2827,14 @@ ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
4364
2827
  const arguments_ = ["_exception.value_", "_error"];
4365
2828
  {
4366
2829
  const _1 = cases_;
4367
- {
4368
- if(_1.length > 0) {
4369
- const case_ = _1[0];
4370
2830
  if(_1.length === 1) {
4371
- return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, case_, false, last_, catchAsync_, $task))
4372
- return
4373
- }
4374
- }
2831
+ const case_ = _1[0];
2832
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, case_, [], [], false, last_, catchAsync_, $task))
4375
2833
  }
4376
2834
  {
4377
2835
  const cs_ = _1;
4378
2836
  const caseStrings_ = (await ff_core_List.List_map$(cases_, (async (_w1, $task) => {
4379
- return (("{\n" + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, _w1, true, last_, catchAsync_, $task))) + "\n}")
2837
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, _w1, [], [], true, last_, catchAsync_, $task))
4380
2838
  }), $task));
4381
2839
  if(last_) {
4382
2840
  return ff_core_List.List_join(caseStrings_, "\n")
@@ -4389,344 +2847,181 @@ return
4389
2847
  }
4390
2848
  {
4391
2849
  const _1 = term_;
4392
- {
4393
- if(_1.ECall) {
4394
- const at_ = _1.at_;
4395
- if(_1.target_.StaticCall) {
4396
- if(_1.target_.name_ === "ff:core/Try.Try_finally") {
4397
- if(_1.arguments_.length > 0) {
4398
- if(_1.arguments_[0].value_.ECall) {
4399
- const at_ = _1.arguments_[0].value_.at_;
4400
- if(_1.arguments_[0].value_.target_.StaticCall) {
4401
- if(_1.arguments_[0].value_.target_.name_ === "ff:core/Core.try") {
4402
- if(_1.arguments_[0].value_.arguments_.length > 0) {
4403
- if(_1.arguments_[0].value_.arguments_[0].value_.ELambda) {
2850
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_finally" && _1.arguments_.length === 2 && _1.arguments_[0].value_.ECall && _1.arguments_[0].value_.target_.StaticCall && _1.arguments_[0].value_.target_.name_ === "ff:core/Core.try" && _1.arguments_[0].value_.arguments_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.ELambda && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0 && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0 && _1.arguments_[1].value_.ELambda && _1.arguments_[1].value_.lambda_.cases_.length === 1 && _1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 0 && _1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
4404
2851
  const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
4405
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length > 0) {
4406
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0) {
4407
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0) {
4408
2852
  const tryBody_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].body_;
4409
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1) {
4410
- if(_1.arguments_[0].value_.arguments_.length === 1) {
4411
- if(_1.arguments_.length > 1) {
4412
- if(_1.arguments_[1].value_.ELambda) {
4413
2853
  const finallyEffect_ = _1.arguments_[1].value_.lambda_.effect_;
4414
- if(_1.arguments_[1].value_.lambda_.cases_.length > 0) {
4415
- if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 0) {
4416
- if(_1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
4417
2854
  const finallyBody_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
4418
- if(_1.arguments_[1].value_.lambda_.cases_.length === 1) {
4419
- if(_1.arguments_.length === 2) {
4420
2855
  const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
4421
2856
  const finallyAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(finallyEffect_));
4422
2857
  return ff_core_Option.Some((((("try {\n" + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, tryBody_, last_, tryAsync_, $task))) + "\n} finally {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, finallyBody_, last_, finallyAsync_, $task))) + "\n}"))
4423
- return
4424
- }
4425
- }
4426
- }
4427
- }
4428
- }
4429
- }
4430
- }
4431
- }
4432
- }
4433
- }
4434
- }
4435
- }
4436
- }
4437
- }
4438
- }
4439
- }
4440
- }
4441
- }
4442
- }
4443
2858
  }
4444
- }
4445
- }
4446
- {
4447
- if(_1.ECall) {
4448
- const at_ = _1.at_;
4449
- if(_1.target_.StaticCall) {
4450
- if(_1.target_.name_ === "ff:core/Try.Try_catch") {
4451
- if(_1.arguments_.length > 0) {
4452
- if(_1.arguments_[0].value_.ECall) {
4453
- const at_ = _1.arguments_[0].value_.at_;
4454
- if(_1.arguments_[0].value_.target_.StaticCall) {
4455
- if(_1.arguments_[0].value_.target_.name_ === "ff:core/Core.try") {
4456
- if(_1.arguments_[0].value_.arguments_.length > 0) {
4457
- if(_1.arguments_[0].value_.arguments_[0].value_.ELambda) {
2859
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_catch" && _1.arguments_.length === 2 && _1.arguments_[0].value_.ECall && _1.arguments_[0].value_.target_.StaticCall && _1.arguments_[0].value_.target_.name_ === "ff:core/Core.try" && _1.arguments_[0].value_.arguments_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.ELambda && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0 && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0 && _1.arguments_[1].value_.ELambda && _1.dictionaries_.length === 1) {
4458
2860
  const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
4459
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length > 0) {
4460
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0) {
4461
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0) {
4462
2861
  const tryBody_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].body_;
4463
- if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1) {
4464
- if(_1.arguments_[0].value_.arguments_.length === 1) {
4465
- if(_1.arguments_.length > 1) {
4466
- if(_1.arguments_[1].value_.ELambda) {
4467
2862
  const catchEffect_ = _1.arguments_[1].value_.lambda_.effect_;
4468
2863
  const cases_ = _1.arguments_[1].value_.lambda_.cases_;
4469
- if(_1.arguments_.length === 2) {
4470
- if(_1.dictionaries_.length > 0) {
4471
2864
  const dictionary_ = _1.dictionaries_[0];
4472
- if(_1.dictionaries_.length === 1) {
4473
2865
  const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
4474
2866
  const d_ = (await ff_compiler_JsEmitter.JsEmitter_emitDictionary$(self_, dictionary_, $task));
4475
2867
  return ff_core_Option.Some(((((((((("try {\n" + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, tryBody_, last_, tryAsync_, $task))) + "\n} catch(_error) {\n") + "if(!_error.ffException) throw _error\n") + "const _exception = ff_core_Any.fromAny_(_error.ffException, ") + d_) + ")\n") + "if(!_exception.Some) throw _error\n") + (await emitCatch_$(catchEffect_, cases_, $task))) + "\n}"))
4476
- return
4477
- }
4478
- }
4479
- }
4480
- }
4481
- }
4482
- }
4483
- }
4484
- }
4485
- }
4486
- }
4487
- }
4488
2868
  }
4489
- }
4490
- }
4491
- }
4492
- }
4493
- }
4494
- }
4495
- }
4496
- }
4497
- {
4498
- if(_1.ECall) {
4499
- const at_ = _1.at_;
4500
- if(_1.target_.StaticCall) {
4501
- if(_1.target_.name_ === "ff:core/Try.Try_finally") {
4502
- if(_1.arguments_.length > 0) {
4503
- if(_1.arguments_[0].value_.ECall) {
4504
- const at_ = _1.arguments_[0].value_.at_;
4505
- if(_1.arguments_[0].value_.target_.StaticCall) {
4506
- if(_1.arguments_[0].value_.target_.name_ === "ff:core/Try.Try_catch") {
4507
- if(_1.arguments_[0].value_.arguments_.length > 0) {
4508
- if(_1.arguments_[0].value_.arguments_[0].value_.ECall) {
4509
- const at_ = _1.arguments_[0].value_.arguments_[0].value_.at_;
4510
- if(_1.arguments_[0].value_.arguments_[0].value_.target_.StaticCall) {
4511
- if(_1.arguments_[0].value_.arguments_[0].value_.target_.name_ === "ff:core/Core.try") {
4512
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_.length > 0) {
4513
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.ELambda) {
2869
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_finally" && _1.arguments_.length === 2 && _1.arguments_[0].value_.ECall && _1.arguments_[0].value_.target_.StaticCall && _1.arguments_[0].value_.target_.name_ === "ff:core/Try.Try_catch" && _1.arguments_[0].value_.arguments_.length === 2 && _1.arguments_[0].value_.arguments_[0].value_.ECall && _1.arguments_[0].value_.arguments_[0].value_.target_.StaticCall && _1.arguments_[0].value_.arguments_[0].value_.target_.name_ === "ff:core/Core.try" && _1.arguments_[0].value_.arguments_[0].value_.arguments_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.ELambda && _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0 && _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0 && _1.arguments_[0].value_.arguments_[1].value_.ELambda && _1.arguments_[0].value_.dictionaries_.length === 1 && _1.arguments_[1].value_.ELambda && _1.arguments_[1].value_.lambda_.cases_.length === 1 && _1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 0 && _1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
4514
2870
  const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
4515
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length > 0) {
4516
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0) {
4517
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0) {
4518
2871
  const tryBody_ = _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].body_;
4519
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1) {
4520
- if(_1.arguments_[0].value_.arguments_[0].value_.arguments_.length === 1) {
4521
- if(_1.arguments_[0].value_.arguments_.length > 1) {
4522
- if(_1.arguments_[0].value_.arguments_[1].value_.ELambda) {
4523
2872
  const catchEffect_ = _1.arguments_[0].value_.arguments_[1].value_.lambda_.effect_;
4524
2873
  const cases_ = _1.arguments_[0].value_.arguments_[1].value_.lambda_.cases_;
4525
- if(_1.arguments_[0].value_.arguments_.length === 2) {
4526
- if(_1.arguments_[0].value_.dictionaries_.length > 0) {
4527
2874
  const dictionary_ = _1.arguments_[0].value_.dictionaries_[0];
4528
- if(_1.arguments_[0].value_.dictionaries_.length === 1) {
4529
- if(_1.arguments_.length > 1) {
4530
- if(_1.arguments_[1].value_.ELambda) {
4531
2875
  const finallyEffect_ = _1.arguments_[1].value_.lambda_.effect_;
4532
- if(_1.arguments_[1].value_.lambda_.cases_.length > 0) {
4533
- if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 0) {
4534
- if(_1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
4535
2876
  const finallyBody_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
4536
- if(_1.arguments_[1].value_.lambda_.cases_.length === 1) {
4537
- if(_1.arguments_.length === 2) {
4538
2877
  const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
4539
2878
  const finallyAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(finallyEffect_));
4540
2879
  const d_ = (await ff_compiler_JsEmitter.JsEmitter_emitDictionary$(self_, dictionary_, $task));
4541
2880
  return ff_core_Option.Some(((((((((((("try {\n" + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, tryBody_, last_, tryAsync_, $task))) + "\n} catch(_error) {\n") + "if(!_error.ffException) throw _error\n") + "const _exception = ff_core_Any.fromAny_(_error.ffException, ") + d_) + ")\n") + "if(!_exception.Some) throw _error\n") + (await emitCatch_$(catchEffect_, cases_, $task))) + "\n} finally {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, finallyBody_, last_, finallyAsync_, $task))) + "\n}"))
4542
- return
4543
- }
4544
- }
4545
- }
4546
- }
4547
- }
4548
- }
4549
- }
4550
- }
4551
- }
4552
- }
4553
- }
4554
- }
4555
- }
4556
- }
4557
- }
4558
- }
4559
- }
4560
- }
4561
- }
4562
- }
4563
- }
4564
- }
4565
- }
4566
- }
4567
- }
4568
- }
4569
- }
4570
- }
4571
- }
4572
- }
4573
2881
  }
4574
2882
  {
4575
2883
  return ff_core_Option.None()
4576
- return
4577
2884
  }
4578
2885
  }
4579
2886
  }
4580
2887
 
4581
- export async function JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task) {
2888
+ export async function JsEmitter_emitCase$(self_, arguments_, matchCase_, conditions_, variables_, jump_, last_, async_, $task) {
2889
+ function emitWrapper_(code_) {
2890
+ return ((((ff_core_List.List_isEmpty(conditions_)
2891
+ ? "{\n"
2892
+ : (("if(" + ff_core_List.List_join(conditions_, " && ")) + ") {\n")) + ff_core_List.List_join(variables_, "")) + code_) + "\n}")
2893
+ }
4582
2894
  {
4583
2895
  const _1 = ff_core_Pair.Pair(matchCase_.patterns_, matchCase_.guards_);
4584
- {
4585
- if(_1.first_.length > 0) {
2896
+ if(_1.first_.length >= 1) {
4586
2897
  const p_ = _1.first_[0];
4587
2898
  const ps_ = _1.first_.slice(1);
4588
2899
  return (await ff_compiler_JsEmitter.JsEmitter_emitPattern$(self_, ff_core_List.List_grab(arguments_, 0), p_, ff_core_List.List_dropFirst(arguments_, 1), (((_c) => {
4589
2900
  return ff_compiler_Syntax.MatchCase(_c.at_, ps_, _c.guards_, _c.body_)
4590
- }))(matchCase_), jump_, last_, async_, $task))
2901
+ }))(matchCase_), conditions_, variables_, jump_, last_, async_, $task))
4591
2902
  return
4592
2903
  }
2904
+ if(_1.first_.length === 0 && _1.second_.length === 1 && _1.second_[0].pattern_.PVariant && _1.second_[0].pattern_.name_ === "ff:core/Bool.True") {
2905
+ const e_ = _1.second_[0].term_;
2906
+ if(ff_core_List.List_isEmpty(variables_)) {
2907
+ const newCase_ = (((_c) => {
2908
+ return ff_compiler_Syntax.MatchCase(_c.at_, [], [], _c.body_)
2909
+ }))(matchCase_);
2910
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, [], newCase_, [...conditions_, (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, e_, async_, $task))], [], jump_, last_, async_, $task))
2911
+ }
2912
+ }
2913
+ if(_1.first_.length === 0 && _1.second_.length === 1 && _1.second_[0].pattern_.PVariant && _1.second_[0].pattern_.name_ === "ff:core/Bool.True") {
2914
+ const e_ = _1.second_[0].term_;
2915
+ const newCase_ = (((_c) => {
2916
+ return ff_compiler_Syntax.MatchCase(_c.at_, [], [], _c.body_)
2917
+ }))(matchCase_);
2918
+ const code_ = (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, [], newCase_, [(await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, e_, async_, $task))], [], jump_, last_, async_, $task));
2919
+ return emitWrapper_(code_)
4593
2920
  }
4594
- {
4595
- if(_1.first_.length === 0) {
4596
- if(_1.second_.length > 0) {
2921
+ if(_1.first_.length === 0 && _1.second_.length >= 1) {
4597
2922
  const guard_ = _1.second_[0];
4598
2923
  const guards_ = _1.second_.slice(1);
4599
2924
  const guardName_ = ("_guard" + (ff_core_List.List_size(guards_) + 1));
4600
2925
  const newCase_ = (((_c) => {
4601
2926
  return ff_compiler_Syntax.MatchCase(_c.at_, [guard_.pattern_], guards_, _c.body_)
4602
2927
  }))(matchCase_);
4603
- return ((((("const " + guardName_) + " = ") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, guard_.term_, async_, $task))) + ";\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, [guardName_], newCase_, jump_, last_, async_, $task)))
4604
- return
2928
+ const code_ = ((((("const " + guardName_) + " = ") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, guard_.term_, async_, $task))) + ";\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, [guardName_], newCase_, [], [], jump_, last_, async_, $task)));
2929
+ return emitWrapper_(code_)
4605
2930
  }
4606
- }
4607
- }
4608
- {
4609
- if(_1.first_.length === 0) {
4610
- if(_1.second_.length === 0) {
4611
- return ((await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, matchCase_.body_, last_, async_, $task)) + ((jump_ && last_)
2931
+ if(_1.first_.length === 0 && _1.second_.length === 0) {
2932
+ const statementsCode_ = (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, matchCase_.body_, last_, async_, $task));
2933
+ const lastLine_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(statementsCode_), ((_w1) => {
2934
+ return (_w1 !== 10)
2935
+ })));
2936
+ const returns_ = ((((((ff_core_String.String_startsWith(lastLine_, "return ", 0) || ff_core_String.String_startsWith(lastLine_, "break ", 0)) || ff_core_String.String_startsWith(lastLine_, "continue ", 0)) || ff_core_String.String_startsWith(lastLine_, "return;", 0)) || ff_core_String.String_startsWith(lastLine_, "break;", 0)) || ff_core_String.String_startsWith(lastLine_, "continue;", 0)) || ff_core_String.String_startsWith(lastLine_, "throw ", 0));
2937
+ const code_ = (statementsCode_ + (((jump_ && last_) && (!returns_))
4612
2938
  ? "\nreturn"
4613
- : jump_
2939
+ : (jump_ && (!returns_))
4614
2940
  ? "\nbreak"
4615
- : ""))
4616
- return
4617
- }
4618
- }
2941
+ : ""));
2942
+ return emitWrapper_(code_)
4619
2943
  }
4620
2944
  }
4621
2945
  }
4622
2946
 
4623
- export async function JsEmitter_emitPattern$(self_, argument_, pattern_, arguments_, matchCase_, jump_, last_, async_, $task) {
2947
+ export async function JsEmitter_emitPattern$(self_, argument_, pattern_, arguments_, matchCase_, conditions_, variables_, jump_, last_, async_, $task) {
4624
2948
  {
4625
2949
  const _1 = pattern_;
4626
- {
4627
2950
  if(_1.PString) {
4628
2951
  const value_ = _1.value_;
4629
- return (((((("if(" + argument_) + " === ") + value_) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))) + "\n}")
4630
- return
4631
- }
2952
+ const newConditions_ = [...conditions_, ((argument_ + " === ") + value_)];
2953
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, newConditions_, variables_, jump_, last_, async_, $task))
4632
2954
  }
4633
- {
4634
2955
  if(_1.PInt) {
4635
2956
  const value_ = _1.value_;
4636
- return (((((("if(" + argument_) + " === ") + value_) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))) + "\n}")
4637
- return
2957
+ const newConditions_ = [...conditions_, ((argument_ + " === ") + value_)];
2958
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, newConditions_, variables_, jump_, last_, async_, $task))
4638
2959
  }
4639
- }
4640
- {
4641
2960
  if(_1.PChar) {
4642
2961
  const value_ = _1.value_;
4643
- return (((((("if(" + argument_) + " === ") + ff_compiler_JsEmitter.charLiteralToNumber_(value_)) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))) + "\n}")
4644
- return
4645
- }
4646
- }
4647
- {
4648
- if(_1.PVariable) {
4649
- if(_1.name_.None) {
4650
- return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))
4651
- return
2962
+ const newConditions_ = [...conditions_, ((argument_ + " === ") + ff_compiler_JsEmitter.charLiteralToNumber_(value_))];
2963
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, newConditions_, variables_, jump_, last_, async_, $task))
4652
2964
  }
2965
+ if(_1.PVariable && _1.name_.None) {
2966
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, conditions_, variables_, jump_, last_, async_, $task))
4653
2967
  }
4654
- }
4655
- {
4656
- if(_1.PVariable) {
4657
- if(_1.name_.Some) {
2968
+ if(_1.PVariable && _1.name_.Some) {
4658
2969
  const name_ = _1.name_.value_;
4659
2970
  const escaped_ = ff_compiler_JsEmitter.escapeKeyword_(name_);
4660
- return (((escaped_ !== argument_)
4661
- ? (((("const " + escaped_) + " = ") + argument_) + ";\n")
4662
- : "") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task)))
4663
- return
2971
+ const newVariables_ = ((escaped_ !== argument_)
2972
+ ? [...variables_, (((("const " + escaped_) + " = ") + argument_) + ";\n")]
2973
+ : variables_);
2974
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, conditions_, newVariables_, jump_, last_, async_, $task))
4664
2975
  }
2976
+ if(_1.PVariant && _1.name_ === "ff:core/Bool.False" && _1.patterns_.length === 0) {
2977
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, [...conditions_, ("!" + argument_)], variables_, jump_, last_, async_, $task))
4665
2978
  }
2979
+ if(_1.PVariant && _1.name_ === "ff:core/Bool.True" && _1.patterns_.length === 0) {
2980
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, [...conditions_, argument_], variables_, jump_, last_, async_, $task))
4666
2981
  }
4667
- {
4668
2982
  if(_1.PVariant) {
4669
- if(_1.name_ === "ff:core/Bool.False") {
4670
- if(_1.patterns_.length === 0) {
4671
- return (((("if(!" + argument_) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))) + "\n}")
4672
- return
4673
- }
4674
- }
2983
+ const emptyOrLink_ = _1.name_;
2984
+ if(((emptyOrLink_ === "List$Empty") || (emptyOrLink_ === "List$Link"))) {
2985
+ let restPattern_ = ff_core_Option.None();
2986
+ function listPatterns_(matchPattern_) {
2987
+ const matchPattern_a = matchPattern_;
2988
+ if(matchPattern_a.PVariant && matchPattern_a.name_ === "List$Empty" && matchPattern_a.patterns_.length === 0) {
2989
+ return []
4675
2990
  }
2991
+ if(matchPattern_a.PVariant && matchPattern_a.name_ === "List$Link" && matchPattern_a.patterns_.length === 2) {
2992
+ const head_ = matchPattern_a.patterns_[0];
2993
+ const tail_ = matchPattern_a.patterns_[1];
2994
+ return [head_, ...listPatterns_(tail_)]
4676
2995
  }
4677
2996
  {
4678
- if(_1.PVariant) {
4679
- if(_1.name_ === "ff:core/Bool.True") {
4680
- if(_1.patterns_.length === 0) {
4681
- return (((("if(" + argument_) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))) + "\n}")
4682
- return
4683
- }
4684
- }
2997
+ const p_ = matchPattern_a;
2998
+ restPattern_ = ff_core_Option.Some(p_);
2999
+ return []
4685
3000
  }
4686
3001
  }
3002
+ const patterns_ = listPatterns_(pattern_);
3003
+ const itemArguments_ = ff_core_List.List_map(ff_core_List.List_pairs(patterns_), ((_1) => {
4687
3004
  {
4688
- if(_1.PVariant) {
4689
- if(_1.name_ === "List$Empty") {
4690
- if(_1.patterns_.length === 0) {
4691
- let shortArgument_ = argument_;
4692
- let shortCount_ = 0;
4693
- while(ff_core_String.String_endsWith(shortArgument_, ".slice(1)")) {
4694
- shortArgument_ = ff_core_String.String_dropLast(shortArgument_, ff_core_String.String_size(".slice(1)"));
4695
- shortCount_ += 1
4696
- };
4697
- return (((((("if(" + shortArgument_) + ".length === ") + shortCount_) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))) + "\n}")
4698
- return
4699
- }
3005
+ const i_ = _1.first_;
3006
+ return (((argument_ + "[") + i_) + "]")
4700
3007
  }
4701
- }
4702
- }
4703
- {
4704
- if(_1.PVariant) {
4705
- if(_1.name_ === "List$Link") {
4706
- if(_1.patterns_.length > 0) {
4707
- const head_ = _1.patterns_[0];
4708
- if(_1.patterns_.length > 1) {
4709
- const tail_ = _1.patterns_[1];
4710
- if(_1.patterns_.length === 2) {
4711
- let shortArgument_ = argument_;
4712
- let shortCount_ = 0;
4713
- while(ff_core_String.String_endsWith(shortArgument_, ".slice(1)")) {
4714
- shortArgument_ = ff_core_String.String_dropLast(shortArgument_, ff_core_String.String_size(".slice(1)"));
4715
- shortCount_ += 1
4716
- };
4717
- const newArguments_ = [(((shortArgument_ + "[") + shortCount_) + "]"), (argument_ + ".slice(1)"), ...arguments_];
3008
+ }));
3009
+ const restArgument_ = ff_core_Option.Option_map(restPattern_, ((_) => {
3010
+ return (((argument_ + ".slice(") + ff_core_List.List_size(patterns_)) + ")")
3011
+ }));
3012
+ const newArguments_ = [...itemArguments_, ...ff_core_Option.Option_toList(restArgument_), ...arguments_];
4718
3013
  const newMatchCase_ = (((_c) => {
4719
- return ff_compiler_Syntax.MatchCase(_c.at_, [head_, tail_, ...matchCase_.patterns_], _c.guards_, _c.body_)
3014
+ return ff_compiler_Syntax.MatchCase(_c.at_, [...patterns_, ...ff_core_Option.Option_toList(restPattern_), ...matchCase_.patterns_], _c.guards_, _c.body_)
4720
3015
  }))(matchCase_);
4721
- return (((((("if(" + shortArgument_) + ".length > ") + shortCount_) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, newArguments_, newMatchCase_, jump_, last_, async_, $task))) + "\n}")
4722
- return
4723
- }
4724
- }
4725
- }
4726
- }
3016
+ const operator_ = ff_core_Option.Option_else(ff_core_Option.Option_map(restPattern_, ((_) => {
3017
+ return ">="
3018
+ })), (() => {
3019
+ return "==="
3020
+ }));
3021
+ const newConditions_ = [...conditions_, ((((argument_ + ".length ") + operator_) + " ") + ff_core_List.List_size(patterns_))];
3022
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, newArguments_, newMatchCase_, newConditions_, variables_, jump_, last_, async_, $task))
4727
3023
  }
4728
3024
  }
4729
- {
4730
3025
  if(_1.PVariant) {
4731
3026
  const name_ = _1.name_;
4732
3027
  const patterns_ = _1.patterns_;
@@ -4734,77 +3029,58 @@ const processed_ = (await ff_compiler_JsEmitter.JsEmitter_processVariantCase$(se
4734
3029
  const newMatchCase_ = (((_c) => {
4735
3030
  return ff_compiler_Syntax.MatchCase(_c.at_, [...patterns_, ...matchCase_.patterns_], _c.guards_, _c.body_)
4736
3031
  }))(matchCase_);
4737
- return (((processed_.loneVariant_
4738
- ? ""
4739
- : (((("if(" + argument_) + ".") + processed_.variantName_) + ") {\n")) + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, [...processed_.arguments_, ...arguments_], newMatchCase_, jump_, last_, async_, $task))) + (processed_.loneVariant_
4740
- ? ""
4741
- : "\n}"))
4742
- return
3032
+ const newConditions_ = (processed_.loneVariant_
3033
+ ? conditions_
3034
+ : [...conditions_, ((argument_ + ".") + processed_.variantName_)]);
3035
+ const newArguments_ = [...processed_.arguments_, ...arguments_];
3036
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, newArguments_, newMatchCase_, newConditions_, variables_, jump_, last_, async_, $task))
4743
3037
  }
4744
- }
4745
- {
4746
3038
  if(_1.PVariantAs) {
4747
3039
  const at_ = _1.at_;
4748
3040
  const name_ = _1.name_;
4749
3041
  const variableAt_ = _1.variableAt_;
4750
3042
  const variable_ = _1.variable_;
4751
3043
  const processed_ = (await ff_compiler_JsEmitter.JsEmitter_processVariantCase$(self_, name_, argument_, $task));
4752
- return ((((processed_.loneVariant_
4753
- ? ""
4754
- : (((("if(" + argument_) + ".") + processed_.variantName_) + ") {\n")) + ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Option.Option_filter(ff_core_Option.Option_map(variable_, ((word_) => {
3044
+ const newConditions_ = (processed_.loneVariant_
3045
+ ? conditions_
3046
+ : [...conditions_, ((argument_ + ".") + processed_.variantName_)]);
3047
+ const newVariables_ = ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Option.Option_filter(ff_core_Option.Option_map(variable_, ((word_) => {
4755
3048
  return ff_compiler_JsEmitter.escapeKeyword_(word_)
4756
3049
  })), ((_w1) => {
4757
3050
  return (_w1 !== argument_)
4758
3051
  })), ((_w1) => {
4759
- return (((("const " + _w1) + " = ") + argument_) + ";\n")
3052
+ return [...variables_, (((("const " + _w1) + " = ") + argument_) + ";\n")]
4760
3053
  })), (() => {
4761
- return ""
4762
- }))) + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))) + (processed_.loneVariant_
4763
- ? ""
4764
- : "\n}"))
4765
- return
4766
- }
3054
+ return []
3055
+ }));
3056
+ return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, newConditions_, newVariables_, jump_, last_, async_, $task))
4767
3057
  }
4768
- {
4769
3058
  if(_1.PAlias) {
4770
3059
  const pattern_ = _1.pattern_;
4771
3060
  const variable_ = _1.variable_;
4772
3061
  const escaped_ = ff_compiler_JsEmitter.escapeKeyword_(variable_);
4773
- return (((escaped_ !== argument_)
4774
- ? (((("const " + escaped_) + " = ") + argument_) + ";\n")
4775
- : "") + (await ff_compiler_JsEmitter.JsEmitter_emitPattern$(self_, argument_, pattern_, arguments_, matchCase_, jump_, last_, async_, $task)))
4776
- return
4777
- }
3062
+ const newVariables_ = ((escaped_ !== argument_)
3063
+ ? [...variables_, (((("const " + escaped_) + " = ") + argument_) + ";\n")]
3064
+ : variables_);
3065
+ return (await ff_compiler_JsEmitter.JsEmitter_emitPattern$(self_, argument_, pattern_, arguments_, matchCase_, conditions_, newVariables_, jump_, last_, async_, $task))
4778
3066
  }
4779
3067
  }
4780
3068
  }
4781
3069
 
4782
3070
  export async function JsEmitter_emitList$(self_, items_, async_, $task) {
4783
3071
  return (("[" + ff_core_List.List_join((await ff_core_List.List_map$(items_, (async (_1, $task) => {
4784
- {
4785
- const item_ = _1.first_;
4786
3072
  if(!_1.second_) {
3073
+ const item_ = _1.first_;
4787
3074
  return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, item_, async_, $task))
4788
- return
4789
3075
  }
4790
- }
4791
- {
4792
- const item_ = _1.first_;
4793
3076
  if(_1.second_) {
3077
+ const item_ = _1.first_;
4794
3078
  return ("..." + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, item_, async_, $task)))
4795
- return
4796
- }
4797
3079
  }
4798
3080
  }), $task)), ", ")) + "]")
4799
3081
  }
4800
3082
 
4801
3083
  export async function JsEmitter_processVariantCase$(self_, name_, argument_, $task) {
4802
- if((name_ === "List$Empty")) {
4803
- return ff_compiler_JsEmitter.ProcessedVariantCase(name_, false, false, [])
4804
- } else {
4805
- if((name_ === "List$Link")) {
4806
- return ff_compiler_JsEmitter.ProcessedVariantCase(name_, false, false, [(argument_ + "[0]"), (argument_ + ".slice(1)")])
4807
- } else {
4808
3084
  const variantNameUnqualified_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(name_), ((_w1) => {
4809
3085
  return (_w1 !== 46)
4810
3086
  })));
@@ -4834,8 +3110,6 @@ return ((argument_ + ".") + ff_compiler_JsEmitter.escapeKeyword_(field_))
4834
3110
  }));
4835
3111
  return ff_compiler_JsEmitter.ProcessedVariantCase(variantName_, newtype_, loneVariant_, newArguments_)
4836
3112
  }
4837
- }
4838
- }
4839
3113
 
4840
3114
  export async function JsEmitter_processVariant$(self_, name_, $task) {
4841
3115
  if(ff_core_String.String_startsWith(name_, "List$", 0)) {
@@ -4862,20 +3136,12 @@ return newtype_
4862
3136
  export async function JsEmitter_emitArgument$(self_, callAt_, argument_, async_, $task) {
4863
3137
  {
4864
3138
  const _1 = argument_.value_;
4865
- {
4866
- if(_1.ECall) {
4867
- if(_1.target_.StaticCall) {
4868
- if(_1.target_.name_ === "ff:core/SourceLocation.callSite") {
3139
+ if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/SourceLocation.callSite") {
4869
3140
  return (((((((((("\"" + self_.moduleName_) + ":") + callAt_.line_) + ":") + callAt_.column_) + ",") + self_.packagePair_.group_) + ",") + self_.packagePair_.name_) + "\"")
4870
- return
4871
- }
4872
- }
4873
- }
4874
3141
  }
4875
3142
  {
4876
3143
  const value_ = _1;
4877
3144
  return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, value_, async_, $task))
4878
- return
4879
3145
  }
4880
3146
  }
4881
3147
  }
@@ -4900,276 +3166,167 @@ return ff_core_Any.internalAnyTag_((("ff:compiler/JsEmitter.ProcessedVariantCase
4900
3166
 
4901
3167
  export const ff_core_Show_Show$ff_compiler_JsEmitter_EmitTarget = {
4902
3168
  show_(value_) {
4903
- {
4904
3169
  const value_a = value_;
4905
- {
4906
3170
  if(value_a.EmitNode) {
4907
3171
  const z_ = value_a;
4908
3172
  return "EmitNode"
4909
- return
4910
- }
4911
3173
  }
4912
- {
4913
3174
  if(value_a.EmitBrowser) {
4914
3175
  const z_ = value_a;
4915
3176
  return "EmitBrowser"
4916
- return
4917
3177
  }
4918
- }
4919
- {
4920
3178
  if(value_a.EmitBuild) {
4921
3179
  const z_ = value_a;
4922
3180
  return "EmitBuild"
4923
- return
4924
- }
4925
3181
  }
4926
- {
4927
3182
  if(value_a.EmitExecutable) {
4928
3183
  const z_ = value_a;
4929
3184
  return "EmitExecutable"
4930
- return
4931
- }
4932
- }
4933
3185
  }
4934
3186
  },
4935
3187
  async show_$(value_, $task) {
4936
- {
4937
3188
  const value_a = value_;
4938
- {
4939
3189
  if(value_a.EmitNode) {
4940
3190
  const z_ = value_a;
4941
3191
  return "EmitNode"
4942
- return
4943
- }
4944
3192
  }
4945
- {
4946
3193
  if(value_a.EmitBrowser) {
4947
3194
  const z_ = value_a;
4948
3195
  return "EmitBrowser"
4949
- return
4950
3196
  }
4951
- }
4952
- {
4953
3197
  if(value_a.EmitBuild) {
4954
3198
  const z_ = value_a;
4955
3199
  return "EmitBuild"
4956
- return
4957
- }
4958
3200
  }
4959
- {
4960
3201
  if(value_a.EmitExecutable) {
4961
3202
  const z_ = value_a;
4962
3203
  return "EmitExecutable"
4963
- return
4964
- }
4965
- }
4966
3204
  }
4967
3205
  }
4968
3206
  };
4969
3207
 
4970
3208
  export const ff_core_Show_Show$ff_compiler_JsEmitter_ProcessedVariantCase = {
4971
3209
  show_(value_) {
4972
- {
4973
3210
  const value_a = value_;
4974
3211
  {
4975
3212
  const z_ = value_a;
4976
3213
  return ((((((((("ProcessedVariantCase" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.variantName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_Bool_Bool.show_(z_.newtype_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_Bool_Bool.show_(z_.loneVariant_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.arguments_)) + ")")
4977
- return
4978
- }
4979
3214
  }
4980
3215
  },
4981
3216
  async show_$(value_, $task) {
4982
- {
4983
3217
  const value_a = value_;
4984
3218
  {
4985
3219
  const z_ = value_a;
4986
3220
  return ((((((((("ProcessedVariantCase" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.variantName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_Bool_Bool.show_(z_.newtype_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_Bool_Bool.show_(z_.loneVariant_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.arguments_)) + ")")
4987
- return
4988
- }
4989
3221
  }
4990
3222
  }
4991
3223
  };
4992
3224
 
4993
3225
  export const ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget = {
4994
3226
  equals_(x_, y_) {
4995
- {
4996
3227
  const x_a = x_;
4997
3228
  const y_a = y_;
4998
- {
4999
- const _guard1 = (x_ === y_);
5000
- if(_guard1) {
3229
+ if((x_ === y_)) {
5001
3230
  return true
5002
- return
5003
- }
5004
3231
  }
5005
3232
  {
5006
3233
  return false
5007
- return
5008
- }
5009
3234
  }
5010
3235
  },
5011
3236
  async equals_$(x_, y_, $task) {
5012
- {
5013
3237
  const x_a = x_;
5014
3238
  const y_a = y_;
5015
- {
5016
- const _guard1 = (x_ === y_);
5017
- if(_guard1) {
3239
+ if((x_ === y_)) {
5018
3240
  return true
5019
- return
5020
- }
5021
3241
  }
5022
3242
  {
5023
3243
  return false
5024
- return
5025
- }
5026
3244
  }
5027
3245
  }
5028
3246
  };
5029
3247
 
5030
3248
  export const ff_core_Equal_Equal$ff_compiler_JsEmitter_ProcessedVariantCase = {
5031
3249
  equals_(x_, y_) {
5032
- {
5033
3250
  const x_a = x_;
5034
3251
  const y_a = y_;
5035
- {
5036
- const _guard1 = (x_ === y_);
5037
- if(_guard1) {
3252
+ if((x_ === y_)) {
5038
3253
  return true
5039
- return
5040
- }
5041
3254
  }
5042
3255
  {
5043
3256
  return ((x_.variantName_ === y_.variantName_) && ((x_.newtype_ === y_.newtype_) && ((x_.loneVariant_ === y_.loneVariant_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.arguments_, y_.arguments_))))
5044
- return
5045
- }
5046
3257
  }
5047
3258
  },
5048
3259
  async equals_$(x_, y_, $task) {
5049
- {
5050
3260
  const x_a = x_;
5051
3261
  const y_a = y_;
5052
- {
5053
- const _guard1 = (x_ === y_);
5054
- if(_guard1) {
3262
+ if((x_ === y_)) {
5055
3263
  return true
5056
- return
5057
- }
5058
3264
  }
5059
3265
  {
5060
3266
  return ((x_.variantName_ === y_.variantName_) && ((x_.newtype_ === y_.newtype_) && ((x_.loneVariant_ === y_.loneVariant_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.arguments_, y_.arguments_))))
5061
- return
5062
- }
5063
3267
  }
5064
3268
  }
5065
3269
  };
5066
3270
 
5067
3271
  export const ff_core_Ordering_Order$ff_compiler_JsEmitter_EmitTarget = {
5068
3272
  compare_(x_, y_) {
5069
- {
5070
3273
  const x_a = x_;
5071
3274
  const y_a = y_;
5072
- {
5073
- const _guard1 = (x_ === y_);
5074
- if(_guard1) {
3275
+ if((x_ === y_)) {
5075
3276
  return ff_core_Ordering.OrderingSame()
5076
- return
5077
- }
5078
3277
  }
5079
3278
  {
5080
3279
  function number_(z_) {
5081
- {
5082
3280
  const z_a = z_;
5083
- {
5084
3281
  if(z_a.EmitNode) {
5085
3282
  return 0
5086
- return
5087
- }
5088
3283
  }
5089
- {
5090
3284
  if(z_a.EmitBrowser) {
5091
3285
  return 1
5092
- return
5093
3286
  }
5094
- }
5095
- {
5096
3287
  if(z_a.EmitBuild) {
5097
3288
  return 2
5098
- return
5099
- }
5100
3289
  }
5101
- {
5102
3290
  if(z_a.EmitExecutable) {
5103
3291
  return 3
5104
- return
5105
- }
5106
- }
5107
3292
  }
5108
3293
  }
5109
3294
  return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(number_(x_), number_(y_))
5110
- return
5111
- }
5112
3295
  }
5113
3296
  },
5114
3297
  async compare_$(x_, y_, $task) {
5115
- {
5116
3298
  const x_a = x_;
5117
3299
  const y_a = y_;
5118
- {
5119
- const _guard1 = (x_ === y_);
5120
- if(_guard1) {
3300
+ if((x_ === y_)) {
5121
3301
  return ff_core_Ordering.OrderingSame()
5122
- return
5123
- }
5124
3302
  }
5125
3303
  {
5126
3304
  function number_(z_) {
5127
- {
5128
3305
  const z_a = z_;
5129
- {
5130
3306
  if(z_a.EmitNode) {
5131
3307
  return 0
5132
- return
5133
- }
5134
3308
  }
5135
- {
5136
3309
  if(z_a.EmitBrowser) {
5137
3310
  return 1
5138
- return
5139
3311
  }
5140
- }
5141
- {
5142
3312
  if(z_a.EmitBuild) {
5143
3313
  return 2
5144
- return
5145
- }
5146
3314
  }
5147
- {
5148
3315
  if(z_a.EmitExecutable) {
5149
3316
  return 3
5150
- return
5151
- }
5152
- }
5153
3317
  }
5154
3318
  }
5155
3319
  return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(number_(x_), number_(y_))
5156
- return
5157
- }
5158
3320
  }
5159
3321
  }
5160
3322
  };
5161
3323
 
5162
3324
  export const ff_core_Ordering_Order$ff_compiler_JsEmitter_ProcessedVariantCase = {
5163
3325
  compare_(x_, y_) {
5164
- {
5165
3326
  const x_a = x_;
5166
3327
  const y_a = y_;
5167
- {
5168
- const _guard1 = (x_ === y_);
5169
- if(_guard1) {
3328
+ if((x_ === y_)) {
5170
3329
  return ff_core_Ordering.OrderingSame()
5171
- return
5172
- }
5173
3330
  }
5174
3331
  {
5175
3332
  const variantNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.variantName_, y_.variantName_);
@@ -5195,18 +3352,12 @@ return ff_core_Ordering.OrderingSame()
5195
3352
  }
5196
3353
  return
5197
3354
  }
5198
- }
5199
3355
  },
5200
3356
  async compare_$(x_, y_, $task) {
5201
- {
5202
3357
  const x_a = x_;
5203
3358
  const y_a = y_;
5204
- {
5205
- const _guard1 = (x_ === y_);
5206
- if(_guard1) {
3359
+ if((x_ === y_)) {
5207
3360
  return ff_core_Ordering.OrderingSame()
5208
- return
5209
- }
5210
3361
  }
5211
3362
  {
5212
3363
  const variantNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.variantName_, y_.variantName_);
@@ -5233,15 +3384,12 @@ return ff_core_Ordering.OrderingSame()
5233
3384
  return
5234
3385
  }
5235
3386
  }
5236
- }
5237
3387
  };
5238
3388
 
5239
3389
  export const ff_core_Serializable_Serializable$ff_compiler_JsEmitter_EmitTarget = {
5240
3390
  serializeUsing_(serialization_, value_) {
5241
- {
5242
3391
  const serialization_a = serialization_;
5243
3392
  const value_a = value_;
5244
- {
5245
3393
  if(value_a.EmitNode) {
5246
3394
  const v_ = value_a;
5247
3395
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 30), 0);
@@ -5250,8 +3398,6 @@ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0
5250
3398
  serialization_.offset_ += 1
5251
3399
  return
5252
3400
  }
5253
- }
5254
- {
5255
3401
  if(value_a.EmitBrowser) {
5256
3402
  const v_ = value_a;
5257
3403
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
@@ -5260,8 +3406,6 @@ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 1
5260
3406
  serialization_.offset_ += 1
5261
3407
  return
5262
3408
  }
5263
- }
5264
- {
5265
3409
  if(value_a.EmitBuild) {
5266
3410
  const v_ = value_a;
5267
3411
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
@@ -5270,8 +3414,6 @@ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 2
5270
3414
  serialization_.offset_ += 1
5271
3415
  return
5272
3416
  }
5273
- }
5274
- {
5275
3417
  if(value_a.EmitExecutable) {
5276
3418
  const v_ = value_a;
5277
3419
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
@@ -5280,53 +3422,36 @@ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 3
5280
3422
  serialization_.offset_ += 1
5281
3423
  return
5282
3424
  }
5283
- }
5284
- }
5285
3425
  },
5286
3426
  deserializeUsing_(serialization_) {
5287
3427
  const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
5288
3428
  serialization_.offset_ += 1;
5289
3429
  {
5290
3430
  const _1 = variantIndex_;
5291
- {
5292
3431
  if(_1 === 0) {
5293
3432
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 30), 0);
5294
3433
  return ff_compiler_JsEmitter.EmitNode()
5295
- return
5296
3434
  }
5297
- }
5298
- {
5299
3435
  if(_1 === 1) {
5300
3436
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
5301
3437
  return ff_compiler_JsEmitter.EmitBrowser()
5302
- return
5303
- }
5304
3438
  }
5305
- {
5306
3439
  if(_1 === 2) {
5307
3440
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
5308
3441
  return ff_compiler_JsEmitter.EmitBuild()
5309
- return
5310
3442
  }
5311
- }
5312
- {
5313
3443
  if(_1 === 3) {
5314
3444
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
5315
3445
  return ff_compiler_JsEmitter.EmitExecutable()
5316
- return
5317
- }
5318
3446
  }
5319
3447
  {
5320
3448
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
5321
- return
5322
3449
  }
5323
3450
  }
5324
3451
  },
5325
3452
  async serializeUsing_$(serialization_, value_, $task) {
5326
- {
5327
3453
  const serialization_a = serialization_;
5328
3454
  const value_a = value_;
5329
- {
5330
3455
  if(value_a.EmitNode) {
5331
3456
  const v_ = value_a;
5332
3457
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 30), 0);
@@ -5335,8 +3460,6 @@ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0
5335
3460
  serialization_.offset_ += 1
5336
3461
  return
5337
3462
  }
5338
- }
5339
- {
5340
3463
  if(value_a.EmitBrowser) {
5341
3464
  const v_ = value_a;
5342
3465
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
@@ -5345,8 +3468,6 @@ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 1
5345
3468
  serialization_.offset_ += 1
5346
3469
  return
5347
3470
  }
5348
- }
5349
- {
5350
3471
  if(value_a.EmitBuild) {
5351
3472
  const v_ = value_a;
5352
3473
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
@@ -5355,8 +3476,6 @@ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 2
5355
3476
  serialization_.offset_ += 1
5356
3477
  return
5357
3478
  }
5358
- }
5359
- {
5360
3479
  if(value_a.EmitExecutable) {
5361
3480
  const v_ = value_a;
5362
3481
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
@@ -5365,45 +3484,30 @@ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 3
5365
3484
  serialization_.offset_ += 1
5366
3485
  return
5367
3486
  }
5368
- }
5369
- }
5370
3487
  },
5371
3488
  async deserializeUsing_$(serialization_, $task) {
5372
3489
  const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
5373
3490
  serialization_.offset_ += 1;
5374
3491
  {
5375
3492
  const _1 = variantIndex_;
5376
- {
5377
3493
  if(_1 === 0) {
5378
3494
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 30), 0);
5379
3495
  return ff_compiler_JsEmitter.EmitNode()
5380
- return
5381
- }
5382
3496
  }
5383
- {
5384
3497
  if(_1 === 1) {
5385
3498
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
5386
3499
  return ff_compiler_JsEmitter.EmitBrowser()
5387
- return
5388
3500
  }
5389
- }
5390
- {
5391
3501
  if(_1 === 2) {
5392
3502
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
5393
3503
  return ff_compiler_JsEmitter.EmitBuild()
5394
- return
5395
- }
5396
3504
  }
5397
- {
5398
3505
  if(_1 === 3) {
5399
3506
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
5400
3507
  return ff_compiler_JsEmitter.EmitExecutable()
5401
- return
5402
- }
5403
3508
  }
5404
3509
  {
5405
3510
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
5406
- return
5407
3511
  }
5408
3512
  }
5409
3513
  }
@@ -5411,7 +3515,6 @@ return
5411
3515
 
5412
3516
  export const ff_core_Serializable_Serializable$ff_compiler_JsEmitter_ProcessedVariantCase = {
5413
3517
  serializeUsing_(serialization_, value_) {
5414
- {
5415
3518
  const serialization_a = serialization_;
5416
3519
  const value_a = value_;
5417
3520
  {
@@ -5426,28 +3529,22 @@ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.seriali
5426
3529
  ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.arguments_)
5427
3530
  return
5428
3531
  }
5429
- }
5430
3532
  },
5431
3533
  deserializeUsing_(serialization_) {
5432
3534
  const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
5433
3535
  serialization_.offset_ += 1;
5434
3536
  {
5435
3537
  const _1 = variantIndex_;
5436
- {
5437
3538
  if(_1 === 0) {
5438
3539
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
5439
3540
  return ff_compiler_JsEmitter.ProcessedVariantCase(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_))
5440
- return
5441
- }
5442
3541
  }
5443
3542
  {
5444
3543
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
5445
- return
5446
3544
  }
5447
3545
  }
5448
3546
  },
5449
3547
  async serializeUsing_$(serialization_, value_, $task) {
5450
- {
5451
3548
  const serialization_a = serialization_;
5452
3549
  const value_a = value_;
5453
3550
  {
@@ -5462,23 +3559,18 @@ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.seriali
5462
3559
  ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.arguments_)
5463
3560
  return
5464
3561
  }
5465
- }
5466
3562
  },
5467
3563
  async deserializeUsing_$(serialization_, $task) {
5468
3564
  const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
5469
3565
  serialization_.offset_ += 1;
5470
3566
  {
5471
3567
  const _1 = variantIndex_;
5472
- {
5473
3568
  if(_1 === 0) {
5474
3569
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
5475
3570
  return ff_compiler_JsEmitter.ProcessedVariantCase(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_))
5476
- return
5477
- }
5478
3571
  }
5479
3572
  {
5480
3573
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
5481
- return
5482
3574
  }
5483
3575
  }
5484
3576
  }