@magnusopera/fscript 0.92.4 → 0.93.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.
- package/dist/FScript.Language/Ast.js +27 -24
- package/dist/FScript.Language/BuiltinFunctions.js +273 -234
- package/dist/FScript.Language/BuiltinSignatures.js +1 -1
- package/dist/FScript.Language/BuiltinTypes.js +3 -5
- package/dist/FScript.Language/Eval.js +583 -532
- package/dist/FScript.Language/ExportSignatures.js +1 -1
- package/dist/FScript.Language/HostInterop.js +194 -116
- package/dist/FScript.Language/IncludeResolver.js +65 -55
- package/dist/FScript.Language/Lexer.js +175 -147
- package/dist/FScript.Language/MatchCoverage.js +12 -18
- package/dist/FScript.Language/Parser.js +561 -419
- package/dist/FScript.Language/Pretty.js +1 -1
- package/dist/FScript.Language/SupportLibrary.js +1 -1
- package/dist/FScript.Language/TaskFunctions.js +1 -1
- package/dist/FScript.Language/TaskSharingAnalysis.js +228 -202
- package/dist/FScript.Language/Token.js +55 -55
- package/dist/FScript.Language/TypeInfer.js +2767 -2027
- package/dist/FScript.Language/Types.js +312 -42
- package/dist/Library.js +8 -8
- package/package.json +1 -1
|
@@ -10,9 +10,9 @@ import { ofExterns, typeDefinitions, permitted, invoke, prepareCall, matches, $0
|
|
|
10
10
|
import { FSharpChoice$2 } from "../fable_modules/fable-library-js.5.27.0/Choice.js";
|
|
11
11
|
import { toList as toList_1, foldBack, head as head_2, tryPick, map, exists } from "../fable_modules/fable-library-js.5.27.0/Seq.js";
|
|
12
12
|
import { item as item_1 } from "../fable_modules/fable-library-js.5.27.0/Array.js";
|
|
13
|
-
import {
|
|
14
|
-
import { ofArray, collect,
|
|
15
|
-
import { keys,
|
|
13
|
+
import { compare as compare_1, defaultOf, disposeSafe, getEnumerator, comparePrimitives, equals as equals_1, int64ToString } from "../fable_modules/fable-library-js.5.27.0/Util.js";
|
|
14
|
+
import { ofArray, collect, tryFind as tryFind_1, tryPick as tryPick_1, reverse, append, zip, fold as fold_1, singleton, forAll as forAll_1, empty, cons, tail as tail_2, head as head_1, choose, isEmpty, forAll2, length, map as map_1 } from "../fable_modules/fable-library-js.5.27.0/List.js";
|
|
15
|
+
import { keys, containsKey, FSharpMap__Add, fold, empty as empty_1, FSharpMap__get_Item, FSharpMap__Remove, FSharpMap__get_IsEmpty, FSharpMap__ContainsKey, add as add_1, FSharpMap__TryFind, toSeq, ofList, tryFind, forAll, FSharpMap__get_Count, toList } from "../fable_modules/fable-library-js.5.27.0/Map.js";
|
|
16
16
|
import { compare, op_Modulus, op_Division, op_Multiply, op_Subtraction, op_Addition, toInt64_unchecked, equals } from "../fable_modules/fable-library-js.5.27.0/BigInt.js";
|
|
17
17
|
import { some, toArray } from "../fable_modules/fable-library-js.5.27.0/Option.js";
|
|
18
18
|
import { Ast_spanOfExpr, Expr, Ast_spanOfPattern, TypeRef } from "./Ast.js";
|
|
@@ -24,6 +24,7 @@ import { Operators_InvalidOp } from "../fable_modules/fable-library-js.5.27.0/FS
|
|
|
24
24
|
import { contains } from "../fable_modules/fable-library-js.5.27.0/Set.js";
|
|
25
25
|
import { builtinReservedNames } from "./BuiltinSignatures.js";
|
|
26
26
|
import { typeDefs as typeDefs_2 } from "./BuiltinTypes.js";
|
|
27
|
+
import { scriptTypeDefinitions } from "./TypeInfer.js";
|
|
27
28
|
|
|
28
29
|
export class ProgramState extends Record {
|
|
29
30
|
constructor(Permissions, TypeDefs, Env, LastValue, ExitCode) {
|
|
@@ -315,198 +316,208 @@ function valueEquals(a_mut, b_mut) {
|
|
|
315
316
|
valueEquals:
|
|
316
317
|
while (true) {
|
|
317
318
|
const a = a_mut, b = b_mut;
|
|
318
|
-
let matchResult, x, y, x_1, y_1, x_2, y_2, x_3, y_3, xs, ys, xs_1, ys_1,
|
|
319
|
+
let matchResult, x, y, x_1, y_1, x_2, y_2, x_3, y_3, xs, ys, xs_1, ys_1, left_1, right_1, value_11;
|
|
319
320
|
switch (a.tag) {
|
|
320
321
|
case 0: {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
xf = activePatternResult;
|
|
331
|
-
yf = activePatternResult_1;
|
|
322
|
+
switch (b.tag) {
|
|
323
|
+
case 0: {
|
|
324
|
+
matchResult = 0;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
case 16: {
|
|
328
|
+
if (!isEmpty(b.fields[0].Descriptor.TypeParameters)) {
|
|
329
|
+
matchResult = 8;
|
|
330
|
+
value_11 = b.fields[0];
|
|
332
331
|
}
|
|
333
332
|
else {
|
|
334
|
-
matchResult =
|
|
333
|
+
matchResult = 9;
|
|
335
334
|
}
|
|
335
|
+
break;
|
|
336
336
|
}
|
|
337
|
-
|
|
338
|
-
matchResult =
|
|
339
|
-
}
|
|
337
|
+
default:
|
|
338
|
+
matchResult = 9;
|
|
340
339
|
}
|
|
341
340
|
break;
|
|
342
341
|
}
|
|
343
342
|
case 1: {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
xf = activePatternResult_2;
|
|
356
|
-
yf = activePatternResult_3;
|
|
343
|
+
switch (b.tag) {
|
|
344
|
+
case 1: {
|
|
345
|
+
matchResult = 1;
|
|
346
|
+
x = a.fields[0];
|
|
347
|
+
y = b.fields[0];
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
case 16: {
|
|
351
|
+
if (!isEmpty(b.fields[0].Descriptor.TypeParameters)) {
|
|
352
|
+
matchResult = 8;
|
|
353
|
+
value_11 = b.fields[0];
|
|
357
354
|
}
|
|
358
355
|
else {
|
|
359
|
-
matchResult =
|
|
356
|
+
matchResult = 9;
|
|
360
357
|
}
|
|
358
|
+
break;
|
|
361
359
|
}
|
|
362
|
-
|
|
363
|
-
matchResult =
|
|
364
|
-
}
|
|
360
|
+
default:
|
|
361
|
+
matchResult = 9;
|
|
365
362
|
}
|
|
366
363
|
break;
|
|
367
364
|
}
|
|
368
365
|
case 2: {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
xf = activePatternResult_4;
|
|
381
|
-
yf = activePatternResult_5;
|
|
366
|
+
switch (b.tag) {
|
|
367
|
+
case 2: {
|
|
368
|
+
matchResult = 2;
|
|
369
|
+
x_1 = a.fields[0];
|
|
370
|
+
y_1 = b.fields[0];
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
case 16: {
|
|
374
|
+
if (!isEmpty(b.fields[0].Descriptor.TypeParameters)) {
|
|
375
|
+
matchResult = 8;
|
|
376
|
+
value_11 = b.fields[0];
|
|
382
377
|
}
|
|
383
378
|
else {
|
|
384
|
-
matchResult =
|
|
379
|
+
matchResult = 9;
|
|
385
380
|
}
|
|
381
|
+
break;
|
|
386
382
|
}
|
|
387
|
-
|
|
388
|
-
matchResult =
|
|
389
|
-
}
|
|
383
|
+
default:
|
|
384
|
+
matchResult = 9;
|
|
390
385
|
}
|
|
391
386
|
break;
|
|
392
387
|
}
|
|
393
388
|
case 3: {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
xf = activePatternResult_6;
|
|
406
|
-
yf = activePatternResult_7;
|
|
389
|
+
switch (b.tag) {
|
|
390
|
+
case 3: {
|
|
391
|
+
matchResult = 3;
|
|
392
|
+
x_2 = a.fields[0];
|
|
393
|
+
y_2 = b.fields[0];
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
case 16: {
|
|
397
|
+
if (!isEmpty(b.fields[0].Descriptor.TypeParameters)) {
|
|
398
|
+
matchResult = 8;
|
|
399
|
+
value_11 = b.fields[0];
|
|
407
400
|
}
|
|
408
401
|
else {
|
|
409
|
-
matchResult =
|
|
402
|
+
matchResult = 9;
|
|
410
403
|
}
|
|
404
|
+
break;
|
|
411
405
|
}
|
|
412
|
-
|
|
413
|
-
matchResult =
|
|
414
|
-
}
|
|
406
|
+
default:
|
|
407
|
+
matchResult = 9;
|
|
415
408
|
}
|
|
416
409
|
break;
|
|
417
410
|
}
|
|
418
411
|
case 4: {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
xf = activePatternResult_8;
|
|
431
|
-
yf = activePatternResult_9;
|
|
412
|
+
switch (b.tag) {
|
|
413
|
+
case 4: {
|
|
414
|
+
matchResult = 4;
|
|
415
|
+
x_3 = a.fields[0];
|
|
416
|
+
y_3 = b.fields[0];
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
case 16: {
|
|
420
|
+
if (!isEmpty(b.fields[0].Descriptor.TypeParameters)) {
|
|
421
|
+
matchResult = 8;
|
|
422
|
+
value_11 = b.fields[0];
|
|
432
423
|
}
|
|
433
424
|
else {
|
|
434
|
-
matchResult =
|
|
425
|
+
matchResult = 9;
|
|
435
426
|
}
|
|
427
|
+
break;
|
|
436
428
|
}
|
|
437
|
-
|
|
438
|
-
matchResult =
|
|
439
|
-
}
|
|
429
|
+
default:
|
|
430
|
+
matchResult = 9;
|
|
440
431
|
}
|
|
441
432
|
break;
|
|
442
433
|
}
|
|
443
434
|
case 5: {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
xf = activePatternResult_10;
|
|
456
|
-
yf = activePatternResult_11;
|
|
435
|
+
switch (b.tag) {
|
|
436
|
+
case 5: {
|
|
437
|
+
matchResult = 5;
|
|
438
|
+
xs = a.fields[0];
|
|
439
|
+
ys = b.fields[0];
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
case 16: {
|
|
443
|
+
if (!isEmpty(b.fields[0].Descriptor.TypeParameters)) {
|
|
444
|
+
matchResult = 8;
|
|
445
|
+
value_11 = b.fields[0];
|
|
457
446
|
}
|
|
458
447
|
else {
|
|
459
|
-
matchResult =
|
|
448
|
+
matchResult = 9;
|
|
460
449
|
}
|
|
450
|
+
break;
|
|
461
451
|
}
|
|
462
|
-
|
|
463
|
-
matchResult =
|
|
464
|
-
}
|
|
452
|
+
default:
|
|
453
|
+
matchResult = 9;
|
|
465
454
|
}
|
|
466
455
|
break;
|
|
467
456
|
}
|
|
468
457
|
case 6: {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
xf = activePatternResult_12;
|
|
481
|
-
yf = activePatternResult_13;
|
|
458
|
+
switch (b.tag) {
|
|
459
|
+
case 6: {
|
|
460
|
+
matchResult = 6;
|
|
461
|
+
xs_1 = a.fields[0];
|
|
462
|
+
ys_1 = b.fields[0];
|
|
463
|
+
break;
|
|
464
|
+
}
|
|
465
|
+
case 16: {
|
|
466
|
+
if (!isEmpty(b.fields[0].Descriptor.TypeParameters)) {
|
|
467
|
+
matchResult = 8;
|
|
468
|
+
value_11 = b.fields[0];
|
|
482
469
|
}
|
|
483
470
|
else {
|
|
484
|
-
matchResult =
|
|
471
|
+
matchResult = 9;
|
|
485
472
|
}
|
|
473
|
+
break;
|
|
486
474
|
}
|
|
487
|
-
|
|
488
|
-
matchResult =
|
|
489
|
-
}
|
|
475
|
+
default:
|
|
476
|
+
matchResult = 9;
|
|
490
477
|
}
|
|
491
478
|
break;
|
|
492
479
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
const activePatternResult_15 = $007CRecordFields$007C_$007C(b);
|
|
497
|
-
if (activePatternResult_15 != null) {
|
|
480
|
+
case 16: {
|
|
481
|
+
if (b.tag === 16) {
|
|
482
|
+
if (!(isEmpty(a.fields[0].Descriptor.TypeParameters) && isEmpty(b.fields[0].Descriptor.TypeParameters))) {
|
|
498
483
|
matchResult = 7;
|
|
499
|
-
|
|
500
|
-
|
|
484
|
+
left_1 = a.fields[0];
|
|
485
|
+
right_1 = b.fields[0];
|
|
501
486
|
}
|
|
502
|
-
else {
|
|
487
|
+
else if (!isEmpty(a.fields[0].Descriptor.TypeParameters)) {
|
|
503
488
|
matchResult = 8;
|
|
489
|
+
value_11 = a.fields[0];
|
|
490
|
+
}
|
|
491
|
+
else if (!isEmpty(b.fields[0].Descriptor.TypeParameters)) {
|
|
492
|
+
matchResult = 8;
|
|
493
|
+
value_11 = b.fields[0];
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
matchResult = 9;
|
|
504
497
|
}
|
|
505
498
|
}
|
|
506
|
-
else {
|
|
499
|
+
else if (!isEmpty(a.fields[0].Descriptor.TypeParameters)) {
|
|
507
500
|
matchResult = 8;
|
|
501
|
+
value_11 = a.fields[0];
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
matchResult = 9;
|
|
508
505
|
}
|
|
506
|
+
break;
|
|
509
507
|
}
|
|
508
|
+
default:
|
|
509
|
+
if (b.tag === 16) {
|
|
510
|
+
if (!isEmpty(b.fields[0].Descriptor.TypeParameters)) {
|
|
511
|
+
matchResult = 8;
|
|
512
|
+
value_11 = b.fields[0];
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
matchResult = 9;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
else {
|
|
519
|
+
matchResult = 9;
|
|
520
|
+
}
|
|
510
521
|
}
|
|
511
522
|
switch (matchResult) {
|
|
512
523
|
case 0:
|
|
@@ -534,150 +545,179 @@ function valueEquals(a_mut, b_mut) {
|
|
|
534
545
|
return false;
|
|
535
546
|
}
|
|
536
547
|
case 7:
|
|
537
|
-
if (
|
|
538
|
-
return
|
|
548
|
+
if (left_1.Descriptor.Name === right_1.Descriptor.Name) {
|
|
549
|
+
return left_1.Payload === right_1.Payload;
|
|
539
550
|
}
|
|
540
551
|
else {
|
|
541
552
|
return false;
|
|
542
553
|
}
|
|
554
|
+
case 8:
|
|
555
|
+
return false;
|
|
543
556
|
default: {
|
|
544
|
-
let matchResult_1,
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
else {
|
|
553
|
-
matchResult_1 = 6;
|
|
554
|
-
}
|
|
555
|
-
break;
|
|
556
|
-
}
|
|
557
|
-
case 9: {
|
|
558
|
-
if (a.fields[0] != null) {
|
|
559
|
-
if (b.tag === 9) {
|
|
560
|
-
if (b.fields[0] != null) {
|
|
561
|
-
matchResult_1 = 2;
|
|
562
|
-
x_4 = a.fields[0];
|
|
563
|
-
y_4 = b.fields[0];
|
|
564
|
-
}
|
|
565
|
-
else {
|
|
566
|
-
matchResult_1 = 6;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
else {
|
|
570
|
-
matchResult_1 = 6;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
else if (b.tag === 9) {
|
|
574
|
-
if (b.fields[0] == null) {
|
|
575
|
-
matchResult_1 = 1;
|
|
576
|
-
}
|
|
577
|
-
else {
|
|
578
|
-
matchResult_1 = 6;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
else {
|
|
582
|
-
matchResult_1 = 6;
|
|
583
|
-
}
|
|
584
|
-
break;
|
|
585
|
-
}
|
|
586
|
-
case 10: {
|
|
587
|
-
if (b.tag === 10) {
|
|
588
|
-
matchResult_1 = 3;
|
|
589
|
-
cx = a.fields[1];
|
|
590
|
-
cy = b.fields[1];
|
|
591
|
-
px = a.fields[2];
|
|
592
|
-
py = b.fields[2];
|
|
593
|
-
tx = a.fields[0];
|
|
594
|
-
ty = b.fields[0];
|
|
595
|
-
}
|
|
596
|
-
else {
|
|
597
|
-
matchResult_1 = 6;
|
|
598
|
-
}
|
|
599
|
-
break;
|
|
600
|
-
}
|
|
601
|
-
case 12: {
|
|
602
|
-
if (b.tag === 12) {
|
|
603
|
-
matchResult_1 = 4;
|
|
604
|
-
tx_1 = a.fields[0];
|
|
605
|
-
ty_1 = b.fields[0];
|
|
606
|
-
}
|
|
607
|
-
else {
|
|
608
|
-
matchResult_1 = 6;
|
|
609
|
-
}
|
|
610
|
-
break;
|
|
557
|
+
let matchResult_1, xf, yf;
|
|
558
|
+
const activePatternResult = $007CRecordFields$007C_$007C(a);
|
|
559
|
+
if (activePatternResult != null) {
|
|
560
|
+
const activePatternResult_1 = $007CRecordFields$007C_$007C(b);
|
|
561
|
+
if (activePatternResult_1 != null) {
|
|
562
|
+
matchResult_1 = 0;
|
|
563
|
+
xf = activePatternResult;
|
|
564
|
+
yf = activePatternResult_1;
|
|
611
565
|
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
matchResult_1 = 5;
|
|
615
|
-
tx_2 = a.fields[0];
|
|
616
|
-
ty_2 = b.fields[0];
|
|
617
|
-
}
|
|
618
|
-
else {
|
|
619
|
-
matchResult_1 = 6;
|
|
620
|
-
}
|
|
621
|
-
break;
|
|
566
|
+
else {
|
|
567
|
+
matchResult_1 = 1;
|
|
622
568
|
}
|
|
623
|
-
|
|
624
|
-
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
matchResult_1 = 1;
|
|
625
572
|
}
|
|
626
573
|
switch (matchResult_1) {
|
|
627
574
|
case 0:
|
|
628
|
-
if (FSharpMap__get_Count(
|
|
629
|
-
return forAll((
|
|
575
|
+
if (FSharpMap__get_Count(xf) === FSharpMap__get_Count(yf)) {
|
|
576
|
+
return forAll((key, value_12) => exists((b_3) => valueEquals(value_12, b_3), toArray(tryFind(key, yf))), xf);
|
|
630
577
|
}
|
|
631
578
|
else {
|
|
632
579
|
return false;
|
|
633
580
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
if ((tx === ty) && (cx === cy)) {
|
|
643
|
-
let matchResult_2, xv, yv;
|
|
644
|
-
if (px != null) {
|
|
645
|
-
if (py != null) {
|
|
646
|
-
matchResult_2 = 1;
|
|
647
|
-
xv = px;
|
|
648
|
-
yv = py;
|
|
581
|
+
default: {
|
|
582
|
+
let matchResult_2, xf_1, yf_1, x_4, y_4, cx, cy, px, py, tx, ty, tx_1, ty_1, tx_2, ty_2;
|
|
583
|
+
switch (a.tag) {
|
|
584
|
+
case 8: {
|
|
585
|
+
if (b.tag === 8) {
|
|
586
|
+
matchResult_2 = 0;
|
|
587
|
+
xf_1 = a.fields[0];
|
|
588
|
+
yf_1 = b.fields[0];
|
|
649
589
|
}
|
|
650
590
|
else {
|
|
651
|
-
matchResult_2 =
|
|
591
|
+
matchResult_2 = 6;
|
|
652
592
|
}
|
|
593
|
+
break;
|
|
653
594
|
}
|
|
654
|
-
|
|
655
|
-
|
|
595
|
+
case 9: {
|
|
596
|
+
if (a.fields[0] != null) {
|
|
597
|
+
if (b.tag === 9) {
|
|
598
|
+
if (b.fields[0] != null) {
|
|
599
|
+
matchResult_2 = 2;
|
|
600
|
+
x_4 = a.fields[0];
|
|
601
|
+
y_4 = b.fields[0];
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
matchResult_2 = 6;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
matchResult_2 = 6;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
else if (b.tag === 9) {
|
|
612
|
+
if (b.fields[0] == null) {
|
|
613
|
+
matchResult_2 = 1;
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
matchResult_2 = 6;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
else {
|
|
620
|
+
matchResult_2 = 6;
|
|
621
|
+
}
|
|
622
|
+
break;
|
|
656
623
|
}
|
|
657
|
-
|
|
658
|
-
|
|
624
|
+
case 10: {
|
|
625
|
+
if (b.tag === 10) {
|
|
626
|
+
matchResult_2 = 3;
|
|
627
|
+
cx = a.fields[1];
|
|
628
|
+
cy = b.fields[1];
|
|
629
|
+
px = a.fields[2];
|
|
630
|
+
py = b.fields[2];
|
|
631
|
+
tx = a.fields[0];
|
|
632
|
+
ty = b.fields[0];
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
matchResult_2 = 6;
|
|
636
|
+
}
|
|
637
|
+
break;
|
|
659
638
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
b_mut = yv;
|
|
666
|
-
continue valueEquals;
|
|
639
|
+
case 12: {
|
|
640
|
+
if (b.tag === 12) {
|
|
641
|
+
matchResult_2 = 4;
|
|
642
|
+
tx_1 = a.fields[0];
|
|
643
|
+
ty_1 = b.fields[0];
|
|
667
644
|
}
|
|
668
|
-
|
|
669
|
-
|
|
645
|
+
else {
|
|
646
|
+
matchResult_2 = 6;
|
|
647
|
+
}
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
650
|
+
case 13: {
|
|
651
|
+
if (b.tag === 13) {
|
|
652
|
+
matchResult_2 = 5;
|
|
653
|
+
tx_2 = a.fields[0];
|
|
654
|
+
ty_2 = b.fields[0];
|
|
655
|
+
}
|
|
656
|
+
else {
|
|
657
|
+
matchResult_2 = 6;
|
|
658
|
+
}
|
|
659
|
+
break;
|
|
670
660
|
}
|
|
661
|
+
default:
|
|
662
|
+
matchResult_2 = 6;
|
|
671
663
|
}
|
|
672
|
-
|
|
673
|
-
|
|
664
|
+
switch (matchResult_2) {
|
|
665
|
+
case 0:
|
|
666
|
+
if (FSharpMap__get_Count(xf_1) === FSharpMap__get_Count(yf_1)) {
|
|
667
|
+
return forAll((key_1, value_13) => exists((b_4) => valueEquals(value_13, b_4), toArray(tryFind(key_1, yf_1))), xf_1);
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
return false;
|
|
671
|
+
}
|
|
672
|
+
case 1:
|
|
673
|
+
return true;
|
|
674
|
+
case 2: {
|
|
675
|
+
a_mut = x_4;
|
|
676
|
+
b_mut = y_4;
|
|
677
|
+
continue valueEquals;
|
|
678
|
+
}
|
|
679
|
+
case 3:
|
|
680
|
+
if ((tx === ty) && (cx === cy)) {
|
|
681
|
+
let matchResult_3, xv, yv;
|
|
682
|
+
if (px != null) {
|
|
683
|
+
if (py != null) {
|
|
684
|
+
matchResult_3 = 1;
|
|
685
|
+
xv = px;
|
|
686
|
+
yv = py;
|
|
687
|
+
}
|
|
688
|
+
else {
|
|
689
|
+
matchResult_3 = 2;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
else if (py == null) {
|
|
693
|
+
matchResult_3 = 0;
|
|
694
|
+
}
|
|
695
|
+
else {
|
|
696
|
+
matchResult_3 = 2;
|
|
697
|
+
}
|
|
698
|
+
switch (matchResult_3) {
|
|
699
|
+
case 0:
|
|
700
|
+
return true;
|
|
701
|
+
case 1: {
|
|
702
|
+
a_mut = xv;
|
|
703
|
+
b_mut = yv;
|
|
704
|
+
continue valueEquals;
|
|
705
|
+
}
|
|
706
|
+
default:
|
|
707
|
+
return false;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
else {
|
|
711
|
+
return false;
|
|
712
|
+
}
|
|
713
|
+
case 4:
|
|
714
|
+
return equals_1(tx_1, ty_1);
|
|
715
|
+
case 5:
|
|
716
|
+
return tx_2 === ty_2;
|
|
717
|
+
default:
|
|
718
|
+
return false;
|
|
674
719
|
}
|
|
675
|
-
|
|
676
|
-
return equals_1(tx_1, ty_1);
|
|
677
|
-
case 5:
|
|
678
|
-
return tx_2 === ty_2;
|
|
679
|
-
default:
|
|
680
|
-
return false;
|
|
720
|
+
}
|
|
681
721
|
}
|
|
682
722
|
}
|
|
683
723
|
}
|
|
@@ -746,86 +786,199 @@ function valueToMapKey(span, value) {
|
|
|
746
786
|
|
|
747
787
|
function valueMatchesTypeRef(typeDefs, tref, value) {
|
|
748
788
|
const resolve = (tref_1) => {
|
|
789
|
+
let matchResult, name, ts, arguments$, name_1, inner, inner_1, inner_2, inner_3, keyType, valueType, fields, fields_1;
|
|
749
790
|
switch (tref_1.tag) {
|
|
750
|
-
case
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
return new Type(/* TTuple */ 7, [option_1]);
|
|
754
|
-
}
|
|
755
|
-
else {
|
|
756
|
-
return undefined;
|
|
757
|
-
}
|
|
791
|
+
case 5: {
|
|
792
|
+
matchResult = 7;
|
|
793
|
+
break;
|
|
758
794
|
}
|
|
759
|
-
case
|
|
760
|
-
|
|
761
|
-
|
|
795
|
+
case 1:
|
|
796
|
+
case 3: {
|
|
797
|
+
matchResult = 8;
|
|
798
|
+
break;
|
|
799
|
+
}
|
|
800
|
+
case 4: {
|
|
801
|
+
matchResult = 6;
|
|
802
|
+
ts = tref_1.fields[0];
|
|
803
|
+
break;
|
|
804
|
+
}
|
|
805
|
+
case 2: {
|
|
806
|
+
matchResult = 9;
|
|
807
|
+
arguments$ = tref_1.fields[1];
|
|
808
|
+
name_1 = tref_1.fields[0];
|
|
809
|
+
break;
|
|
810
|
+
}
|
|
811
|
+
case 6: {
|
|
762
812
|
switch (tref_1.fields[1]) {
|
|
763
813
|
case "list": {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}
|
|
768
|
-
else {
|
|
769
|
-
return undefined;
|
|
770
|
-
}
|
|
814
|
+
matchResult = 10;
|
|
815
|
+
inner = tref_1.fields[0];
|
|
816
|
+
break;
|
|
771
817
|
}
|
|
772
818
|
case "task": {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
}
|
|
777
|
-
else {
|
|
778
|
-
return undefined;
|
|
779
|
-
}
|
|
819
|
+
matchResult = 11;
|
|
820
|
+
inner_1 = tref_1.fields[0];
|
|
821
|
+
break;
|
|
780
822
|
}
|
|
781
823
|
case "option": {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
}
|
|
786
|
-
else {
|
|
787
|
-
return undefined;
|
|
788
|
-
}
|
|
824
|
+
matchResult = 12;
|
|
825
|
+
inner_2 = tref_1.fields[0];
|
|
826
|
+
break;
|
|
789
827
|
}
|
|
790
828
|
case "map": {
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
}
|
|
795
|
-
else {
|
|
796
|
-
return undefined;
|
|
797
|
-
}
|
|
829
|
+
matchResult = 13;
|
|
830
|
+
inner_3 = tref_1.fields[0];
|
|
831
|
+
break;
|
|
798
832
|
}
|
|
799
833
|
default:
|
|
800
|
-
|
|
834
|
+
matchResult = 15;
|
|
801
835
|
}
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
836
|
+
break;
|
|
837
|
+
}
|
|
838
|
+
case 7: {
|
|
839
|
+
matchResult = 14;
|
|
840
|
+
keyType = tref_1.fields[0];
|
|
841
|
+
valueType = tref_1.fields[1];
|
|
842
|
+
break;
|
|
843
|
+
}
|
|
844
|
+
case 8: {
|
|
845
|
+
matchResult = 16;
|
|
846
|
+
fields = tref_1.fields[0];
|
|
847
|
+
break;
|
|
848
|
+
}
|
|
849
|
+
case 9: {
|
|
850
|
+
matchResult = 17;
|
|
851
|
+
fields_1 = tref_1.fields[0];
|
|
852
|
+
break;
|
|
853
|
+
}
|
|
854
|
+
default:
|
|
855
|
+
switch (tref_1.fields[0]) {
|
|
856
|
+
case "unit": {
|
|
857
|
+
matchResult = 0;
|
|
858
|
+
break;
|
|
859
|
+
}
|
|
860
|
+
case "int": {
|
|
861
|
+
matchResult = 1;
|
|
862
|
+
break;
|
|
863
|
+
}
|
|
864
|
+
case "float": {
|
|
865
|
+
matchResult = 2;
|
|
866
|
+
break;
|
|
867
|
+
}
|
|
868
|
+
case "bool": {
|
|
869
|
+
matchResult = 3;
|
|
870
|
+
break;
|
|
871
|
+
}
|
|
872
|
+
case "string": {
|
|
873
|
+
matchResult = 4;
|
|
874
|
+
break;
|
|
875
|
+
}
|
|
876
|
+
default: {
|
|
877
|
+
matchResult = 5;
|
|
878
|
+
name = tref_1.fields[0];
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
switch (matchResult) {
|
|
883
|
+
case 0:
|
|
884
|
+
return Type.TUnit;
|
|
885
|
+
case 1:
|
|
886
|
+
return Type.TInt;
|
|
887
|
+
case 2:
|
|
888
|
+
return Type.TFloat;
|
|
889
|
+
case 3:
|
|
890
|
+
return Type.TBool;
|
|
891
|
+
case 4:
|
|
892
|
+
return Type.TString;
|
|
893
|
+
case 5:
|
|
894
|
+
return tryFind(name, typeDefs);
|
|
895
|
+
case 6: {
|
|
896
|
+
const option_1 = resolveTypeList(ts);
|
|
897
|
+
if (option_1 != null) {
|
|
898
|
+
return new Type(/* TTuple */ 7, [option_1]);
|
|
899
|
+
}
|
|
900
|
+
else {
|
|
901
|
+
return undefined;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
case 7:
|
|
905
|
+
return undefined;
|
|
906
|
+
case 8:
|
|
907
|
+
return undefined;
|
|
908
|
+
case 9: {
|
|
909
|
+
const resolved = choose(resolve, arguments$);
|
|
910
|
+
if (length(resolved) === length(arguments$)) {
|
|
911
|
+
return new Type(/* TApplied */ 13, [name_1, resolved]);
|
|
912
|
+
}
|
|
913
|
+
else {
|
|
914
|
+
return undefined;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
case 10: {
|
|
918
|
+
const option_3 = resolve(inner);
|
|
919
|
+
if (option_3 != null) {
|
|
920
|
+
return new Type(/* TList */ 5, [option_3]);
|
|
921
|
+
}
|
|
922
|
+
else {
|
|
923
|
+
return undefined;
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
case 11: {
|
|
927
|
+
const option_5 = resolve(inner_1);
|
|
928
|
+
if (option_5 != null) {
|
|
929
|
+
return new Type(/* TTask */ 6, [option_5]);
|
|
930
|
+
}
|
|
931
|
+
else {
|
|
932
|
+
return undefined;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
case 12: {
|
|
936
|
+
const option_7 = resolve(inner_2);
|
|
937
|
+
if (option_7 != null) {
|
|
938
|
+
return new Type(/* TOption */ 10, [option_7]);
|
|
939
|
+
}
|
|
940
|
+
else {
|
|
941
|
+
return undefined;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
case 13: {
|
|
945
|
+
const option_9 = resolve(inner_3);
|
|
946
|
+
if (option_9 != null) {
|
|
947
|
+
return new Type(/* TMap */ 9, [Type.TString, option_9]);
|
|
948
|
+
}
|
|
949
|
+
else {
|
|
950
|
+
return undefined;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
case 14: {
|
|
954
|
+
const matchValue = equals_1(keyType, new TypeRef(/* TRName */ 0, ["numeric"])) ? Type.TInt : resolve(keyType);
|
|
955
|
+
const matchValue_1 = resolve(valueType);
|
|
956
|
+
let matchResult_1, key, value_1;
|
|
806
957
|
if (matchValue != null) {
|
|
807
958
|
if (matchValue_1 != null) {
|
|
808
|
-
|
|
959
|
+
matchResult_1 = 0;
|
|
809
960
|
key = matchValue;
|
|
810
961
|
value_1 = matchValue_1;
|
|
811
962
|
}
|
|
812
963
|
else {
|
|
813
|
-
|
|
964
|
+
matchResult_1 = 1;
|
|
814
965
|
}
|
|
815
966
|
}
|
|
816
967
|
else {
|
|
817
|
-
|
|
968
|
+
matchResult_1 = 1;
|
|
818
969
|
}
|
|
819
|
-
switch (
|
|
970
|
+
switch (matchResult_1) {
|
|
820
971
|
case 0:
|
|
821
972
|
return new Type(/* TMap */ 9, [key, value_1]);
|
|
822
973
|
default:
|
|
823
974
|
return undefined;
|
|
824
975
|
}
|
|
825
976
|
}
|
|
826
|
-
case
|
|
977
|
+
case 15:
|
|
978
|
+
return undefined;
|
|
979
|
+
case 16: {
|
|
827
980
|
let shape;
|
|
828
|
-
const option_11 = resolveFieldList(
|
|
981
|
+
const option_11 = resolveFieldList(fields);
|
|
829
982
|
shape = ((option_11 != null) ? ofList(option_11, {
|
|
830
983
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
831
984
|
}) : undefined);
|
|
@@ -833,20 +986,20 @@ function valueMatchesTypeRef(typeDefs, tref, value) {
|
|
|
833
986
|
const s = shape;
|
|
834
987
|
return tryPick((tupledArg) => {
|
|
835
988
|
const t_1 = tupledArg[1];
|
|
836
|
-
let
|
|
989
|
+
let matchResult_2, f_1;
|
|
837
990
|
if (t_1.tag === 8) {
|
|
838
991
|
if (t_1.fields[0].Equals(s)) {
|
|
839
|
-
|
|
992
|
+
matchResult_2 = 0;
|
|
840
993
|
f_1 = t_1.fields[0];
|
|
841
994
|
}
|
|
842
995
|
else {
|
|
843
|
-
|
|
996
|
+
matchResult_2 = 1;
|
|
844
997
|
}
|
|
845
998
|
}
|
|
846
999
|
else {
|
|
847
|
-
|
|
1000
|
+
matchResult_2 = 1;
|
|
848
1001
|
}
|
|
849
|
-
switch (
|
|
1002
|
+
switch (matchResult_2) {
|
|
850
1003
|
case 0:
|
|
851
1004
|
return new Type(/* TNamed */ 12, [tupledArg[0]]);
|
|
852
1005
|
default:
|
|
@@ -858,8 +1011,8 @@ function valueMatchesTypeRef(typeDefs, tref, value) {
|
|
|
858
1011
|
return undefined;
|
|
859
1012
|
}
|
|
860
1013
|
}
|
|
861
|
-
|
|
862
|
-
const option_13 = resolveFieldList(
|
|
1014
|
+
default: {
|
|
1015
|
+
const option_13 = resolveFieldList(fields_1);
|
|
863
1016
|
if (option_13 != null) {
|
|
864
1017
|
return new Type(/* TRecord */ 8, [ofList(option_13, {
|
|
865
1018
|
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
@@ -869,42 +1022,27 @@ function valueMatchesTypeRef(typeDefs, tref, value) {
|
|
|
869
1022
|
return undefined;
|
|
870
1023
|
}
|
|
871
1024
|
}
|
|
872
|
-
default:
|
|
873
|
-
switch (tref_1.fields[0]) {
|
|
874
|
-
case "unit":
|
|
875
|
-
return Type.TUnit;
|
|
876
|
-
case "int":
|
|
877
|
-
return Type.TInt;
|
|
878
|
-
case "float":
|
|
879
|
-
return Type.TFloat;
|
|
880
|
-
case "bool":
|
|
881
|
-
return Type.TBool;
|
|
882
|
-
case "string":
|
|
883
|
-
return Type.TString;
|
|
884
|
-
default:
|
|
885
|
-
return tryFind(tref_1.fields[0], typeDefs);
|
|
886
|
-
}
|
|
887
1025
|
}
|
|
888
1026
|
};
|
|
889
1027
|
const resolveTypeList = (items) => {
|
|
890
1028
|
if (!isEmpty(items)) {
|
|
891
1029
|
const matchValue_3 = resolve(head_1(items));
|
|
892
1030
|
const matchValue_4 = resolveTypeList(tail_2(items));
|
|
893
|
-
let
|
|
1031
|
+
let matchResult_3, h, t_2;
|
|
894
1032
|
if (matchValue_3 != null) {
|
|
895
1033
|
if (matchValue_4 != null) {
|
|
896
|
-
|
|
1034
|
+
matchResult_3 = 0;
|
|
897
1035
|
h = matchValue_3;
|
|
898
1036
|
t_2 = matchValue_4;
|
|
899
1037
|
}
|
|
900
1038
|
else {
|
|
901
|
-
|
|
1039
|
+
matchResult_3 = 1;
|
|
902
1040
|
}
|
|
903
1041
|
}
|
|
904
1042
|
else {
|
|
905
|
-
|
|
1043
|
+
matchResult_3 = 1;
|
|
906
1044
|
}
|
|
907
|
-
switch (
|
|
1045
|
+
switch (matchResult_3) {
|
|
908
1046
|
case 0:
|
|
909
1047
|
return cons(h, t_2);
|
|
910
1048
|
default:
|
|
@@ -919,21 +1057,21 @@ function valueMatchesTypeRef(typeDefs, tref, value) {
|
|
|
919
1057
|
if (!isEmpty(fields_2)) {
|
|
920
1058
|
const matchValue_6 = resolve(head_1(fields_2)[1]);
|
|
921
1059
|
const matchValue_7 = resolveFieldList(tail_2(fields_2));
|
|
922
|
-
let
|
|
1060
|
+
let matchResult_4, rest, t_3;
|
|
923
1061
|
if (matchValue_6 != null) {
|
|
924
1062
|
if (matchValue_7 != null) {
|
|
925
|
-
|
|
1063
|
+
matchResult_4 = 0;
|
|
926
1064
|
rest = matchValue_7;
|
|
927
1065
|
t_3 = matchValue_6;
|
|
928
1066
|
}
|
|
929
1067
|
else {
|
|
930
|
-
|
|
1068
|
+
matchResult_4 = 1;
|
|
931
1069
|
}
|
|
932
1070
|
}
|
|
933
1071
|
else {
|
|
934
|
-
|
|
1072
|
+
matchResult_4 = 1;
|
|
935
1073
|
}
|
|
936
|
-
switch (
|
|
1074
|
+
switch (matchResult_4) {
|
|
937
1075
|
case 0:
|
|
938
1076
|
return cons([head_1(fields_2)[0], t_3], rest);
|
|
939
1077
|
default:
|
|
@@ -948,148 +1086,149 @@ function valueMatchesTypeRef(typeDefs, tref, value) {
|
|
|
948
1086
|
valueHasType:
|
|
949
1087
|
while (true) {
|
|
950
1088
|
const value_2 = value_2_mut, t_4 = t_4_mut;
|
|
951
|
-
let
|
|
1089
|
+
let matchResult_5, inner_4, items_1, inner_5, items_2, inner_6, inner_7, v_1, fields_3, values, fields_4, values_1, name_6, v_2;
|
|
952
1090
|
switch (t_4.tag) {
|
|
1091
|
+
case 13:
|
|
1092
|
+
case 19: {
|
|
1093
|
+
matchResult_5 = 12;
|
|
1094
|
+
break;
|
|
1095
|
+
}
|
|
953
1096
|
case 0: {
|
|
954
1097
|
if (value_2.tag === 0) {
|
|
955
|
-
|
|
1098
|
+
matchResult_5 = 0;
|
|
956
1099
|
}
|
|
957
1100
|
else {
|
|
958
|
-
|
|
1101
|
+
matchResult_5 = 15;
|
|
959
1102
|
}
|
|
960
1103
|
break;
|
|
961
1104
|
}
|
|
962
1105
|
case 1: {
|
|
963
1106
|
if (value_2.tag === 1) {
|
|
964
|
-
|
|
1107
|
+
matchResult_5 = 1;
|
|
965
1108
|
}
|
|
966
1109
|
else {
|
|
967
|
-
|
|
1110
|
+
matchResult_5 = 15;
|
|
968
1111
|
}
|
|
969
1112
|
break;
|
|
970
1113
|
}
|
|
971
1114
|
case 2: {
|
|
972
1115
|
if (value_2.tag === 2) {
|
|
973
|
-
|
|
1116
|
+
matchResult_5 = 2;
|
|
974
1117
|
}
|
|
975
1118
|
else {
|
|
976
|
-
|
|
1119
|
+
matchResult_5 = 15;
|
|
977
1120
|
}
|
|
978
1121
|
break;
|
|
979
1122
|
}
|
|
980
1123
|
case 3: {
|
|
981
1124
|
if (value_2.tag === 3) {
|
|
982
|
-
|
|
1125
|
+
matchResult_5 = 3;
|
|
983
1126
|
}
|
|
984
1127
|
else {
|
|
985
|
-
|
|
1128
|
+
matchResult_5 = 15;
|
|
986
1129
|
}
|
|
987
1130
|
break;
|
|
988
1131
|
}
|
|
989
1132
|
case 4: {
|
|
990
1133
|
if (value_2.tag === 4) {
|
|
991
|
-
|
|
1134
|
+
matchResult_5 = 4;
|
|
992
1135
|
}
|
|
993
1136
|
else {
|
|
994
|
-
|
|
1137
|
+
matchResult_5 = 15;
|
|
995
1138
|
}
|
|
996
1139
|
break;
|
|
997
1140
|
}
|
|
998
1141
|
case 5: {
|
|
999
1142
|
if (value_2.tag === 5) {
|
|
1000
|
-
|
|
1143
|
+
matchResult_5 = 5;
|
|
1001
1144
|
inner_4 = t_4.fields[0];
|
|
1002
1145
|
items_1 = value_2.fields[0];
|
|
1003
1146
|
}
|
|
1004
1147
|
else {
|
|
1005
|
-
|
|
1148
|
+
matchResult_5 = 15;
|
|
1006
1149
|
}
|
|
1007
1150
|
break;
|
|
1008
1151
|
}
|
|
1009
1152
|
case 6: {
|
|
1010
1153
|
if (value_2.tag === 13) {
|
|
1011
|
-
|
|
1154
|
+
matchResult_5 = 6;
|
|
1012
1155
|
}
|
|
1013
1156
|
else {
|
|
1014
|
-
|
|
1157
|
+
matchResult_5 = 15;
|
|
1015
1158
|
}
|
|
1016
1159
|
break;
|
|
1017
1160
|
}
|
|
1018
1161
|
case 7: {
|
|
1019
1162
|
if (value_2.tag === 6) {
|
|
1020
|
-
|
|
1163
|
+
matchResult_5 = 7;
|
|
1021
1164
|
inner_5 = t_4.fields[0];
|
|
1022
1165
|
items_2 = value_2.fields[0];
|
|
1023
1166
|
}
|
|
1024
1167
|
else {
|
|
1025
|
-
|
|
1168
|
+
matchResult_5 = 15;
|
|
1026
1169
|
}
|
|
1027
1170
|
break;
|
|
1028
1171
|
}
|
|
1029
1172
|
case 10: {
|
|
1030
1173
|
if (value_2.tag === 9) {
|
|
1031
1174
|
if (value_2.fields[0] != null) {
|
|
1032
|
-
|
|
1175
|
+
matchResult_5 = 9;
|
|
1033
1176
|
inner_7 = t_4.fields[0];
|
|
1034
1177
|
v_1 = value_2.fields[0];
|
|
1035
1178
|
}
|
|
1036
1179
|
else {
|
|
1037
|
-
|
|
1180
|
+
matchResult_5 = 8;
|
|
1038
1181
|
inner_6 = t_4.fields[0];
|
|
1039
1182
|
}
|
|
1040
1183
|
}
|
|
1041
1184
|
else {
|
|
1042
|
-
|
|
1185
|
+
matchResult_5 = 15;
|
|
1043
1186
|
}
|
|
1044
1187
|
break;
|
|
1045
1188
|
}
|
|
1046
1189
|
case 9: {
|
|
1047
1190
|
if (value_2.tag === 8) {
|
|
1048
|
-
|
|
1191
|
+
matchResult_5 = 10;
|
|
1049
1192
|
}
|
|
1050
1193
|
else {
|
|
1051
|
-
|
|
1194
|
+
matchResult_5 = 15;
|
|
1052
1195
|
}
|
|
1053
1196
|
break;
|
|
1054
1197
|
}
|
|
1055
1198
|
case 8: {
|
|
1056
1199
|
const activePatternResult = $007CRecordFields$007C_$007C(value_2);
|
|
1057
1200
|
if (activePatternResult != null) {
|
|
1058
|
-
|
|
1201
|
+
matchResult_5 = 11;
|
|
1059
1202
|
fields_3 = t_4.fields[0];
|
|
1060
1203
|
values = activePatternResult;
|
|
1061
1204
|
}
|
|
1062
1205
|
else {
|
|
1063
|
-
|
|
1206
|
+
matchResult_5 = 15;
|
|
1064
1207
|
}
|
|
1065
1208
|
break;
|
|
1066
1209
|
}
|
|
1067
|
-
case
|
|
1068
|
-
matchResult_4 = 12;
|
|
1069
|
-
break;
|
|
1070
|
-
}
|
|
1071
|
-
case 18: {
|
|
1210
|
+
case 20: {
|
|
1072
1211
|
const activePatternResult_1 = $007CRecordFields$007C_$007C(value_2);
|
|
1073
1212
|
if (activePatternResult_1 != null) {
|
|
1074
|
-
|
|
1213
|
+
matchResult_5 = 13;
|
|
1075
1214
|
fields_4 = t_4.fields[1];
|
|
1076
1215
|
values_1 = activePatternResult_1;
|
|
1077
1216
|
}
|
|
1078
1217
|
else {
|
|
1079
|
-
|
|
1218
|
+
matchResult_5 = 15;
|
|
1080
1219
|
}
|
|
1081
1220
|
break;
|
|
1082
1221
|
}
|
|
1083
1222
|
case 12: {
|
|
1084
|
-
|
|
1085
|
-
|
|
1223
|
+
matchResult_5 = 14;
|
|
1224
|
+
name_6 = t_4.fields[0];
|
|
1086
1225
|
v_2 = value_2;
|
|
1087
1226
|
break;
|
|
1088
1227
|
}
|
|
1089
1228
|
default:
|
|
1090
|
-
|
|
1229
|
+
matchResult_5 = 15;
|
|
1091
1230
|
}
|
|
1092
|
-
switch (
|
|
1231
|
+
switch (matchResult_5) {
|
|
1093
1232
|
case 0:
|
|
1094
1233
|
return true;
|
|
1095
1234
|
case 1:
|
|
@@ -1121,8 +1260,8 @@ function valueMatchesTypeRef(typeDefs, tref, value) {
|
|
|
1121
1260
|
case 10:
|
|
1122
1261
|
return true;
|
|
1123
1262
|
case 11:
|
|
1124
|
-
return forAll((
|
|
1125
|
-
const matchValue_10 = FSharpMap__TryFind(values,
|
|
1263
|
+
return forAll((name_4, ft) => {
|
|
1264
|
+
const matchValue_10 = FSharpMap__TryFind(values, name_4);
|
|
1126
1265
|
if (matchValue_10 == null) {
|
|
1127
1266
|
return false;
|
|
1128
1267
|
}
|
|
@@ -1133,9 +1272,9 @@ function valueMatchesTypeRef(typeDefs, tref, value) {
|
|
|
1133
1272
|
case 12:
|
|
1134
1273
|
return matches(typeDefs, t_4, value_2);
|
|
1135
1274
|
case 13:
|
|
1136
|
-
return forAll((
|
|
1275
|
+
return forAll((name_5, ft_1) => exists((fv_1) => valueHasType(fv_1, ft_1), toArray(FSharpMap__TryFind(values_1, name_5))), fields_4);
|
|
1137
1276
|
case 14: {
|
|
1138
|
-
const matchValue_11 = FSharpMap__TryFind(typeDefs,
|
|
1277
|
+
const matchValue_11 = FSharpMap__TryFind(typeDefs, name_6);
|
|
1139
1278
|
if (matchValue_11 == null) {
|
|
1140
1279
|
return false;
|
|
1141
1280
|
}
|
|
@@ -1152,7 +1291,7 @@ function valueMatchesTypeRef(typeDefs, tref, value) {
|
|
|
1152
1291
|
}
|
|
1153
1292
|
};
|
|
1154
1293
|
switch (tref.tag) {
|
|
1155
|
-
case
|
|
1294
|
+
case 8: {
|
|
1156
1295
|
const matchValue_12 = resolve(tref);
|
|
1157
1296
|
if (matchValue_12 == null) {
|
|
1158
1297
|
return false;
|
|
@@ -1161,8 +1300,8 @@ function valueMatchesTypeRef(typeDefs, tref, value) {
|
|
|
1161
1300
|
return valueHasType(value, matchValue_12);
|
|
1162
1301
|
}
|
|
1163
1302
|
}
|
|
1164
|
-
case
|
|
1165
|
-
const matchValue_13 = resolve(new TypeRef(/* TRStructuralRecord */
|
|
1303
|
+
case 9: {
|
|
1304
|
+
const matchValue_13 = resolve(new TypeRef(/* TRStructuralRecord */ 9, [tref.fields[0]]));
|
|
1166
1305
|
if (matchValue_13 == null) {
|
|
1167
1306
|
return false;
|
|
1168
1307
|
}
|
|
@@ -1918,7 +2057,7 @@ function applyFunctionValue(runtime, typeDefs, span, fnValue, argValue) {
|
|
|
1918
2057
|
checkRuntime(runtime);
|
|
1919
2058
|
switch (fnValue.tag) {
|
|
1920
2059
|
case 14:
|
|
1921
|
-
if (fnValue.fields[1].tag ===
|
|
2060
|
+
if (fnValue.fields[1].tag === 5) {
|
|
1922
2061
|
return new Execution$1(new Value(/* VClosure */ 14, [fnValue.fields[1].fields[0].Name, fnValue.fields[1].fields[1], new FSharpRef(FSharpMap__Add(fnValue.fields[2].contents, fnValue.fields[0], argValue))]), defaultOf());
|
|
1923
2062
|
}
|
|
1924
2063
|
else {
|
|
@@ -2328,11 +2467,11 @@ function evalExpr(runtime, typeDefs, env, expr) {
|
|
|
2328
2467
|
return immediate(matchValue);
|
|
2329
2468
|
}
|
|
2330
2469
|
}
|
|
2331
|
-
case
|
|
2470
|
+
case 5:
|
|
2332
2471
|
return immediate(new Value(/* VClosure */ 14, [expr.fields[0].Name, expr.fields[1], new FSharpRef(env)]));
|
|
2333
|
-
case
|
|
2472
|
+
case 28:
|
|
2334
2473
|
return immediate(new Value(/* VOption */ 9, [undefined]));
|
|
2335
|
-
case
|
|
2474
|
+
case 29: {
|
|
2336
2475
|
const name_1 = expr.fields[0];
|
|
2337
2476
|
const matchValue_1 = FSharpMap__TryFind(typeDefs, name_1);
|
|
2338
2477
|
if (matchValue_1 == null) {
|
|
@@ -2342,7 +2481,7 @@ function evalExpr(runtime, typeDefs, env, expr) {
|
|
|
2342
2481
|
return immediate(new Value(/* VTypeToken */ 12, [matchValue_1]));
|
|
2343
2482
|
}
|
|
2344
2483
|
}
|
|
2345
|
-
case
|
|
2484
|
+
case 30: {
|
|
2346
2485
|
const name_2 = expr.fields[0];
|
|
2347
2486
|
if (FSharpMap__ContainsKey(env, name_2)) {
|
|
2348
2487
|
return immediate(new Value(/* VString */ 4, [name_2]));
|
|
@@ -2363,21 +2502,26 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
2363
2502
|
case 0:
|
|
2364
2503
|
case 1:
|
|
2365
2504
|
case 2:
|
|
2366
|
-
case
|
|
2367
|
-
case 27:
|
|
2505
|
+
case 5:
|
|
2368
2506
|
case 28:
|
|
2369
|
-
case 29:
|
|
2507
|
+
case 29:
|
|
2508
|
+
case 30: {
|
|
2370
2509
|
matchResult = 22;
|
|
2371
2510
|
break;
|
|
2372
2511
|
}
|
|
2373
|
-
case
|
|
2512
|
+
case 3: {
|
|
2513
|
+
matchResult = 0;
|
|
2514
|
+
inner = expr.fields[0];
|
|
2515
|
+
break;
|
|
2516
|
+
}
|
|
2517
|
+
case 6: {
|
|
2374
2518
|
matchResult = 1;
|
|
2375
2519
|
arg = expr.fields[1];
|
|
2376
2520
|
fn = expr.fields[0];
|
|
2377
2521
|
span = expr.fields[2];
|
|
2378
2522
|
break;
|
|
2379
2523
|
}
|
|
2380
|
-
case
|
|
2524
|
+
case 7: {
|
|
2381
2525
|
matchResult = 2;
|
|
2382
2526
|
cond = expr.fields[0];
|
|
2383
2527
|
no = expr.fields[2];
|
|
@@ -2385,13 +2529,13 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
2385
2529
|
yes = expr.fields[1];
|
|
2386
2530
|
break;
|
|
2387
2531
|
}
|
|
2388
|
-
case
|
|
2532
|
+
case 8: {
|
|
2389
2533
|
matchResult = 3;
|
|
2390
2534
|
span_2 = expr.fields[1];
|
|
2391
2535
|
valueExpr = expr.fields[0];
|
|
2392
2536
|
break;
|
|
2393
2537
|
}
|
|
2394
|
-
case
|
|
2538
|
+
case 9: {
|
|
2395
2539
|
matchResult = 4;
|
|
2396
2540
|
body_12 = expr.fields[2];
|
|
2397
2541
|
name = expr.fields[0];
|
|
@@ -2399,16 +2543,16 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
2399
2543
|
span_3 = expr.fields[3];
|
|
2400
2544
|
break;
|
|
2401
2545
|
}
|
|
2402
|
-
case
|
|
2546
|
+
case 11: {
|
|
2403
2547
|
matchResult = 5;
|
|
2404
2548
|
body_18 = expr.fields[2];
|
|
2405
2549
|
isRec = expr.fields[3];
|
|
2406
2550
|
name_1 = expr.fields[0];
|
|
2407
|
-
span_4 = expr.fields[
|
|
2551
|
+
span_4 = expr.fields[6];
|
|
2408
2552
|
value_21 = expr.fields[1];
|
|
2409
2553
|
break;
|
|
2410
2554
|
}
|
|
2411
|
-
case
|
|
2555
|
+
case 12: {
|
|
2412
2556
|
matchResult = 6;
|
|
2413
2557
|
body_23 = expr.fields[2];
|
|
2414
2558
|
pattern = expr.fields[0];
|
|
@@ -2416,81 +2560,81 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
2416
2560
|
value_25 = expr.fields[1];
|
|
2417
2561
|
break;
|
|
2418
2562
|
}
|
|
2419
|
-
case
|
|
2563
|
+
case 13: {
|
|
2420
2564
|
matchResult = 7;
|
|
2421
2565
|
bindings_1 = expr.fields[0];
|
|
2422
2566
|
body_27 = expr.fields[1];
|
|
2423
2567
|
span_6 = expr.fields[2];
|
|
2424
2568
|
break;
|
|
2425
2569
|
}
|
|
2426
|
-
case
|
|
2570
|
+
case 10: {
|
|
2427
2571
|
matchResult = 8;
|
|
2428
2572
|
cases = expr.fields[1];
|
|
2429
2573
|
scrutinee = expr.fields[0];
|
|
2430
2574
|
span_7 = expr.fields[2];
|
|
2431
2575
|
break;
|
|
2432
2576
|
}
|
|
2433
|
-
case
|
|
2577
|
+
case 14: {
|
|
2434
2578
|
matchResult = 9;
|
|
2435
2579
|
items_1 = expr.fields[0];
|
|
2436
2580
|
break;
|
|
2437
2581
|
}
|
|
2438
|
-
case
|
|
2582
|
+
case 16: {
|
|
2439
2583
|
matchResult = 10;
|
|
2440
2584
|
items_2 = expr.fields[0];
|
|
2441
2585
|
break;
|
|
2442
2586
|
}
|
|
2443
|
-
case
|
|
2587
|
+
case 15: {
|
|
2444
2588
|
matchResult = 11;
|
|
2445
2589
|
first_1 = expr.fields[0];
|
|
2446
2590
|
last = expr.fields[1];
|
|
2447
2591
|
span_8 = expr.fields[2];
|
|
2448
2592
|
break;
|
|
2449
2593
|
}
|
|
2450
|
-
case
|
|
2594
|
+
case 17: {
|
|
2451
2595
|
matchResult = 12;
|
|
2452
2596
|
fields = expr.fields[0];
|
|
2453
2597
|
break;
|
|
2454
2598
|
}
|
|
2455
|
-
case
|
|
2599
|
+
case 18: {
|
|
2456
2600
|
matchResult = 12;
|
|
2457
2601
|
fields = expr.fields[0];
|
|
2458
2602
|
break;
|
|
2459
2603
|
}
|
|
2460
|
-
case
|
|
2604
|
+
case 19: {
|
|
2461
2605
|
matchResult = 13;
|
|
2462
2606
|
entries_1 = expr.fields[0];
|
|
2463
2607
|
break;
|
|
2464
2608
|
}
|
|
2465
|
-
case
|
|
2609
|
+
case 20: {
|
|
2466
2610
|
matchResult = 14;
|
|
2467
2611
|
span_9 = expr.fields[2];
|
|
2468
2612
|
target = expr.fields[0];
|
|
2469
2613
|
updates = expr.fields[1];
|
|
2470
2614
|
break;
|
|
2471
2615
|
}
|
|
2472
|
-
case
|
|
2616
|
+
case 21: {
|
|
2473
2617
|
matchResult = 15;
|
|
2474
2618
|
span_10 = expr.fields[2];
|
|
2475
2619
|
target_1 = expr.fields[0];
|
|
2476
2620
|
updates_1 = expr.fields[1];
|
|
2477
2621
|
break;
|
|
2478
2622
|
}
|
|
2479
|
-
case
|
|
2623
|
+
case 22: {
|
|
2480
2624
|
matchResult = 16;
|
|
2481
2625
|
field = expr.fields[1];
|
|
2482
2626
|
span_11 = expr.fields[2];
|
|
2483
2627
|
target_2 = expr.fields[0];
|
|
2484
2628
|
break;
|
|
2485
2629
|
}
|
|
2486
|
-
case
|
|
2630
|
+
case 23: {
|
|
2487
2631
|
matchResult = 17;
|
|
2488
2632
|
keyExpr_1 = expr.fields[1];
|
|
2489
2633
|
span_12 = expr.fields[2];
|
|
2490
2634
|
target_3 = expr.fields[0];
|
|
2491
2635
|
break;
|
|
2492
2636
|
}
|
|
2493
|
-
case
|
|
2637
|
+
case 26: {
|
|
2494
2638
|
switch (expr.fields[0]) {
|
|
2495
2639
|
case "&&": {
|
|
2496
2640
|
matchResult = 18;
|
|
@@ -2517,26 +2661,26 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
2517
2661
|
}
|
|
2518
2662
|
break;
|
|
2519
2663
|
}
|
|
2520
|
-
case
|
|
2664
|
+
case 24: {
|
|
2521
2665
|
matchResult = 19;
|
|
2522
2666
|
a_3 = expr.fields[0];
|
|
2523
2667
|
b_2 = expr.fields[1];
|
|
2524
2668
|
span_14 = expr.fields[2];
|
|
2525
2669
|
break;
|
|
2526
2670
|
}
|
|
2527
|
-
case
|
|
2671
|
+
case 25: {
|
|
2528
2672
|
matchResult = 19;
|
|
2529
2673
|
a_3 = expr.fields[0];
|
|
2530
2674
|
b_2 = expr.fields[1];
|
|
2531
2675
|
span_14 = expr.fields[2];
|
|
2532
2676
|
break;
|
|
2533
2677
|
}
|
|
2534
|
-
case
|
|
2678
|
+
case 27: {
|
|
2535
2679
|
matchResult = 20;
|
|
2536
2680
|
value_113 = expr.fields[0];
|
|
2537
2681
|
break;
|
|
2538
2682
|
}
|
|
2539
|
-
case
|
|
2683
|
+
case 31: {
|
|
2540
2684
|
matchResult = 21;
|
|
2541
2685
|
parts = expr.fields[0];
|
|
2542
2686
|
break;
|
|
@@ -2957,7 +3101,7 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
2957
3101
|
}
|
|
2958
3102
|
case 5:
|
|
2959
3103
|
if (isRec) {
|
|
2960
|
-
if (value_21.tag ===
|
|
3104
|
+
if (value_21.tag === 5) {
|
|
2961
3105
|
const recEnv = new FSharpRef(env);
|
|
2962
3106
|
recEnv.contents = FSharpMap__Add(env, name_1, new Value(/* VClosure */ 14, [value_21.fields[0].Name, value_21.fields[1], recEnv]));
|
|
2963
3107
|
return evalExpr(runtime, typeDefs, recEnv.contents, body_18);
|
|
@@ -3048,8 +3192,8 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
3048
3192
|
if (isEmpty(args)) {
|
|
3049
3193
|
throw new EvalException(new EvalError$("\'let rec ... and ...\' requires function arguments for each binding", bindingSpan));
|
|
3050
3194
|
}
|
|
3051
|
-
const matchValue_1 = foldBack((arg_1, acc) => (new Expr(/* ELambda */
|
|
3052
|
-
if (matchValue_1.tag ===
|
|
3195
|
+
const matchValue_1 = foldBack((arg_1, acc) => (new Expr(/* ELambda */ 5, [arg_1, acc, bindingSpan])), args, tupledArg[3]);
|
|
3196
|
+
if (matchValue_1.tag === 5) {
|
|
3053
3197
|
return [tupledArg[0], new Value(/* VClosure */ 14, [matchValue_1.fields[0].Name, matchValue_1.fields[1], recEnv_1])];
|
|
3054
3198
|
}
|
|
3055
3199
|
else {
|
|
@@ -4194,7 +4338,7 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
4194
4338
|
}
|
|
4195
4339
|
break;
|
|
4196
4340
|
}
|
|
4197
|
-
case
|
|
4341
|
+
case 22: {
|
|
4198
4342
|
matchResult_13 = 2;
|
|
4199
4343
|
name_8 = _arg_22.fields[1];
|
|
4200
4344
|
parent = _arg_22.fields[0];
|
|
@@ -5490,7 +5634,7 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
5490
5634
|
const body_72 = evalExpr(runtime, typeDefs, env, b_2);
|
|
5491
5635
|
if (Execution$1__get_IsImmediate(body_72)) {
|
|
5492
5636
|
const bv = body_72.Value;
|
|
5493
|
-
const op_2 = (expr.tag ===
|
|
5637
|
+
const op_2 = (expr.tag === 24) ? "::" : ((expr.tag === 25) ? "@" : ((expr.tag === 26) ? expr.fields[0] : ""));
|
|
5494
5638
|
if (op_2 === "|>") {
|
|
5495
5639
|
return applyFunctionValue(runtime, typeDefs, span_14, bv, av);
|
|
5496
5640
|
}
|
|
@@ -5504,7 +5648,7 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
5504
5648
|
if (Execution$1__get_IsImmediate(execution_53)) {
|
|
5505
5649
|
let execution_52;
|
|
5506
5650
|
const bv = execution_53.Value;
|
|
5507
|
-
const op_2 = (expr.tag ===
|
|
5651
|
+
const op_2 = (expr.tag === 24) ? "::" : ((expr.tag === 25) ? "@" : ((expr.tag === 26) ? expr.fields[0] : ""));
|
|
5508
5652
|
execution_52 = ((op_2 === "|>") ? applyFunctionValue(runtime, typeDefs, span_14, bv, av) : (new Execution$1(binaryOperator(span_14, op_2, av, bv), defaultOf())));
|
|
5509
5653
|
const continuation_79 = continuation_78;
|
|
5510
5654
|
if (Execution$1__get_IsImmediate(execution_52)) {
|
|
@@ -5518,7 +5662,7 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
5518
5662
|
return execution_53.Resume((value_111) => {
|
|
5519
5663
|
let execution_52;
|
|
5520
5664
|
const bv = value_111;
|
|
5521
|
-
const op_2 = (expr.tag ===
|
|
5665
|
+
const op_2 = (expr.tag === 24) ? "::" : ((expr.tag === 25) ? "@" : ((expr.tag === 26) ? expr.fields[0] : ""));
|
|
5522
5666
|
execution_52 = ((op_2 === "|>") ? applyFunctionValue(runtime, typeDefs, span_14, bv, av) : (new Execution$1(binaryOperator(span_14, op_2, av, bv), defaultOf())));
|
|
5523
5667
|
const continuation_79 = continuation_78;
|
|
5524
5668
|
return Execution$1__get_IsImmediate(execution_52) ? continuation_79(execution_52.Value) : execution_52.Resume(continuation_79);
|
|
@@ -5536,7 +5680,7 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
5536
5680
|
const body_72 = evalExpr(runtime, typeDefs, env, b_2);
|
|
5537
5681
|
if (Execution$1__get_IsImmediate(body_72)) {
|
|
5538
5682
|
const bv = body_72.Value;
|
|
5539
|
-
const op_2 = (expr.tag ===
|
|
5683
|
+
const op_2 = (expr.tag === 24) ? "::" : ((expr.tag === 25) ? "@" : ((expr.tag === 26) ? expr.fields[0] : ""));
|
|
5540
5684
|
execution_54 = ((op_2 === "|>") ? applyFunctionValue(runtime, typeDefs, span_14, bv, av) : (new Execution$1(binaryOperator(span_14, op_2, av, bv), defaultOf())));
|
|
5541
5685
|
}
|
|
5542
5686
|
else {
|
|
@@ -5545,7 +5689,7 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
5545
5689
|
if (Execution$1__get_IsImmediate(execution_53)) {
|
|
5546
5690
|
let execution_52;
|
|
5547
5691
|
const bv = execution_53.Value;
|
|
5548
|
-
const op_2 = (expr.tag ===
|
|
5692
|
+
const op_2 = (expr.tag === 24) ? "::" : ((expr.tag === 25) ? "@" : ((expr.tag === 26) ? expr.fields[0] : ""));
|
|
5549
5693
|
execution_52 = ((op_2 === "|>") ? applyFunctionValue(runtime, typeDefs, span_14, bv, av) : (new Execution$1(binaryOperator(span_14, op_2, av, bv), defaultOf())));
|
|
5550
5694
|
const continuation_79 = continuation_78;
|
|
5551
5695
|
if (Execution$1__get_IsImmediate(execution_52)) {
|
|
@@ -5559,7 +5703,7 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
5559
5703
|
return execution_53.Resume((value_111) => {
|
|
5560
5704
|
let execution_52;
|
|
5561
5705
|
const bv = value_111;
|
|
5562
|
-
const op_2 = (expr.tag ===
|
|
5706
|
+
const op_2 = (expr.tag === 24) ? "::" : ((expr.tag === 25) ? "@" : ((expr.tag === 26) ? expr.fields[0] : ""));
|
|
5563
5707
|
execution_52 = ((op_2 === "|>") ? applyFunctionValue(runtime, typeDefs, span_14, bv, av) : (new Execution$1(binaryOperator(span_14, op_2, av, bv), defaultOf())));
|
|
5564
5708
|
const continuation_79 = continuation_78;
|
|
5565
5709
|
return Execution$1__get_IsImmediate(execution_52) ? continuation_79(execution_52.Value) : execution_52.Resume(continuation_79);
|
|
@@ -5582,7 +5726,7 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
5582
5726
|
const body_72 = evalExpr(runtime, typeDefs, env, b_2);
|
|
5583
5727
|
if (Execution$1__get_IsImmediate(body_72)) {
|
|
5584
5728
|
const bv = body_72.Value;
|
|
5585
|
-
const op_2 = (expr.tag ===
|
|
5729
|
+
const op_2 = (expr.tag === 24) ? "::" : ((expr.tag === 25) ? "@" : ((expr.tag === 26) ? expr.fields[0] : ""));
|
|
5586
5730
|
execution_54 = ((op_2 === "|>") ? applyFunctionValue(runtime, typeDefs, span_14, bv, av) : (new Execution$1(binaryOperator(span_14, op_2, av, bv), defaultOf())));
|
|
5587
5731
|
}
|
|
5588
5732
|
else {
|
|
@@ -5591,7 +5735,7 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
5591
5735
|
if (Execution$1__get_IsImmediate(execution_53)) {
|
|
5592
5736
|
let execution_52;
|
|
5593
5737
|
const bv = execution_53.Value;
|
|
5594
|
-
const op_2 = (expr.tag ===
|
|
5738
|
+
const op_2 = (expr.tag === 24) ? "::" : ((expr.tag === 25) ? "@" : ((expr.tag === 26) ? expr.fields[0] : ""));
|
|
5595
5739
|
execution_52 = ((op_2 === "|>") ? applyFunctionValue(runtime, typeDefs, span_14, bv, av) : (new Execution$1(binaryOperator(span_14, op_2, av, bv), defaultOf())));
|
|
5596
5740
|
const continuation_79 = continuation_78;
|
|
5597
5741
|
if (Execution$1__get_IsImmediate(execution_52)) {
|
|
@@ -5605,7 +5749,7 @@ function evalCompound(runtime, typeDefs, env, expr) {
|
|
|
5605
5749
|
return execution_53.Resume((value_111) => {
|
|
5606
5750
|
let execution_52;
|
|
5607
5751
|
const bv = value_111;
|
|
5608
|
-
const op_2 = (expr.tag ===
|
|
5752
|
+
const op_2 = (expr.tag === 24) ? "::" : ((expr.tag === 25) ? "@" : ((expr.tag === 26) ? expr.fields[0] : ""));
|
|
5609
5753
|
execution_52 = ((op_2 === "|>") ? applyFunctionValue(runtime, typeDefs, span_14, bv, av) : (new Execution$1(binaryOperator(span_14, op_2, av, bv), defaultOf())));
|
|
5610
5754
|
const continuation_79 = continuation_78;
|
|
5611
5755
|
return Execution$1__get_IsImmediate(execution_52) ? continuation_79(execution_52.Value) : execution_52.Resume(continuation_79);
|
|
@@ -5751,7 +5895,7 @@ export function invokeValueWithPermissionsAndExitCode(permissions, typeDefs, fnV
|
|
|
5751
5895
|
while (true) {
|
|
5752
5896
|
const envAcc = envAcc_mut, exprAcc = exprAcc_mut, argsAcc = argsAcc_mut;
|
|
5753
5897
|
let matchResult, nextArg, nextBody, param, rest;
|
|
5754
|
-
if (exprAcc.tag ===
|
|
5898
|
+
if (exprAcc.tag === 5) {
|
|
5755
5899
|
if (!isEmpty(argsAcc)) {
|
|
5756
5900
|
matchResult = 0;
|
|
5757
5901
|
nextArg = head_1(argsAcc);
|
|
@@ -5897,7 +6041,7 @@ function evaluateStatements(runtime, typeDefs, initialEnv, program) {
|
|
|
5897
6041
|
const name_1 = stmt.fields[0];
|
|
5898
6042
|
const expr = stmt.fields[1];
|
|
5899
6043
|
if (stmt.fields[3]) {
|
|
5900
|
-
if (expr.tag ===
|
|
6044
|
+
if (expr.tag === 5) {
|
|
5901
6045
|
const recEnv = new FSharpRef(env);
|
|
5902
6046
|
const finalEnv = add_1(name_1, new Value(/* VClosure */ 14, [expr.fields[0].Name, expr.fields[1], recEnv]), env);
|
|
5903
6047
|
recEnv.contents = finalEnv;
|
|
@@ -5931,7 +6075,7 @@ function evaluateStatements(runtime, typeDefs, initialEnv, program) {
|
|
|
5931
6075
|
let finalEnv_1;
|
|
5932
6076
|
const list_1 = map_1((tupledArg) => {
|
|
5933
6077
|
const expr_2 = tupledArg[1];
|
|
5934
|
-
if (expr_2.tag ===
|
|
6078
|
+
if (expr_2.tag === 5) {
|
|
5935
6079
|
return [tupledArg[0], new Value(/* VClosure */ 14, [expr_2.fields[0].Name, expr_2.fields[1], recEnv_1])];
|
|
5936
6080
|
}
|
|
5937
6081
|
else {
|
|
@@ -5984,118 +6128,25 @@ function evaluateRegistered(registration, program) {
|
|
|
5984
6128
|
}, program)), {
|
|
5985
6129
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
5986
6130
|
});
|
|
5987
|
-
const
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
return new Type(/* TList */ 5, [fromRef(stack, tref.fields[0])]);
|
|
5997
|
-
case "task":
|
|
5998
|
-
return new Type(/* TTask */ 6, [fromRef(stack, tref.fields[0])]);
|
|
5999
|
-
case "option":
|
|
6000
|
-
return new Type(/* TOption */ 10, [fromRef(stack, tref.fields[0])]);
|
|
6001
|
-
case "map":
|
|
6002
|
-
return new Type(/* TMap */ 9, [Type.TString, fromRef(stack, tref.fields[0])]);
|
|
6003
|
-
default:
|
|
6004
|
-
throw new EvalException(new EvalError$(concat("Unsupported type suffix ", tref.fields[1]), unknownSpan));
|
|
6005
|
-
}
|
|
6006
|
-
case 4:
|
|
6007
|
-
return new Type(/* TMap */ 9, [equals_1(tref.fields[0], new TypeRef(/* TRName */ 0, ["numeric"])) ? Type.TInt : fromRef(stack, tref.fields[0]), fromRef(stack, tref.fields[1])]);
|
|
6008
|
-
case 5:
|
|
6009
|
-
return new Type(/* TRecord */ 8, [ofList(map_1((tupledArg_2) => [tupledArg_2[0], fromRef(stack, tupledArg_2[1])], tref.fields[0]), {
|
|
6010
|
-
Compare: (x_3, y_4) => (comparePrimitives(x_3, y_4) | 0),
|
|
6011
|
-
})]);
|
|
6012
|
-
case 6:
|
|
6013
|
-
return new Type(/* TRecord */ 8, [ofList(map_1((tupledArg_3) => [tupledArg_3[0], fromRef(stack, tupledArg_3[1])], tref.fields[0]), {
|
|
6014
|
-
Compare: (x_4, y_5) => (comparePrimitives(x_4, y_5) | 0),
|
|
6015
|
-
})]);
|
|
6016
|
-
default:
|
|
6017
|
-
switch (tref.fields[0]) {
|
|
6018
|
-
case "unit":
|
|
6019
|
-
return Type.TUnit;
|
|
6020
|
-
case "int":
|
|
6021
|
-
return Type.TInt;
|
|
6022
|
-
case "float":
|
|
6023
|
-
return Type.TFloat;
|
|
6024
|
-
case "bool":
|
|
6025
|
-
return Type.TBool;
|
|
6026
|
-
case "string":
|
|
6027
|
-
return Type.TString;
|
|
6028
|
-
default: {
|
|
6029
|
-
const matchValue = FSharpMap__TryFind(decls, tref.fields[0]);
|
|
6030
|
-
if (matchValue == null) {
|
|
6031
|
-
return new Type(/* TNamed */ 12, [tref.fields[0]]);
|
|
6032
|
-
}
|
|
6033
|
-
else {
|
|
6034
|
-
const d = matchValue;
|
|
6035
|
-
const matchValue_1 = tryFindIndex((y_1) => (tref.fields[0] === y_1), stack);
|
|
6036
|
-
if (matchValue_1 == null) {
|
|
6037
|
-
if (!isEmpty(d.Cases)) {
|
|
6038
|
-
return new Type(/* TUnion */ 13, [tref.fields[0], ofList(map_1((tupledArg) => {
|
|
6039
|
-
let mapping_1, option_3;
|
|
6040
|
-
return [tupledArg[0], (mapping_1 = curry2(fromRef)(cons(tref.fields[0], stack)), (option_3 = tupledArg[1], (option_3 != null) ? mapping_1(option_3) : undefined))];
|
|
6041
|
-
}, d.Cases), {
|
|
6042
|
-
Compare: (x_1, y_2) => (comparePrimitives(x_1, y_2) | 0),
|
|
6043
|
-
})]);
|
|
6044
|
-
}
|
|
6045
|
-
else {
|
|
6046
|
-
return new Type(/* TRecord */ 8, [ofList(map_1((tupledArg_1) => [tupledArg_1[0], fromRef(cons(tref.fields[0], stack), tupledArg_1[1])], d.Fields), {
|
|
6047
|
-
Compare: (x_2, y_3) => (comparePrimitives(x_2, y_3) | 0),
|
|
6048
|
-
})]);
|
|
6049
|
-
}
|
|
6050
|
-
}
|
|
6051
|
-
else if (matchValue_1 === 0) {
|
|
6052
|
-
if (d.IsRecursive) {
|
|
6053
|
-
return new Type(/* TNamed */ 12, [tref.fields[0]]);
|
|
6054
|
-
}
|
|
6055
|
-
else {
|
|
6056
|
-
throw new EvalException(new EvalError$(concat("Recursive type \'", tref.fields[0], "\' requires \'type rec\'"), unknownSpan));
|
|
6057
|
-
}
|
|
6058
|
-
}
|
|
6059
|
-
else {
|
|
6060
|
-
throw new EvalException(new EvalError$("Mutual recursive types are not supported", unknownSpan));
|
|
6061
|
-
}
|
|
6062
|
-
}
|
|
6063
|
-
}
|
|
6064
|
-
}
|
|
6065
|
-
}
|
|
6066
|
-
};
|
|
6067
|
-
const typeDefs_1 = fold((acc, name_3, t_2) => add_1(name_3, t_2, acc), map_2((name_2, def_2) => {
|
|
6068
|
-
if (!isEmpty(def_2.Cases)) {
|
|
6069
|
-
return new Type(/* TUnion */ 13, [name_2, ofList(map_1((tupledArg_4) => {
|
|
6070
|
-
let mapping_8, option_5;
|
|
6071
|
-
return [tupledArg_4[0], (mapping_8 = curry2(fromRef)(singleton(name_2)), (option_5 = tupledArg_4[1], (option_5 != null) ? mapping_8(option_5) : undefined))];
|
|
6072
|
-
}, def_2.Cases), {
|
|
6073
|
-
Compare: (x_5, y_6) => (comparePrimitives(x_5, y_6) | 0),
|
|
6074
|
-
})]);
|
|
6075
|
-
}
|
|
6076
|
-
else {
|
|
6077
|
-
return new Type(/* TRecord */ 8, [ofList(map_1((tupledArg_5) => [tupledArg_5[0], fromRef(singleton(name_2), tupledArg_5[1])], def_2.Fields), {
|
|
6078
|
-
Compare: (x_6, y_7) => (comparePrimitives(x_6, y_7) | 0),
|
|
6079
|
-
})]);
|
|
6080
|
-
}
|
|
6081
|
-
}, decls), typeDefinitions(registration_1, toList_1(keys(decls))));
|
|
6082
|
-
const constructorValues = collect((tupledArg_6) => {
|
|
6083
|
-
const typeName = tupledArg_6[0];
|
|
6084
|
-
return collect((tupledArg_7) => {
|
|
6085
|
-
const caseName_2 = tupledArg_7[0];
|
|
6086
|
-
const value = (tupledArg_7[1] != null) ? (new Value(/* VUnionCtor */ 11, [typeName, caseName_2])) : (new Value(/* VUnionCase */ 10, [typeName, caseName_2, undefined]));
|
|
6087
|
-
return ofArray([[caseName_2, value], [concat(typeName, ".", caseName_2), value]]);
|
|
6088
|
-
}, tupledArg_6[1].Cases);
|
|
6131
|
+
const hostDefinitions = typeDefinitions(registration_1, toList_1(keys(decls)));
|
|
6132
|
+
const typeDefs_1 = fold((acc, name, t) => add_1(name, t, acc), scriptTypeDefinitions(hostDefinitions, decls), hostDefinitions);
|
|
6133
|
+
const constructorValues = collect((tupledArg) => {
|
|
6134
|
+
const typeName = tupledArg[0];
|
|
6135
|
+
return collect((tupledArg_1) => {
|
|
6136
|
+
const caseName = tupledArg_1[0];
|
|
6137
|
+
const value = (tupledArg_1[1] != null) ? (new Value(/* VUnionCtor */ 11, [typeName, caseName])) : (new Value(/* VUnionCase */ 10, [typeName, caseName, undefined]));
|
|
6138
|
+
return ofArray([[caseName, value], [concat(typeName, ".", caseName), value]]);
|
|
6139
|
+
}, tupledArg[1].Cases);
|
|
6089
6140
|
}, toList(decls));
|
|
6090
|
-
const constructorValues_1 = append(collect((descriptor) => collect((
|
|
6091
|
-
const
|
|
6092
|
-
const value_1 = (
|
|
6093
|
-
return ofArray([[
|
|
6141
|
+
const constructorValues_1 = append(collect((descriptor) => collect((tupledArg_2) => {
|
|
6142
|
+
const caseName_1 = tupledArg_2[0];
|
|
6143
|
+
const value_1 = (tupledArg_2[1] == null) ? (new Value(/* VUnionCase */ 10, [descriptor.Name, caseName_1, undefined])) : (new Value(/* VUnionCtor */ 11, [descriptor.Name, caseName_1]));
|
|
6144
|
+
return ofArray([[caseName_1, value_1], [concat(descriptor.Name, ".", caseName_1), value_1]]);
|
|
6094
6145
|
}, toList(descriptor.Cases)), registration_1.Unions), constructorValues);
|
|
6095
6146
|
const externContext = createExternContext(runtime, typeDefs_1, unknownSpan);
|
|
6096
6147
|
const result_1 = runRuntime(runtime, () => {
|
|
6097
6148
|
let env;
|
|
6098
|
-
const
|
|
6149
|
+
const list_7 = append(builtinExterns, externs);
|
|
6099
6150
|
env = fold_1((acc_1, ext_2) => {
|
|
6100
6151
|
if (ext_2.Arity === 0) {
|
|
6101
6152
|
return FSharpMap__Add(acc_1, ext_2.Name, invoke(typeDefs_1, ext_2, externContext, empty()));
|
|
@@ -6104,9 +6155,9 @@ function evaluateRegistered(registration, program) {
|
|
|
6104
6155
|
return FSharpMap__Add(acc_1, ext_2.Name, new Value(/* VExternal */ 15, [ext_2, empty()]));
|
|
6105
6156
|
}
|
|
6106
6157
|
}, empty_1({
|
|
6107
|
-
Compare: (
|
|
6108
|
-
}),
|
|
6109
|
-
env = fold_1((acc_2,
|
|
6158
|
+
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
6159
|
+
}), list_7);
|
|
6160
|
+
env = fold_1((acc_2, tupledArg_3) => FSharpMap__Add(acc_2, tupledArg_3[0], tupledArg_3[1]), env, constructorValues_1);
|
|
6110
6161
|
try {
|
|
6111
6162
|
return evaluateStatements(runtime, typeDefs_1, env, program);
|
|
6112
6163
|
}
|