@magnusopera/fscript 0.86.2 → 0.87.0

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.
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { FSharpRef, Union, Record } from "../fable_modules/fable-library-js.5.24.0/Types.js";
3
3
  import { union_type, option_type, int32_type, list_type, bool_type, record_type, class_type, string_type } from "../fable_modules/fable-library-js.5.24.0/Reflection.js";
4
- import { contains, add as add_1, singleton as singleton_1, toList, FSharpSet__get_IsEmpty, difference, ofList as ofList_1, ofSeq, union, empty as empty_1 } from "../fable_modules/fable-library-js.5.24.0/Set.js";
4
+ import { fold as fold_2, contains, add as add_1, singleton as singleton_1, toList, FSharpSet__get_IsEmpty, difference, ofList as ofList_1, ofSeq, union, empty as empty_1 } from "../fable_modules/fable-library-js.5.24.0/Set.js";
5
5
  import { compareArrays, stringHash, clear, curry2, int32ToString, curry3, defaultOf, disposeSafe, getEnumerator, safeHash, arrayHash, equalArrays, Exception, equals, compare, comparePrimitives } from "../fable_modules/fable-library-js.5.24.0/Util.js";
6
6
  import { Span_$reflection } from "./Span.js";
7
7
  import { ResolvedSymbolKind, ResolvedExpression_$reflection, ResolvedBinding_$reflection } from "./TypeInfer.js";
@@ -432,45 +432,45 @@ export function analyze(registration, options, program) {
432
432
  let matchValue_6;
433
433
  return append_1((matchValue_6 = expression.Node, (matchValue_6.tag === 1) ? singleton_2(matchValue_6.fields[0].SymbolId) : (empty_4())), delay(() => collect_1(references, expression.Children)));
434
434
  });
435
- const bindPattern = (env_1_mut, pattern_mut, value_9_mut) => {
435
+ const bindPattern = (env_1_mut, pattern_mut, value_10_mut) => {
436
436
  bindPattern:
437
437
  while (true) {
438
- const env_1 = env_1_mut, pattern = pattern_mut, value_9 = value_9_mut;
438
+ const env_1 = env_1_mut, pattern = pattern_mut, value_10 = value_10_mut;
439
439
  let mapping_18, option_13;
440
- const bind = (env_2, pattern_1) => bindPattern(env_2, pattern_1, value_9);
441
- const matchValue_7 = pattern.Node;
440
+ const bind = (env_2, pattern_1) => bindPattern(env_2, pattern_1, value_10);
441
+ const matchValue_8 = pattern.Node;
442
442
  let matchResult_2, binding_1, patterns, fields_2, a, b, pattern_4, pattern_5, entries, tail;
443
- switch (matchValue_7.tag) {
443
+ switch (matchValue_8.tag) {
444
444
  case 1: {
445
445
  matchResult_2 = 0;
446
- binding_1 = matchValue_7.fields[0];
446
+ binding_1 = matchValue_8.fields[0];
447
447
  break;
448
448
  }
449
449
  case 5: {
450
450
  matchResult_2 = 1;
451
- patterns = matchValue_7.fields[0];
451
+ patterns = matchValue_8.fields[0];
452
452
  break;
453
453
  }
454
454
  case 6: {
455
455
  matchResult_2 = 2;
456
- fields_2 = matchValue_7.fields[0];
456
+ fields_2 = matchValue_8.fields[0];
457
457
  break;
458
458
  }
459
459
  case 4: {
460
460
  matchResult_2 = 3;
461
- a = matchValue_7.fields[0];
462
- b = matchValue_7.fields[1];
461
+ a = matchValue_8.fields[0];
462
+ b = matchValue_8.fields[1];
463
463
  break;
464
464
  }
465
465
  case 8: {
466
466
  matchResult_2 = 4;
467
- pattern_4 = matchValue_7.fields[0];
467
+ pattern_4 = matchValue_8.fields[0];
468
468
  break;
469
469
  }
470
470
  case 10: {
471
- if (matchValue_7.fields[2] != null) {
471
+ if (matchValue_8.fields[2] != null) {
472
472
  matchResult_2 = 5;
473
- pattern_5 = matchValue_7.fields[2];
473
+ pattern_5 = matchValue_8.fields[2];
474
474
  }
475
475
  else {
476
476
  matchResult_2 = 7;
@@ -479,8 +479,8 @@ export function analyze(registration, options, program) {
479
479
  }
480
480
  case 7: {
481
481
  matchResult_2 = 6;
482
- entries = matchValue_7.fields[0];
483
- tail = matchValue_7.fields[1];
482
+ entries = matchValue_8.fields[0];
483
+ tail = matchValue_8.fields[1];
484
484
  break;
485
485
  }
486
486
  default:
@@ -488,27 +488,27 @@ export function analyze(registration, options, program) {
488
488
  }
489
489
  switch (matchResult_2) {
490
490
  case 0:
491
- return add(binding_1.SymbolId, value_9, env_1);
491
+ return add(binding_1.SymbolId, value_10, env_1);
492
492
  case 1:
493
- return fold((env_3, tupledArg_1) => bindPattern(env_3, tupledArg_1[1], defaultArg(tryFind(int32ToString(tupledArg_1[0]), value_9.Fields), value_9)), env_1, indexed(patterns));
493
+ return fold((env_3, tupledArg_1) => bindPattern(env_3, tupledArg_1[1], defaultArg(tryFind(int32ToString(tupledArg_1[0]), value_10.Fields), value_10)), env_1, indexed(patterns));
494
494
  case 2:
495
- return fold((env_4, tupledArg_2) => bindPattern(env_4, tupledArg_2[1], defaultArg(tryFind(tupledArg_2[0], value_9.Fields), value_9)), env_1, fields_2);
495
+ return fold((env_4, tupledArg_2) => bindPattern(env_4, tupledArg_2[1], defaultArg(tryFind(tupledArg_2[0], value_10.Fields), value_10)), env_1, fields_2);
496
496
  case 3: {
497
- env_1_mut = bindPattern(env_1, a, contents(value_9));
497
+ env_1_mut = bindPattern(env_1, a, contents(value_10));
498
498
  pattern_mut = b;
499
- value_9_mut = value_9;
499
+ value_10_mut = value_10;
500
500
  continue bindPattern;
501
501
  }
502
502
  case 4: {
503
503
  env_1_mut = env_1;
504
504
  pattern_mut = pattern_4;
505
- value_9_mut = contents(value_9);
505
+ value_10_mut = contents(value_10);
506
506
  continue bindPattern;
507
507
  }
508
508
  case 5:
509
509
  return bind(env_1, pattern_5);
510
510
  case 6: {
511
- const env_6 = fold((env_5, tupledArg_3) => bindPattern(bindPattern(env_5, tupledArg_3[0], contents(value_9)), tupledArg_3[1], contents(value_9)), env_1, entries);
511
+ const env_6 = fold((env_5, tupledArg_3) => bindPattern(bindPattern(env_5, tupledArg_3[0], contents(value_10)), tupledArg_3[1], contents(value_10)), env_1, entries);
512
512
  return defaultArg((mapping_18 = curry2(bind)(env_6), (option_13 = tail, (option_13 != null) ? mapping_18(option_13) : undefined)), env_6);
513
513
  }
514
514
  default:
@@ -518,75 +518,85 @@ export function analyze(registration, options, program) {
518
518
  }
519
519
  };
520
520
  const evaluate = (env_7) => ((expression_1) => {
521
- let matchValue_11, matchValue_12, option_19, option_21;
521
+ let matchValue_12, matchValue_13, option_19, option_21;
522
522
  const eval$ = evaluate(env_7);
523
- const matchValue_8 = expression_1.Node;
524
- switch (matchValue_8.tag) {
523
+ const matchValue_9 = expression_1.Node;
524
+ switch (matchValue_9.tag) {
525
525
  case 1: {
526
- const reference_1 = matchValue_8.fields[0];
527
- const matchValue_9 = tryFind(reference_1.SymbolId, env_7);
528
- if (matchValue_9 == null) {
526
+ const reference_1 = matchValue_9.fields[0];
527
+ const matchValue_10 = tryFind(reference_1.SymbolId, env_7);
528
+ if (matchValue_10 == null) {
529
529
  if (equals(reference_1.Kind, ResolvedSymbolKind.ExternSymbol) ? true : equals(reference_1.Kind, ResolvedSymbolKind.BuiltinSymbol)) {
530
- const arity = (_arg_5) => {
531
- if (_arg_5.tag === 11) {
532
- return (1 + arity(_arg_5.fields[1])) | 0;
530
+ const arity = (_arg_4) => {
531
+ if (_arg_4.tag === 11) {
532
+ return (1 + arity(_arg_4.fields[1])) | 0;
533
533
  }
534
534
  else {
535
535
  return 0;
536
536
  }
537
537
  };
538
538
  const count = defaultArg(tryFind(reference_1.Name, functions), arity(reference_1.Type)) | 0;
539
- const value_12 = new AbstractValue(empty.Resources, empty.Fields, singleton(new Callable(/* Function */ 1, [reference_1.Name, count, equals(reference_1.Kind, ResolvedSymbolKind.ExternSymbol), reference_1.Type, empty_3()])), empty.Tasks, empty.Count);
540
- return (count === 0) ? invokeFunction(expression_1.Span)(expression_1.Type)(reference_1.Name)(equals(reference_1.Kind, ResolvedSymbolKind.ExternSymbol))(empty_3()) : value_12;
539
+ const value_13 = new AbstractValue(empty.Resources, empty.Fields, singleton(new Callable(/* Function */ 1, [reference_1.Name, count, equals(reference_1.Kind, ResolvedSymbolKind.ExternSymbol), reference_1.Type, empty_3()])), empty.Tasks, empty.Count);
540
+ return (count === 0) ? invokeFunction(expression_1.Span)(expression_1.Type)(reference_1.Name)(equals(reference_1.Kind, ResolvedSymbolKind.ExternSymbol))(empty_3()) : value_13;
541
541
  }
542
542
  else {
543
543
  return unknown("symbol:" + int32ToString(reference_1.SymbolId), expression_1.Type);
544
544
  }
545
545
  }
546
546
  else {
547
- return matchValue_9;
547
+ return matchValue_10;
548
548
  }
549
549
  }
550
550
  case 2: {
551
- const binding = matchValue_8.fields[0];
552
- const body = matchValue_8.fields[1];
551
+ const binding = matchValue_9.fields[0];
552
+ const body = matchValue_9.fields[1];
553
553
  const capturedIds = ofSeq(references(body), {
554
554
  Compare: (x_14, y_14) => (comparePrimitives(x_14, y_14) | 0),
555
555
  });
556
- const captured = filter_1((id, _arg_4) => contains(id, capturedIds), env_7);
556
+ const captured = fold_2((state_2, id) => {
557
+ const matchValue_7 = tryFind(id, env_7);
558
+ if (matchValue_7 == null) {
559
+ return state_2;
560
+ }
561
+ else {
562
+ return add(id, matchValue_7, state_2);
563
+ }
564
+ }, empty_2({
565
+ Compare: (x_15, y_15) => (comparePrimitives(x_15, y_15) | 0),
566
+ }), capturedIds);
557
567
  const captures = combine(map((tuple_7) => tuple_7[1], toList_1(captured)));
558
568
  return new AbstractValue(captures.Resources, captures.Fields, singleton(new Callable(/* Closure */ 0, [binding.SymbolId, binding, body, new FSharpRef(captured)])), captures.Tasks, captures.Count);
559
569
  }
560
570
  case 3:
561
- return apply(expression_1.Span)(expression_1.Type)(eval$(matchValue_8.fields[0]))(eval$(matchValue_8.fields[1]));
571
+ return apply(expression_1.Span)(expression_1.Type)(eval$(matchValue_9.fields[0]))(eval$(matchValue_9.fields[1]));
562
572
  case 4: {
563
- const argument_3 = eval$(matchValue_8.fields[0]);
564
- return apply(expression_1.Span)(expression_1.Type)(eval$(matchValue_8.fields[1]))(argument_3);
573
+ const argument_3 = eval$(matchValue_9.fields[0]);
574
+ return apply(expression_1.Span)(expression_1.Type)(eval$(matchValue_9.fields[1]))(argument_3);
565
575
  }
566
576
  case 15: {
567
- const value_14 = eval$(matchValue_8.fields[2]);
568
- const next = add(matchValue_8.fields[0].SymbolId, value_14, env_7);
569
- if (matchValue_8.fields[1]) {
570
- wireRecursive(next)(singleton(value_14));
577
+ const value_15 = eval$(matchValue_9.fields[2]);
578
+ const next = add(matchValue_9.fields[0].SymbolId, value_15, env_7);
579
+ if (matchValue_9.fields[1]) {
580
+ wireRecursive(next)(singleton(value_15));
571
581
  }
572
- return evaluate(next)(matchValue_8.fields[3]);
582
+ return evaluate(next)(matchValue_9.fields[3]);
573
583
  }
574
584
  case 16: {
575
- const values_7 = map((binding_4) => [binding_4.Binding.SymbolId, eval$(binding_4.Value)], matchValue_8.fields[0]);
576
- const next_1 = fold((state_2, tupledArg_4) => add(tupledArg_4[0], tupledArg_4[1], state_2), env_7, values_7);
585
+ const values_7 = map((binding_4) => [binding_4.Binding.SymbolId, eval$(binding_4.Value)], matchValue_9.fields[0]);
586
+ const next_1 = fold((state_4, tupledArg_4) => add(tupledArg_4[0], tupledArg_4[1], state_4), env_7, values_7);
577
587
  wireRecursive(next_1)(map((tuple_8) => tuple_8[1], values_7));
578
- return evaluate(next_1)(matchValue_8.fields[1]);
588
+ return evaluate(next_1)(matchValue_9.fields[1]);
579
589
  }
580
590
  case 5: {
581
- const yes = matchValue_8.fields[1];
582
- const no = matchValue_8.fields[2];
583
- const condition = matchValue_8.fields[0];
591
+ const yes = matchValue_9.fields[1];
592
+ const no = matchValue_9.fields[2];
593
+ const condition = matchValue_9.fields[0];
584
594
  eval$(condition);
585
- const matchValue_10 = condition.Node;
595
+ const matchValue_11 = condition.Node;
586
596
  let matchResult_3;
587
- if (matchValue_10.tag === 0) {
588
- if (matchValue_10.fields[0].tag === 3) {
589
- if (matchValue_10.fields[0].fields[0]) {
597
+ if (matchValue_11.tag === 0) {
598
+ if (matchValue_11.fields[0].tag === 3) {
599
+ if (matchValue_11.fields[0].fields[0]) {
590
600
  matchResult_3 = 0;
591
601
  }
592
602
  else {
@@ -610,78 +620,78 @@ export function analyze(registration, options, program) {
610
620
  }
611
621
  }
612
622
  case 18: {
613
- const value_17 = eval$(matchValue_8.fields[0]);
623
+ const value_18 = eval$(matchValue_9.fields[0]);
614
624
  return branches(map((case$) => (() => {
615
- const next_2 = bindPattern(env_7, case$.Pattern, value_17);
625
+ const next_2 = bindPattern(env_7, case$.Pattern, value_18);
616
626
  const option_17 = case$.Guard;
617
627
  if (option_17 != null) {
618
628
  evaluate(next_2)(option_17);
619
629
  }
620
630
  return evaluate(next_2)(case$.Body);
621
- }), matchValue_8.fields[1]));
631
+ }), matchValue_9.fields[1]));
622
632
  }
623
633
  case 11:
624
- return container("$value", undefined, eval$(matchValue_8.fields[0]));
634
+ return container("$value", undefined, eval$(matchValue_9.fields[0]));
625
635
  case 8: {
626
- const expressions = matchValue_8.fields[0];
636
+ const expressions = matchValue_9.fields[0];
627
637
  return container("$items", length(expressions), combine(map(eval$, expressions)));
628
638
  }
629
639
  case 19: {
630
- const last = matchValue_8.fields[1];
631
- const first_1 = matchValue_8.fields[0];
640
+ const last = matchValue_9.fields[1];
641
+ const first_1 = matchValue_9.fields[0];
632
642
  eval$(first_1);
633
643
  eval$(last);
634
- return container("$items", (matchValue_11 = first_1.Node, (matchValue_12 = last.Node, (matchValue_11.tag === 0) ? ((matchValue_11.fields[0].tag === 1) ? ((matchValue_12.tag === 0) ? ((matchValue_12.fields[0].tag === 1) ? (equals_1(matchValue_11.fields[0].fields[0], matchValue_12.fields[0].fields[0]) ? 1 : 2) : undefined) : undefined) : undefined) : undefined)), empty);
644
+ return container("$items", (matchValue_12 = first_1.Node, (matchValue_13 = last.Node, (matchValue_12.tag === 0) ? ((matchValue_12.fields[0].tag === 1) ? ((matchValue_13.tag === 0) ? ((matchValue_13.fields[0].tag === 1) ? (equals_1(matchValue_12.fields[0].fields[0], matchValue_13.fields[0].fields[0]) ? 1 : 2) : undefined) : undefined) : undefined) : undefined)), empty);
635
645
  }
636
646
  case 13: {
637
- const matchValue_14 = eval$(matchValue_8.fields[0]);
638
- const rest_2 = eval$(matchValue_8.fields[1]);
639
- return container("$items", (option_19 = rest_2.Count, (option_19 != null) ? (1 + option_19) : undefined), combine(ofArray([matchValue_14, contents(rest_2)])));
647
+ const matchValue_15 = eval$(matchValue_9.fields[0]);
648
+ const rest_2 = eval$(matchValue_9.fields[1]);
649
+ return container("$items", (option_19 = rest_2.Count, (option_19 != null) ? (1 + option_19) : undefined), combine(ofArray([matchValue_15, contents(rest_2)])));
640
650
  }
641
651
  case 14: {
642
- const matchValue_16 = eval$(matchValue_8.fields[0]);
643
- const matchValue_17 = eval$(matchValue_8.fields[1]);
644
- return container("$items", undefined, combine(ofArray([contents(matchValue_16), contents(matchValue_17)])));
652
+ const matchValue_17 = eval$(matchValue_9.fields[0]);
653
+ const matchValue_18 = eval$(matchValue_9.fields[1]);
654
+ return container("$items", undefined, combine(ofArray([contents(matchValue_17), contents(matchValue_18)])));
645
655
  }
646
656
  case 21: {
647
- eval$(matchValue_8.fields[1]);
648
- return contents(eval$(matchValue_8.fields[0]));
657
+ eval$(matchValue_9.fields[1]);
658
+ return contents(eval$(matchValue_9.fields[0]));
649
659
  }
650
660
  case 23:
651
- return container("$items", undefined, combine(collect((_arg_6) => {
652
- if (_arg_6.tag === 1) {
653
- return singleton(contents(eval$(_arg_6.fields[0])));
661
+ return container("$items", undefined, combine(collect((_arg_5) => {
662
+ if (_arg_5.tag === 1) {
663
+ return singleton(contents(eval$(_arg_5.fields[0])));
654
664
  }
655
665
  else {
656
- return ofArray([eval$(_arg_6.fields[0]), eval$(_arg_6.fields[1])]);
666
+ return ofArray([eval$(_arg_5.fields[0]), eval$(_arg_5.fields[1])]);
657
667
  }
658
- }, matchValue_8.fields[0])));
668
+ }, matchValue_9.fields[0])));
659
669
  case 7: {
660
- const fields_3 = ofList(mapIndexed((index_2, value_25) => [int32ToString(index_2), eval$(value_25)], matchValue_8.fields[0]), {
661
- Compare: (x_16, y_16) => (comparePrimitives(x_16, y_16) | 0),
670
+ const fields_3 = ofList(mapIndexed((index_2, value_26) => [int32ToString(index_2), eval$(value_26)], matchValue_9.fields[0]), {
671
+ Compare: (x_17, y_17) => (comparePrimitives(x_17, y_17) | 0),
662
672
  });
663
673
  const bind$0040_1 = combine(map((tuple_9) => tuple_9[1], toList_1(fields_3)));
664
674
  return new AbstractValue(bind$0040_1.Resources, fields_3, empty_3(), empty_1({
665
- Compare: (x_17, y_17) => (comparePrimitives(x_17, y_17) | 0),
675
+ Compare: (x_18, y_18) => (comparePrimitives(x_18, y_18) | 0),
666
676
  }), bind$0040_1.Count);
667
677
  }
668
678
  case 9: {
669
- const fields_4 = ofList(map((tupledArg_5) => [tupledArg_5[0], eval$(tupledArg_5[1])], matchValue_8.fields[0]), {
670
- Compare: (x_18, y_18) => (comparePrimitives(x_18, y_18) | 0),
679
+ const fields_4 = ofList(map((tupledArg_5) => [tupledArg_5[0], eval$(tupledArg_5[1])], matchValue_9.fields[0]), {
680
+ Compare: (x_19, y_19) => (comparePrimitives(x_19, y_19) | 0),
671
681
  });
672
682
  const bind$0040_2 = combine(map((tuple_10) => tuple_10[1], toList_1(fields_4)));
673
683
  return new AbstractValue(bind$0040_2.Resources, fields_4, empty_3(), empty_1({
674
- Compare: (x_19, y_19) => (comparePrimitives(x_19, y_19) | 0),
684
+ Compare: (x_20, y_20) => (comparePrimitives(x_20, y_20) | 0),
675
685
  }), bind$0040_2.Count);
676
686
  }
677
687
  case 10: {
678
- const name_6 = matchValue_8.fields[1];
679
- const value_27 = eval$(matchValue_8.fields[0]);
680
- access(expression_1.Span, value_27.Resources);
681
- const matchValue_18 = tryFind(name_6, value_27.Fields);
682
- if (matchValue_18 == null) {
683
- const matchValue_19 = expression_1.Type;
684
- switch (matchValue_19.tag) {
688
+ const name_6 = matchValue_9.fields[1];
689
+ const value_28 = eval$(matchValue_9.fields[0]);
690
+ access(expression_1.Span, value_28.Resources);
691
+ const matchValue_19 = tryFind(name_6, value_28.Fields);
692
+ if (matchValue_19 == null) {
693
+ const matchValue_20 = expression_1.Type;
694
+ switch (matchValue_20.tag) {
685
695
  case 0:
686
696
  case 1:
687
697
  case 2:
@@ -690,29 +700,29 @@ export function analyze(registration, options, program) {
690
700
  case 14:
691
701
  return empty;
692
702
  default:
693
- return combine(ofArray([value_27, unknown("field:" + name_6, expression_1.Type)]));
703
+ return combine(ofArray([value_28, unknown("field:" + name_6, expression_1.Type)]));
694
704
  }
695
705
  }
696
706
  else {
697
- return matchValue_18;
707
+ return matchValue_19;
698
708
  }
699
709
  }
700
710
  case 20: {
701
- const target_4 = eval$(matchValue_8.fields[1]);
711
+ const target_4 = eval$(matchValue_9.fields[1]);
702
712
  access(expression_1.Span, target_4.Resources);
703
- const fields_6 = fold((state_3, tupledArg_6) => add(tupledArg_6[0], eval$(tupledArg_6[1]), state_3), target_4.Fields, matchValue_8.fields[2]);
713
+ const fields_6 = fold((state_5, tupledArg_6) => add(tupledArg_6[0], eval$(tupledArg_6[1]), state_5), target_4.Fields, matchValue_9.fields[2]);
704
714
  const bind$0040_3 = combine(cons(target_4, map((tuple_11) => tuple_11[1], toList_1(fields_6))));
705
715
  return new AbstractValue(bind$0040_3.Resources, fields_6, empty_3(), empty_1({
706
- Compare: (x_20, y_20) => (comparePrimitives(x_20, y_20) | 0),
716
+ Compare: (x_21, y_21) => (comparePrimitives(x_21, y_21) | 0),
707
717
  }), bind$0040_3.Count);
708
718
  }
709
719
  case 6: {
710
- const arg_9 = combine(map(eval$, matchValue_8.fields[1])).Resources;
720
+ const arg_9 = combine(map(eval$, matchValue_9.fields[1])).Resources;
711
721
  access(expression_1.Span, arg_9);
712
722
  return empty;
713
723
  }
714
724
  case 22: {
715
- const enumerator_2 = getEnumerator(matchValue_8.fields[0]);
725
+ const enumerator_2 = getEnumerator(matchValue_9.fields[0]);
716
726
  try {
717
727
  while (enumerator_2["System.Collections.IEnumerator.MoveNext"]()) {
718
728
  const part = enumerator_2["System.Collections.Generic.IEnumerator`1.get_Current"]();
@@ -728,15 +738,15 @@ export function analyze(registration, options, program) {
728
738
  return empty;
729
739
  }
730
740
  case 24: {
731
- const items = eval$(matchValue_8.fields[1]);
732
- const next_3 = add(matchValue_8.fields[0].SymbolId, contents(items), env_7);
741
+ const items = eval$(matchValue_9.fields[1]);
742
+ const next_3 = add(matchValue_9.fields[0].SymbolId, contents(items), env_7);
733
743
  for (let forLoopVar_1 = 1; forLoopVar_1 <= defaultArg((option_21 = items.Count, (option_21 != null) ? min(2, option_21) : undefined), 2); forLoopVar_1++) {
734
- evaluate(next_3)(matchValue_8.fields[2]);
744
+ evaluate(next_3)(matchValue_9.fields[2]);
735
745
  }
736
746
  return empty;
737
747
  }
738
748
  case 17: {
739
- eval$(matchValue_8.fields[0]);
749
+ eval$(matchValue_9.fields[0]);
740
750
  return empty;
741
751
  }
742
752
  default:
@@ -746,11 +756,11 @@ export function analyze(registration, options, program) {
746
756
  const branches = (alternatives) => {
747
757
  const snapshot = () => toList_2(map_1((pair) => [pair[0], ofSeq_1(pair[1])], histories));
748
758
  const clock_1 = clock;
749
- const matchValue_20 = snapshot();
759
+ const matchValue_21 = snapshot();
750
760
  const results = map((branch) => {
751
761
  clock = clock_1;
752
762
  histories.clear();
753
- const enumerator_3 = getEnumerator(matchValue_20);
763
+ const enumerator_3 = getEnumerator(matchValue_21);
754
764
  try {
755
765
  while (enumerator_3["System.Collections.IEnumerator.MoveNext"]()) {
756
766
  const forLoopVar_2 = enumerator_3["System.Collections.Generic.IEnumerator`1.get_Current"]();
@@ -772,13 +782,13 @@ export function analyze(registration, options, program) {
772
782
  const forLoopVar_4 = enumerator_5["System.Collections.Generic.IEnumerator`1.get_Current"]();
773
783
  const values_14 = forLoopVar_4[1];
774
784
  const key_9 = forLoopVar_4[0];
775
- let matchValue_21;
785
+ let matchValue_22;
776
786
  let outArg_1 = defaultOf();
777
- matchValue_21 = [tryGetValue(histories, key_9, new FSharpRef(() => outArg_1, (v_1) => {
787
+ matchValue_22 = [tryGetValue(histories, key_9, new FSharpRef(() => outArg_1, (v_1) => {
778
788
  outArg_1 = v_1;
779
789
  })), outArg_1];
780
- if (matchValue_21[0]) {
781
- addRangeInPlace(values_14, matchValue_21[1]);
790
+ if (matchValue_22[0]) {
791
+ addRangeInPlace(values_14, matchValue_22[1]);
782
792
  }
783
793
  else {
784
794
  histories.set(key_9, Array.from(values_14));
@@ -799,7 +809,7 @@ export function analyze(registration, options, program) {
799
809
  const pair_1 = enumerator_6["System.Collections.Generic.IEnumerator`1.get_Current"]();
800
810
  const distinct = toArray(distinct_1(pair_1[1], {
801
811
  Equals: equalArrays,
802
- GetHashCode: (x_21) => (arrayHash(x_21) | 0),
812
+ GetHashCode: (x_22) => (arrayHash(x_22) | 0),
803
813
  }));
804
814
  clear(pair_1[1]);
805
815
  addRangeInPlace(distinct, pair_1[1]);
@@ -823,9 +833,9 @@ export function analyze(registration, options, program) {
823
833
  const callable = enumerator_8["System.Collections.Generic.IEnumerator`1.get_Current"]();
824
834
  if (callable.tag === 0) {
825
835
  const ids = ofSeq(references(callable.fields[2]), {
826
- Compare: (x_22, y_22) => (comparePrimitives(x_22, y_22) | 0),
836
+ Compare: (x_23, y_23) => (comparePrimitives(x_23, y_23) | 0),
827
837
  });
828
- callable.fields[3].contents = filter_1((id_2, _arg_13) => contains(id_2, ids), env_8);
838
+ callable.fields[3].contents = filter_1((id_2, _arg_12) => contains(id_2, ids), env_8);
829
839
  }
830
840
  }
831
841
  }
@@ -845,13 +855,13 @@ export function analyze(registration, options, program) {
845
855
  return combine(ofArray([fn_4, argument_4, unknown("unknown-call", resultType)]));
846
856
  }
847
857
  else {
848
- const invoke = (_arg_14) => {
849
- if (_arg_14.tag === 1) {
850
- const signature = _arg_14.fields[3];
851
- const name_8 = _arg_14.fields[0];
852
- const external = _arg_14.fields[2];
853
- const arity_1 = _arg_14.fields[1] | 0;
854
- const arguments$_1 = append(_arg_14.fields[4], singleton(argument_4));
858
+ const invoke = (_arg_13) => {
859
+ if (_arg_13.tag === 1) {
860
+ const signature = _arg_13.fields[3];
861
+ const name_8 = _arg_13.fields[0];
862
+ const external = _arg_13.fields[2];
863
+ const arity_1 = _arg_13.fields[1] | 0;
864
+ const arguments$_1 = append(_arg_13.fields[4], singleton(argument_4));
855
865
  if (length(arguments$_1) >= arity_1) {
856
866
  const returned = (count_2_mut, typ_8_mut) => {
857
867
  returned:
@@ -879,12 +889,12 @@ export function analyze(registration, options, program) {
879
889
  }
880
890
  }
881
891
  else {
882
- const id_3 = _arg_14.fields[0] | 0;
892
+ const id_3 = _arg_13.fields[0] | 0;
883
893
  if (addToSet(id_3, activeCalls)) {
884
894
  const previous_2 = callSites;
885
895
  callSites = cons(span_1, previous_2);
886
896
  try {
887
- return evaluate(add(_arg_14.fields[1].SymbolId, argument_4, _arg_14.fields[3].contents))(_arg_14.fields[2]);
897
+ return evaluate(add(_arg_13.fields[1].SymbolId, argument_4, _arg_13.fields[3].contents))(_arg_13.fields[2]);
888
898
  }
889
899
  finally {
890
900
  callSites = previous_2;
@@ -896,21 +906,21 @@ export function analyze(registration, options, program) {
896
906
  }
897
907
  }
898
908
  };
899
- const matchValue_23 = fn_4.Callables;
909
+ const matchValue_24 = fn_4.Callables;
900
910
  let matchResult_4, only, alternatives_1;
901
- if (!isEmpty(matchValue_23)) {
902
- if (isEmpty(tail_2(matchValue_23))) {
911
+ if (!isEmpty(matchValue_24)) {
912
+ if (isEmpty(tail_2(matchValue_24))) {
903
913
  matchResult_4 = 0;
904
- only = head(matchValue_23);
914
+ only = head(matchValue_24);
905
915
  }
906
916
  else {
907
917
  matchResult_4 = 1;
908
- alternatives_1 = matchValue_23;
918
+ alternatives_1 = matchValue_24;
909
919
  }
910
920
  }
911
921
  else {
912
922
  matchResult_4 = 1;
913
- alternatives_1 = matchValue_23;
923
+ alternatives_1 = matchValue_24;
914
924
  }
915
925
  switch (matchResult_4) {
916
926
  case 0:
@@ -922,7 +932,7 @@ export function analyze(registration, options, program) {
922
932
  })));
923
933
  const invokeFunction = (span_2) => ((resultType_1) => ((name_9) => ((external_1) => ((arguments$_2) => {
924
934
  let option_26;
925
- let matchResult_5, thunk, value_39;
935
+ let matchResult_5, thunk, value_40;
926
936
  switch (name_9) {
927
937
  case "Task.spawn": {
928
938
  if (!isEmpty(arguments$_2)) {
@@ -943,7 +953,7 @@ export function analyze(registration, options, program) {
943
953
  if (!isEmpty(arguments$_2)) {
944
954
  if (isEmpty(tail_2(arguments$_2))) {
945
955
  matchResult_5 = 1;
946
- value_39 = head(arguments$_2);
956
+ value_40 = head(arguments$_2);
947
957
  }
948
958
  else {
949
959
  matchResult_5 = 2;
@@ -974,23 +984,23 @@ export function analyze(registration, options, program) {
974
984
  clock = mergeClock(clock_3, forkClock);
975
985
  tick();
976
986
  return new AbstractValue(empty.Resources, empty.Fields, empty.Callables, singleton_1(child_1, {
977
- Compare: (x_23, y_23) => (comparePrimitives(x_23, y_23) | 0),
987
+ Compare: (x_24, y_24) => (comparePrimitives(x_24, y_24) | 0),
978
988
  }), empty.Count);
979
989
  }
980
990
  case 1: {
981
991
  const completed = choose((id_4) => {
982
- let matchValue_25;
992
+ let matchValue_26;
983
993
  let outArg_2 = defaultOf();
984
- matchValue_25 = [tryGetValue(tasks, id_4, new FSharpRef(() => outArg_2, (v_2) => {
994
+ matchValue_26 = [tryGetValue(tasks, id_4, new FSharpRef(() => outArg_2, (v_2) => {
985
995
  outArg_2 = v_2;
986
996
  })), outArg_2];
987
- if (matchValue_25[0]) {
988
- return matchValue_25[1];
997
+ if (matchValue_26[0]) {
998
+ return matchValue_26[1];
989
999
  }
990
1000
  else {
991
1001
  return undefined;
992
1002
  }
993
- }, toList(value_39.Tasks));
1003
+ }, toList(value_40.Tasks));
994
1004
  if (!isEmpty(completed)) {
995
1005
  clock = mergeClock(clock, commonClock(map((tuple_12) => tuple_12[0], completed)));
996
1006
  }
@@ -1003,16 +1013,16 @@ export function analyze(registration, options, program) {
1003
1013
  const arg_17 = add_1(new Resource("function:" + name_9, name_9, true), inputs.Resources);
1004
1014
  access(span_2, arg_17);
1005
1015
  }
1006
- const parameterTypes = (_arg_15) => {
1007
- if (_arg_15.tag === 11) {
1008
- return cons(_arg_15.fields[0], parameterTypes(_arg_15.fields[1]));
1016
+ const parameterTypes = (_arg_14) => {
1017
+ if (_arg_14.tag === 11) {
1018
+ return cons(_arg_14.fields[0], parameterTypes(_arg_14.fields[1]));
1009
1019
  }
1010
1020
  else {
1011
1021
  return empty_3();
1012
1022
  }
1013
1023
  };
1014
1024
  const signature_1 = defaultArg((option_26 = tryFind(name_9, builtinSchemes), (option_26 != null) ? parameterTypes(option_26.fields[1]) : undefined), empty_3());
1015
- const items_1 = combine(map(contents, filter((value_41) => isEmpty(value_41.Callables), arguments$_2)));
1025
+ const items_1 = combine(map(contents, filter((value_42) => isEmpty(value_42.Callables), arguments$_2)));
1016
1026
  const callbackResults = collect((tupledArg_10) => {
1017
1027
  let option_29, option_32;
1018
1028
  const callback = tupledArg_10[1];
@@ -1021,8 +1031,8 @@ export function analyze(registration, options, program) {
1021
1031
  return empty_3();
1022
1032
  }
1023
1033
  else {
1024
- const iterations = ((name_9.startsWith("List.") ? true : name_9.startsWith("Map.")) ? defaultArg((option_32 = tryPick((_arg_17) => _arg_17.Count, arguments$_2), (option_32 != null) ? min(2, option_32) : undefined), 2) : 1) | 0;
1025
- return toList_2(delay(() => collect_1((matchValue_26) => singleton_2(fold((fn_5, typ_12) => apply(span_2)(typ_12)(fn_5)(items_1), callback, callbackParameters)), rangeDouble(1, 1, iterations))));
1034
+ const iterations = ((name_9.startsWith("List.") ? true : name_9.startsWith("Map.")) ? defaultArg((option_32 = tryPick((_arg_16) => _arg_16.Count, arguments$_2), (option_32 != null) ? min(2, option_32) : undefined), 2) : 1) | 0;
1035
+ return toList_2(delay(() => collect_1((matchValue_27) => singleton_2(fold((fn_5, typ_12) => apply(span_2)(typ_12)(fn_5)(items_1), callback, callbackParameters)), rangeDouble(1, 1, iterations))));
1026
1036
  }
1027
1037
  }, indexed(arguments$_2));
1028
1038
  const result_4 = unknown("result:" + name_9, resultType_1);
@@ -1065,18 +1075,18 @@ export function analyze(registration, options, program) {
1065
1075
  case 0:
1066
1076
  return empty;
1067
1077
  case 1:
1068
- return container("$items", tryPick((_arg_18) => _arg_18.Count, arguments$_2), contains_1(name_9, ofArray(["List.map", "List.choose", "List.collect"]), {
1069
- Equals: (x_24, y_24) => (x_24 === y_24),
1070
- GetHashCode: (x_24) => (stringHash(x_24) | 0),
1078
+ return container("$items", tryPick((_arg_17) => _arg_17.Count, arguments$_2), contains_1(name_9, ofArray(["List.map", "List.choose", "List.collect"]), {
1079
+ Equals: (x_25, y_25) => (x_25 === y_25),
1080
+ GetHashCode: (x_25) => (stringHash(x_25) | 0),
1071
1081
  }) ? combine(map(contents, callbackResults)) : combine(ofArray([items_1, contents(result_4)])));
1072
1082
  case 2:
1073
1083
  return container("$value", undefined, (name_9 === "Option.map") ? combine(callbackResults) : combine(ofArray([items_1, contents(result_4)])));
1074
1084
  case 3:
1075
1085
  return container("$items", undefined, combine(ofArrayWithTail([contents(inputs), result_4], callbackResults)));
1076
1086
  case 4: {
1077
- const arity_2 = (_arg_19) => {
1078
- if (_arg_19.tag === 11) {
1079
- return (1 + arity_2(_arg_19.fields[1])) | 0;
1087
+ const arity_2 = (_arg_18) => {
1088
+ if (_arg_18.tag === 11) {
1089
+ return (1 + arity_2(_arg_18.fields[1])) | 0;
1080
1090
  }
1081
1091
  else {
1082
1092
  return 0;
@@ -1092,31 +1102,31 @@ export function analyze(registration, options, program) {
1092
1102
  }
1093
1103
  }))));
1094
1104
  let environment = empty_2({
1095
- Compare: (x_25, y_25) => (comparePrimitives(x_25, y_25) | 0),
1105
+ Compare: (x_26, y_26) => (comparePrimitives(x_26, y_26) | 0),
1096
1106
  });
1097
1107
  const entryFunctions = [];
1098
- const remember = (binding_7, value_46) => {
1099
- environment = add(binding_7.SymbolId, value_46, environment);
1100
- if (!isEmpty(value_46.Callables)) {
1101
- void (entryFunctions.push([value_46, binding_7.Type, binding_7.Span]));
1108
+ const remember = (binding_7, value_47) => {
1109
+ environment = add(binding_7.SymbolId, value_47, environment);
1110
+ if (!isEmpty(value_47.Callables)) {
1111
+ void (entryFunctions.push([value_47, binding_7.Type, binding_7.Span]));
1102
1112
  }
1103
1113
  };
1104
1114
  const enumerator_9 = getEnumerator(program.ResolvedStatements);
1105
1115
  try {
1106
1116
  while (enumerator_9["System.Collections.IEnumerator.MoveNext"]()) {
1107
- const matchValue_27 = enumerator_9["System.Collections.Generic.IEnumerator`1.get_Current"]().Node;
1108
- switch (matchValue_27.tag) {
1117
+ const matchValue_28 = enumerator_9["System.Collections.Generic.IEnumerator`1.get_Current"]().Node;
1118
+ switch (matchValue_28.tag) {
1109
1119
  case 1: {
1110
- const declaration_2 = matchValue_27.fields[0];
1111
- const value_47 = evaluate(environment)(declaration_2.Value);
1112
- remember(declaration_2.Binding, value_47);
1120
+ const declaration_2 = matchValue_28.fields[0];
1121
+ const value_48 = evaluate(environment)(declaration_2.Value);
1122
+ remember(declaration_2.Binding, value_48);
1113
1123
  if (declaration_2.IsRecursive) {
1114
- wireRecursive(environment)(singleton(value_47));
1124
+ wireRecursive(environment)(singleton(value_48));
1115
1125
  }
1116
1126
  break;
1117
1127
  }
1118
1128
  case 3: {
1119
- const values_22 = map((declaration_3) => [declaration_3, evaluate(environment)(declaration_3.Value)], matchValue_27.fields[0]);
1129
+ const values_22 = map((declaration_3) => [declaration_3, evaluate(environment)(declaration_3.Value)], matchValue_28.fields[0]);
1120
1130
  const enumerator_10 = getEnumerator(values_22);
1121
1131
  try {
1122
1132
  while (enumerator_10["System.Collections.IEnumerator.MoveNext"]()) {
@@ -1131,47 +1141,47 @@ export function analyze(registration, options, program) {
1131
1141
  break;
1132
1142
  }
1133
1143
  case 2: {
1134
- const declaration_5 = matchValue_27.fields[0];
1135
- const value_49 = evaluate(environment)(declaration_5.Value);
1136
- const bound = bindPattern(environment, declaration_5.Pattern, value_49);
1144
+ const declaration_5 = matchValue_28.fields[0];
1145
+ const value_50 = evaluate(environment)(declaration_5.Value);
1146
+ const bound = bindPattern(environment, declaration_5.Pattern, value_50);
1137
1147
  const bindings_1 = (pattern_6_mut) => {
1138
1148
  bindings_1:
1139
1149
  while (true) {
1140
1150
  const pattern_6 = pattern_6_mut;
1141
1151
  let option_35;
1142
- const matchValue_28 = pattern_6.Node;
1152
+ const matchValue_29 = pattern_6.Node;
1143
1153
  let matchResult_7, binding_8, patterns_1, fields_7, a_2, b_2, item_4, entries_2, tail_1;
1144
- switch (matchValue_28.tag) {
1154
+ switch (matchValue_29.tag) {
1145
1155
  case 1: {
1146
1156
  matchResult_7 = 0;
1147
- binding_8 = matchValue_28.fields[0];
1157
+ binding_8 = matchValue_29.fields[0];
1148
1158
  break;
1149
1159
  }
1150
1160
  case 5: {
1151
1161
  matchResult_7 = 1;
1152
- patterns_1 = matchValue_28.fields[0];
1162
+ patterns_1 = matchValue_29.fields[0];
1153
1163
  break;
1154
1164
  }
1155
1165
  case 6: {
1156
1166
  matchResult_7 = 2;
1157
- fields_7 = matchValue_28.fields[0];
1167
+ fields_7 = matchValue_29.fields[0];
1158
1168
  break;
1159
1169
  }
1160
1170
  case 4: {
1161
1171
  matchResult_7 = 3;
1162
- a_2 = matchValue_28.fields[0];
1163
- b_2 = matchValue_28.fields[1];
1172
+ a_2 = matchValue_29.fields[0];
1173
+ b_2 = matchValue_29.fields[1];
1164
1174
  break;
1165
1175
  }
1166
1176
  case 8: {
1167
1177
  matchResult_7 = 4;
1168
- item_4 = matchValue_28.fields[0];
1178
+ item_4 = matchValue_29.fields[0];
1169
1179
  break;
1170
1180
  }
1171
1181
  case 10: {
1172
- if (matchValue_28.fields[2] != null) {
1182
+ if (matchValue_29.fields[2] != null) {
1173
1183
  matchResult_7 = 4;
1174
- item_4 = matchValue_28.fields[2];
1184
+ item_4 = matchValue_29.fields[2];
1175
1185
  }
1176
1186
  else {
1177
1187
  matchResult_7 = 6;
@@ -1180,8 +1190,8 @@ export function analyze(registration, options, program) {
1180
1190
  }
1181
1191
  case 7: {
1182
1192
  matchResult_7 = 5;
1183
- entries_2 = matchValue_28.fields[0];
1184
- tail_1 = matchValue_28.fields[1];
1193
+ entries_2 = matchValue_29.fields[0];
1194
+ tail_1 = matchValue_29.fields[1];
1185
1195
  break;
1186
1196
  }
1187
1197
  default:
@@ -1209,17 +1219,17 @@ export function analyze(registration, options, program) {
1209
1219
  }
1210
1220
  };
1211
1221
  const patternIds = ofList(map((binding_9) => [binding_9.Name, binding_9.SymbolId], bindings_1(declaration_5.Pattern)), {
1212
- Compare: (x_26, y_26) => (comparePrimitives(x_26, y_26) | 0),
1222
+ Compare: (x_27, y_27) => (comparePrimitives(x_27, y_27) | 0),
1213
1223
  });
1214
1224
  environment = fold((env_9, tupledArg_12) => {
1215
1225
  let option_38;
1216
1226
  const binding_10 = tupledArg_12[0];
1217
- return add(binding_10.SymbolId, defaultArg((option_38 = tryFind(binding_10.Name, patternIds), (option_38 != null) ? tryFind(option_38, bound) : undefined), value_49), env_9);
1227
+ return add(binding_10.SymbolId, defaultArg((option_38 = tryFind(binding_10.Name, patternIds), (option_38 != null) ? tryFind(option_38, bound) : undefined), value_50), env_9);
1218
1228
  }, bound, declaration_5.Bindings);
1219
1229
  break;
1220
1230
  }
1221
1231
  case 5: {
1222
- evaluate(environment)(matchValue_27.fields[0]);
1232
+ evaluate(environment)(matchValue_28.fields[0]);
1223
1233
  break;
1224
1234
  }
1225
1235
  default:
@@ -1240,15 +1250,15 @@ export function analyze(registration, options, program) {
1240
1250
  activeCalls.clear();
1241
1251
  task = 0;
1242
1252
  clock = ofList(singleton([0, 0]), {
1243
- Compare: (x_27, y_27) => (comparePrimitives(x_27, y_27) | 0),
1253
+ Compare: (x_28, y_28) => (comparePrimitives(x_28, y_28) | 0),
1244
1254
  });
1245
- const enter = (value_55_mut, typ_14_mut, index_4_mut) => {
1255
+ const enter = (value_56_mut, typ_14_mut, index_4_mut) => {
1246
1256
  enter:
1247
1257
  while (true) {
1248
- const value_55 = value_55_mut, typ_14 = typ_14_mut, index_4 = index_4_mut;
1258
+ const value_56 = value_56_mut, typ_14 = typ_14_mut, index_4 = index_4_mut;
1249
1259
  if (typ_14.tag === 11) {
1250
1260
  const result_6 = typ_14.fields[1];
1251
- value_55_mut = apply(span_3)(result_6)(value_55)(unknown((("entry:" + int32ToString(index_4)) + ":") + int32ToString(span_3.Start.Line), typ_14.fields[0]));
1261
+ value_56_mut = apply(span_3)(result_6)(value_56)(unknown((("entry:" + int32ToString(index_4)) + ":") + int32ToString(span_3.Start.Line), typ_14.fields[0]));
1252
1262
  typ_14_mut = result_6;
1253
1263
  index_4_mut = (index_4 + 1);
1254
1264
  continue enter;
@@ -1264,9 +1274,9 @@ export function analyze(registration, options, program) {
1264
1274
  }
1265
1275
  return toList_2(sortBy((diagnostic) => [diagnostic.Span.Start.File, diagnostic.Span.Start.Line, diagnostic.Span.Start.Column, diagnostic.Code, diagnostic.RelatedSpan.Start.Line], distinct_1(diagnostics, {
1266
1276
  Equals: equals,
1267
- GetHashCode: (x_28) => (safeHash(x_28) | 0),
1277
+ GetHashCode: (x_29) => (safeHash(x_29) | 0),
1268
1278
  }), {
1269
- Compare: (x_29, y_29) => (compareArrays(x_29, y_29) | 0),
1279
+ Compare: (x_30, y_30) => (compareArrays(x_30, y_30) | 0),
1270
1280
  }));
1271
1281
  }
1272
1282