@magnusopera/fscript 0.82.2 → 0.83.1
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/BuiltinFunctions.js +1176 -195
- package/dist/FScript.Language/Eval.js +3659 -740
- package/dist/FScript.Language/Execution.js +513 -0
- package/dist/FScript.Language/HostInterop.js +9 -4
- package/dist/FScript.Language/IncludeResolver.js +13 -4
- package/dist/FScript.Language/TaskFunctions.js +50 -0
- package/dist/fable_modules/project_cracked.json +1 -1
- package/package.json +1 -1
|
@@ -6,19 +6,21 @@ import { ExternalCallContext, MapKey, Value, TaskHandle_$reflection, Value_$refl
|
|
|
6
6
|
import { EvalException, EvalError$, EvalError$_$reflection } from "./Error.js";
|
|
7
7
|
import { Span, Position } from "./Span.js";
|
|
8
8
|
import { printf, toText, join, concat } from "../fable_modules/fable-library-js.5.13.0/String.js";
|
|
9
|
-
import { curry2, disposeSafe, getEnumerator, equals as equals_1, compare, comparePrimitives, int64ToString } from "../fable_modules/fable-library-js.5.13.0/Util.js";
|
|
10
|
-
import { ofArray, collect, tryFindIndex, choose, tryFind as tryFind_1, tryPick as tryPick_1,
|
|
9
|
+
import { curry2, Exception, defaultOf, disposeSafe, getEnumerator, equals as equals_1, compare, comparePrimitives, int64ToString } from "../fable_modules/fable-library-js.5.13.0/Util.js";
|
|
10
|
+
import { ofArray, collect, tryFindIndex, choose, 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, isEmpty, forAll2, length, map } from "../fable_modules/fable-library-js.5.13.0/List.js";
|
|
11
11
|
import { keys, map as map_1, containsKey, FSharpMap__Add, fold, empty as empty_1, FSharpMap__Remove, FSharpMap__get_IsEmpty, FSharpMap__ContainsKey, add, FSharpMap__TryFind, tryFind, toSeq, ofList, FSharpMap__get_Item, forAll, FSharpMap__get_Keys, FSharpMap__get_Count, toList } from "../fable_modules/fable-library-js.5.13.0/Map.js";
|
|
12
|
-
import { op_Modulus, op_Division, op_Multiply, op_Subtraction, op_Addition, toInt64_unchecked,
|
|
12
|
+
import { compare as compare_1, op_Modulus, op_Division, op_Multiply, op_Subtraction, op_Addition, toInt64_unchecked, equals } from "../fable_modules/fable-library-js.5.13.0/BigInt.js";
|
|
13
13
|
import { contains, ofSeq } from "../fable_modules/fable-library-js.5.13.0/Set.js";
|
|
14
|
-
import { ofExterns, typeDefinitions, invoke, matches, $007CRecordFields$007C_$007C } from "./HostInterop.js";
|
|
14
|
+
import { ofExterns, typeDefinitions, invoke, prepareCall, matches, $007CRecordFields$007C_$007C } from "./HostInterop.js";
|
|
15
15
|
import { Ast_spanOfExpr, Expr, Ast_spanOfPattern, TypeRef } from "./Ast.js";
|
|
16
|
-
import { toList as toList_1, filter, length as length_1, foldBack, head as
|
|
16
|
+
import { toList as toList_1, filter, length as length_1, foldBack, head as head_2, exists, tryPick } from "../fable_modules/fable-library-js.5.13.0/Seq.js";
|
|
17
17
|
import { some, toArray } from "../fable_modules/fable-library-js.5.13.0/Option.js";
|
|
18
|
+
import { Execution_fold, Execution_map, Execution_execution, Execution_Builder__For_Z3A5BE4A, Execution$1__get_IsImmediate, Execution$1, Execution_run } from "./Execution.js";
|
|
19
|
+
import { awaitTask, spawn } from "./TaskFunctions.js";
|
|
20
|
+
import { builtinExterns, tryExecution } from "./BuiltinFunctions.js";
|
|
18
21
|
import { StringBuilder__Append_Z721C83C5, StringBuilder_$ctor } from "../fable_modules/fable-library-js.5.13.0/System.Text.js";
|
|
19
22
|
import { builtinReservedNames } from "./BuiltinSignatures.js";
|
|
20
|
-
import { typeDefs as
|
|
21
|
-
import { builtinExterns } from "./BuiltinFunctions.js";
|
|
23
|
+
import { typeDefs as typeDefs_2 } from "./BuiltinTypes.js";
|
|
22
24
|
|
|
23
25
|
export class ProgramState extends Record {
|
|
24
26
|
constructor(TypeDefs, Env, LastValue) {
|
|
@@ -44,7 +46,7 @@ class RuntimeState extends Record {
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
function RuntimeState_$reflection() {
|
|
47
|
-
return record_type("FScript.Language.Eval.RuntimeState", [], RuntimeState, () => [["SyncRoot", obj_type], ["Active", bool_type], ["PendingTasks", array_type(TaskHandle_$reflection())], ["BackgroundFailure", option_type(EvalError$_$reflection())]]);
|
|
49
|
+
return record_type("FScript.Language.Eval.RuntimeState", [], RuntimeState, () => [["SyncRoot", obj_type], ["Active", record_type("Microsoft.FSharp.Core.FSharpRef`1", [bool_type], FSharpRef, () => [["contents", bool_type]])], ["PendingTasks", array_type(TaskHandle_$reflection())], ["BackgroundFailure", record_type("Microsoft.FSharp.Core.FSharpRef`1", [option_type(EvalError$_$reflection())], FSharpRef, () => [["contents", option_type(EvalError$_$reflection())]])]]);
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
const unknownSpan = new Span(new Position(undefined, 0, 0), new Position(undefined, 0, 0));
|
|
@@ -57,19 +59,13 @@ function wrapUnexpectedTaskFailure(ex) {
|
|
|
57
59
|
return new EvalError$(concat("Task failed: ", ex.message), unknownSpan);
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
function withRuntimeLock(runtime, f) {
|
|
61
|
-
return f();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
62
|
function raiseIfBackgroundFailed(runtime) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
});
|
|
63
|
+
const matchValue = runtime.BackgroundFailure.contents;
|
|
64
|
+
if (matchValue == null) {
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
throw new EvalException(matchValue);
|
|
68
|
+
}
|
|
73
69
|
}
|
|
74
70
|
|
|
75
71
|
function literalToValue(lit) {
|
|
@@ -833,7 +829,7 @@ function valueMatchesTypeRef(typeDefs, tref, value) {
|
|
|
833
829
|
};
|
|
834
830
|
const resolveTypeList = (items) => {
|
|
835
831
|
if (!isEmpty(items)) {
|
|
836
|
-
const matchValue_3 = resolve(
|
|
832
|
+
const matchValue_3 = resolve(head_1(items));
|
|
837
833
|
const matchValue_4 = resolveTypeList(tail_2(items));
|
|
838
834
|
let matchResult_2, h, t_2;
|
|
839
835
|
if (matchValue_3 != null) {
|
|
@@ -862,7 +858,7 @@ function valueMatchesTypeRef(typeDefs, tref, value) {
|
|
|
862
858
|
};
|
|
863
859
|
const resolveFieldList = (fields_2) => {
|
|
864
860
|
if (!isEmpty(fields_2)) {
|
|
865
|
-
const matchValue_6 = resolve(
|
|
861
|
+
const matchValue_6 = resolve(head_1(fields_2)[1]);
|
|
866
862
|
const matchValue_7 = resolveFieldList(tail_2(fields_2));
|
|
867
863
|
let matchResult_3, rest, t_3;
|
|
868
864
|
if (matchValue_6 != null) {
|
|
@@ -880,7 +876,7 @@ function valueMatchesTypeRef(typeDefs, tref, value) {
|
|
|
880
876
|
}
|
|
881
877
|
switch (matchResult_3) {
|
|
882
878
|
case 0:
|
|
883
|
-
return cons([
|
|
879
|
+
return cons([head_1(fields_2)[0], t_3], rest);
|
|
884
880
|
default:
|
|
885
881
|
return undefined;
|
|
886
882
|
}
|
|
@@ -1165,16 +1161,16 @@ function patternMatch(typeDefs_mut, pat_mut, value_mut) {
|
|
|
1165
1161
|
while (true) {
|
|
1166
1162
|
const hasExplicitClauses = hasExplicitClauses_mut, clauses = clauses_mut, tailPattern = tailPattern_mut, remaining = remaining_mut, envAcc = envAcc_mut;
|
|
1167
1163
|
if (!isEmpty(clauses)) {
|
|
1168
|
-
const valuePattern =
|
|
1164
|
+
const valuePattern = head_1(clauses)[1];
|
|
1169
1165
|
const rest = tail_2(clauses);
|
|
1170
|
-
const keyPattern =
|
|
1166
|
+
const keyPattern = head_1(clauses)[0];
|
|
1171
1167
|
if (keyPattern.tag === 1) {
|
|
1172
1168
|
if (!FSharpMap__ContainsKey(envAcc, keyPattern.fields[0])) {
|
|
1173
1169
|
if (FSharpMap__get_IsEmpty(remaining)) {
|
|
1174
1170
|
return undefined;
|
|
1175
1171
|
}
|
|
1176
1172
|
else {
|
|
1177
|
-
const head =
|
|
1173
|
+
const head = head_2(remaining);
|
|
1178
1174
|
const key = head[0];
|
|
1179
1175
|
const nextRemaining = FSharpMap__Remove(remaining, key);
|
|
1180
1176
|
const matchValue_2 = patternMatch(typeDefs, keyPattern, mapKeyToValue(key));
|
|
@@ -1349,7 +1345,7 @@ function patternMatch(typeDefs_mut, pat_mut, value_mut) {
|
|
|
1349
1345
|
if (value.tag === 5) {
|
|
1350
1346
|
if (!isEmpty(value.fields[0])) {
|
|
1351
1347
|
matchResult_1 = 4;
|
|
1352
|
-
h =
|
|
1348
|
+
h = head_1(value.fields[0]);
|
|
1353
1349
|
p1 = pat.fields[0];
|
|
1354
1350
|
p2 = pat.fields[1];
|
|
1355
1351
|
t = tail_2(value.fields[0]);
|
|
@@ -1632,8 +1628,211 @@ function patternMatch(typeDefs_mut, pat_mut, value_mut) {
|
|
|
1632
1628
|
}
|
|
1633
1629
|
}
|
|
1634
1630
|
|
|
1631
|
+
function binaryOperator(span, op, av, bv) {
|
|
1632
|
+
const arith = (fInt, fFloat) => {
|
|
1633
|
+
let matchResult, x, y, x_1, y_1;
|
|
1634
|
+
switch (av.tag) {
|
|
1635
|
+
case 1: {
|
|
1636
|
+
if (bv.tag === 1) {
|
|
1637
|
+
matchResult = 0;
|
|
1638
|
+
x = av.fields[0];
|
|
1639
|
+
y = bv.fields[0];
|
|
1640
|
+
}
|
|
1641
|
+
else {
|
|
1642
|
+
matchResult = 2;
|
|
1643
|
+
}
|
|
1644
|
+
break;
|
|
1645
|
+
}
|
|
1646
|
+
case 2: {
|
|
1647
|
+
if (bv.tag === 2) {
|
|
1648
|
+
matchResult = 1;
|
|
1649
|
+
x_1 = av.fields[0];
|
|
1650
|
+
y_1 = bv.fields[0];
|
|
1651
|
+
}
|
|
1652
|
+
else {
|
|
1653
|
+
matchResult = 2;
|
|
1654
|
+
}
|
|
1655
|
+
break;
|
|
1656
|
+
}
|
|
1657
|
+
default:
|
|
1658
|
+
matchResult = 2;
|
|
1659
|
+
}
|
|
1660
|
+
switch (matchResult) {
|
|
1661
|
+
case 0:
|
|
1662
|
+
return new Value(/* VInt */ 1, [fInt(x)(y)]);
|
|
1663
|
+
case 1:
|
|
1664
|
+
return new Value(/* VFloat */ 2, [fFloat(x_1)(y_1)]);
|
|
1665
|
+
default:
|
|
1666
|
+
throw new EvalException(new EvalError$("Numeric operands required", span));
|
|
1667
|
+
}
|
|
1668
|
+
};
|
|
1669
|
+
switch (op) {
|
|
1670
|
+
case "+":
|
|
1671
|
+
return arith((x_2) => ((y_2) => toInt64_unchecked(op_Addition(x_2, y_2))), (x_3) => ((y_3) => (x_3 + y_3)));
|
|
1672
|
+
case "-":
|
|
1673
|
+
return arith((x_4) => ((y_4) => toInt64_unchecked(op_Subtraction(x_4, y_4))), (x_5) => ((y_5) => (x_5 - y_5)));
|
|
1674
|
+
case "*":
|
|
1675
|
+
return arith((x_6) => ((y_6) => toInt64_unchecked(op_Multiply(x_6, y_6))), (x_7) => ((y_7) => (x_7 * y_7)));
|
|
1676
|
+
case "/": {
|
|
1677
|
+
let matchResult_1, x_8, y_8, x_9, y_9;
|
|
1678
|
+
switch (av.tag) {
|
|
1679
|
+
case 1: {
|
|
1680
|
+
if (bv.tag === 1) {
|
|
1681
|
+
matchResult_1 = 0;
|
|
1682
|
+
x_8 = av.fields[0];
|
|
1683
|
+
y_8 = bv.fields[0];
|
|
1684
|
+
}
|
|
1685
|
+
else {
|
|
1686
|
+
matchResult_1 = 2;
|
|
1687
|
+
}
|
|
1688
|
+
break;
|
|
1689
|
+
}
|
|
1690
|
+
case 2: {
|
|
1691
|
+
if (bv.tag === 2) {
|
|
1692
|
+
matchResult_1 = 1;
|
|
1693
|
+
x_9 = av.fields[0];
|
|
1694
|
+
y_9 = bv.fields[0];
|
|
1695
|
+
}
|
|
1696
|
+
else {
|
|
1697
|
+
matchResult_1 = 2;
|
|
1698
|
+
}
|
|
1699
|
+
break;
|
|
1700
|
+
}
|
|
1701
|
+
default:
|
|
1702
|
+
matchResult_1 = 2;
|
|
1703
|
+
}
|
|
1704
|
+
switch (matchResult_1) {
|
|
1705
|
+
case 0:
|
|
1706
|
+
return new Value(/* VInt */ 1, [toInt64_unchecked(op_Division(x_8, y_8))]);
|
|
1707
|
+
case 1:
|
|
1708
|
+
return new Value(/* VFloat */ 2, [x_9 / y_9]);
|
|
1709
|
+
default:
|
|
1710
|
+
throw new EvalException(new EvalError$("Numeric operands required", span));
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
case "%": {
|
|
1714
|
+
let matchResult_2, x_10, y_10;
|
|
1715
|
+
if (av.tag === 1) {
|
|
1716
|
+
if (bv.tag === 1) {
|
|
1717
|
+
matchResult_2 = 0;
|
|
1718
|
+
x_10 = av.fields[0];
|
|
1719
|
+
y_10 = bv.fields[0];
|
|
1720
|
+
}
|
|
1721
|
+
else {
|
|
1722
|
+
matchResult_2 = 1;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
else {
|
|
1726
|
+
matchResult_2 = 1;
|
|
1727
|
+
}
|
|
1728
|
+
switch (matchResult_2) {
|
|
1729
|
+
case 0:
|
|
1730
|
+
return new Value(/* VInt */ 1, [toInt64_unchecked(op_Modulus(x_10, y_10))]);
|
|
1731
|
+
default:
|
|
1732
|
+
throw new EvalException(new EvalError$("Integer operands required", span));
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
case "=":
|
|
1736
|
+
return new Value(/* VBool */ 3, [valueEquals(av, bv)]);
|
|
1737
|
+
case "<":
|
|
1738
|
+
case ">":
|
|
1739
|
+
case "<=":
|
|
1740
|
+
case ">=": {
|
|
1741
|
+
let matchResult_3, x_11, y_11, x_12, y_12;
|
|
1742
|
+
switch (av.tag) {
|
|
1743
|
+
case 1: {
|
|
1744
|
+
if (bv.tag === 1) {
|
|
1745
|
+
matchResult_3 = 0;
|
|
1746
|
+
x_11 = av.fields[0];
|
|
1747
|
+
y_11 = bv.fields[0];
|
|
1748
|
+
}
|
|
1749
|
+
else {
|
|
1750
|
+
matchResult_3 = 2;
|
|
1751
|
+
}
|
|
1752
|
+
break;
|
|
1753
|
+
}
|
|
1754
|
+
case 2: {
|
|
1755
|
+
if (bv.tag === 2) {
|
|
1756
|
+
matchResult_3 = 1;
|
|
1757
|
+
x_12 = av.fields[0];
|
|
1758
|
+
y_12 = bv.fields[0];
|
|
1759
|
+
}
|
|
1760
|
+
else {
|
|
1761
|
+
matchResult_3 = 2;
|
|
1762
|
+
}
|
|
1763
|
+
break;
|
|
1764
|
+
}
|
|
1765
|
+
default:
|
|
1766
|
+
matchResult_3 = 2;
|
|
1767
|
+
}
|
|
1768
|
+
switch (matchResult_3) {
|
|
1769
|
+
case 0:
|
|
1770
|
+
return new Value(/* VBool */ 3, [(op === "<") ? (compare_1(x_11, y_11) < 0) : ((op === ">") ? (compare_1(x_11, y_11) > 0) : ((op === "<=") ? (compare_1(x_11, y_11) <= 0) : ((op === ">=") && (compare_1(x_11, y_11) >= 0))))]);
|
|
1771
|
+
case 1:
|
|
1772
|
+
return new Value(/* VBool */ 3, [(op === "<") ? (x_12 < y_12) : ((op === ">") ? (x_12 > y_12) : ((op === "<=") ? (x_12 <= y_12) : ((op === ">=") && (x_12 >= y_12))))]);
|
|
1773
|
+
default:
|
|
1774
|
+
throw new EvalException(new EvalError$("Numeric operands required", span));
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
case "&&":
|
|
1778
|
+
case "||": {
|
|
1779
|
+
let matchResult_4, x_13, y_13;
|
|
1780
|
+
if (av.tag === 3) {
|
|
1781
|
+
if (bv.tag === 3) {
|
|
1782
|
+
matchResult_4 = 0;
|
|
1783
|
+
x_13 = av.fields[0];
|
|
1784
|
+
y_13 = bv.fields[0];
|
|
1785
|
+
}
|
|
1786
|
+
else {
|
|
1787
|
+
matchResult_4 = 1;
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
else {
|
|
1791
|
+
matchResult_4 = 1;
|
|
1792
|
+
}
|
|
1793
|
+
switch (matchResult_4) {
|
|
1794
|
+
case 0:
|
|
1795
|
+
return new Value(/* VBool */ 3, [(op === "&&") ? (x_13 && y_13) : (x_13 ? true : y_13)]);
|
|
1796
|
+
default:
|
|
1797
|
+
throw new EvalException(new EvalError$("Boolean operands required", span));
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
case "::":
|
|
1801
|
+
if (bv.tag === 5) {
|
|
1802
|
+
return new Value(/* VList */ 5, [cons(av, bv.fields[0])]);
|
|
1803
|
+
}
|
|
1804
|
+
else {
|
|
1805
|
+
throw new EvalException(new EvalError$("Right side of \'::\' must be list", span));
|
|
1806
|
+
}
|
|
1807
|
+
case "@": {
|
|
1808
|
+
let matchResult_5, xs_1, ys;
|
|
1809
|
+
if (av.tag === 5) {
|
|
1810
|
+
if (bv.tag === 5) {
|
|
1811
|
+
matchResult_5 = 0;
|
|
1812
|
+
xs_1 = av.fields[0];
|
|
1813
|
+
ys = bv.fields[0];
|
|
1814
|
+
}
|
|
1815
|
+
else {
|
|
1816
|
+
matchResult_5 = 1;
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
else {
|
|
1820
|
+
matchResult_5 = 1;
|
|
1821
|
+
}
|
|
1822
|
+
switch (matchResult_5) {
|
|
1823
|
+
case 0:
|
|
1824
|
+
return new Value(/* VList */ 5, [append(xs_1, ys)]);
|
|
1825
|
+
default:
|
|
1826
|
+
throw new EvalException(new EvalError$("Both sides of \'@\' must be lists", span));
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
default:
|
|
1830
|
+
throw new EvalException(new EvalError$(toText(printf("Unknown operator %s"))(op), span));
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1635
1834
|
function createExternContext(runtime, typeDefs, span) {
|
|
1636
|
-
return new ExternalCallContext(runtime.SyncRoot, () =>
|
|
1835
|
+
return new ExternalCallContext(runtime.SyncRoot, () => runtime.Active.contents, (f_1, a) => Execution_run(applyFunctionValue(runtime, typeDefs, span, f_1, a)), (thunk) => spawnTaskValue(runtime, typeDefs, thunk), (taskValue) => awaitTaskValue(runtime, taskValue), () => {
|
|
1637
1836
|
raiseIfBackgroundFailed(runtime);
|
|
1638
1837
|
});
|
|
1639
1838
|
}
|
|
@@ -1648,857 +1847,3574 @@ function awaitTaskValue(runtime, taskValue) {
|
|
|
1648
1847
|
throw new EvalException(new EvalError$("Task.await is not supported in Fable builds", unknownSpan));
|
|
1649
1848
|
}
|
|
1650
1849
|
|
|
1651
|
-
function applyFunctionValue(runtime,
|
|
1850
|
+
function applyFunctionValue(runtime, typeDefs, span, fnValue, argValue) {
|
|
1652
1851
|
raiseIfBackgroundFailed(runtime);
|
|
1653
1852
|
switch (fnValue.tag) {
|
|
1654
1853
|
case 14:
|
|
1655
|
-
|
|
1854
|
+
if (fnValue.fields[1].tag === 4) {
|
|
1855
|
+
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());
|
|
1856
|
+
}
|
|
1857
|
+
else {
|
|
1858
|
+
return evalExpr(runtime, typeDefs, FSharpMap__Add(fnValue.fields[2].contents, fnValue.fields[0], argValue), fnValue.fields[1]);
|
|
1859
|
+
}
|
|
1656
1860
|
case 11:
|
|
1657
|
-
return new Value(/* VUnionCase */ 10, [fnValue.fields[0], fnValue.fields[1], argValue]);
|
|
1861
|
+
return new Execution$1(new Value(/* VUnionCase */ 10, [fnValue.fields[0], fnValue.fields[1], argValue]), defaultOf());
|
|
1658
1862
|
case 15: {
|
|
1659
|
-
const
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
return invoke(typeDefs, ext, createExternContext(runtime, typeDefs, span), reverse(args$0027));
|
|
1863
|
+
const arguments$ = cons(argValue, fnValue.fields[1]);
|
|
1864
|
+
if (length(arguments$) === fnValue.fields[0].Arity) {
|
|
1865
|
+
return invokeExternal(runtime, typeDefs, span, fnValue.fields[0], reverse(arguments$));
|
|
1663
1866
|
}
|
|
1664
|
-
else if (length(
|
|
1665
|
-
return new Value(/* VExternal */ 15, [
|
|
1867
|
+
else if (length(arguments$) < fnValue.fields[0].Arity) {
|
|
1868
|
+
return new Execution$1(new Value(/* VExternal */ 15, [fnValue.fields[0], arguments$]), defaultOf());
|
|
1666
1869
|
}
|
|
1667
1870
|
else {
|
|
1668
|
-
|
|
1871
|
+
return new Execution$1((() => {
|
|
1872
|
+
throw new EvalException(new EvalError$(concat("External function \'", fnValue.fields[0].Name, "\' received too many arguments"), span));
|
|
1873
|
+
})(), defaultOf());
|
|
1669
1874
|
}
|
|
1670
1875
|
}
|
|
1671
1876
|
default:
|
|
1672
|
-
|
|
1877
|
+
return new Execution$1((() => {
|
|
1878
|
+
throw new EvalException(new EvalError$("Attempted to apply non-function", span));
|
|
1879
|
+
})(), defaultOf());
|
|
1673
1880
|
}
|
|
1674
1881
|
}
|
|
1675
1882
|
|
|
1676
|
-
function
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
const
|
|
1687
|
-
|
|
1688
|
-
|
|
1883
|
+
function invokeExternal(runtime, typeDefs, span, ext, args) {
|
|
1884
|
+
const validateResult = prepareCall(typeDefs, ext.Scheme.fields[1], args);
|
|
1885
|
+
const body_1 = invokeExternalUnchecked(runtime, typeDefs, span, ext, args);
|
|
1886
|
+
if (Execution$1__get_IsImmediate(body_1)) {
|
|
1887
|
+
return new Execution$1(validateResult(body_1.Value), defaultOf());
|
|
1888
|
+
}
|
|
1889
|
+
else {
|
|
1890
|
+
return new Execution$1(defaultOf(), (continuation) => {
|
|
1891
|
+
const execution_1 = body_1;
|
|
1892
|
+
if (Execution$1__get_IsImmediate(execution_1)) {
|
|
1893
|
+
const execution = new Execution$1(validateResult(execution_1.Value), defaultOf());
|
|
1894
|
+
const continuation_1 = continuation;
|
|
1895
|
+
if (Execution$1__get_IsImmediate(execution)) {
|
|
1896
|
+
return continuation_1(execution.Value);
|
|
1689
1897
|
}
|
|
1690
1898
|
else {
|
|
1691
|
-
return
|
|
1899
|
+
return execution.Resume(continuation_1);
|
|
1692
1900
|
}
|
|
1693
1901
|
}
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1902
|
+
else {
|
|
1903
|
+
return execution_1.Resume((value_2) => {
|
|
1904
|
+
const execution = new Execution$1(validateResult(value_2), defaultOf());
|
|
1905
|
+
const continuation_1 = continuation;
|
|
1906
|
+
return Execution$1__get_IsImmediate(execution) ? continuation_1(execution.Value) : execution.Resume(continuation_1);
|
|
1907
|
+
});
|
|
1700
1908
|
}
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1909
|
+
});
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
function invokeExternalUnchecked(runtime, typeDefs, span, ext, args) {
|
|
1914
|
+
if (ext === spawn) {
|
|
1915
|
+
return new Execution$1(spawnTaskValue(runtime, typeDefs, head_1(args)), defaultOf());
|
|
1916
|
+
}
|
|
1917
|
+
else if (ext === awaitTask) {
|
|
1918
|
+
return new Execution$1(awaitTaskValue(runtime, head_1(args)), defaultOf());
|
|
1919
|
+
}
|
|
1920
|
+
else {
|
|
1921
|
+
const matchValue = tryExecution(ext);
|
|
1922
|
+
if (matchValue == null) {
|
|
1923
|
+
return new Execution$1(ext.Impl(createExternContext(runtime, typeDefs, span), args), defaultOf());
|
|
1924
|
+
}
|
|
1925
|
+
else {
|
|
1926
|
+
return matchValue((fnValue) => ((argValue) => applyFunctionValue(runtime, typeDefs, span, fnValue, argValue)))(args);
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
function updateRecord(runtime, typeDefs, env, target, updates, span, structural) {
|
|
1932
|
+
const body_5 = evalExpr(runtime, typeDefs, env, target);
|
|
1933
|
+
if (Execution$1__get_IsImmediate(body_5)) {
|
|
1934
|
+
const targetValue = body_5.Value;
|
|
1935
|
+
if (targetValue.tag === 7) {
|
|
1936
|
+
let result = targetValue.fields[0];
|
|
1937
|
+
const second_1 = () => (new Execution$1(new Value(/* VRecord */ 7, [result]), defaultOf()));
|
|
1938
|
+
const body_3 = Execution_Builder__For_Z3A5BE4A(Execution_execution, updates, (_arg_1) => {
|
|
1939
|
+
const name = _arg_1[0];
|
|
1940
|
+
const second = () => {
|
|
1941
|
+
const body_1 = evalExpr(runtime, typeDefs, env, _arg_1[1]);
|
|
1942
|
+
if (Execution$1__get_IsImmediate(body_1)) {
|
|
1943
|
+
result = add(name, body_1.Value, result);
|
|
1944
|
+
return new Execution$1(undefined, defaultOf());
|
|
1714
1945
|
}
|
|
1715
1946
|
else {
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1947
|
+
return new Execution$1(defaultOf(), (continuation) => {
|
|
1948
|
+
const execution_1 = body_1;
|
|
1949
|
+
if (Execution$1__get_IsImmediate(execution_1)) {
|
|
1950
|
+
let execution;
|
|
1951
|
+
result = add(name, execution_1.Value, result);
|
|
1952
|
+
execution = (new Execution$1(undefined, defaultOf()));
|
|
1953
|
+
const continuation_1 = continuation;
|
|
1954
|
+
if (Execution$1__get_IsImmediate(execution)) {
|
|
1955
|
+
return continuation_1(execution.Value);
|
|
1956
|
+
}
|
|
1957
|
+
else {
|
|
1958
|
+
return execution.Resume(continuation_1);
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
else {
|
|
1962
|
+
return execution_1.Resume((value_4) => {
|
|
1963
|
+
let execution;
|
|
1964
|
+
result = add(name, value_4, result);
|
|
1965
|
+
execution = (new Execution$1(undefined, defaultOf()));
|
|
1966
|
+
const continuation_1 = continuation;
|
|
1967
|
+
return Execution$1__get_IsImmediate(execution) ? continuation_1(execution.Value) : execution.Resume(continuation_1);
|
|
1968
|
+
});
|
|
1969
|
+
}
|
|
1970
|
+
});
|
|
1721
1971
|
}
|
|
1972
|
+
};
|
|
1973
|
+
let body_2;
|
|
1974
|
+
if (!structural && !containsKey(name, result)) {
|
|
1975
|
+
throw new EvalException(new EvalError$(toText(printf("Record field \'%s\' not found"))(name), span));
|
|
1976
|
+
body_2 = (new Execution$1(undefined, defaultOf()));
|
|
1722
1977
|
}
|
|
1723
1978
|
else {
|
|
1724
|
-
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
}
|
|
1737
|
-
case 8: {
|
|
1738
|
-
const matchValue_3 = evalExpr(runtime, typeDefs, env, expr.fields[1]);
|
|
1739
|
-
if (matchValue_3.tag === 5) {
|
|
1740
|
-
const enumerator = getEnumerator(matchValue_3.fields[0]);
|
|
1741
|
-
try {
|
|
1742
|
-
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1743
|
-
evalExpr(runtime, typeDefs, add(expr.fields[0], enumerator["System.Collections.Generic.IEnumerator`1.get_Current"](), env), expr.fields[2]);
|
|
1979
|
+
body_2 = (new Execution$1(undefined, defaultOf()));
|
|
1980
|
+
}
|
|
1981
|
+
return Execution$1__get_IsImmediate(body_2) ? second() : (new Execution$1(defaultOf(), (continuation_3) => {
|
|
1982
|
+
const execution_3 = body_2;
|
|
1983
|
+
if (Execution$1__get_IsImmediate(execution_3)) {
|
|
1984
|
+
const execution_2 = second();
|
|
1985
|
+
const continuation_4 = continuation_3;
|
|
1986
|
+
if (Execution$1__get_IsImmediate(execution_2)) {
|
|
1987
|
+
return continuation_4(execution_2.Value);
|
|
1988
|
+
}
|
|
1989
|
+
else {
|
|
1990
|
+
return execution_2.Resume(continuation_4);
|
|
1744
1991
|
}
|
|
1745
|
-
}
|
|
1746
|
-
finally {
|
|
1747
|
-
disposeSafe(enumerator);
|
|
1748
|
-
}
|
|
1749
|
-
return Value.VUnit;
|
|
1750
|
-
}
|
|
1751
|
-
else {
|
|
1752
|
-
throw new EvalException(new EvalError$("For loop source must be list", expr.fields[3]));
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
case 10: {
|
|
1756
|
-
const value_1 = expr.fields[1];
|
|
1757
|
-
const name_2 = expr.fields[0];
|
|
1758
|
-
const body_2 = expr.fields[2];
|
|
1759
|
-
if (expr.fields[3]) {
|
|
1760
|
-
if (value_1.tag === 4) {
|
|
1761
|
-
const recEnv = new FSharpRef(env);
|
|
1762
|
-
recEnv.contents = add(name_2, new Value(/* VClosure */ 14, [value_1.fields[0].Name, value_1.fields[1], recEnv]), env);
|
|
1763
|
-
runtime_mut = runtime;
|
|
1764
|
-
typeDefs_mut = typeDefs;
|
|
1765
|
-
env_mut = recEnv.contents;
|
|
1766
|
-
expr_mut = body_2;
|
|
1767
|
-
continue evalExpr;
|
|
1768
1992
|
}
|
|
1769
1993
|
else {
|
|
1770
|
-
|
|
1994
|
+
return execution_3.Resume((value_5) => {
|
|
1995
|
+
const execution_2 = second();
|
|
1996
|
+
const continuation_4 = continuation_3;
|
|
1997
|
+
return Execution$1__get_IsImmediate(execution_2) ? continuation_4(execution_2.Value) : execution_2.Resume(continuation_4);
|
|
1998
|
+
});
|
|
1771
1999
|
}
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
env_mut = add(name_2, evalExpr(runtime, typeDefs, env, value_1), env);
|
|
1777
|
-
expr_mut = body_2;
|
|
1778
|
-
continue evalExpr;
|
|
1779
|
-
}
|
|
2000
|
+
}));
|
|
2001
|
+
});
|
|
2002
|
+
if (Execution$1__get_IsImmediate(body_3)) {
|
|
2003
|
+
return second_1();
|
|
1780
2004
|
}
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
env_mut = fold((acc, k, value_3) => add(k, value_3, acc), env, matchValue_4);
|
|
1790
|
-
expr_mut = expr.fields[2];
|
|
1791
|
-
continue evalExpr;
|
|
1792
|
-
}
|
|
1793
|
-
}
|
|
1794
|
-
case 12: {
|
|
1795
|
-
const body_4 = expr.fields[1];
|
|
1796
|
-
const bindings_1 = expr.fields[0];
|
|
1797
|
-
if (isEmpty(bindings_1)) {
|
|
1798
|
-
runtime_mut = runtime;
|
|
1799
|
-
typeDefs_mut = typeDefs;
|
|
1800
|
-
env_mut = env;
|
|
1801
|
-
expr_mut = body_4;
|
|
1802
|
-
continue evalExpr;
|
|
1803
|
-
}
|
|
1804
|
-
else {
|
|
1805
|
-
const recEnv_1 = new FSharpRef(env);
|
|
1806
|
-
const finalEnv = fold_1((acc_1, tupledArg_1) => add(tupledArg_1[0], tupledArg_1[1], acc_1), env, map((tupledArg) => {
|
|
1807
|
-
const args = tupledArg[1];
|
|
1808
|
-
const bindingSpan = tupledArg[4];
|
|
1809
|
-
if (isEmpty(args)) {
|
|
1810
|
-
throw new EvalException(new EvalError$("\'let rec ... and ...\' requires function arguments for each binding", bindingSpan));
|
|
1811
|
-
}
|
|
1812
|
-
const folded = foldBack((arg_2, accExpr) => (new Expr(/* ELambda */ 4, [arg_2, accExpr, bindingSpan])), args, tupledArg[3]);
|
|
1813
|
-
if (folded.tag === 4) {
|
|
1814
|
-
return [tupledArg[0], new Value(/* VClosure */ 14, [folded.fields[0].Name, folded.fields[1], recEnv_1])];
|
|
2005
|
+
else {
|
|
2006
|
+
return new Execution$1(defaultOf(), (continuation_6) => {
|
|
2007
|
+
const execution_5 = body_3;
|
|
2008
|
+
if (Execution$1__get_IsImmediate(execution_5)) {
|
|
2009
|
+
const execution_4 = second_1();
|
|
2010
|
+
const continuation_7 = continuation_6;
|
|
2011
|
+
if (Execution$1__get_IsImmediate(execution_4)) {
|
|
2012
|
+
return continuation_7(execution_4.Value);
|
|
1815
2013
|
}
|
|
1816
2014
|
else {
|
|
1817
|
-
|
|
2015
|
+
return execution_4.Resume(continuation_7);
|
|
1818
2016
|
}
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
2017
|
+
}
|
|
2018
|
+
else {
|
|
2019
|
+
return execution_5.Resume((value_8) => {
|
|
2020
|
+
const execution_4 = second_1();
|
|
2021
|
+
const continuation_7 = continuation_6;
|
|
2022
|
+
return Execution$1__get_IsImmediate(execution_4) ? continuation_7(execution_4.Value) : execution_4.Resume(continuation_7);
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
});
|
|
1827
2026
|
}
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
2027
|
+
}
|
|
2028
|
+
else {
|
|
2029
|
+
return new Execution$1((() => {
|
|
2030
|
+
throw new EvalException(new EvalError$(structural ? "Structural record update requires a record value" : "Record update requires a record value", span));
|
|
2031
|
+
})(), defaultOf());
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
2034
|
+
else {
|
|
2035
|
+
return new Execution$1(defaultOf(), (continuation_9) => {
|
|
2036
|
+
const execution_7 = body_5;
|
|
2037
|
+
if (Execution$1__get_IsImmediate(execution_7)) {
|
|
2038
|
+
let execution_6;
|
|
2039
|
+
const targetValue = execution_7.Value;
|
|
2040
|
+
if (targetValue.tag === 7) {
|
|
2041
|
+
let result = targetValue.fields[0];
|
|
2042
|
+
const second_1 = () => (new Execution$1(new Value(/* VRecord */ 7, [result]), defaultOf()));
|
|
2043
|
+
const body_3 = Execution_Builder__For_Z3A5BE4A(Execution_execution, updates, (_arg_1) => {
|
|
2044
|
+
const name = _arg_1[0];
|
|
2045
|
+
const second = () => {
|
|
2046
|
+
const body_1 = evalExpr(runtime, typeDefs, env, _arg_1[1]);
|
|
2047
|
+
if (Execution$1__get_IsImmediate(body_1)) {
|
|
2048
|
+
result = add(name, body_1.Value, result);
|
|
2049
|
+
return new Execution$1(undefined, defaultOf());
|
|
1843
2050
|
}
|
|
1844
2051
|
else {
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
if (
|
|
1853
|
-
return
|
|
2052
|
+
return new Execution$1(defaultOf(), (continuation) => {
|
|
2053
|
+
const execution_1 = body_1;
|
|
2054
|
+
if (Execution$1__get_IsImmediate(execution_1)) {
|
|
2055
|
+
let execution;
|
|
2056
|
+
result = add(name, execution_1.Value, result);
|
|
2057
|
+
execution = (new Execution$1(undefined, defaultOf()));
|
|
2058
|
+
const continuation_1 = continuation;
|
|
2059
|
+
if (Execution$1__get_IsImmediate(execution)) {
|
|
2060
|
+
return continuation_1(execution.Value);
|
|
1854
2061
|
}
|
|
1855
2062
|
else {
|
|
1856
|
-
|
|
1857
|
-
continue tryCases;
|
|
2063
|
+
return execution.Resume(continuation_1);
|
|
1858
2064
|
}
|
|
1859
2065
|
}
|
|
1860
2066
|
else {
|
|
1861
|
-
|
|
2067
|
+
return execution_1.Resume((value_4) => {
|
|
2068
|
+
let execution;
|
|
2069
|
+
result = add(name, value_4, result);
|
|
2070
|
+
execution = (new Execution$1(undefined, defaultOf()));
|
|
2071
|
+
const continuation_1 = continuation;
|
|
2072
|
+
return Execution$1__get_IsImmediate(execution) ? continuation_1(execution.Value) : execution.Resume(continuation_1);
|
|
2073
|
+
});
|
|
1862
2074
|
}
|
|
1863
|
-
}
|
|
2075
|
+
});
|
|
1864
2076
|
}
|
|
2077
|
+
};
|
|
2078
|
+
let body_2;
|
|
2079
|
+
if (!structural && !containsKey(name, result)) {
|
|
2080
|
+
throw new EvalException(new EvalError$(toText(printf("Record field \'%s\' not found"))(name), span));
|
|
2081
|
+
body_2 = (new Execution$1(undefined, defaultOf()));
|
|
1865
2082
|
}
|
|
1866
2083
|
else {
|
|
1867
|
-
|
|
2084
|
+
body_2 = (new Execution$1(undefined, defaultOf()));
|
|
1868
2085
|
}
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
case 14: {
|
|
1877
|
-
const startValue = evalExpr(runtime, typeDefs, env, expr.fields[0]);
|
|
1878
|
-
const endValue = evalExpr(runtime, typeDefs, env, expr.fields[1]);
|
|
1879
|
-
let matchResult, e, s;
|
|
1880
|
-
if (startValue.tag === 1) {
|
|
1881
|
-
if (endValue.tag === 1) {
|
|
1882
|
-
matchResult = 0;
|
|
1883
|
-
e = endValue.fields[0];
|
|
1884
|
-
s = startValue.fields[0];
|
|
1885
|
-
}
|
|
1886
|
-
else {
|
|
1887
|
-
matchResult = 1;
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
else {
|
|
1891
|
-
matchResult = 1;
|
|
1892
|
-
}
|
|
1893
|
-
switch (matchResult) {
|
|
1894
|
-
case 0: {
|
|
1895
|
-
const step = (compare_1(s, e) <= 0) ? (1n) : (-1n);
|
|
1896
|
-
const build = (acc_3_mut, current_mut) => {
|
|
1897
|
-
build:
|
|
1898
|
-
while (true) {
|
|
1899
|
-
const acc_3 = acc_3_mut, current = current_mut;
|
|
1900
|
-
if (((compare_1(step, 0n) > 0) && (compare_1(current, e) > 0)) ? true : ((compare_1(step, 0n) < 0) && (compare_1(current, e) < 0))) {
|
|
1901
|
-
return reverse(acc_3);
|
|
2086
|
+
return Execution$1__get_IsImmediate(body_2) ? second() : (new Execution$1(defaultOf(), (continuation_3) => {
|
|
2087
|
+
const execution_3 = body_2;
|
|
2088
|
+
if (Execution$1__get_IsImmediate(execution_3)) {
|
|
2089
|
+
const execution_2 = second();
|
|
2090
|
+
const continuation_4 = continuation_3;
|
|
2091
|
+
if (Execution$1__get_IsImmediate(execution_2)) {
|
|
2092
|
+
return continuation_4(execution_2.Value);
|
|
1902
2093
|
}
|
|
1903
2094
|
else {
|
|
1904
|
-
|
|
1905
|
-
current_mut = toInt64_unchecked(op_Addition(current, step));
|
|
1906
|
-
continue build;
|
|
2095
|
+
return execution_2.Resume(continuation_4);
|
|
1907
2096
|
}
|
|
1908
|
-
break;
|
|
1909
2097
|
}
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
}
|
|
1917
|
-
case 15:
|
|
1918
|
-
return new Value(/* VTuple */ 6, [map((expr_3) => evalExpr(runtime, typeDefs, env, expr_3), expr.fields[0])]);
|
|
1919
|
-
case 16:
|
|
1920
|
-
return new Value(/* VRecord */ 7, [ofList(map((tupledArg_2) => [tupledArg_2[0], evalExpr(runtime, typeDefs, env, tupledArg_2[1])], expr.fields[0]), {
|
|
1921
|
-
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
1922
|
-
})]);
|
|
1923
|
-
case 17:
|
|
1924
|
-
return new Value(/* VRecord */ 7, [ofList(map((tupledArg_3) => [tupledArg_3[0], evalExpr(runtime, typeDefs, env, tupledArg_3[1])], expr.fields[0]), {
|
|
1925
|
-
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
1926
|
-
})]);
|
|
1927
|
-
case 18:
|
|
1928
|
-
return new Value(/* VMap */ 8, [fold_1((acc_4, entry) => {
|
|
1929
|
-
if (entry.tag === 1) {
|
|
1930
|
-
const spreadExpr = entry.fields[0];
|
|
1931
|
-
const matchValue_8 = evalExpr(runtime, typeDefs, env, spreadExpr);
|
|
1932
|
-
if (matchValue_8.tag === 8) {
|
|
1933
|
-
return fold((state, key, value_5) => {
|
|
1934
|
-
if (FSharpMap__ContainsKey(state, key)) {
|
|
1935
|
-
return state;
|
|
1936
|
-
}
|
|
1937
|
-
else {
|
|
1938
|
-
return add(key, value_5, state);
|
|
1939
|
-
}
|
|
1940
|
-
}, acc_4, matchValue_8.fields[0]);
|
|
1941
|
-
}
|
|
1942
|
-
else {
|
|
1943
|
-
throw new EvalException(new EvalError$("Map spread value must be a map", Ast_spanOfExpr(spreadExpr)));
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
else {
|
|
1947
|
-
const keyExpr = entry.fields[0];
|
|
1948
|
-
const keyValue = evalExpr(runtime, typeDefs, env, keyExpr);
|
|
1949
|
-
let matchResult_1;
|
|
1950
|
-
switch (keyValue.tag) {
|
|
1951
|
-
case 4:
|
|
1952
|
-
case 1:
|
|
1953
|
-
case 3: {
|
|
1954
|
-
matchResult_1 = 0;
|
|
1955
|
-
break;
|
|
2098
|
+
else {
|
|
2099
|
+
return execution_3.Resume((value_5) => {
|
|
2100
|
+
const execution_2 = second();
|
|
2101
|
+
const continuation_4 = continuation_3;
|
|
2102
|
+
return Execution$1__get_IsImmediate(execution_2) ? continuation_4(execution_2.Value) : execution_2.Resume(continuation_4);
|
|
2103
|
+
});
|
|
1956
2104
|
}
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
2105
|
+
}));
|
|
2106
|
+
});
|
|
2107
|
+
execution_6 = (Execution$1__get_IsImmediate(body_3) ? second_1() : (new Execution$1(defaultOf(), (continuation_6) => {
|
|
2108
|
+
const execution_5 = body_3;
|
|
2109
|
+
if (Execution$1__get_IsImmediate(execution_5)) {
|
|
2110
|
+
const execution_4 = second_1();
|
|
2111
|
+
const continuation_7 = continuation_6;
|
|
2112
|
+
if (Execution$1__get_IsImmediate(execution_4)) {
|
|
2113
|
+
return continuation_7(execution_4.Value);
|
|
2114
|
+
}
|
|
2115
|
+
else {
|
|
2116
|
+
return execution_4.Resume(continuation_7);
|
|
1965
2117
|
}
|
|
1966
|
-
default:
|
|
1967
|
-
matchResult_1 = 1;
|
|
1968
|
-
}
|
|
1969
|
-
switch (matchResult_1) {
|
|
1970
|
-
case 0:
|
|
1971
|
-
return FSharpMap__Add(acc_4, valueToMapKey(Ast_spanOfExpr(keyExpr), keyValue), evalExpr(runtime, typeDefs, env, entry.fields[1]));
|
|
1972
|
-
default:
|
|
1973
|
-
throw new EvalException(new EvalError$("Unsupported map literal key", Ast_spanOfExpr(keyExpr)));
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
}, empty_1({
|
|
1977
|
-
Compare: (x_2, y_2) => (compare(x_2, y_2) | 0),
|
|
1978
|
-
}), expr.fields[0])]);
|
|
1979
|
-
case 19: {
|
|
1980
|
-
const span_10 = expr.fields[2];
|
|
1981
|
-
const matchValue_9 = evalExpr(runtime, typeDefs, env, expr.fields[0]);
|
|
1982
|
-
if (matchValue_9.tag === 7) {
|
|
1983
|
-
return new Value(/* VRecord */ 7, [fold_1((acc_5, tupledArg_4) => {
|
|
1984
|
-
const name_7 = tupledArg_4[0];
|
|
1985
|
-
if (containsKey(name_7, acc_5)) {
|
|
1986
|
-
return add(name_7, evalExpr(runtime, typeDefs, env, tupledArg_4[1]), acc_5);
|
|
1987
2118
|
}
|
|
1988
2119
|
else {
|
|
1989
|
-
|
|
2120
|
+
return execution_5.Resume((value_8) => {
|
|
2121
|
+
const execution_4 = second_1();
|
|
2122
|
+
const continuation_7 = continuation_6;
|
|
2123
|
+
return Execution$1__get_IsImmediate(execution_4) ? continuation_7(execution_4.Value) : execution_4.Resume(continuation_7);
|
|
2124
|
+
});
|
|
1990
2125
|
}
|
|
1991
|
-
}
|
|
2126
|
+
})));
|
|
1992
2127
|
}
|
|
1993
2128
|
else {
|
|
1994
|
-
|
|
2129
|
+
execution_6 = (new Execution$1((() => {
|
|
2130
|
+
throw new EvalException(new EvalError$(structural ? "Structural record update requires a record value" : "Record update requires a record value", span));
|
|
2131
|
+
})(), defaultOf()));
|
|
1995
2132
|
}
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
if (matchValue_10.tag === 7) {
|
|
2000
|
-
return new Value(/* VRecord */ 7, [fold_1((acc_6, tupledArg_5) => add(tupledArg_5[0], evalExpr(runtime, typeDefs, env, tupledArg_5[1]), acc_6), matchValue_10.fields[0], expr.fields[1])]);
|
|
2133
|
+
const continuation_10 = continuation_9;
|
|
2134
|
+
if (Execution$1__get_IsImmediate(execution_6)) {
|
|
2135
|
+
return continuation_10(execution_6.Value);
|
|
2001
2136
|
}
|
|
2002
2137
|
else {
|
|
2003
|
-
|
|
2004
|
-
}
|
|
2005
|
-
}
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2138
|
+
return execution_6.Resume(continuation_10);
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
else {
|
|
2142
|
+
return execution_7.Resume((value_11) => {
|
|
2143
|
+
let execution_6;
|
|
2144
|
+
const targetValue = value_11;
|
|
2145
|
+
if (targetValue.tag === 7) {
|
|
2146
|
+
let result = targetValue.fields[0];
|
|
2147
|
+
const second_1 = () => (new Execution$1(new Value(/* VRecord */ 7, [result]), defaultOf()));
|
|
2148
|
+
const body_3 = Execution_Builder__For_Z3A5BE4A(Execution_execution, updates, (_arg_1) => {
|
|
2149
|
+
const name = _arg_1[0];
|
|
2150
|
+
const second = () => {
|
|
2151
|
+
const body_1 = evalExpr(runtime, typeDefs, env, _arg_1[1]);
|
|
2152
|
+
if (Execution$1__get_IsImmediate(body_1)) {
|
|
2153
|
+
result = add(name, body_1.Value, result);
|
|
2154
|
+
return new Execution$1(undefined, defaultOf());
|
|
2155
|
+
}
|
|
2156
|
+
else {
|
|
2157
|
+
return new Execution$1(defaultOf(), (continuation) => {
|
|
2158
|
+
const execution_1 = body_1;
|
|
2159
|
+
if (Execution$1__get_IsImmediate(execution_1)) {
|
|
2160
|
+
let execution;
|
|
2161
|
+
result = add(name, execution_1.Value, result);
|
|
2162
|
+
execution = (new Execution$1(undefined, defaultOf()));
|
|
2163
|
+
const continuation_1 = continuation;
|
|
2164
|
+
if (Execution$1__get_IsImmediate(execution)) {
|
|
2165
|
+
return continuation_1(execution.Value);
|
|
2166
|
+
}
|
|
2167
|
+
else {
|
|
2168
|
+
return execution.Resume(continuation_1);
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
else {
|
|
2172
|
+
return execution_1.Resume((value_4) => {
|
|
2173
|
+
let execution;
|
|
2174
|
+
result = add(name, value_4, result);
|
|
2175
|
+
execution = (new Execution$1(undefined, defaultOf()));
|
|
2176
|
+
const continuation_1 = continuation;
|
|
2177
|
+
return Execution$1__get_IsImmediate(execution) ? continuation_1(execution.Value) : execution.Resume(continuation_1);
|
|
2178
|
+
});
|
|
2179
|
+
}
|
|
2180
|
+
});
|
|
2181
|
+
}
|
|
2182
|
+
};
|
|
2183
|
+
let body_2;
|
|
2184
|
+
if (!structural && !containsKey(name, result)) {
|
|
2185
|
+
throw new EvalException(new EvalError$(toText(printf("Record field \'%s\' not found"))(name), span));
|
|
2186
|
+
body_2 = (new Execution$1(undefined, defaultOf()));
|
|
2187
|
+
}
|
|
2188
|
+
else {
|
|
2189
|
+
body_2 = (new Execution$1(undefined, defaultOf()));
|
|
2190
|
+
}
|
|
2191
|
+
return Execution$1__get_IsImmediate(body_2) ? second() : (new Execution$1(defaultOf(), (continuation_3) => {
|
|
2192
|
+
const execution_3 = body_2;
|
|
2193
|
+
if (Execution$1__get_IsImmediate(execution_3)) {
|
|
2194
|
+
const execution_2 = second();
|
|
2195
|
+
const continuation_4 = continuation_3;
|
|
2196
|
+
if (Execution$1__get_IsImmediate(execution_2)) {
|
|
2197
|
+
return continuation_4(execution_2.Value);
|
|
2198
|
+
}
|
|
2199
|
+
else {
|
|
2200
|
+
return execution_2.Resume(continuation_4);
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
else {
|
|
2204
|
+
return execution_3.Resume((value_5) => {
|
|
2205
|
+
const execution_2 = second();
|
|
2206
|
+
const continuation_4 = continuation_3;
|
|
2207
|
+
return Execution$1__get_IsImmediate(execution_2) ? continuation_4(execution_2.Value) : execution_2.Resume(continuation_4);
|
|
2208
|
+
});
|
|
2209
|
+
}
|
|
2210
|
+
}));
|
|
2211
|
+
});
|
|
2212
|
+
execution_6 = (Execution$1__get_IsImmediate(body_3) ? second_1() : (new Execution$1(defaultOf(), (continuation_6) => {
|
|
2213
|
+
const execution_5 = body_3;
|
|
2214
|
+
if (Execution$1__get_IsImmediate(execution_5)) {
|
|
2215
|
+
const execution_4 = second_1();
|
|
2216
|
+
const continuation_7 = continuation_6;
|
|
2217
|
+
if (Execution$1__get_IsImmediate(execution_4)) {
|
|
2218
|
+
return continuation_7(execution_4.Value);
|
|
2219
|
+
}
|
|
2220
|
+
else {
|
|
2221
|
+
return execution_4.Resume(continuation_7);
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
else {
|
|
2225
|
+
return execution_5.Resume((value_8) => {
|
|
2226
|
+
const execution_4 = second_1();
|
|
2227
|
+
const continuation_7 = continuation_6;
|
|
2228
|
+
return Execution$1__get_IsImmediate(execution_4) ? continuation_7(execution_4.Value) : execution_4.Resume(continuation_7);
|
|
2229
|
+
});
|
|
2230
|
+
}
|
|
2231
|
+
})));
|
|
2232
|
+
}
|
|
2233
|
+
else {
|
|
2234
|
+
execution_6 = (new Execution$1((() => {
|
|
2235
|
+
throw new EvalException(new EvalError$(structural ? "Structural record update requires a record value" : "Record update requires a record value", span));
|
|
2236
|
+
})(), defaultOf()));
|
|
2237
|
+
}
|
|
2238
|
+
const continuation_10 = continuation_9;
|
|
2239
|
+
return Execution$1__get_IsImmediate(execution_6) ? continuation_10(execution_6.Value) : execution_6.Resume(continuation_10);
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
});
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
function evalExpr(runtime, typeDefs, env, expr) {
|
|
2247
|
+
raiseIfBackgroundFailed(runtime);
|
|
2248
|
+
const immediate = (value) => (new Execution$1(value, defaultOf()));
|
|
2249
|
+
switch (expr.tag) {
|
|
2250
|
+
case 0:
|
|
2251
|
+
return immediate(Value.VUnit);
|
|
2252
|
+
case 1:
|
|
2253
|
+
return immediate(literalToValue(expr.fields[0]));
|
|
2254
|
+
case 2: {
|
|
2255
|
+
const name = expr.fields[0];
|
|
2256
|
+
const matchValue = FSharpMap__TryFind(env, name);
|
|
2257
|
+
if (matchValue == null) {
|
|
2258
|
+
throw new EvalException(new EvalError$(concat("Unbound variable \'", name, "\'"), expr.fields[1]));
|
|
2259
|
+
}
|
|
2260
|
+
else {
|
|
2261
|
+
return immediate(matchValue);
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
case 4:
|
|
2265
|
+
return immediate(new Value(/* VClosure */ 14, [expr.fields[0].Name, expr.fields[1], new FSharpRef(env)]));
|
|
2266
|
+
case 27:
|
|
2267
|
+
return immediate(new Value(/* VOption */ 9, [undefined]));
|
|
2268
|
+
case 28: {
|
|
2269
|
+
const name_1 = expr.fields[0];
|
|
2270
|
+
const matchValue_1 = FSharpMap__TryFind(typeDefs, name_1);
|
|
2271
|
+
if (matchValue_1 == null) {
|
|
2272
|
+
throw new EvalException(new EvalError$(concat("Unknown type \'", name_1, "\'"), expr.fields[1]));
|
|
2273
|
+
}
|
|
2274
|
+
else {
|
|
2275
|
+
return immediate(new Value(/* VTypeToken */ 12, [matchValue_1]));
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
case 29: {
|
|
2279
|
+
const name_2 = expr.fields[0];
|
|
2280
|
+
if (FSharpMap__ContainsKey(env, name_2)) {
|
|
2281
|
+
return immediate(new Value(/* VString */ 4, [name_2]));
|
|
2282
|
+
}
|
|
2283
|
+
else {
|
|
2284
|
+
throw new EvalException(new EvalError$(concat("Unbound variable \'", name_2, "\'"), expr.fields[1]));
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
default:
|
|
2288
|
+
return evalCompound(runtime, typeDefs, env, expr);
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
function evalCompound(runtime, typeDefs, env, expr) {
|
|
2293
|
+
let matchResult, fields, a_2, b_1, span_13;
|
|
2294
|
+
switch (expr.tag) {
|
|
2295
|
+
case 5: {
|
|
2296
|
+
matchResult = 1;
|
|
2297
|
+
break;
|
|
2298
|
+
}
|
|
2299
|
+
case 6: {
|
|
2300
|
+
matchResult = 2;
|
|
2301
|
+
break;
|
|
2302
|
+
}
|
|
2303
|
+
case 7: {
|
|
2304
|
+
matchResult = 3;
|
|
2305
|
+
break;
|
|
2306
|
+
}
|
|
2307
|
+
case 8: {
|
|
2308
|
+
matchResult = 4;
|
|
2309
|
+
break;
|
|
2310
|
+
}
|
|
2311
|
+
case 10: {
|
|
2312
|
+
matchResult = 5;
|
|
2313
|
+
break;
|
|
2314
|
+
}
|
|
2315
|
+
case 11: {
|
|
2316
|
+
matchResult = 6;
|
|
2317
|
+
break;
|
|
2318
|
+
}
|
|
2319
|
+
case 12: {
|
|
2320
|
+
matchResult = 7;
|
|
2321
|
+
break;
|
|
2322
|
+
}
|
|
2323
|
+
case 9: {
|
|
2324
|
+
matchResult = 8;
|
|
2325
|
+
break;
|
|
2326
|
+
}
|
|
2327
|
+
case 13: {
|
|
2328
|
+
matchResult = 9;
|
|
2329
|
+
break;
|
|
2330
|
+
}
|
|
2331
|
+
case 15: {
|
|
2332
|
+
matchResult = 10;
|
|
2333
|
+
break;
|
|
2334
|
+
}
|
|
2335
|
+
case 14: {
|
|
2336
|
+
matchResult = 11;
|
|
2337
|
+
break;
|
|
2338
|
+
}
|
|
2339
|
+
case 18: {
|
|
2340
|
+
matchResult = 13;
|
|
2341
|
+
break;
|
|
2342
|
+
}
|
|
2343
|
+
case 19: {
|
|
2344
|
+
matchResult = 14;
|
|
2345
|
+
break;
|
|
2346
|
+
}
|
|
2347
|
+
case 20: {
|
|
2348
|
+
matchResult = 15;
|
|
2349
|
+
break;
|
|
2350
|
+
}
|
|
2351
|
+
case 21: {
|
|
2352
|
+
matchResult = 16;
|
|
2353
|
+
break;
|
|
2354
|
+
}
|
|
2355
|
+
case 22: {
|
|
2356
|
+
matchResult = 17;
|
|
2357
|
+
break;
|
|
2358
|
+
}
|
|
2359
|
+
case 26: {
|
|
2360
|
+
matchResult = 19;
|
|
2361
|
+
break;
|
|
2362
|
+
}
|
|
2363
|
+
case 30: {
|
|
2364
|
+
matchResult = 20;
|
|
2365
|
+
break;
|
|
2366
|
+
}
|
|
2367
|
+
case 0:
|
|
2368
|
+
case 1:
|
|
2369
|
+
case 2:
|
|
2370
|
+
case 4:
|
|
2371
|
+
case 27:
|
|
2372
|
+
case 28:
|
|
2373
|
+
case 29: {
|
|
2374
|
+
matchResult = 21;
|
|
2375
|
+
break;
|
|
2376
|
+
}
|
|
2377
|
+
case 16: {
|
|
2378
|
+
matchResult = 12;
|
|
2379
|
+
fields = expr.fields[0];
|
|
2380
|
+
break;
|
|
2381
|
+
}
|
|
2382
|
+
case 17: {
|
|
2383
|
+
matchResult = 12;
|
|
2384
|
+
fields = expr.fields[0];
|
|
2385
|
+
break;
|
|
2386
|
+
}
|
|
2387
|
+
case 23: {
|
|
2388
|
+
matchResult = 18;
|
|
2389
|
+
a_2 = expr.fields[0];
|
|
2390
|
+
b_1 = expr.fields[1];
|
|
2391
|
+
span_13 = expr.fields[2];
|
|
2392
|
+
break;
|
|
2393
|
+
}
|
|
2394
|
+
case 24: {
|
|
2395
|
+
matchResult = 18;
|
|
2396
|
+
a_2 = expr.fields[0];
|
|
2397
|
+
b_1 = expr.fields[1];
|
|
2398
|
+
span_13 = expr.fields[2];
|
|
2399
|
+
break;
|
|
2400
|
+
}
|
|
2401
|
+
case 25: {
|
|
2402
|
+
matchResult = 18;
|
|
2403
|
+
a_2 = expr.fields[1];
|
|
2404
|
+
b_1 = expr.fields[2];
|
|
2405
|
+
span_13 = expr.fields[3];
|
|
2406
|
+
break;
|
|
2407
|
+
}
|
|
2408
|
+
default:
|
|
2409
|
+
matchResult = 0;
|
|
2410
|
+
}
|
|
2411
|
+
switch (matchResult) {
|
|
2412
|
+
case 0:
|
|
2413
|
+
return evalExpr(runtime, typeDefs, env, expr.fields[0]);
|
|
2414
|
+
case 1: {
|
|
2415
|
+
const span = expr.fields[2];
|
|
2416
|
+
const arg = expr.fields[1];
|
|
2417
|
+
const body_5 = evalExpr(runtime, typeDefs, env, expr.fields[0]);
|
|
2418
|
+
if (Execution$1__get_IsImmediate(body_5)) {
|
|
2419
|
+
const f = body_5.Value;
|
|
2420
|
+
const body_3 = evalExpr(runtime, typeDefs, env, arg);
|
|
2421
|
+
if (Execution$1__get_IsImmediate(body_3)) {
|
|
2422
|
+
return applyFunctionValue(runtime, typeDefs, span, f, body_3.Value);
|
|
2423
|
+
}
|
|
2424
|
+
else {
|
|
2425
|
+
return new Execution$1(defaultOf(), (continuation) => {
|
|
2426
|
+
const execution_1 = body_3;
|
|
2427
|
+
if (Execution$1__get_IsImmediate(execution_1)) {
|
|
2428
|
+
const execution = applyFunctionValue(runtime, typeDefs, span, f, execution_1.Value);
|
|
2429
|
+
const continuation_1 = continuation;
|
|
2430
|
+
if (Execution$1__get_IsImmediate(execution)) {
|
|
2431
|
+
return continuation_1(execution.Value);
|
|
2432
|
+
}
|
|
2433
|
+
else {
|
|
2434
|
+
return execution.Resume(continuation_1);
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
else {
|
|
2438
|
+
return execution_1.Resume((value) => {
|
|
2439
|
+
const execution = applyFunctionValue(runtime, typeDefs, span, f, value);
|
|
2440
|
+
const continuation_1 = continuation;
|
|
2441
|
+
return Execution$1__get_IsImmediate(execution) ? continuation_1(execution.Value) : execution.Resume(continuation_1);
|
|
2442
|
+
});
|
|
2443
|
+
}
|
|
2444
|
+
});
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
else {
|
|
2448
|
+
return new Execution$1(defaultOf(), (continuation_3) => {
|
|
2449
|
+
const execution_3 = body_5;
|
|
2450
|
+
if (Execution$1__get_IsImmediate(execution_3)) {
|
|
2451
|
+
let execution_2;
|
|
2452
|
+
const f = execution_3.Value;
|
|
2453
|
+
const body_3 = evalExpr(runtime, typeDefs, env, arg);
|
|
2454
|
+
execution_2 = (Execution$1__get_IsImmediate(body_3) ? applyFunctionValue(runtime, typeDefs, span, f, body_3.Value) : (new Execution$1(defaultOf(), (continuation) => {
|
|
2455
|
+
const execution_1 = body_3;
|
|
2456
|
+
if (Execution$1__get_IsImmediate(execution_1)) {
|
|
2457
|
+
const execution = applyFunctionValue(runtime, typeDefs, span, f, execution_1.Value);
|
|
2458
|
+
const continuation_1 = continuation;
|
|
2459
|
+
if (Execution$1__get_IsImmediate(execution)) {
|
|
2460
|
+
return continuation_1(execution.Value);
|
|
2461
|
+
}
|
|
2462
|
+
else {
|
|
2463
|
+
return execution.Resume(continuation_1);
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
else {
|
|
2467
|
+
return execution_1.Resume((value) => {
|
|
2468
|
+
const execution = applyFunctionValue(runtime, typeDefs, span, f, value);
|
|
2469
|
+
const continuation_1 = continuation;
|
|
2470
|
+
return Execution$1__get_IsImmediate(execution) ? continuation_1(execution.Value) : execution.Resume(continuation_1);
|
|
2471
|
+
});
|
|
2472
|
+
}
|
|
2473
|
+
})));
|
|
2474
|
+
const continuation_4 = continuation_3;
|
|
2475
|
+
if (Execution$1__get_IsImmediate(execution_2)) {
|
|
2476
|
+
return continuation_4(execution_2.Value);
|
|
2477
|
+
}
|
|
2478
|
+
else {
|
|
2479
|
+
return execution_2.Resume(continuation_4);
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
else {
|
|
2483
|
+
return execution_3.Resume((value_1) => {
|
|
2484
|
+
let execution_2;
|
|
2485
|
+
const f = value_1;
|
|
2486
|
+
const body_3 = evalExpr(runtime, typeDefs, env, arg);
|
|
2487
|
+
execution_2 = (Execution$1__get_IsImmediate(body_3) ? applyFunctionValue(runtime, typeDefs, span, f, body_3.Value) : (new Execution$1(defaultOf(), (continuation) => {
|
|
2488
|
+
const execution_1 = body_3;
|
|
2489
|
+
if (Execution$1__get_IsImmediate(execution_1)) {
|
|
2490
|
+
const execution = applyFunctionValue(runtime, typeDefs, span, f, execution_1.Value);
|
|
2491
|
+
const continuation_1 = continuation;
|
|
2492
|
+
if (Execution$1__get_IsImmediate(execution)) {
|
|
2493
|
+
return continuation_1(execution.Value);
|
|
2494
|
+
}
|
|
2495
|
+
else {
|
|
2496
|
+
return execution.Resume(continuation_1);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
else {
|
|
2500
|
+
return execution_1.Resume((value) => {
|
|
2501
|
+
const execution = applyFunctionValue(runtime, typeDefs, span, f, value);
|
|
2502
|
+
const continuation_1 = continuation;
|
|
2503
|
+
return Execution$1__get_IsImmediate(execution) ? continuation_1(execution.Value) : execution.Resume(continuation_1);
|
|
2504
|
+
});
|
|
2505
|
+
}
|
|
2506
|
+
})));
|
|
2507
|
+
const continuation_4 = continuation_3;
|
|
2508
|
+
return Execution$1__get_IsImmediate(execution_2) ? continuation_4(execution_2.Value) : execution_2.Resume(continuation_4);
|
|
2509
|
+
});
|
|
2510
|
+
}
|
|
2511
|
+
});
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
case 2: {
|
|
2515
|
+
const yes = expr.fields[1];
|
|
2516
|
+
const span_1 = expr.fields[3];
|
|
2517
|
+
const no = expr.fields[2];
|
|
2518
|
+
const body_9 = evalExpr(runtime, typeDefs, env, expr.fields[0]);
|
|
2519
|
+
if (Execution$1__get_IsImmediate(body_9)) {
|
|
2520
|
+
const value_2 = body_9.Value;
|
|
2521
|
+
if (value_2.tag === 3) {
|
|
2522
|
+
if (value_2.fields[0]) {
|
|
2523
|
+
return evalExpr(runtime, typeDefs, env, yes);
|
|
2524
|
+
}
|
|
2525
|
+
else {
|
|
2526
|
+
return evalExpr(runtime, typeDefs, env, no);
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
else {
|
|
2530
|
+
return new Execution$1((() => {
|
|
2531
|
+
throw new EvalException(new EvalError$("Condition must be bool", span_1));
|
|
2532
|
+
})(), defaultOf());
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
else {
|
|
2536
|
+
return new Execution$1(defaultOf(), (continuation_6) => {
|
|
2537
|
+
const execution_5 = body_9;
|
|
2538
|
+
if (Execution$1__get_IsImmediate(execution_5)) {
|
|
2539
|
+
let execution_4;
|
|
2540
|
+
const value_2 = execution_5.Value;
|
|
2541
|
+
execution_4 = ((value_2.tag === 3) ? (value_2.fields[0] ? evalExpr(runtime, typeDefs, env, yes) : evalExpr(runtime, typeDefs, env, no)) : (new Execution$1((() => {
|
|
2542
|
+
throw new EvalException(new EvalError$("Condition must be bool", span_1));
|
|
2543
|
+
})(), defaultOf())));
|
|
2544
|
+
const continuation_7 = continuation_6;
|
|
2545
|
+
if (Execution$1__get_IsImmediate(execution_4)) {
|
|
2546
|
+
return continuation_7(execution_4.Value);
|
|
2547
|
+
}
|
|
2548
|
+
else {
|
|
2549
|
+
return execution_4.Resume(continuation_7);
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
else {
|
|
2553
|
+
return execution_5.Resume((value_5) => {
|
|
2554
|
+
let execution_4;
|
|
2555
|
+
const value_2 = value_5;
|
|
2556
|
+
execution_4 = ((value_2.tag === 3) ? (value_2.fields[0] ? evalExpr(runtime, typeDefs, env, yes) : evalExpr(runtime, typeDefs, env, no)) : (new Execution$1((() => {
|
|
2557
|
+
throw new EvalException(new EvalError$("Condition must be bool", span_1));
|
|
2558
|
+
})(), defaultOf())));
|
|
2559
|
+
const continuation_7 = continuation_6;
|
|
2560
|
+
return Execution$1__get_IsImmediate(execution_4) ? continuation_7(execution_4.Value) : execution_4.Resume(continuation_7);
|
|
2561
|
+
});
|
|
2562
|
+
}
|
|
2563
|
+
});
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
case 3: {
|
|
2567
|
+
const span_2 = expr.fields[1];
|
|
2568
|
+
const body_11 = evalExpr(runtime, typeDefs, env, expr.fields[0]);
|
|
2569
|
+
if (Execution$1__get_IsImmediate(body_11)) {
|
|
2570
|
+
const value_6 = body_11.Value;
|
|
2571
|
+
if (value_6.tag === 4) {
|
|
2572
|
+
return new Execution$1((() => {
|
|
2573
|
+
throw new EvalException(new EvalError$(value_6.fields[0], span_2));
|
|
2574
|
+
})(), defaultOf());
|
|
2575
|
+
}
|
|
2576
|
+
else {
|
|
2577
|
+
return new Execution$1((() => {
|
|
2578
|
+
throw new EvalException(new EvalError$("raise expects a string", span_2));
|
|
2579
|
+
})(), defaultOf());
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
else {
|
|
2583
|
+
return new Execution$1(defaultOf(), (continuation_9) => {
|
|
2584
|
+
const execution_7 = body_11;
|
|
2585
|
+
if (Execution$1__get_IsImmediate(execution_7)) {
|
|
2586
|
+
let execution_6;
|
|
2587
|
+
const value_6 = execution_7.Value;
|
|
2588
|
+
execution_6 = ((value_6.tag === 4) ? (new Execution$1((() => {
|
|
2589
|
+
throw new EvalException(new EvalError$(value_6.fields[0], span_2));
|
|
2590
|
+
})(), defaultOf())) : (new Execution$1((() => {
|
|
2591
|
+
throw new EvalException(new EvalError$("raise expects a string", span_2));
|
|
2592
|
+
})(), defaultOf())));
|
|
2593
|
+
const continuation_10 = continuation_9;
|
|
2594
|
+
if (Execution$1__get_IsImmediate(execution_6)) {
|
|
2595
|
+
return continuation_10(execution_6.Value);
|
|
2596
|
+
}
|
|
2597
|
+
else {
|
|
2598
|
+
return execution_6.Resume(continuation_10);
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
else {
|
|
2602
|
+
return execution_7.Resume((value_11) => {
|
|
2603
|
+
let execution_6;
|
|
2604
|
+
const value_6 = value_11;
|
|
2605
|
+
execution_6 = ((value_6.tag === 4) ? (new Execution$1((() => {
|
|
2606
|
+
throw new EvalException(new EvalError$(value_6.fields[0], span_2));
|
|
2607
|
+
})(), defaultOf())) : (new Execution$1((() => {
|
|
2608
|
+
throw new EvalException(new EvalError$("raise expects a string", span_2));
|
|
2609
|
+
})(), defaultOf())));
|
|
2610
|
+
const continuation_10 = continuation_9;
|
|
2611
|
+
return Execution$1__get_IsImmediate(execution_6) ? continuation_10(execution_6.Value) : execution_6.Resume(continuation_10);
|
|
2612
|
+
});
|
|
2613
|
+
}
|
|
2614
|
+
});
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
case 4: {
|
|
2618
|
+
const span_3 = expr.fields[3];
|
|
2619
|
+
const name = expr.fields[0];
|
|
2620
|
+
const body_12 = expr.fields[2];
|
|
2621
|
+
const body_17 = evalExpr(runtime, typeDefs, env, expr.fields[1]);
|
|
2622
|
+
if (Execution$1__get_IsImmediate(body_17)) {
|
|
2623
|
+
const value_12 = body_17.Value;
|
|
2624
|
+
if (value_12.tag === 5) {
|
|
2625
|
+
const second = () => (new Execution$1(Value.VUnit, defaultOf()));
|
|
2626
|
+
const body_15 = Execution_Builder__For_Z3A5BE4A(Execution_execution, value_12.fields[0], (_arg_5) => {
|
|
2627
|
+
const body_14 = evalExpr(runtime, typeDefs, FSharpMap__Add(env, name, _arg_5), body_12);
|
|
2628
|
+
if (Execution$1__get_IsImmediate(body_14)) {
|
|
2629
|
+
return new Execution$1(undefined, defaultOf());
|
|
2630
|
+
}
|
|
2631
|
+
else {
|
|
2632
|
+
return new Execution$1(defaultOf(), (continuation_12) => {
|
|
2633
|
+
const execution_9 = body_14;
|
|
2634
|
+
if (Execution$1__get_IsImmediate(execution_9)) {
|
|
2635
|
+
let execution_8;
|
|
2636
|
+
execution_8 = (new Execution$1(undefined, defaultOf()));
|
|
2637
|
+
const continuation_13 = continuation_12;
|
|
2638
|
+
if (Execution$1__get_IsImmediate(execution_8)) {
|
|
2639
|
+
return continuation_13(execution_8.Value);
|
|
2640
|
+
}
|
|
2641
|
+
else {
|
|
2642
|
+
return execution_8.Resume(continuation_13);
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
else {
|
|
2646
|
+
return execution_9.Resume((value_14) => {
|
|
2647
|
+
let execution_8;
|
|
2648
|
+
execution_8 = (new Execution$1(undefined, defaultOf()));
|
|
2649
|
+
const continuation_13 = continuation_12;
|
|
2650
|
+
return Execution$1__get_IsImmediate(execution_8) ? continuation_13(execution_8.Value) : execution_8.Resume(continuation_13);
|
|
2651
|
+
});
|
|
2652
|
+
}
|
|
2653
|
+
});
|
|
2654
|
+
}
|
|
2655
|
+
});
|
|
2656
|
+
if (Execution$1__get_IsImmediate(body_15)) {
|
|
2657
|
+
return second();
|
|
2658
|
+
}
|
|
2659
|
+
else {
|
|
2660
|
+
return new Execution$1(defaultOf(), (continuation_15) => {
|
|
2661
|
+
const execution_11 = body_15;
|
|
2662
|
+
if (Execution$1__get_IsImmediate(execution_11)) {
|
|
2663
|
+
const execution_10 = second();
|
|
2664
|
+
const continuation_16 = continuation_15;
|
|
2665
|
+
if (Execution$1__get_IsImmediate(execution_10)) {
|
|
2666
|
+
return continuation_16(execution_10.Value);
|
|
2667
|
+
}
|
|
2668
|
+
else {
|
|
2669
|
+
return execution_10.Resume(continuation_16);
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
else {
|
|
2673
|
+
return execution_11.Resume((value_17) => {
|
|
2674
|
+
const execution_10 = second();
|
|
2675
|
+
const continuation_16 = continuation_15;
|
|
2676
|
+
return Execution$1__get_IsImmediate(execution_10) ? continuation_16(execution_10.Value) : execution_10.Resume(continuation_16);
|
|
2677
|
+
});
|
|
2678
|
+
}
|
|
2679
|
+
});
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
else {
|
|
2683
|
+
return new Execution$1((() => {
|
|
2684
|
+
throw new EvalException(new EvalError$("For loop source must be list", span_3));
|
|
2685
|
+
})(), defaultOf());
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
else {
|
|
2689
|
+
return new Execution$1(defaultOf(), (continuation_18) => {
|
|
2690
|
+
const execution_13 = body_17;
|
|
2691
|
+
if (Execution$1__get_IsImmediate(execution_13)) {
|
|
2692
|
+
let execution_12;
|
|
2693
|
+
const value_12 = execution_13.Value;
|
|
2694
|
+
if (value_12.tag === 5) {
|
|
2695
|
+
const second = () => (new Execution$1(Value.VUnit, defaultOf()));
|
|
2696
|
+
const body_15 = Execution_Builder__For_Z3A5BE4A(Execution_execution, value_12.fields[0], (_arg_5) => {
|
|
2697
|
+
const body_14 = evalExpr(runtime, typeDefs, FSharpMap__Add(env, name, _arg_5), body_12);
|
|
2698
|
+
if (Execution$1__get_IsImmediate(body_14)) {
|
|
2699
|
+
return new Execution$1(undefined, defaultOf());
|
|
2700
|
+
}
|
|
2701
|
+
else {
|
|
2702
|
+
return new Execution$1(defaultOf(), (continuation_12) => {
|
|
2703
|
+
const execution_9 = body_14;
|
|
2704
|
+
if (Execution$1__get_IsImmediate(execution_9)) {
|
|
2705
|
+
let execution_8;
|
|
2706
|
+
execution_8 = (new Execution$1(undefined, defaultOf()));
|
|
2707
|
+
const continuation_13 = continuation_12;
|
|
2708
|
+
if (Execution$1__get_IsImmediate(execution_8)) {
|
|
2709
|
+
return continuation_13(execution_8.Value);
|
|
2710
|
+
}
|
|
2711
|
+
else {
|
|
2712
|
+
return execution_8.Resume(continuation_13);
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
else {
|
|
2716
|
+
return execution_9.Resume((value_14) => {
|
|
2717
|
+
let execution_8;
|
|
2718
|
+
execution_8 = (new Execution$1(undefined, defaultOf()));
|
|
2719
|
+
const continuation_13 = continuation_12;
|
|
2720
|
+
return Execution$1__get_IsImmediate(execution_8) ? continuation_13(execution_8.Value) : execution_8.Resume(continuation_13);
|
|
2721
|
+
});
|
|
2722
|
+
}
|
|
2723
|
+
});
|
|
2724
|
+
}
|
|
2725
|
+
});
|
|
2726
|
+
execution_12 = (Execution$1__get_IsImmediate(body_15) ? second() : (new Execution$1(defaultOf(), (continuation_15) => {
|
|
2727
|
+
const execution_11 = body_15;
|
|
2728
|
+
if (Execution$1__get_IsImmediate(execution_11)) {
|
|
2729
|
+
const execution_10 = second();
|
|
2730
|
+
const continuation_16 = continuation_15;
|
|
2731
|
+
if (Execution$1__get_IsImmediate(execution_10)) {
|
|
2732
|
+
return continuation_16(execution_10.Value);
|
|
2733
|
+
}
|
|
2734
|
+
else {
|
|
2735
|
+
return execution_10.Resume(continuation_16);
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
else {
|
|
2739
|
+
return execution_11.Resume((value_17) => {
|
|
2740
|
+
const execution_10 = second();
|
|
2741
|
+
const continuation_16 = continuation_15;
|
|
2742
|
+
return Execution$1__get_IsImmediate(execution_10) ? continuation_16(execution_10.Value) : execution_10.Resume(continuation_16);
|
|
2743
|
+
});
|
|
2744
|
+
}
|
|
2745
|
+
})));
|
|
2746
|
+
}
|
|
2747
|
+
else {
|
|
2748
|
+
execution_12 = (new Execution$1((() => {
|
|
2749
|
+
throw new EvalException(new EvalError$("For loop source must be list", span_3));
|
|
2750
|
+
})(), defaultOf()));
|
|
2751
|
+
}
|
|
2752
|
+
const continuation_19 = continuation_18;
|
|
2753
|
+
if (Execution$1__get_IsImmediate(execution_12)) {
|
|
2754
|
+
return continuation_19(execution_12.Value);
|
|
2755
|
+
}
|
|
2756
|
+
else {
|
|
2757
|
+
return execution_12.Resume(continuation_19);
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
else {
|
|
2761
|
+
return execution_13.Resume((value_20) => {
|
|
2762
|
+
let execution_12;
|
|
2763
|
+
const value_12 = value_20;
|
|
2764
|
+
if (value_12.tag === 5) {
|
|
2765
|
+
const second = () => (new Execution$1(Value.VUnit, defaultOf()));
|
|
2766
|
+
const body_15 = Execution_Builder__For_Z3A5BE4A(Execution_execution, value_12.fields[0], (_arg_5) => {
|
|
2767
|
+
const body_14 = evalExpr(runtime, typeDefs, FSharpMap__Add(env, name, _arg_5), body_12);
|
|
2768
|
+
if (Execution$1__get_IsImmediate(body_14)) {
|
|
2769
|
+
return new Execution$1(undefined, defaultOf());
|
|
2770
|
+
}
|
|
2771
|
+
else {
|
|
2772
|
+
return new Execution$1(defaultOf(), (continuation_12) => {
|
|
2773
|
+
const execution_9 = body_14;
|
|
2774
|
+
if (Execution$1__get_IsImmediate(execution_9)) {
|
|
2775
|
+
let execution_8;
|
|
2776
|
+
execution_8 = (new Execution$1(undefined, defaultOf()));
|
|
2777
|
+
const continuation_13 = continuation_12;
|
|
2778
|
+
if (Execution$1__get_IsImmediate(execution_8)) {
|
|
2779
|
+
return continuation_13(execution_8.Value);
|
|
2780
|
+
}
|
|
2781
|
+
else {
|
|
2782
|
+
return execution_8.Resume(continuation_13);
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
else {
|
|
2786
|
+
return execution_9.Resume((value_14) => {
|
|
2787
|
+
let execution_8;
|
|
2788
|
+
execution_8 = (new Execution$1(undefined, defaultOf()));
|
|
2789
|
+
const continuation_13 = continuation_12;
|
|
2790
|
+
return Execution$1__get_IsImmediate(execution_8) ? continuation_13(execution_8.Value) : execution_8.Resume(continuation_13);
|
|
2791
|
+
});
|
|
2792
|
+
}
|
|
2793
|
+
});
|
|
2794
|
+
}
|
|
2795
|
+
});
|
|
2796
|
+
execution_12 = (Execution$1__get_IsImmediate(body_15) ? second() : (new Execution$1(defaultOf(), (continuation_15) => {
|
|
2797
|
+
const execution_11 = body_15;
|
|
2798
|
+
if (Execution$1__get_IsImmediate(execution_11)) {
|
|
2799
|
+
const execution_10 = second();
|
|
2800
|
+
const continuation_16 = continuation_15;
|
|
2801
|
+
if (Execution$1__get_IsImmediate(execution_10)) {
|
|
2802
|
+
return continuation_16(execution_10.Value);
|
|
2803
|
+
}
|
|
2804
|
+
else {
|
|
2805
|
+
return execution_10.Resume(continuation_16);
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
else {
|
|
2809
|
+
return execution_11.Resume((value_17) => {
|
|
2810
|
+
const execution_10 = second();
|
|
2811
|
+
const continuation_16 = continuation_15;
|
|
2812
|
+
return Execution$1__get_IsImmediate(execution_10) ? continuation_16(execution_10.Value) : execution_10.Resume(continuation_16);
|
|
2813
|
+
});
|
|
2814
|
+
}
|
|
2815
|
+
})));
|
|
2816
|
+
}
|
|
2817
|
+
else {
|
|
2818
|
+
execution_12 = (new Execution$1((() => {
|
|
2819
|
+
throw new EvalException(new EvalError$("For loop source must be list", span_3));
|
|
2820
|
+
})(), defaultOf()));
|
|
2821
|
+
}
|
|
2822
|
+
const continuation_19 = continuation_18;
|
|
2823
|
+
return Execution$1__get_IsImmediate(execution_12) ? continuation_19(execution_12.Value) : execution_12.Resume(continuation_19);
|
|
2824
|
+
});
|
|
2825
|
+
}
|
|
2826
|
+
});
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
case 5: {
|
|
2830
|
+
const value_21 = expr.fields[1];
|
|
2831
|
+
const name_1 = expr.fields[0];
|
|
2832
|
+
const body_18 = expr.fields[2];
|
|
2833
|
+
if (expr.fields[3]) {
|
|
2834
|
+
if (value_21.tag === 4) {
|
|
2835
|
+
const recEnv = new FSharpRef(env);
|
|
2836
|
+
recEnv.contents = FSharpMap__Add(env, name_1, new Value(/* VClosure */ 14, [value_21.fields[0].Name, value_21.fields[1], recEnv]));
|
|
2837
|
+
return evalExpr(runtime, typeDefs, recEnv.contents, body_18);
|
|
2838
|
+
}
|
|
2839
|
+
else {
|
|
2840
|
+
return new Execution$1((() => {
|
|
2841
|
+
throw new EvalException(new EvalError$("let rec requires a function binding", expr.fields[5]));
|
|
2842
|
+
})(), defaultOf());
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
else {
|
|
2846
|
+
const body_22 = evalExpr(runtime, typeDefs, env, value_21);
|
|
2847
|
+
if (Execution$1__get_IsImmediate(body_22)) {
|
|
2848
|
+
return evalExpr(runtime, typeDefs, FSharpMap__Add(env, name_1, body_22.Value), body_18);
|
|
2849
|
+
}
|
|
2850
|
+
else {
|
|
2851
|
+
return new Execution$1(defaultOf(), (continuation_21) => {
|
|
2852
|
+
const execution_15 = body_22;
|
|
2853
|
+
if (Execution$1__get_IsImmediate(execution_15)) {
|
|
2854
|
+
const execution_14 = evalExpr(runtime, typeDefs, FSharpMap__Add(env, name_1, execution_15.Value), body_18);
|
|
2855
|
+
const continuation_22 = continuation_21;
|
|
2856
|
+
if (Execution$1__get_IsImmediate(execution_14)) {
|
|
2857
|
+
return continuation_22(execution_14.Value);
|
|
2858
|
+
}
|
|
2859
|
+
else {
|
|
2860
|
+
return execution_14.Resume(continuation_22);
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
else {
|
|
2864
|
+
return execution_15.Resume((value_24) => {
|
|
2865
|
+
const execution_14 = evalExpr(runtime, typeDefs, FSharpMap__Add(env, name_1, value_24), body_18);
|
|
2866
|
+
const continuation_22 = continuation_21;
|
|
2867
|
+
return Execution$1__get_IsImmediate(execution_14) ? continuation_22(execution_14.Value) : execution_14.Resume(continuation_22);
|
|
2868
|
+
});
|
|
2869
|
+
}
|
|
2870
|
+
});
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
case 6: {
|
|
2875
|
+
const span_5 = expr.fields[3];
|
|
2876
|
+
const pattern = expr.fields[0];
|
|
2877
|
+
const body_23 = expr.fields[2];
|
|
2878
|
+
const body_26 = evalExpr(runtime, typeDefs, env, expr.fields[1]);
|
|
2879
|
+
if (Execution$1__get_IsImmediate(body_26)) {
|
|
2880
|
+
const matchValue = patternMatch(typeDefs, pattern, body_26.Value);
|
|
2881
|
+
if (matchValue == null) {
|
|
2882
|
+
return new Execution$1((() => {
|
|
2883
|
+
throw new EvalException(new EvalError$("Let pattern did not match value", span_5));
|
|
2884
|
+
})(), defaultOf());
|
|
2885
|
+
}
|
|
2886
|
+
else {
|
|
2887
|
+
return evalExpr(runtime, typeDefs, fold((state, k, v) => add(k, v, state), env, matchValue), body_23);
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
else {
|
|
2891
|
+
return new Execution$1(defaultOf(), (continuation_24) => {
|
|
2892
|
+
const execution_17 = body_26;
|
|
2893
|
+
if (Execution$1__get_IsImmediate(execution_17)) {
|
|
2894
|
+
let execution_16;
|
|
2895
|
+
const matchValue = patternMatch(typeDefs, pattern, execution_17.Value);
|
|
2896
|
+
execution_16 = ((matchValue == null) ? (new Execution$1((() => {
|
|
2897
|
+
throw new EvalException(new EvalError$("Let pattern did not match value", span_5));
|
|
2898
|
+
})(), defaultOf())) : evalExpr(runtime, typeDefs, fold((state, k, v) => add(k, v, state), env, matchValue), body_23));
|
|
2899
|
+
const continuation_25 = continuation_24;
|
|
2900
|
+
if (Execution$1__get_IsImmediate(execution_16)) {
|
|
2901
|
+
return continuation_25(execution_16.Value);
|
|
2902
|
+
}
|
|
2903
|
+
else {
|
|
2904
|
+
return execution_16.Resume(continuation_25);
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
else {
|
|
2908
|
+
return execution_17.Resume((value_28) => {
|
|
2909
|
+
let execution_16;
|
|
2910
|
+
const matchValue = patternMatch(typeDefs, pattern, value_28);
|
|
2911
|
+
execution_16 = ((matchValue == null) ? (new Execution$1((() => {
|
|
2912
|
+
throw new EvalException(new EvalError$("Let pattern did not match value", span_5));
|
|
2913
|
+
})(), defaultOf())) : evalExpr(runtime, typeDefs, fold((state, k, v) => add(k, v, state), env, matchValue), body_23));
|
|
2914
|
+
const continuation_25 = continuation_24;
|
|
2915
|
+
return Execution$1__get_IsImmediate(execution_16) ? continuation_25(execution_16.Value) : execution_16.Resume(continuation_25);
|
|
2916
|
+
});
|
|
2917
|
+
}
|
|
2918
|
+
});
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
case 7: {
|
|
2922
|
+
const recEnv_1 = new FSharpRef(env);
|
|
2923
|
+
const entries = map((tupledArg) => {
|
|
2924
|
+
const args = tupledArg[1];
|
|
2925
|
+
const bindingSpan = tupledArg[4];
|
|
2926
|
+
if (isEmpty(args)) {
|
|
2927
|
+
throw new EvalException(new EvalError$("\'let rec ... and ...\' requires function arguments for each binding", bindingSpan));
|
|
2928
|
+
}
|
|
2929
|
+
const matchValue_1 = foldBack((arg_1, acc) => (new Expr(/* ELambda */ 4, [arg_1, acc, bindingSpan])), args, tupledArg[3]);
|
|
2930
|
+
if (matchValue_1.tag === 4) {
|
|
2931
|
+
return [tupledArg[0], new Value(/* VClosure */ 14, [matchValue_1.fields[0].Name, matchValue_1.fields[1], recEnv_1])];
|
|
2932
|
+
}
|
|
2933
|
+
else {
|
|
2934
|
+
throw new EvalException(new EvalError$("let rec requires a function binding", expr.fields[2]));
|
|
2935
|
+
}
|
|
2936
|
+
}, expr.fields[0]);
|
|
2937
|
+
recEnv_1.contents = fold_1((state_1, tupledArg_1) => add(tupledArg_1[0], tupledArg_1[1], state_1), env, entries);
|
|
2938
|
+
return evalExpr(runtime, typeDefs, recEnv_1.contents, expr.fields[1]);
|
|
2939
|
+
}
|
|
2940
|
+
case 8: {
|
|
2941
|
+
const span_7 = expr.fields[2];
|
|
2942
|
+
const cases = expr.fields[1];
|
|
2943
|
+
const body_37 = evalExpr(runtime, typeDefs, env, expr.fields[0]);
|
|
2944
|
+
if (Execution$1__get_IsImmediate(body_37)) {
|
|
2945
|
+
const tryCases = (cases_1_mut) => {
|
|
2946
|
+
tryCases:
|
|
2947
|
+
while (true) {
|
|
2948
|
+
const cases_1 = cases_1_mut;
|
|
2949
|
+
if (!isEmpty(cases_1)) {
|
|
2950
|
+
const rest = tail_2(cases_1);
|
|
2951
|
+
const guard = head_1(cases_1)[1];
|
|
2952
|
+
const body_29 = head_1(cases_1)[2];
|
|
2953
|
+
const matchValue_2 = patternMatch(typeDefs, head_1(cases_1)[0], body_37.Value);
|
|
2954
|
+
if (matchValue_2 != null) {
|
|
2955
|
+
const scope = fold((state_2, k_1, v_1) => add(k_1, v_1, state_2), env, matchValue_2);
|
|
2956
|
+
const body_34 = (guard == null) ? (new Execution$1(new Value(/* VBool */ 3, [true]), defaultOf())) : evalExpr(runtime, typeDefs, scope, guard);
|
|
2957
|
+
if (Execution$1__get_IsImmediate(body_34)) {
|
|
2958
|
+
const accepted = body_34.Value;
|
|
2959
|
+
if (accepted.tag === 3) {
|
|
2960
|
+
if (accepted.fields[0]) {
|
|
2961
|
+
return evalExpr(runtime, typeDefs, scope, body_29);
|
|
2962
|
+
}
|
|
2963
|
+
else {
|
|
2964
|
+
cases_1_mut = rest;
|
|
2965
|
+
continue tryCases;
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
else {
|
|
2969
|
+
return new Execution$1((() => {
|
|
2970
|
+
throw new EvalException(new EvalError$("Match guard must evaluate to bool", span_7));
|
|
2971
|
+
})(), defaultOf());
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
else {
|
|
2975
|
+
return new Execution$1(defaultOf(), (continuation_27) => {
|
|
2976
|
+
const execution_19 = body_34;
|
|
2977
|
+
if (Execution$1__get_IsImmediate(execution_19)) {
|
|
2978
|
+
let execution_18;
|
|
2979
|
+
const accepted = execution_19.Value;
|
|
2980
|
+
execution_18 = ((accepted.tag === 3) ? (accepted.fields[0] ? evalExpr(runtime, typeDefs, scope, body_29) : tryCases(rest)) : (new Execution$1((() => {
|
|
2981
|
+
throw new EvalException(new EvalError$("Match guard must evaluate to bool", span_7));
|
|
2982
|
+
})(), defaultOf())));
|
|
2983
|
+
const continuation_28 = continuation_27;
|
|
2984
|
+
if (Execution$1__get_IsImmediate(execution_18)) {
|
|
2985
|
+
return continuation_28(execution_18.Value);
|
|
2986
|
+
}
|
|
2987
|
+
else {
|
|
2988
|
+
return execution_18.Resume(continuation_28);
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
else {
|
|
2992
|
+
return execution_19.Resume((value_37) => {
|
|
2993
|
+
let execution_18;
|
|
2994
|
+
const accepted = value_37;
|
|
2995
|
+
execution_18 = ((accepted.tag === 3) ? (accepted.fields[0] ? evalExpr(runtime, typeDefs, scope, body_29) : tryCases(rest)) : (new Execution$1((() => {
|
|
2996
|
+
throw new EvalException(new EvalError$("Match guard must evaluate to bool", span_7));
|
|
2997
|
+
})(), defaultOf())));
|
|
2998
|
+
const continuation_28 = continuation_27;
|
|
2999
|
+
return Execution$1__get_IsImmediate(execution_18) ? continuation_28(execution_18.Value) : execution_18.Resume(continuation_28);
|
|
3000
|
+
});
|
|
3001
|
+
}
|
|
3002
|
+
});
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
else {
|
|
3006
|
+
cases_1_mut = rest;
|
|
3007
|
+
continue tryCases;
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
else {
|
|
3011
|
+
return new Execution$1((() => {
|
|
3012
|
+
throw new EvalException(new EvalError$("No match cases matched", span_7));
|
|
3013
|
+
})(), defaultOf());
|
|
3014
|
+
}
|
|
3015
|
+
break;
|
|
3016
|
+
}
|
|
3017
|
+
};
|
|
3018
|
+
return tryCases(cases);
|
|
3019
|
+
}
|
|
3020
|
+
else {
|
|
3021
|
+
return new Execution$1(defaultOf(), (continuation_30) => {
|
|
3022
|
+
const execution_21 = body_37;
|
|
3023
|
+
if (Execution$1__get_IsImmediate(execution_21)) {
|
|
3024
|
+
let execution_20;
|
|
3025
|
+
const tryCases = (cases_1_mut_1) => {
|
|
3026
|
+
tryCases:
|
|
3027
|
+
while (true) {
|
|
3028
|
+
const cases_1 = cases_1_mut_1;
|
|
3029
|
+
if (!isEmpty(cases_1)) {
|
|
3030
|
+
const rest = tail_2(cases_1);
|
|
3031
|
+
const guard = head_1(cases_1)[1];
|
|
3032
|
+
const body_29 = head_1(cases_1)[2];
|
|
3033
|
+
const matchValue_2 = patternMatch(typeDefs, head_1(cases_1)[0], execution_21.Value);
|
|
3034
|
+
if (matchValue_2 != null) {
|
|
3035
|
+
const scope = fold((state_2, k_1, v_1) => add(k_1, v_1, state_2), env, matchValue_2);
|
|
3036
|
+
const body_34 = (guard == null) ? (new Execution$1(new Value(/* VBool */ 3, [true]), defaultOf())) : evalExpr(runtime, typeDefs, scope, guard);
|
|
3037
|
+
if (Execution$1__get_IsImmediate(body_34)) {
|
|
3038
|
+
const accepted = body_34.Value;
|
|
3039
|
+
if (accepted.tag === 3) {
|
|
3040
|
+
if (accepted.fields[0]) {
|
|
3041
|
+
return evalExpr(runtime, typeDefs, scope, body_29);
|
|
3042
|
+
}
|
|
3043
|
+
else {
|
|
3044
|
+
cases_1_mut_1 = rest;
|
|
3045
|
+
continue tryCases;
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
else {
|
|
3049
|
+
return new Execution$1((() => {
|
|
3050
|
+
throw new EvalException(new EvalError$("Match guard must evaluate to bool", span_7));
|
|
3051
|
+
})(), defaultOf());
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
else {
|
|
3055
|
+
return new Execution$1(defaultOf(), (continuation_27) => {
|
|
3056
|
+
const execution_19 = body_34;
|
|
3057
|
+
if (Execution$1__get_IsImmediate(execution_19)) {
|
|
3058
|
+
let execution_18;
|
|
3059
|
+
const accepted = execution_19.Value;
|
|
3060
|
+
execution_18 = ((accepted.tag === 3) ? (accepted.fields[0] ? evalExpr(runtime, typeDefs, scope, body_29) : tryCases(rest)) : (new Execution$1((() => {
|
|
3061
|
+
throw new EvalException(new EvalError$("Match guard must evaluate to bool", span_7));
|
|
3062
|
+
})(), defaultOf())));
|
|
3063
|
+
const continuation_28 = continuation_27;
|
|
3064
|
+
if (Execution$1__get_IsImmediate(execution_18)) {
|
|
3065
|
+
return continuation_28(execution_18.Value);
|
|
3066
|
+
}
|
|
3067
|
+
else {
|
|
3068
|
+
return execution_18.Resume(continuation_28);
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
else {
|
|
3072
|
+
return execution_19.Resume((value_37) => {
|
|
3073
|
+
let execution_18;
|
|
3074
|
+
const accepted = value_37;
|
|
3075
|
+
execution_18 = ((accepted.tag === 3) ? (accepted.fields[0] ? evalExpr(runtime, typeDefs, scope, body_29) : tryCases(rest)) : (new Execution$1((() => {
|
|
3076
|
+
throw new EvalException(new EvalError$("Match guard must evaluate to bool", span_7));
|
|
3077
|
+
})(), defaultOf())));
|
|
3078
|
+
const continuation_28 = continuation_27;
|
|
3079
|
+
return Execution$1__get_IsImmediate(execution_18) ? continuation_28(execution_18.Value) : execution_18.Resume(continuation_28);
|
|
3080
|
+
});
|
|
3081
|
+
}
|
|
3082
|
+
});
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
else {
|
|
3086
|
+
cases_1_mut_1 = rest;
|
|
3087
|
+
continue tryCases;
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
else {
|
|
3091
|
+
return new Execution$1((() => {
|
|
3092
|
+
throw new EvalException(new EvalError$("No match cases matched", span_7));
|
|
3093
|
+
})(), defaultOf());
|
|
3094
|
+
}
|
|
3095
|
+
break;
|
|
3096
|
+
}
|
|
3097
|
+
};
|
|
3098
|
+
execution_20 = tryCases(cases);
|
|
3099
|
+
const continuation_31 = continuation_30;
|
|
3100
|
+
if (Execution$1__get_IsImmediate(execution_20)) {
|
|
3101
|
+
return continuation_31(execution_20.Value);
|
|
3102
|
+
}
|
|
3103
|
+
else {
|
|
3104
|
+
return execution_20.Resume(continuation_31);
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
else {
|
|
3108
|
+
return execution_21.Resume((value_38) => {
|
|
3109
|
+
let execution_20;
|
|
3110
|
+
const tryCases = (cases_1_mut_2) => {
|
|
3111
|
+
tryCases:
|
|
3112
|
+
while (true) {
|
|
3113
|
+
const cases_1 = cases_1_mut_2;
|
|
3114
|
+
if (!isEmpty(cases_1)) {
|
|
3115
|
+
const rest = tail_2(cases_1);
|
|
3116
|
+
const guard = head_1(cases_1)[1];
|
|
3117
|
+
const body_29 = head_1(cases_1)[2];
|
|
3118
|
+
const matchValue_2 = patternMatch(typeDefs, head_1(cases_1)[0], value_38);
|
|
3119
|
+
if (matchValue_2 != null) {
|
|
3120
|
+
const scope = fold((state_2, k_1, v_1) => add(k_1, v_1, state_2), env, matchValue_2);
|
|
3121
|
+
const body_34 = (guard == null) ? (new Execution$1(new Value(/* VBool */ 3, [true]), defaultOf())) : evalExpr(runtime, typeDefs, scope, guard);
|
|
3122
|
+
if (Execution$1__get_IsImmediate(body_34)) {
|
|
3123
|
+
const accepted = body_34.Value;
|
|
3124
|
+
if (accepted.tag === 3) {
|
|
3125
|
+
if (accepted.fields[0]) {
|
|
3126
|
+
return evalExpr(runtime, typeDefs, scope, body_29);
|
|
3127
|
+
}
|
|
3128
|
+
else {
|
|
3129
|
+
cases_1_mut_2 = rest;
|
|
3130
|
+
continue tryCases;
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
else {
|
|
3134
|
+
return new Execution$1((() => {
|
|
3135
|
+
throw new EvalException(new EvalError$("Match guard must evaluate to bool", span_7));
|
|
3136
|
+
})(), defaultOf());
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
else {
|
|
3140
|
+
return new Execution$1(defaultOf(), (continuation_27) => {
|
|
3141
|
+
const execution_19 = body_34;
|
|
3142
|
+
if (Execution$1__get_IsImmediate(execution_19)) {
|
|
3143
|
+
let execution_18;
|
|
3144
|
+
const accepted = execution_19.Value;
|
|
3145
|
+
execution_18 = ((accepted.tag === 3) ? (accepted.fields[0] ? evalExpr(runtime, typeDefs, scope, body_29) : tryCases(rest)) : (new Execution$1((() => {
|
|
3146
|
+
throw new EvalException(new EvalError$("Match guard must evaluate to bool", span_7));
|
|
3147
|
+
})(), defaultOf())));
|
|
3148
|
+
const continuation_28 = continuation_27;
|
|
3149
|
+
if (Execution$1__get_IsImmediate(execution_18)) {
|
|
3150
|
+
return continuation_28(execution_18.Value);
|
|
3151
|
+
}
|
|
3152
|
+
else {
|
|
3153
|
+
return execution_18.Resume(continuation_28);
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
else {
|
|
3157
|
+
return execution_19.Resume((value_37) => {
|
|
3158
|
+
let execution_18;
|
|
3159
|
+
const accepted = value_37;
|
|
3160
|
+
execution_18 = ((accepted.tag === 3) ? (accepted.fields[0] ? evalExpr(runtime, typeDefs, scope, body_29) : tryCases(rest)) : (new Execution$1((() => {
|
|
3161
|
+
throw new EvalException(new EvalError$("Match guard must evaluate to bool", span_7));
|
|
3162
|
+
})(), defaultOf())));
|
|
3163
|
+
const continuation_28 = continuation_27;
|
|
3164
|
+
return Execution$1__get_IsImmediate(execution_18) ? continuation_28(execution_18.Value) : execution_18.Resume(continuation_28);
|
|
3165
|
+
});
|
|
3166
|
+
}
|
|
3167
|
+
});
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
else {
|
|
3171
|
+
cases_1_mut_2 = rest;
|
|
3172
|
+
continue tryCases;
|
|
3173
|
+
}
|
|
3174
|
+
}
|
|
3175
|
+
else {
|
|
3176
|
+
return new Execution$1((() => {
|
|
3177
|
+
throw new EvalException(new EvalError$("No match cases matched", span_7));
|
|
3178
|
+
})(), defaultOf());
|
|
3179
|
+
}
|
|
3180
|
+
break;
|
|
3181
|
+
}
|
|
3182
|
+
};
|
|
3183
|
+
execution_20 = tryCases(cases);
|
|
3184
|
+
const continuation_31 = continuation_30;
|
|
3185
|
+
return Execution$1__get_IsImmediate(execution_20) ? continuation_31(execution_20.Value) : execution_20.Resume(continuation_31);
|
|
3186
|
+
});
|
|
3187
|
+
}
|
|
3188
|
+
});
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3191
|
+
case 9: {
|
|
3192
|
+
const body_39 = Execution_map((expr_1) => evalExpr(runtime, typeDefs, env, expr_1), expr.fields[0]);
|
|
3193
|
+
if (Execution$1__get_IsImmediate(body_39)) {
|
|
3194
|
+
return new Execution$1(new Value(/* VList */ 5, [body_39.Value]), defaultOf());
|
|
3195
|
+
}
|
|
3196
|
+
else {
|
|
3197
|
+
return new Execution$1(defaultOf(), (continuation_33) => {
|
|
3198
|
+
const execution_23 = body_39;
|
|
3199
|
+
if (Execution$1__get_IsImmediate(execution_23)) {
|
|
3200
|
+
const execution_22 = new Execution$1(new Value(/* VList */ 5, [execution_23.Value]), defaultOf());
|
|
3201
|
+
const continuation_34 = continuation_33;
|
|
3202
|
+
if (Execution$1__get_IsImmediate(execution_22)) {
|
|
3203
|
+
return continuation_34(execution_22.Value);
|
|
3204
|
+
}
|
|
3205
|
+
else {
|
|
3206
|
+
return execution_22.Resume(continuation_34);
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
else {
|
|
3210
|
+
return execution_23.Resume((value_41) => {
|
|
3211
|
+
const execution_22 = new Execution$1(new Value(/* VList */ 5, [value_41]), defaultOf());
|
|
3212
|
+
const continuation_34 = continuation_33;
|
|
3213
|
+
return Execution$1__get_IsImmediate(execution_22) ? continuation_34(execution_22.Value) : execution_22.Resume(continuation_34);
|
|
3214
|
+
});
|
|
3215
|
+
}
|
|
3216
|
+
});
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
case 10: {
|
|
3220
|
+
const body_41 = Execution_map((expr_2) => evalExpr(runtime, typeDefs, env, expr_2), expr.fields[0]);
|
|
3221
|
+
if (Execution$1__get_IsImmediate(body_41)) {
|
|
3222
|
+
return new Execution$1(new Value(/* VTuple */ 6, [body_41.Value]), defaultOf());
|
|
3223
|
+
}
|
|
3224
|
+
else {
|
|
3225
|
+
return new Execution$1(defaultOf(), (continuation_36) => {
|
|
3226
|
+
const execution_25 = body_41;
|
|
3227
|
+
if (Execution$1__get_IsImmediate(execution_25)) {
|
|
3228
|
+
const execution_24 = new Execution$1(new Value(/* VTuple */ 6, [execution_25.Value]), defaultOf());
|
|
3229
|
+
const continuation_37 = continuation_36;
|
|
3230
|
+
if (Execution$1__get_IsImmediate(execution_24)) {
|
|
3231
|
+
return continuation_37(execution_24.Value);
|
|
3232
|
+
}
|
|
3233
|
+
else {
|
|
3234
|
+
return execution_24.Resume(continuation_37);
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
else {
|
|
3238
|
+
return execution_25.Resume((value_44) => {
|
|
3239
|
+
const execution_24 = new Execution$1(new Value(/* VTuple */ 6, [value_44]), defaultOf());
|
|
3240
|
+
const continuation_37 = continuation_36;
|
|
3241
|
+
return Execution$1__get_IsImmediate(execution_24) ? continuation_37(execution_24.Value) : execution_24.Resume(continuation_37);
|
|
3242
|
+
});
|
|
3243
|
+
}
|
|
3244
|
+
});
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
case 11: {
|
|
3248
|
+
const span_8 = expr.fields[2];
|
|
3249
|
+
const last = expr.fields[1];
|
|
3250
|
+
const body_45 = evalExpr(runtime, typeDefs, env, expr.fields[0]);
|
|
3251
|
+
if (Execution$1__get_IsImmediate(body_45)) {
|
|
3252
|
+
const a_1 = body_45.Value;
|
|
3253
|
+
const body_43 = evalExpr(runtime, typeDefs, env, last);
|
|
3254
|
+
if (Execution$1__get_IsImmediate(body_43)) {
|
|
3255
|
+
const b = body_43.Value;
|
|
3256
|
+
let matchResult_1, e, s;
|
|
3257
|
+
if (a_1.tag === 1) {
|
|
3258
|
+
if (b.tag === 1) {
|
|
3259
|
+
matchResult_1 = 0;
|
|
3260
|
+
e = b.fields[0];
|
|
3261
|
+
s = a_1.fields[0];
|
|
3262
|
+
}
|
|
3263
|
+
else {
|
|
3264
|
+
matchResult_1 = 1;
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
else {
|
|
3268
|
+
matchResult_1 = 1;
|
|
3269
|
+
}
|
|
3270
|
+
switch (matchResult_1) {
|
|
3271
|
+
case 0: {
|
|
3272
|
+
const step = (compare_1(s, e) <= 0) ? (1n) : (-1n);
|
|
3273
|
+
const build = (acc_1_mut, current_mut) => {
|
|
3274
|
+
build:
|
|
3275
|
+
while (true) {
|
|
3276
|
+
const acc_1 = acc_1_mut, current = current_mut;
|
|
3277
|
+
if (((compare_1(step, 0n) > 0) && (compare_1(current, e) > 0)) ? true : ((compare_1(step, 0n) < 0) && (compare_1(current, e) < 0))) {
|
|
3278
|
+
return reverse(acc_1);
|
|
3279
|
+
}
|
|
3280
|
+
else {
|
|
3281
|
+
acc_1_mut = cons(new Value(/* VInt */ 1, [current]), acc_1);
|
|
3282
|
+
current_mut = toInt64_unchecked(op_Addition(current, step));
|
|
3283
|
+
continue build;
|
|
3284
|
+
}
|
|
3285
|
+
break;
|
|
3286
|
+
}
|
|
3287
|
+
};
|
|
3288
|
+
return new Execution$1(new Value(/* VList */ 5, [build(empty(), s)]), defaultOf());
|
|
3289
|
+
}
|
|
3290
|
+
default:
|
|
3291
|
+
return new Execution$1((() => {
|
|
3292
|
+
throw new EvalException(new EvalError$("Range endpoints must be int", span_8));
|
|
3293
|
+
})(), defaultOf());
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
else {
|
|
3297
|
+
return new Execution$1(defaultOf(), (continuation_39) => {
|
|
3298
|
+
const execution_27 = body_43;
|
|
3299
|
+
if (Execution$1__get_IsImmediate(execution_27)) {
|
|
3300
|
+
let execution_26;
|
|
3301
|
+
const b = execution_27.Value;
|
|
3302
|
+
let matchResult_2, e, s;
|
|
3303
|
+
if (a_1.tag === 1) {
|
|
3304
|
+
if (b.tag === 1) {
|
|
3305
|
+
matchResult_2 = 0;
|
|
3306
|
+
e = b.fields[0];
|
|
3307
|
+
s = a_1.fields[0];
|
|
3308
|
+
}
|
|
3309
|
+
else {
|
|
3310
|
+
matchResult_2 = 1;
|
|
3311
|
+
}
|
|
3312
|
+
}
|
|
3313
|
+
else {
|
|
3314
|
+
matchResult_2 = 1;
|
|
3315
|
+
}
|
|
3316
|
+
switch (matchResult_2) {
|
|
3317
|
+
case 0: {
|
|
3318
|
+
const step = (compare_1(s, e) <= 0) ? (1n) : (-1n);
|
|
3319
|
+
const build = (acc_1_mut_1, current_mut_1) => {
|
|
3320
|
+
build:
|
|
3321
|
+
while (true) {
|
|
3322
|
+
const acc_1 = acc_1_mut_1, current = current_mut_1;
|
|
3323
|
+
if (((compare_1(step, 0n) > 0) && (compare_1(current, e) > 0)) ? true : ((compare_1(step, 0n) < 0) && (compare_1(current, e) < 0))) {
|
|
3324
|
+
return reverse(acc_1);
|
|
3325
|
+
}
|
|
3326
|
+
else {
|
|
3327
|
+
acc_1_mut_1 = cons(new Value(/* VInt */ 1, [current]), acc_1);
|
|
3328
|
+
current_mut_1 = toInt64_unchecked(op_Addition(current, step));
|
|
3329
|
+
continue build;
|
|
3330
|
+
}
|
|
3331
|
+
break;
|
|
3332
|
+
}
|
|
3333
|
+
};
|
|
3334
|
+
execution_26 = (new Execution$1(new Value(/* VList */ 5, [build(empty(), s)]), defaultOf()));
|
|
3335
|
+
break;
|
|
3336
|
+
}
|
|
3337
|
+
default:
|
|
3338
|
+
execution_26 = (new Execution$1((() => {
|
|
3339
|
+
throw new EvalException(new EvalError$("Range endpoints must be int", span_8));
|
|
3340
|
+
})(), defaultOf()));
|
|
3341
|
+
}
|
|
3342
|
+
const continuation_40 = continuation_39;
|
|
3343
|
+
if (Execution$1__get_IsImmediate(execution_26)) {
|
|
3344
|
+
return continuation_40(execution_26.Value);
|
|
3345
|
+
}
|
|
3346
|
+
else {
|
|
3347
|
+
return execution_26.Resume(continuation_40);
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
else {
|
|
3351
|
+
return execution_27.Resume((value_49) => {
|
|
3352
|
+
let execution_26;
|
|
3353
|
+
const b = value_49;
|
|
3354
|
+
let matchResult_3, e, s;
|
|
3355
|
+
if (a_1.tag === 1) {
|
|
3356
|
+
if (b.tag === 1) {
|
|
3357
|
+
matchResult_3 = 0;
|
|
3358
|
+
e = b.fields[0];
|
|
3359
|
+
s = a_1.fields[0];
|
|
3360
|
+
}
|
|
3361
|
+
else {
|
|
3362
|
+
matchResult_3 = 1;
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
else {
|
|
3366
|
+
matchResult_3 = 1;
|
|
3367
|
+
}
|
|
3368
|
+
switch (matchResult_3) {
|
|
3369
|
+
case 0: {
|
|
3370
|
+
const step = (compare_1(s, e) <= 0) ? (1n) : (-1n);
|
|
3371
|
+
const build = (acc_1_mut_2, current_mut_2) => {
|
|
3372
|
+
build:
|
|
3373
|
+
while (true) {
|
|
3374
|
+
const acc_1 = acc_1_mut_2, current = current_mut_2;
|
|
3375
|
+
if (((compare_1(step, 0n) > 0) && (compare_1(current, e) > 0)) ? true : ((compare_1(step, 0n) < 0) && (compare_1(current, e) < 0))) {
|
|
3376
|
+
return reverse(acc_1);
|
|
3377
|
+
}
|
|
3378
|
+
else {
|
|
3379
|
+
acc_1_mut_2 = cons(new Value(/* VInt */ 1, [current]), acc_1);
|
|
3380
|
+
current_mut_2 = toInt64_unchecked(op_Addition(current, step));
|
|
3381
|
+
continue build;
|
|
3382
|
+
}
|
|
3383
|
+
break;
|
|
3384
|
+
}
|
|
3385
|
+
};
|
|
3386
|
+
execution_26 = (new Execution$1(new Value(/* VList */ 5, [build(empty(), s)]), defaultOf()));
|
|
3387
|
+
break;
|
|
3388
|
+
}
|
|
3389
|
+
default:
|
|
3390
|
+
execution_26 = (new Execution$1((() => {
|
|
3391
|
+
throw new EvalException(new EvalError$("Range endpoints must be int", span_8));
|
|
3392
|
+
})(), defaultOf()));
|
|
3393
|
+
}
|
|
3394
|
+
const continuation_40 = continuation_39;
|
|
3395
|
+
return Execution$1__get_IsImmediate(execution_26) ? continuation_40(execution_26.Value) : execution_26.Resume(continuation_40);
|
|
3396
|
+
});
|
|
3397
|
+
}
|
|
3398
|
+
});
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3401
|
+
else {
|
|
3402
|
+
return new Execution$1(defaultOf(), (continuation_42) => {
|
|
3403
|
+
const execution_29 = body_45;
|
|
3404
|
+
if (Execution$1__get_IsImmediate(execution_29)) {
|
|
3405
|
+
let execution_28;
|
|
3406
|
+
const a_1 = execution_29.Value;
|
|
3407
|
+
const body_43 = evalExpr(runtime, typeDefs, env, last);
|
|
3408
|
+
if (Execution$1__get_IsImmediate(body_43)) {
|
|
3409
|
+
const b = body_43.Value;
|
|
3410
|
+
let matchResult_4, e, s;
|
|
3411
|
+
if (a_1.tag === 1) {
|
|
3412
|
+
if (b.tag === 1) {
|
|
3413
|
+
matchResult_4 = 0;
|
|
3414
|
+
e = b.fields[0];
|
|
3415
|
+
s = a_1.fields[0];
|
|
3416
|
+
}
|
|
3417
|
+
else {
|
|
3418
|
+
matchResult_4 = 1;
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
else {
|
|
3422
|
+
matchResult_4 = 1;
|
|
3423
|
+
}
|
|
3424
|
+
switch (matchResult_4) {
|
|
3425
|
+
case 0: {
|
|
3426
|
+
const step = (compare_1(s, e) <= 0) ? (1n) : (-1n);
|
|
3427
|
+
const build = (acc_1_mut_3, current_mut_3) => {
|
|
3428
|
+
build:
|
|
3429
|
+
while (true) {
|
|
3430
|
+
const acc_1 = acc_1_mut_3, current = current_mut_3;
|
|
3431
|
+
if (((compare_1(step, 0n) > 0) && (compare_1(current, e) > 0)) ? true : ((compare_1(step, 0n) < 0) && (compare_1(current, e) < 0))) {
|
|
3432
|
+
return reverse(acc_1);
|
|
3433
|
+
}
|
|
3434
|
+
else {
|
|
3435
|
+
acc_1_mut_3 = cons(new Value(/* VInt */ 1, [current]), acc_1);
|
|
3436
|
+
current_mut_3 = toInt64_unchecked(op_Addition(current, step));
|
|
3437
|
+
continue build;
|
|
3438
|
+
}
|
|
3439
|
+
break;
|
|
3440
|
+
}
|
|
3441
|
+
};
|
|
3442
|
+
execution_28 = (new Execution$1(new Value(/* VList */ 5, [build(empty(), s)]), defaultOf()));
|
|
3443
|
+
break;
|
|
3444
|
+
}
|
|
3445
|
+
default:
|
|
3446
|
+
execution_28 = (new Execution$1((() => {
|
|
3447
|
+
throw new EvalException(new EvalError$("Range endpoints must be int", span_8));
|
|
3448
|
+
})(), defaultOf()));
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3451
|
+
else {
|
|
3452
|
+
execution_28 = (new Execution$1(defaultOf(), (continuation_39) => {
|
|
3453
|
+
const execution_27 = body_43;
|
|
3454
|
+
if (Execution$1__get_IsImmediate(execution_27)) {
|
|
3455
|
+
let execution_26;
|
|
3456
|
+
const b = execution_27.Value;
|
|
3457
|
+
let matchResult_5, e, s;
|
|
3458
|
+
if (a_1.tag === 1) {
|
|
3459
|
+
if (b.tag === 1) {
|
|
3460
|
+
matchResult_5 = 0;
|
|
3461
|
+
e = b.fields[0];
|
|
3462
|
+
s = a_1.fields[0];
|
|
3463
|
+
}
|
|
3464
|
+
else {
|
|
3465
|
+
matchResult_5 = 1;
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
else {
|
|
3469
|
+
matchResult_5 = 1;
|
|
3470
|
+
}
|
|
3471
|
+
switch (matchResult_5) {
|
|
3472
|
+
case 0: {
|
|
3473
|
+
const step = (compare_1(s, e) <= 0) ? (1n) : (-1n);
|
|
3474
|
+
const build = (acc_1_mut_4, current_mut_4) => {
|
|
3475
|
+
build:
|
|
3476
|
+
while (true) {
|
|
3477
|
+
const acc_1 = acc_1_mut_4, current = current_mut_4;
|
|
3478
|
+
if (((compare_1(step, 0n) > 0) && (compare_1(current, e) > 0)) ? true : ((compare_1(step, 0n) < 0) && (compare_1(current, e) < 0))) {
|
|
3479
|
+
return reverse(acc_1);
|
|
3480
|
+
}
|
|
3481
|
+
else {
|
|
3482
|
+
acc_1_mut_4 = cons(new Value(/* VInt */ 1, [current]), acc_1);
|
|
3483
|
+
current_mut_4 = toInt64_unchecked(op_Addition(current, step));
|
|
3484
|
+
continue build;
|
|
3485
|
+
}
|
|
3486
|
+
break;
|
|
3487
|
+
}
|
|
3488
|
+
};
|
|
3489
|
+
execution_26 = (new Execution$1(new Value(/* VList */ 5, [build(empty(), s)]), defaultOf()));
|
|
3490
|
+
break;
|
|
3491
|
+
}
|
|
3492
|
+
default:
|
|
3493
|
+
execution_26 = (new Execution$1((() => {
|
|
3494
|
+
throw new EvalException(new EvalError$("Range endpoints must be int", span_8));
|
|
3495
|
+
})(), defaultOf()));
|
|
3496
|
+
}
|
|
3497
|
+
const continuation_40 = continuation_39;
|
|
3498
|
+
if (Execution$1__get_IsImmediate(execution_26)) {
|
|
3499
|
+
return continuation_40(execution_26.Value);
|
|
3500
|
+
}
|
|
3501
|
+
else {
|
|
3502
|
+
return execution_26.Resume(continuation_40);
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
else {
|
|
3506
|
+
return execution_27.Resume((value_49) => {
|
|
3507
|
+
let execution_26;
|
|
3508
|
+
const b = value_49;
|
|
3509
|
+
let matchResult_6, e, s;
|
|
3510
|
+
if (a_1.tag === 1) {
|
|
3511
|
+
if (b.tag === 1) {
|
|
3512
|
+
matchResult_6 = 0;
|
|
3513
|
+
e = b.fields[0];
|
|
3514
|
+
s = a_1.fields[0];
|
|
3515
|
+
}
|
|
3516
|
+
else {
|
|
3517
|
+
matchResult_6 = 1;
|
|
3518
|
+
}
|
|
3519
|
+
}
|
|
3520
|
+
else {
|
|
3521
|
+
matchResult_6 = 1;
|
|
3522
|
+
}
|
|
3523
|
+
switch (matchResult_6) {
|
|
3524
|
+
case 0: {
|
|
3525
|
+
const step = (compare_1(s, e) <= 0) ? (1n) : (-1n);
|
|
3526
|
+
const build = (acc_1_mut_5, current_mut_5) => {
|
|
3527
|
+
build:
|
|
3528
|
+
while (true) {
|
|
3529
|
+
const acc_1 = acc_1_mut_5, current = current_mut_5;
|
|
3530
|
+
if (((compare_1(step, 0n) > 0) && (compare_1(current, e) > 0)) ? true : ((compare_1(step, 0n) < 0) && (compare_1(current, e) < 0))) {
|
|
3531
|
+
return reverse(acc_1);
|
|
3532
|
+
}
|
|
3533
|
+
else {
|
|
3534
|
+
acc_1_mut_5 = cons(new Value(/* VInt */ 1, [current]), acc_1);
|
|
3535
|
+
current_mut_5 = toInt64_unchecked(op_Addition(current, step));
|
|
3536
|
+
continue build;
|
|
3537
|
+
}
|
|
3538
|
+
break;
|
|
3539
|
+
}
|
|
3540
|
+
};
|
|
3541
|
+
execution_26 = (new Execution$1(new Value(/* VList */ 5, [build(empty(), s)]), defaultOf()));
|
|
3542
|
+
break;
|
|
3543
|
+
}
|
|
3544
|
+
default:
|
|
3545
|
+
execution_26 = (new Execution$1((() => {
|
|
3546
|
+
throw new EvalException(new EvalError$("Range endpoints must be int", span_8));
|
|
3547
|
+
})(), defaultOf()));
|
|
3548
|
+
}
|
|
3549
|
+
const continuation_40 = continuation_39;
|
|
3550
|
+
return Execution$1__get_IsImmediate(execution_26) ? continuation_40(execution_26.Value) : execution_26.Resume(continuation_40);
|
|
3551
|
+
});
|
|
3552
|
+
}
|
|
3553
|
+
}));
|
|
3554
|
+
}
|
|
3555
|
+
const continuation_43 = continuation_42;
|
|
3556
|
+
if (Execution$1__get_IsImmediate(execution_28)) {
|
|
3557
|
+
return continuation_43(execution_28.Value);
|
|
3558
|
+
}
|
|
3559
|
+
else {
|
|
3560
|
+
return execution_28.Resume(continuation_43);
|
|
3561
|
+
}
|
|
3562
|
+
}
|
|
3563
|
+
else {
|
|
3564
|
+
return execution_29.Resume((value_50) => {
|
|
3565
|
+
let execution_28;
|
|
3566
|
+
const a_1 = value_50;
|
|
3567
|
+
const body_43 = evalExpr(runtime, typeDefs, env, last);
|
|
3568
|
+
if (Execution$1__get_IsImmediate(body_43)) {
|
|
3569
|
+
const b = body_43.Value;
|
|
3570
|
+
let matchResult_7, e, s;
|
|
3571
|
+
if (a_1.tag === 1) {
|
|
3572
|
+
if (b.tag === 1) {
|
|
3573
|
+
matchResult_7 = 0;
|
|
3574
|
+
e = b.fields[0];
|
|
3575
|
+
s = a_1.fields[0];
|
|
3576
|
+
}
|
|
3577
|
+
else {
|
|
3578
|
+
matchResult_7 = 1;
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
else {
|
|
3582
|
+
matchResult_7 = 1;
|
|
3583
|
+
}
|
|
3584
|
+
switch (matchResult_7) {
|
|
3585
|
+
case 0: {
|
|
3586
|
+
const step = (compare_1(s, e) <= 0) ? (1n) : (-1n);
|
|
3587
|
+
const build = (acc_1_mut_6, current_mut_6) => {
|
|
3588
|
+
build:
|
|
3589
|
+
while (true) {
|
|
3590
|
+
const acc_1 = acc_1_mut_6, current = current_mut_6;
|
|
3591
|
+
if (((compare_1(step, 0n) > 0) && (compare_1(current, e) > 0)) ? true : ((compare_1(step, 0n) < 0) && (compare_1(current, e) < 0))) {
|
|
3592
|
+
return reverse(acc_1);
|
|
3593
|
+
}
|
|
3594
|
+
else {
|
|
3595
|
+
acc_1_mut_6 = cons(new Value(/* VInt */ 1, [current]), acc_1);
|
|
3596
|
+
current_mut_6 = toInt64_unchecked(op_Addition(current, step));
|
|
3597
|
+
continue build;
|
|
3598
|
+
}
|
|
3599
|
+
break;
|
|
3600
|
+
}
|
|
3601
|
+
};
|
|
3602
|
+
execution_28 = (new Execution$1(new Value(/* VList */ 5, [build(empty(), s)]), defaultOf()));
|
|
3603
|
+
break;
|
|
3604
|
+
}
|
|
3605
|
+
default:
|
|
3606
|
+
execution_28 = (new Execution$1((() => {
|
|
3607
|
+
throw new EvalException(new EvalError$("Range endpoints must be int", span_8));
|
|
3608
|
+
})(), defaultOf()));
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
else {
|
|
3612
|
+
execution_28 = (new Execution$1(defaultOf(), (continuation_39) => {
|
|
3613
|
+
const execution_27 = body_43;
|
|
3614
|
+
if (Execution$1__get_IsImmediate(execution_27)) {
|
|
3615
|
+
let execution_26;
|
|
3616
|
+
const b = execution_27.Value;
|
|
3617
|
+
let matchResult_8, e, s;
|
|
3618
|
+
if (a_1.tag === 1) {
|
|
3619
|
+
if (b.tag === 1) {
|
|
3620
|
+
matchResult_8 = 0;
|
|
3621
|
+
e = b.fields[0];
|
|
3622
|
+
s = a_1.fields[0];
|
|
3623
|
+
}
|
|
3624
|
+
else {
|
|
3625
|
+
matchResult_8 = 1;
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
else {
|
|
3629
|
+
matchResult_8 = 1;
|
|
3630
|
+
}
|
|
3631
|
+
switch (matchResult_8) {
|
|
3632
|
+
case 0: {
|
|
3633
|
+
const step = (compare_1(s, e) <= 0) ? (1n) : (-1n);
|
|
3634
|
+
const build = (acc_1_mut_7, current_mut_7) => {
|
|
3635
|
+
build:
|
|
3636
|
+
while (true) {
|
|
3637
|
+
const acc_1 = acc_1_mut_7, current = current_mut_7;
|
|
3638
|
+
if (((compare_1(step, 0n) > 0) && (compare_1(current, e) > 0)) ? true : ((compare_1(step, 0n) < 0) && (compare_1(current, e) < 0))) {
|
|
3639
|
+
return reverse(acc_1);
|
|
3640
|
+
}
|
|
3641
|
+
else {
|
|
3642
|
+
acc_1_mut_7 = cons(new Value(/* VInt */ 1, [current]), acc_1);
|
|
3643
|
+
current_mut_7 = toInt64_unchecked(op_Addition(current, step));
|
|
3644
|
+
continue build;
|
|
3645
|
+
}
|
|
3646
|
+
break;
|
|
3647
|
+
}
|
|
3648
|
+
};
|
|
3649
|
+
execution_26 = (new Execution$1(new Value(/* VList */ 5, [build(empty(), s)]), defaultOf()));
|
|
3650
|
+
break;
|
|
3651
|
+
}
|
|
3652
|
+
default:
|
|
3653
|
+
execution_26 = (new Execution$1((() => {
|
|
3654
|
+
throw new EvalException(new EvalError$("Range endpoints must be int", span_8));
|
|
3655
|
+
})(), defaultOf()));
|
|
3656
|
+
}
|
|
3657
|
+
const continuation_40 = continuation_39;
|
|
3658
|
+
if (Execution$1__get_IsImmediate(execution_26)) {
|
|
3659
|
+
return continuation_40(execution_26.Value);
|
|
3660
|
+
}
|
|
3661
|
+
else {
|
|
3662
|
+
return execution_26.Resume(continuation_40);
|
|
3663
|
+
}
|
|
3664
|
+
}
|
|
3665
|
+
else {
|
|
3666
|
+
return execution_27.Resume((value_49) => {
|
|
3667
|
+
let execution_26;
|
|
3668
|
+
const b = value_49;
|
|
3669
|
+
let matchResult_9, e, s;
|
|
3670
|
+
if (a_1.tag === 1) {
|
|
3671
|
+
if (b.tag === 1) {
|
|
3672
|
+
matchResult_9 = 0;
|
|
3673
|
+
e = b.fields[0];
|
|
3674
|
+
s = a_1.fields[0];
|
|
3675
|
+
}
|
|
3676
|
+
else {
|
|
3677
|
+
matchResult_9 = 1;
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
else {
|
|
3681
|
+
matchResult_9 = 1;
|
|
3682
|
+
}
|
|
3683
|
+
switch (matchResult_9) {
|
|
3684
|
+
case 0: {
|
|
3685
|
+
const step = (compare_1(s, e) <= 0) ? (1n) : (-1n);
|
|
3686
|
+
const build = (acc_1_mut_8, current_mut_8) => {
|
|
3687
|
+
build:
|
|
3688
|
+
while (true) {
|
|
3689
|
+
const acc_1 = acc_1_mut_8, current = current_mut_8;
|
|
3690
|
+
if (((compare_1(step, 0n) > 0) && (compare_1(current, e) > 0)) ? true : ((compare_1(step, 0n) < 0) && (compare_1(current, e) < 0))) {
|
|
3691
|
+
return reverse(acc_1);
|
|
3692
|
+
}
|
|
3693
|
+
else {
|
|
3694
|
+
acc_1_mut_8 = cons(new Value(/* VInt */ 1, [current]), acc_1);
|
|
3695
|
+
current_mut_8 = toInt64_unchecked(op_Addition(current, step));
|
|
3696
|
+
continue build;
|
|
3697
|
+
}
|
|
3698
|
+
break;
|
|
3699
|
+
}
|
|
3700
|
+
};
|
|
3701
|
+
execution_26 = (new Execution$1(new Value(/* VList */ 5, [build(empty(), s)]), defaultOf()));
|
|
3702
|
+
break;
|
|
3703
|
+
}
|
|
3704
|
+
default:
|
|
3705
|
+
execution_26 = (new Execution$1((() => {
|
|
3706
|
+
throw new EvalException(new EvalError$("Range endpoints must be int", span_8));
|
|
3707
|
+
})(), defaultOf()));
|
|
3708
|
+
}
|
|
3709
|
+
const continuation_40 = continuation_39;
|
|
3710
|
+
return Execution$1__get_IsImmediate(execution_26) ? continuation_40(execution_26.Value) : execution_26.Resume(continuation_40);
|
|
3711
|
+
});
|
|
3712
|
+
}
|
|
3713
|
+
}));
|
|
3714
|
+
}
|
|
3715
|
+
const continuation_43 = continuation_42;
|
|
3716
|
+
return Execution$1__get_IsImmediate(execution_28) ? continuation_43(execution_28.Value) : execution_28.Resume(continuation_43);
|
|
3717
|
+
});
|
|
3718
|
+
}
|
|
3719
|
+
});
|
|
3720
|
+
}
|
|
3721
|
+
}
|
|
3722
|
+
case 12: {
|
|
3723
|
+
const body_49 = Execution_map((tupledArg_2) => {
|
|
3724
|
+
const name_4 = tupledArg_2[0];
|
|
3725
|
+
const body_47 = evalExpr(runtime, typeDefs, env, tupledArg_2[1]);
|
|
3726
|
+
if (Execution$1__get_IsImmediate(body_47)) {
|
|
3727
|
+
return new Execution$1([name_4, body_47.Value], defaultOf());
|
|
3728
|
+
}
|
|
3729
|
+
else {
|
|
3730
|
+
return new Execution$1(defaultOf(), (continuation_45) => {
|
|
3731
|
+
const execution_31 = body_47;
|
|
3732
|
+
if (Execution$1__get_IsImmediate(execution_31)) {
|
|
3733
|
+
const execution_30 = new Execution$1([name_4, execution_31.Value], defaultOf());
|
|
3734
|
+
const continuation_46 = continuation_45;
|
|
3735
|
+
if (Execution$1__get_IsImmediate(execution_30)) {
|
|
3736
|
+
return continuation_46(execution_30.Value);
|
|
2017
3737
|
}
|
|
2018
3738
|
else {
|
|
2019
|
-
|
|
3739
|
+
return execution_30.Resume(continuation_46);
|
|
2020
3740
|
}
|
|
2021
|
-
break;
|
|
2022
3741
|
}
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
3742
|
+
else {
|
|
3743
|
+
return execution_31.Resume((value_54) => {
|
|
3744
|
+
const execution_30 = new Execution$1([name_4, value_54], defaultOf());
|
|
3745
|
+
const continuation_46 = continuation_45;
|
|
3746
|
+
return Execution$1__get_IsImmediate(execution_30) ? continuation_46(execution_30.Value) : execution_30.Resume(continuation_46);
|
|
3747
|
+
});
|
|
3748
|
+
}
|
|
3749
|
+
});
|
|
3750
|
+
}
|
|
3751
|
+
}, fields);
|
|
3752
|
+
if (Execution$1__get_IsImmediate(body_49)) {
|
|
3753
|
+
return new Execution$1(new Value(/* VRecord */ 7, [ofList(body_49.Value, {
|
|
3754
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
3755
|
+
})]), defaultOf());
|
|
3756
|
+
}
|
|
3757
|
+
else {
|
|
3758
|
+
return new Execution$1(defaultOf(), (continuation_48) => {
|
|
3759
|
+
const execution_33 = body_49;
|
|
3760
|
+
if (Execution$1__get_IsImmediate(execution_33)) {
|
|
3761
|
+
const execution_32 = new Execution$1(new Value(/* VRecord */ 7, [ofList(execution_33.Value, {
|
|
3762
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
3763
|
+
})]), defaultOf());
|
|
3764
|
+
const continuation_49 = continuation_48;
|
|
3765
|
+
if (Execution$1__get_IsImmediate(execution_32)) {
|
|
3766
|
+
return continuation_49(execution_32.Value);
|
|
3767
|
+
}
|
|
3768
|
+
else {
|
|
3769
|
+
return execution_32.Resume(continuation_49);
|
|
2028
3770
|
}
|
|
2029
|
-
default:
|
|
2030
|
-
matchResult_2 = 2;
|
|
2031
3771
|
}
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
3772
|
+
else {
|
|
3773
|
+
return execution_33.Resume((value_57) => {
|
|
3774
|
+
const execution_32 = new Execution$1(new Value(/* VRecord */ 7, [ofList(value_57, {
|
|
3775
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
3776
|
+
})]), defaultOf());
|
|
3777
|
+
const continuation_49 = continuation_48;
|
|
3778
|
+
return Execution$1__get_IsImmediate(execution_32) ? continuation_49(execution_32.Value) : execution_32.Resume(continuation_49);
|
|
3779
|
+
});
|
|
3780
|
+
}
|
|
3781
|
+
});
|
|
3782
|
+
}
|
|
3783
|
+
}
|
|
3784
|
+
case 13: {
|
|
3785
|
+
const body_57 = Execution_fold((acc_2, entry) => {
|
|
3786
|
+
if (entry.tag === 1) {
|
|
3787
|
+
const spread = entry.fields[0];
|
|
3788
|
+
const body_55 = evalExpr(runtime, typeDefs, env, spread);
|
|
3789
|
+
if (Execution$1__get_IsImmediate(body_55)) {
|
|
3790
|
+
const value_65 = body_55.Value;
|
|
3791
|
+
if (value_65.tag === 8) {
|
|
3792
|
+
return new Execution$1(fold((state_3, k_2, v_2) => (containsKey(k_2, state_3) ? state_3 : add(k_2, v_2, state_3)), acc_2, value_65.fields[0]), defaultOf());
|
|
3793
|
+
}
|
|
3794
|
+
else {
|
|
3795
|
+
return new Execution$1((() => {
|
|
3796
|
+
throw new EvalException(new EvalError$("Map spread value must be a map", Ast_spanOfExpr(spread)));
|
|
3797
|
+
})(), defaultOf());
|
|
3798
|
+
}
|
|
3799
|
+
}
|
|
3800
|
+
else {
|
|
3801
|
+
return new Execution$1(defaultOf(), (continuation_57) => {
|
|
3802
|
+
const execution_39 = body_55;
|
|
3803
|
+
if (Execution$1__get_IsImmediate(execution_39)) {
|
|
3804
|
+
let execution_38;
|
|
3805
|
+
const value_65 = execution_39.Value;
|
|
3806
|
+
execution_38 = ((value_65.tag === 8) ? (new Execution$1(fold((state_3, k_2, v_2) => (containsKey(k_2, state_3) ? state_3 : add(k_2, v_2, state_3)), acc_2, value_65.fields[0]), defaultOf())) : (new Execution$1((() => {
|
|
3807
|
+
throw new EvalException(new EvalError$("Map spread value must be a map", Ast_spanOfExpr(spread)));
|
|
3808
|
+
})(), defaultOf())));
|
|
3809
|
+
const continuation_58 = continuation_57;
|
|
3810
|
+
if (Execution$1__get_IsImmediate(execution_38)) {
|
|
3811
|
+
return continuation_58(execution_38.Value);
|
|
3812
|
+
}
|
|
3813
|
+
else {
|
|
3814
|
+
return execution_38.Resume(continuation_58);
|
|
3815
|
+
}
|
|
2039
3816
|
}
|
|
2040
3817
|
else {
|
|
2041
|
-
return
|
|
3818
|
+
return execution_39.Resume((value_70) => {
|
|
3819
|
+
let execution_38;
|
|
3820
|
+
const value_65 = value_70;
|
|
3821
|
+
execution_38 = ((value_65.tag === 8) ? (new Execution$1(fold((state_3, k_2, v_2) => (containsKey(k_2, state_3) ? state_3 : add(k_2, v_2, state_3)), acc_2, value_65.fields[0]), defaultOf())) : (new Execution$1((() => {
|
|
3822
|
+
throw new EvalException(new EvalError$("Map spread value must be a map", Ast_spanOfExpr(spread)));
|
|
3823
|
+
})(), defaultOf())));
|
|
3824
|
+
const continuation_58 = continuation_57;
|
|
3825
|
+
return Execution$1__get_IsImmediate(execution_38) ? continuation_58(execution_38.Value) : execution_38.Resume(continuation_58);
|
|
3826
|
+
});
|
|
2042
3827
|
}
|
|
2043
|
-
}
|
|
2044
|
-
default:
|
|
2045
|
-
return undefined;
|
|
3828
|
+
});
|
|
2046
3829
|
}
|
|
2047
|
-
}
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
const
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
3830
|
+
}
|
|
3831
|
+
else {
|
|
3832
|
+
const valueExpr_1 = entry.fields[1];
|
|
3833
|
+
const keyExpr = entry.fields[0];
|
|
3834
|
+
const body_53 = evalExpr(runtime, typeDefs, env, keyExpr);
|
|
3835
|
+
if (Execution$1__get_IsImmediate(body_53)) {
|
|
3836
|
+
const key = body_53.Value;
|
|
3837
|
+
let matchResult_10;
|
|
3838
|
+
switch (key.tag) {
|
|
3839
|
+
case 4:
|
|
3840
|
+
case 1:
|
|
3841
|
+
case 3: {
|
|
3842
|
+
matchResult_10 = 0;
|
|
2058
3843
|
break;
|
|
2059
3844
|
}
|
|
2060
|
-
case
|
|
2061
|
-
|
|
2062
|
-
|
|
3845
|
+
case 10: {
|
|
3846
|
+
if (key.fields[2] == null) {
|
|
3847
|
+
matchResult_10 = 0;
|
|
3848
|
+
}
|
|
3849
|
+
else {
|
|
3850
|
+
matchResult_10 = 1;
|
|
3851
|
+
}
|
|
2063
3852
|
break;
|
|
2064
3853
|
}
|
|
2065
3854
|
default:
|
|
2066
|
-
|
|
3855
|
+
matchResult_10 = 1;
|
|
2067
3856
|
}
|
|
2068
|
-
switch (
|
|
3857
|
+
switch (matchResult_10) {
|
|
2069
3858
|
case 0: {
|
|
2070
|
-
const
|
|
2071
|
-
|
|
2072
|
-
|
|
3859
|
+
const converted = valueToMapKey(Ast_spanOfExpr(keyExpr), key);
|
|
3860
|
+
const body_51 = evalExpr(runtime, typeDefs, env, valueExpr_1);
|
|
3861
|
+
if (Execution$1__get_IsImmediate(body_51)) {
|
|
3862
|
+
return new Execution$1(add(converted, body_51.Value, acc_2), defaultOf());
|
|
2073
3863
|
}
|
|
2074
3864
|
else {
|
|
2075
|
-
return
|
|
3865
|
+
return new Execution$1(defaultOf(), (continuation_51) => {
|
|
3866
|
+
const execution_35 = body_51;
|
|
3867
|
+
if (Execution$1__get_IsImmediate(execution_35)) {
|
|
3868
|
+
const execution_34 = new Execution$1(add(converted, execution_35.Value, acc_2), defaultOf());
|
|
3869
|
+
const continuation_52 = continuation_51;
|
|
3870
|
+
if (Execution$1__get_IsImmediate(execution_34)) {
|
|
3871
|
+
return continuation_52(execution_34.Value);
|
|
3872
|
+
}
|
|
3873
|
+
else {
|
|
3874
|
+
return execution_34.Resume(continuation_52);
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
else {
|
|
3878
|
+
return execution_35.Resume((value_61) => {
|
|
3879
|
+
const execution_34 = new Execution$1(add(converted, value_61, acc_2), defaultOf());
|
|
3880
|
+
const continuation_52 = continuation_51;
|
|
3881
|
+
return Execution$1__get_IsImmediate(execution_34) ? continuation_52(execution_34.Value) : execution_34.Resume(continuation_52);
|
|
3882
|
+
});
|
|
3883
|
+
}
|
|
3884
|
+
});
|
|
2076
3885
|
}
|
|
2077
3886
|
}
|
|
2078
3887
|
default:
|
|
2079
|
-
|
|
3888
|
+
return new Execution$1((() => {
|
|
3889
|
+
throw new EvalException(new EvalError$("Unsupported map literal key", Ast_spanOfExpr(keyExpr)));
|
|
3890
|
+
})(), defaultOf());
|
|
3891
|
+
}
|
|
3892
|
+
}
|
|
3893
|
+
else {
|
|
3894
|
+
return new Execution$1(defaultOf(), (continuation_54) => {
|
|
3895
|
+
const execution_37 = body_53;
|
|
3896
|
+
if (Execution$1__get_IsImmediate(execution_37)) {
|
|
3897
|
+
let execution_36;
|
|
3898
|
+
const key = execution_37.Value;
|
|
3899
|
+
let matchResult_11;
|
|
3900
|
+
switch (key.tag) {
|
|
3901
|
+
case 4:
|
|
3902
|
+
case 1:
|
|
3903
|
+
case 3: {
|
|
3904
|
+
matchResult_11 = 0;
|
|
3905
|
+
break;
|
|
3906
|
+
}
|
|
3907
|
+
case 10: {
|
|
3908
|
+
if (key.fields[2] == null) {
|
|
3909
|
+
matchResult_11 = 0;
|
|
3910
|
+
}
|
|
3911
|
+
else {
|
|
3912
|
+
matchResult_11 = 1;
|
|
3913
|
+
}
|
|
3914
|
+
break;
|
|
3915
|
+
}
|
|
3916
|
+
default:
|
|
3917
|
+
matchResult_11 = 1;
|
|
3918
|
+
}
|
|
3919
|
+
switch (matchResult_11) {
|
|
3920
|
+
case 0: {
|
|
3921
|
+
const converted = valueToMapKey(Ast_spanOfExpr(keyExpr), key);
|
|
3922
|
+
const body_51 = evalExpr(runtime, typeDefs, env, valueExpr_1);
|
|
3923
|
+
execution_36 = (Execution$1__get_IsImmediate(body_51) ? (new Execution$1(add(converted, body_51.Value, acc_2), defaultOf())) : (new Execution$1(defaultOf(), (continuation_51) => {
|
|
3924
|
+
const execution_35 = body_51;
|
|
3925
|
+
if (Execution$1__get_IsImmediate(execution_35)) {
|
|
3926
|
+
const execution_34 = new Execution$1(add(converted, execution_35.Value, acc_2), defaultOf());
|
|
3927
|
+
const continuation_52 = continuation_51;
|
|
3928
|
+
if (Execution$1__get_IsImmediate(execution_34)) {
|
|
3929
|
+
return continuation_52(execution_34.Value);
|
|
3930
|
+
}
|
|
3931
|
+
else {
|
|
3932
|
+
return execution_34.Resume(continuation_52);
|
|
3933
|
+
}
|
|
3934
|
+
}
|
|
3935
|
+
else {
|
|
3936
|
+
return execution_35.Resume((value_61) => {
|
|
3937
|
+
const execution_34 = new Execution$1(add(converted, value_61, acc_2), defaultOf());
|
|
3938
|
+
const continuation_52 = continuation_51;
|
|
3939
|
+
return Execution$1__get_IsImmediate(execution_34) ? continuation_52(execution_34.Value) : execution_34.Resume(continuation_52);
|
|
3940
|
+
});
|
|
3941
|
+
}
|
|
3942
|
+
})));
|
|
3943
|
+
break;
|
|
3944
|
+
}
|
|
3945
|
+
default:
|
|
3946
|
+
execution_36 = (new Execution$1((() => {
|
|
3947
|
+
throw new EvalException(new EvalError$("Unsupported map literal key", Ast_spanOfExpr(keyExpr)));
|
|
3948
|
+
})(), defaultOf()));
|
|
3949
|
+
}
|
|
3950
|
+
const continuation_55 = continuation_54;
|
|
3951
|
+
if (Execution$1__get_IsImmediate(execution_36)) {
|
|
3952
|
+
return continuation_55(execution_36.Value);
|
|
3953
|
+
}
|
|
3954
|
+
else {
|
|
3955
|
+
return execution_36.Resume(continuation_55);
|
|
3956
|
+
}
|
|
3957
|
+
}
|
|
3958
|
+
else {
|
|
3959
|
+
return execution_37.Resume((value_64) => {
|
|
3960
|
+
let execution_36;
|
|
3961
|
+
const key = value_64;
|
|
3962
|
+
let matchResult_12;
|
|
3963
|
+
switch (key.tag) {
|
|
3964
|
+
case 4:
|
|
3965
|
+
case 1:
|
|
3966
|
+
case 3: {
|
|
3967
|
+
matchResult_12 = 0;
|
|
3968
|
+
break;
|
|
3969
|
+
}
|
|
3970
|
+
case 10: {
|
|
3971
|
+
if (key.fields[2] == null) {
|
|
3972
|
+
matchResult_12 = 0;
|
|
3973
|
+
}
|
|
3974
|
+
else {
|
|
3975
|
+
matchResult_12 = 1;
|
|
3976
|
+
}
|
|
3977
|
+
break;
|
|
3978
|
+
}
|
|
3979
|
+
default:
|
|
3980
|
+
matchResult_12 = 1;
|
|
3981
|
+
}
|
|
3982
|
+
switch (matchResult_12) {
|
|
3983
|
+
case 0: {
|
|
3984
|
+
const converted = valueToMapKey(Ast_spanOfExpr(keyExpr), key);
|
|
3985
|
+
const body_51 = evalExpr(runtime, typeDefs, env, valueExpr_1);
|
|
3986
|
+
execution_36 = (Execution$1__get_IsImmediate(body_51) ? (new Execution$1(add(converted, body_51.Value, acc_2), defaultOf())) : (new Execution$1(defaultOf(), (continuation_51) => {
|
|
3987
|
+
const execution_35 = body_51;
|
|
3988
|
+
if (Execution$1__get_IsImmediate(execution_35)) {
|
|
3989
|
+
const execution_34 = new Execution$1(add(converted, execution_35.Value, acc_2), defaultOf());
|
|
3990
|
+
const continuation_52 = continuation_51;
|
|
3991
|
+
if (Execution$1__get_IsImmediate(execution_34)) {
|
|
3992
|
+
return continuation_52(execution_34.Value);
|
|
3993
|
+
}
|
|
3994
|
+
else {
|
|
3995
|
+
return execution_34.Resume(continuation_52);
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
else {
|
|
3999
|
+
return execution_35.Resume((value_61) => {
|
|
4000
|
+
const execution_34 = new Execution$1(add(converted, value_61, acc_2), defaultOf());
|
|
4001
|
+
const continuation_52 = continuation_51;
|
|
4002
|
+
return Execution$1__get_IsImmediate(execution_34) ? continuation_52(execution_34.Value) : execution_34.Resume(continuation_52);
|
|
4003
|
+
});
|
|
4004
|
+
}
|
|
4005
|
+
})));
|
|
4006
|
+
break;
|
|
4007
|
+
}
|
|
4008
|
+
default:
|
|
4009
|
+
execution_36 = (new Execution$1((() => {
|
|
4010
|
+
throw new EvalException(new EvalError$("Unsupported map literal key", Ast_spanOfExpr(keyExpr)));
|
|
4011
|
+
})(), defaultOf()));
|
|
4012
|
+
}
|
|
4013
|
+
const continuation_55 = continuation_54;
|
|
4014
|
+
return Execution$1__get_IsImmediate(execution_36) ? continuation_55(execution_36.Value) : execution_36.Resume(continuation_55);
|
|
4015
|
+
});
|
|
4016
|
+
}
|
|
4017
|
+
});
|
|
4018
|
+
}
|
|
4019
|
+
}
|
|
4020
|
+
}, empty_1({
|
|
4021
|
+
Compare: (x_1, y_1) => (compare(x_1, y_1) | 0),
|
|
4022
|
+
}), expr.fields[0]);
|
|
4023
|
+
if (Execution$1__get_IsImmediate(body_57)) {
|
|
4024
|
+
return new Execution$1(new Value(/* VMap */ 8, [body_57.Value]), defaultOf());
|
|
4025
|
+
}
|
|
4026
|
+
else {
|
|
4027
|
+
return new Execution$1(defaultOf(), (continuation_60) => {
|
|
4028
|
+
const execution_41 = body_57;
|
|
4029
|
+
if (Execution$1__get_IsImmediate(execution_41)) {
|
|
4030
|
+
const execution_40 = new Execution$1(new Value(/* VMap */ 8, [execution_41.Value]), defaultOf());
|
|
4031
|
+
const continuation_61 = continuation_60;
|
|
4032
|
+
if (Execution$1__get_IsImmediate(execution_40)) {
|
|
4033
|
+
return continuation_61(execution_40.Value);
|
|
4034
|
+
}
|
|
4035
|
+
else {
|
|
4036
|
+
return execution_40.Resume(continuation_61);
|
|
2080
4037
|
}
|
|
2081
4038
|
}
|
|
2082
4039
|
else {
|
|
2083
|
-
return
|
|
4040
|
+
return execution_41.Resume((value_73) => {
|
|
4041
|
+
const execution_40 = new Execution$1(new Value(/* VMap */ 8, [value_73]), defaultOf());
|
|
4042
|
+
const continuation_61 = continuation_60;
|
|
4043
|
+
return Execution$1__get_IsImmediate(execution_40) ? continuation_61(execution_40.Value) : execution_40.Resume(continuation_61);
|
|
4044
|
+
});
|
|
4045
|
+
}
|
|
4046
|
+
});
|
|
4047
|
+
}
|
|
4048
|
+
}
|
|
4049
|
+
case 14:
|
|
4050
|
+
return updateRecord(runtime, typeDefs, env, expr.fields[0], expr.fields[1], expr.fields[2], false);
|
|
4051
|
+
case 15:
|
|
4052
|
+
return updateRecord(runtime, typeDefs, env, expr.fields[0], expr.fields[1], expr.fields[2], true);
|
|
4053
|
+
case 16: {
|
|
4054
|
+
const target_2 = expr.fields[0];
|
|
4055
|
+
const span_11 = expr.fields[2];
|
|
4056
|
+
const field = expr.fields[1];
|
|
4057
|
+
const qualified = (_arg_22) => {
|
|
4058
|
+
let matchResult_13, name_6, name_7, parent;
|
|
4059
|
+
switch (_arg_22.tag) {
|
|
4060
|
+
case 2: {
|
|
4061
|
+
if (!FSharpMap__ContainsKey(env, _arg_22.fields[0])) {
|
|
4062
|
+
matchResult_13 = 0;
|
|
4063
|
+
name_6 = _arg_22.fields[0];
|
|
4064
|
+
}
|
|
4065
|
+
else {
|
|
4066
|
+
matchResult_13 = 2;
|
|
4067
|
+
}
|
|
4068
|
+
break;
|
|
4069
|
+
}
|
|
4070
|
+
case 21: {
|
|
4071
|
+
matchResult_13 = 1;
|
|
4072
|
+
name_7 = _arg_22.fields[1];
|
|
4073
|
+
parent = _arg_22.fields[0];
|
|
4074
|
+
break;
|
|
2084
4075
|
}
|
|
4076
|
+
default:
|
|
4077
|
+
matchResult_13 = 2;
|
|
2085
4078
|
}
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
4079
|
+
switch (matchResult_13) {
|
|
4080
|
+
case 0:
|
|
4081
|
+
return name_6;
|
|
4082
|
+
case 1: {
|
|
4083
|
+
const option_1 = qualified(parent);
|
|
4084
|
+
if (option_1 != null) {
|
|
4085
|
+
return (option_1 + ".") + name_7;
|
|
4086
|
+
}
|
|
4087
|
+
else {
|
|
4088
|
+
return undefined;
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
default:
|
|
4092
|
+
return undefined;
|
|
4093
|
+
}
|
|
4094
|
+
};
|
|
4095
|
+
let direct;
|
|
4096
|
+
const option_3 = qualified(target_2);
|
|
4097
|
+
direct = ((option_3 != null) ? FSharpMap__TryFind(env, (option_3 + ".") + field) : undefined);
|
|
4098
|
+
if (direct == null) {
|
|
4099
|
+
const body_61 = evalExpr(runtime, typeDefs, env, target_2);
|
|
4100
|
+
if (Execution$1__get_IsImmediate(body_61)) {
|
|
4101
|
+
const value_77 = body_61.Value;
|
|
4102
|
+
let matchResult_14, fields_2;
|
|
4103
|
+
switch (value_77.tag) {
|
|
2090
4104
|
case 7: {
|
|
2091
|
-
|
|
2092
|
-
|
|
4105
|
+
matchResult_14 = 0;
|
|
4106
|
+
fields_2 = value_77.fields[0];
|
|
2093
4107
|
break;
|
|
2094
4108
|
}
|
|
2095
4109
|
case 16: {
|
|
2096
|
-
|
|
2097
|
-
|
|
4110
|
+
matchResult_14 = 0;
|
|
4111
|
+
fields_2 = value_77.fields[0].Fields;
|
|
2098
4112
|
break;
|
|
2099
4113
|
}
|
|
2100
4114
|
default:
|
|
2101
|
-
|
|
4115
|
+
matchResult_14 = 1;
|
|
2102
4116
|
}
|
|
2103
|
-
switch (
|
|
4117
|
+
switch (matchResult_14) {
|
|
4118
|
+
case 0: {
|
|
4119
|
+
const matchValue_4 = FSharpMap__TryFind(fields_2, field);
|
|
4120
|
+
if (matchValue_4 == null) {
|
|
4121
|
+
return new Execution$1((() => {
|
|
4122
|
+
throw new EvalException(new EvalError$(concat("Record field \'", field, "\' not found"), span_11));
|
|
4123
|
+
})(), defaultOf());
|
|
4124
|
+
}
|
|
4125
|
+
else {
|
|
4126
|
+
return new Execution$1(matchValue_4, defaultOf());
|
|
4127
|
+
}
|
|
4128
|
+
}
|
|
4129
|
+
default:
|
|
4130
|
+
return new Execution$1((() => {
|
|
4131
|
+
throw new EvalException(new EvalError$("Field access requires a record value", span_11));
|
|
4132
|
+
})(), defaultOf());
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
4135
|
+
else {
|
|
4136
|
+
return new Execution$1(defaultOf(), (continuation_63) => {
|
|
4137
|
+
const execution_43 = body_61;
|
|
4138
|
+
if (Execution$1__get_IsImmediate(execution_43)) {
|
|
4139
|
+
let execution_42;
|
|
4140
|
+
const value_77 = execution_43.Value;
|
|
4141
|
+
let matchResult_15, fields_2;
|
|
4142
|
+
switch (value_77.tag) {
|
|
4143
|
+
case 7: {
|
|
4144
|
+
matchResult_15 = 0;
|
|
4145
|
+
fields_2 = value_77.fields[0];
|
|
4146
|
+
break;
|
|
4147
|
+
}
|
|
4148
|
+
case 16: {
|
|
4149
|
+
matchResult_15 = 0;
|
|
4150
|
+
fields_2 = value_77.fields[0].Fields;
|
|
4151
|
+
break;
|
|
4152
|
+
}
|
|
4153
|
+
default:
|
|
4154
|
+
matchResult_15 = 1;
|
|
4155
|
+
}
|
|
4156
|
+
switch (matchResult_15) {
|
|
4157
|
+
case 0: {
|
|
4158
|
+
const matchValue_4 = FSharpMap__TryFind(fields_2, field);
|
|
4159
|
+
execution_42 = ((matchValue_4 == null) ? (new Execution$1((() => {
|
|
4160
|
+
throw new EvalException(new EvalError$(concat("Record field \'", field, "\' not found"), span_11));
|
|
4161
|
+
})(), defaultOf())) : (new Execution$1(matchValue_4, defaultOf())));
|
|
4162
|
+
break;
|
|
4163
|
+
}
|
|
4164
|
+
default:
|
|
4165
|
+
execution_42 = (new Execution$1((() => {
|
|
4166
|
+
throw new EvalException(new EvalError$("Field access requires a record value", span_11));
|
|
4167
|
+
})(), defaultOf()));
|
|
4168
|
+
}
|
|
4169
|
+
const continuation_64 = continuation_63;
|
|
4170
|
+
if (Execution$1__get_IsImmediate(execution_42)) {
|
|
4171
|
+
return continuation_64(execution_42.Value);
|
|
4172
|
+
}
|
|
4173
|
+
else {
|
|
4174
|
+
return execution_42.Resume(continuation_64);
|
|
4175
|
+
}
|
|
4176
|
+
}
|
|
4177
|
+
else {
|
|
4178
|
+
return execution_43.Resume((value_84) => {
|
|
4179
|
+
let execution_42;
|
|
4180
|
+
const value_77 = value_84;
|
|
4181
|
+
let matchResult_16, fields_2;
|
|
4182
|
+
switch (value_77.tag) {
|
|
4183
|
+
case 7: {
|
|
4184
|
+
matchResult_16 = 0;
|
|
4185
|
+
fields_2 = value_77.fields[0];
|
|
4186
|
+
break;
|
|
4187
|
+
}
|
|
4188
|
+
case 16: {
|
|
4189
|
+
matchResult_16 = 0;
|
|
4190
|
+
fields_2 = value_77.fields[0].Fields;
|
|
4191
|
+
break;
|
|
4192
|
+
}
|
|
4193
|
+
default:
|
|
4194
|
+
matchResult_16 = 1;
|
|
4195
|
+
}
|
|
4196
|
+
switch (matchResult_16) {
|
|
4197
|
+
case 0: {
|
|
4198
|
+
const matchValue_4 = FSharpMap__TryFind(fields_2, field);
|
|
4199
|
+
execution_42 = ((matchValue_4 == null) ? (new Execution$1((() => {
|
|
4200
|
+
throw new EvalException(new EvalError$(concat("Record field \'", field, "\' not found"), span_11));
|
|
4201
|
+
})(), defaultOf())) : (new Execution$1(matchValue_4, defaultOf())));
|
|
4202
|
+
break;
|
|
4203
|
+
}
|
|
4204
|
+
default:
|
|
4205
|
+
execution_42 = (new Execution$1((() => {
|
|
4206
|
+
throw new EvalException(new EvalError$("Field access requires a record value", span_11));
|
|
4207
|
+
})(), defaultOf()));
|
|
4208
|
+
}
|
|
4209
|
+
const continuation_64 = continuation_63;
|
|
4210
|
+
return Execution$1__get_IsImmediate(execution_42) ? continuation_64(execution_42.Value) : execution_42.Resume(continuation_64);
|
|
4211
|
+
});
|
|
4212
|
+
}
|
|
4213
|
+
});
|
|
4214
|
+
}
|
|
4215
|
+
}
|
|
4216
|
+
else {
|
|
4217
|
+
return new Execution$1(direct, defaultOf());
|
|
4218
|
+
}
|
|
4219
|
+
}
|
|
4220
|
+
case 17: {
|
|
4221
|
+
const span_12 = expr.fields[2];
|
|
4222
|
+
const keyExpr_1 = expr.fields[1];
|
|
4223
|
+
const body_65 = evalExpr(runtime, typeDefs, env, expr.fields[0]);
|
|
4224
|
+
if (Execution$1__get_IsImmediate(body_65)) {
|
|
4225
|
+
const targetValue = body_65.Value;
|
|
4226
|
+
const body_63 = evalExpr(runtime, typeDefs, env, keyExpr_1);
|
|
4227
|
+
if (Execution$1__get_IsImmediate(body_63)) {
|
|
4228
|
+
const key_1 = body_63.Value;
|
|
4229
|
+
let matchResult_17, index, values_3, values_4;
|
|
4230
|
+
switch (targetValue.tag) {
|
|
4231
|
+
case 5: {
|
|
4232
|
+
if (key_1.tag === 1) {
|
|
4233
|
+
matchResult_17 = 0;
|
|
4234
|
+
index = key_1.fields[0];
|
|
4235
|
+
values_3 = targetValue.fields[0];
|
|
4236
|
+
}
|
|
4237
|
+
else {
|
|
4238
|
+
matchResult_17 = 3;
|
|
4239
|
+
}
|
|
4240
|
+
break;
|
|
4241
|
+
}
|
|
4242
|
+
case 8: {
|
|
4243
|
+
switch (key_1.tag) {
|
|
4244
|
+
case 4: {
|
|
4245
|
+
matchResult_17 = 1;
|
|
4246
|
+
values_4 = targetValue.fields[0];
|
|
4247
|
+
break;
|
|
4248
|
+
}
|
|
4249
|
+
case 1: {
|
|
4250
|
+
matchResult_17 = 1;
|
|
4251
|
+
values_4 = targetValue.fields[0];
|
|
4252
|
+
break;
|
|
4253
|
+
}
|
|
4254
|
+
case 3: {
|
|
4255
|
+
matchResult_17 = 1;
|
|
4256
|
+
values_4 = targetValue.fields[0];
|
|
4257
|
+
break;
|
|
4258
|
+
}
|
|
4259
|
+
case 10: {
|
|
4260
|
+
if (key_1.fields[2] == null) {
|
|
4261
|
+
matchResult_17 = 1;
|
|
4262
|
+
values_4 = targetValue.fields[0];
|
|
4263
|
+
}
|
|
4264
|
+
else {
|
|
4265
|
+
matchResult_17 = 2;
|
|
4266
|
+
}
|
|
4267
|
+
break;
|
|
4268
|
+
}
|
|
4269
|
+
default:
|
|
4270
|
+
matchResult_17 = 2;
|
|
4271
|
+
}
|
|
4272
|
+
break;
|
|
4273
|
+
}
|
|
4274
|
+
default:
|
|
4275
|
+
matchResult_17 = 4;
|
|
4276
|
+
}
|
|
4277
|
+
switch (matchResult_17) {
|
|
2104
4278
|
case 0: {
|
|
2105
|
-
const
|
|
2106
|
-
|
|
2107
|
-
|
|
4279
|
+
const find = (items_5_mut, current_1_mut) => {
|
|
4280
|
+
find:
|
|
4281
|
+
while (true) {
|
|
4282
|
+
const items_5 = items_5_mut, current_1 = current_1_mut;
|
|
4283
|
+
if (!isEmpty(items_5)) {
|
|
4284
|
+
if (equals(current_1, index)) {
|
|
4285
|
+
return some(head_1(items_5));
|
|
4286
|
+
}
|
|
4287
|
+
else {
|
|
4288
|
+
items_5_mut = tail_2(items_5);
|
|
4289
|
+
current_1_mut = toInt64_unchecked(op_Addition(current_1, 1n));
|
|
4290
|
+
continue find;
|
|
4291
|
+
}
|
|
4292
|
+
}
|
|
4293
|
+
else {
|
|
4294
|
+
return undefined;
|
|
4295
|
+
}
|
|
4296
|
+
break;
|
|
4297
|
+
}
|
|
4298
|
+
};
|
|
4299
|
+
return new Execution$1(new Value(/* VOption */ 9, [(compare_1(index, 0n) < 0) ? undefined : find(values_3, 0n)]), defaultOf());
|
|
4300
|
+
}
|
|
4301
|
+
case 1:
|
|
4302
|
+
return new Execution$1(new Value(/* VOption */ 9, [FSharpMap__TryFind(values_4, valueToMapKey(span_12, key_1))]), defaultOf());
|
|
4303
|
+
case 2:
|
|
4304
|
+
return new Execution$1((() => {
|
|
4305
|
+
throw new EvalException(new EvalError$("Map index key must be string, int, bool, or a payload-free union case", span_12));
|
|
4306
|
+
})(), defaultOf());
|
|
4307
|
+
case 3:
|
|
4308
|
+
return new Execution$1((() => {
|
|
4309
|
+
throw new EvalException(new EvalError$("List index must be int", span_12));
|
|
4310
|
+
})(), defaultOf());
|
|
4311
|
+
default:
|
|
4312
|
+
return new Execution$1((() => {
|
|
4313
|
+
throw new EvalException(new EvalError$("Index access requires a list or map value", span_12));
|
|
4314
|
+
})(), defaultOf());
|
|
4315
|
+
}
|
|
4316
|
+
}
|
|
4317
|
+
else {
|
|
4318
|
+
return new Execution$1(defaultOf(), (continuation_66) => {
|
|
4319
|
+
const execution_45 = body_63;
|
|
4320
|
+
if (Execution$1__get_IsImmediate(execution_45)) {
|
|
4321
|
+
let execution_44;
|
|
4322
|
+
const key_1 = execution_45.Value;
|
|
4323
|
+
let matchResult_18, index, values_3, values_4;
|
|
4324
|
+
switch (targetValue.tag) {
|
|
4325
|
+
case 5: {
|
|
4326
|
+
if (key_1.tag === 1) {
|
|
4327
|
+
matchResult_18 = 0;
|
|
4328
|
+
index = key_1.fields[0];
|
|
4329
|
+
values_3 = targetValue.fields[0];
|
|
4330
|
+
}
|
|
4331
|
+
else {
|
|
4332
|
+
matchResult_18 = 3;
|
|
4333
|
+
}
|
|
4334
|
+
break;
|
|
4335
|
+
}
|
|
4336
|
+
case 8: {
|
|
4337
|
+
switch (key_1.tag) {
|
|
4338
|
+
case 4: {
|
|
4339
|
+
matchResult_18 = 1;
|
|
4340
|
+
values_4 = targetValue.fields[0];
|
|
4341
|
+
break;
|
|
4342
|
+
}
|
|
4343
|
+
case 1: {
|
|
4344
|
+
matchResult_18 = 1;
|
|
4345
|
+
values_4 = targetValue.fields[0];
|
|
4346
|
+
break;
|
|
4347
|
+
}
|
|
4348
|
+
case 3: {
|
|
4349
|
+
matchResult_18 = 1;
|
|
4350
|
+
values_4 = targetValue.fields[0];
|
|
4351
|
+
break;
|
|
4352
|
+
}
|
|
4353
|
+
case 10: {
|
|
4354
|
+
if (key_1.fields[2] == null) {
|
|
4355
|
+
matchResult_18 = 1;
|
|
4356
|
+
values_4 = targetValue.fields[0];
|
|
4357
|
+
}
|
|
4358
|
+
else {
|
|
4359
|
+
matchResult_18 = 2;
|
|
4360
|
+
}
|
|
4361
|
+
break;
|
|
4362
|
+
}
|
|
4363
|
+
default:
|
|
4364
|
+
matchResult_18 = 2;
|
|
4365
|
+
}
|
|
4366
|
+
break;
|
|
4367
|
+
}
|
|
4368
|
+
default:
|
|
4369
|
+
matchResult_18 = 4;
|
|
4370
|
+
}
|
|
4371
|
+
switch (matchResult_18) {
|
|
4372
|
+
case 0: {
|
|
4373
|
+
const find = (items_5_mut_1, current_1_mut_1) => {
|
|
4374
|
+
find:
|
|
4375
|
+
while (true) {
|
|
4376
|
+
const items_5 = items_5_mut_1, current_1 = current_1_mut_1;
|
|
4377
|
+
if (!isEmpty(items_5)) {
|
|
4378
|
+
if (equals(current_1, index)) {
|
|
4379
|
+
return some(head_1(items_5));
|
|
4380
|
+
}
|
|
4381
|
+
else {
|
|
4382
|
+
items_5_mut_1 = tail_2(items_5);
|
|
4383
|
+
current_1_mut_1 = toInt64_unchecked(op_Addition(current_1, 1n));
|
|
4384
|
+
continue find;
|
|
4385
|
+
}
|
|
4386
|
+
}
|
|
4387
|
+
else {
|
|
4388
|
+
return undefined;
|
|
4389
|
+
}
|
|
4390
|
+
break;
|
|
4391
|
+
}
|
|
4392
|
+
};
|
|
4393
|
+
execution_44 = (new Execution$1(new Value(/* VOption */ 9, [(compare_1(index, 0n) < 0) ? undefined : find(values_3, 0n)]), defaultOf()));
|
|
4394
|
+
break;
|
|
4395
|
+
}
|
|
4396
|
+
case 1: {
|
|
4397
|
+
execution_44 = (new Execution$1(new Value(/* VOption */ 9, [FSharpMap__TryFind(values_4, valueToMapKey(span_12, key_1))]), defaultOf()));
|
|
4398
|
+
break;
|
|
4399
|
+
}
|
|
4400
|
+
case 2: {
|
|
4401
|
+
execution_44 = (new Execution$1((() => {
|
|
4402
|
+
throw new EvalException(new EvalError$("Map index key must be string, int, bool, or a payload-free union case", span_12));
|
|
4403
|
+
})(), defaultOf()));
|
|
4404
|
+
break;
|
|
4405
|
+
}
|
|
4406
|
+
case 3: {
|
|
4407
|
+
execution_44 = (new Execution$1((() => {
|
|
4408
|
+
throw new EvalException(new EvalError$("List index must be int", span_12));
|
|
4409
|
+
})(), defaultOf()));
|
|
4410
|
+
break;
|
|
4411
|
+
}
|
|
4412
|
+
default:
|
|
4413
|
+
execution_44 = (new Execution$1((() => {
|
|
4414
|
+
throw new EvalException(new EvalError$("Index access requires a list or map value", span_12));
|
|
4415
|
+
})(), defaultOf()));
|
|
4416
|
+
}
|
|
4417
|
+
const continuation_67 = continuation_66;
|
|
4418
|
+
if (Execution$1__get_IsImmediate(execution_44)) {
|
|
4419
|
+
return continuation_67(execution_44.Value);
|
|
2108
4420
|
}
|
|
2109
4421
|
else {
|
|
2110
|
-
return
|
|
4422
|
+
return execution_44.Resume(continuation_67);
|
|
2111
4423
|
}
|
|
2112
4424
|
}
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
4425
|
+
else {
|
|
4426
|
+
return execution_45.Resume((value_95) => {
|
|
4427
|
+
let execution_44;
|
|
4428
|
+
const key_1 = value_95;
|
|
4429
|
+
let matchResult_19, index, values_3, values_4;
|
|
4430
|
+
switch (targetValue.tag) {
|
|
4431
|
+
case 5: {
|
|
4432
|
+
if (key_1.tag === 1) {
|
|
4433
|
+
matchResult_19 = 0;
|
|
4434
|
+
index = key_1.fields[0];
|
|
4435
|
+
values_3 = targetValue.fields[0];
|
|
4436
|
+
}
|
|
4437
|
+
else {
|
|
4438
|
+
matchResult_19 = 3;
|
|
4439
|
+
}
|
|
4440
|
+
break;
|
|
4441
|
+
}
|
|
4442
|
+
case 8: {
|
|
4443
|
+
switch (key_1.tag) {
|
|
4444
|
+
case 4: {
|
|
4445
|
+
matchResult_19 = 1;
|
|
4446
|
+
values_4 = targetValue.fields[0];
|
|
4447
|
+
break;
|
|
4448
|
+
}
|
|
4449
|
+
case 1: {
|
|
4450
|
+
matchResult_19 = 1;
|
|
4451
|
+
values_4 = targetValue.fields[0];
|
|
4452
|
+
break;
|
|
4453
|
+
}
|
|
4454
|
+
case 3: {
|
|
4455
|
+
matchResult_19 = 1;
|
|
4456
|
+
values_4 = targetValue.fields[0];
|
|
4457
|
+
break;
|
|
4458
|
+
}
|
|
4459
|
+
case 10: {
|
|
4460
|
+
if (key_1.fields[2] == null) {
|
|
4461
|
+
matchResult_19 = 1;
|
|
4462
|
+
values_4 = targetValue.fields[0];
|
|
4463
|
+
}
|
|
4464
|
+
else {
|
|
4465
|
+
matchResult_19 = 2;
|
|
4466
|
+
}
|
|
4467
|
+
break;
|
|
4468
|
+
}
|
|
4469
|
+
default:
|
|
4470
|
+
matchResult_19 = 2;
|
|
4471
|
+
}
|
|
4472
|
+
break;
|
|
4473
|
+
}
|
|
4474
|
+
default:
|
|
4475
|
+
matchResult_19 = 4;
|
|
4476
|
+
}
|
|
4477
|
+
switch (matchResult_19) {
|
|
4478
|
+
case 0: {
|
|
4479
|
+
const find = (items_5_mut_2, current_1_mut_2) => {
|
|
4480
|
+
find:
|
|
4481
|
+
while (true) {
|
|
4482
|
+
const items_5 = items_5_mut_2, current_1 = current_1_mut_2;
|
|
4483
|
+
if (!isEmpty(items_5)) {
|
|
4484
|
+
if (equals(current_1, index)) {
|
|
4485
|
+
return some(head_1(items_5));
|
|
4486
|
+
}
|
|
4487
|
+
else {
|
|
4488
|
+
items_5_mut_2 = tail_2(items_5);
|
|
4489
|
+
current_1_mut_2 = toInt64_unchecked(op_Addition(current_1, 1n));
|
|
4490
|
+
continue find;
|
|
4491
|
+
}
|
|
4492
|
+
}
|
|
4493
|
+
else {
|
|
4494
|
+
return undefined;
|
|
4495
|
+
}
|
|
4496
|
+
break;
|
|
4497
|
+
}
|
|
4498
|
+
};
|
|
4499
|
+
execution_44 = (new Execution$1(new Value(/* VOption */ 9, [(compare_1(index, 0n) < 0) ? undefined : find(values_3, 0n)]), defaultOf()));
|
|
4500
|
+
break;
|
|
4501
|
+
}
|
|
4502
|
+
case 1: {
|
|
4503
|
+
execution_44 = (new Execution$1(new Value(/* VOption */ 9, [FSharpMap__TryFind(values_4, valueToMapKey(span_12, key_1))]), defaultOf()));
|
|
4504
|
+
break;
|
|
4505
|
+
}
|
|
4506
|
+
case 2: {
|
|
4507
|
+
execution_44 = (new Execution$1((() => {
|
|
4508
|
+
throw new EvalException(new EvalError$("Map index key must be string, int, bool, or a payload-free union case", span_12));
|
|
4509
|
+
})(), defaultOf()));
|
|
4510
|
+
break;
|
|
4511
|
+
}
|
|
4512
|
+
case 3: {
|
|
4513
|
+
execution_44 = (new Execution$1((() => {
|
|
4514
|
+
throw new EvalException(new EvalError$("List index must be int", span_12));
|
|
4515
|
+
})(), defaultOf()));
|
|
4516
|
+
break;
|
|
4517
|
+
}
|
|
4518
|
+
default:
|
|
4519
|
+
execution_44 = (new Execution$1((() => {
|
|
4520
|
+
throw new EvalException(new EvalError$("Index access requires a list or map value", span_12));
|
|
4521
|
+
})(), defaultOf()));
|
|
4522
|
+
}
|
|
4523
|
+
const continuation_67 = continuation_66;
|
|
4524
|
+
return Execution$1__get_IsImmediate(execution_44) ? continuation_67(execution_44.Value) : execution_44.Resume(continuation_67);
|
|
4525
|
+
});
|
|
4526
|
+
}
|
|
4527
|
+
});
|
|
2116
4528
|
}
|
|
2117
4529
|
}
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
if (
|
|
2126
|
-
|
|
2127
|
-
index
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
4530
|
+
else {
|
|
4531
|
+
return new Execution$1(defaultOf(), (continuation_69) => {
|
|
4532
|
+
const execution_47 = body_65;
|
|
4533
|
+
if (Execution$1__get_IsImmediate(execution_47)) {
|
|
4534
|
+
let execution_46;
|
|
4535
|
+
const targetValue = execution_47.Value;
|
|
4536
|
+
const body_63 = evalExpr(runtime, typeDefs, env, keyExpr_1);
|
|
4537
|
+
if (Execution$1__get_IsImmediate(body_63)) {
|
|
4538
|
+
const key_1 = body_63.Value;
|
|
4539
|
+
let matchResult_20, index, values_3, values_4;
|
|
4540
|
+
switch (targetValue.tag) {
|
|
4541
|
+
case 5: {
|
|
4542
|
+
if (key_1.tag === 1) {
|
|
4543
|
+
matchResult_20 = 0;
|
|
4544
|
+
index = key_1.fields[0];
|
|
4545
|
+
values_3 = targetValue.fields[0];
|
|
4546
|
+
}
|
|
4547
|
+
else {
|
|
4548
|
+
matchResult_20 = 3;
|
|
4549
|
+
}
|
|
4550
|
+
break;
|
|
4551
|
+
}
|
|
4552
|
+
case 8: {
|
|
4553
|
+
switch (key_1.tag) {
|
|
4554
|
+
case 4: {
|
|
4555
|
+
matchResult_20 = 1;
|
|
4556
|
+
values_4 = targetValue.fields[0];
|
|
4557
|
+
break;
|
|
4558
|
+
}
|
|
4559
|
+
case 1: {
|
|
4560
|
+
matchResult_20 = 1;
|
|
4561
|
+
values_4 = targetValue.fields[0];
|
|
4562
|
+
break;
|
|
4563
|
+
}
|
|
4564
|
+
case 3: {
|
|
4565
|
+
matchResult_20 = 1;
|
|
4566
|
+
values_4 = targetValue.fields[0];
|
|
4567
|
+
break;
|
|
4568
|
+
}
|
|
4569
|
+
case 10: {
|
|
4570
|
+
if (key_1.fields[2] == null) {
|
|
4571
|
+
matchResult_20 = 1;
|
|
4572
|
+
values_4 = targetValue.fields[0];
|
|
4573
|
+
}
|
|
4574
|
+
else {
|
|
4575
|
+
matchResult_20 = 2;
|
|
4576
|
+
}
|
|
4577
|
+
break;
|
|
4578
|
+
}
|
|
4579
|
+
default:
|
|
4580
|
+
matchResult_20 = 2;
|
|
4581
|
+
}
|
|
4582
|
+
break;
|
|
4583
|
+
}
|
|
4584
|
+
default:
|
|
4585
|
+
matchResult_20 = 4;
|
|
2151
4586
|
}
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
4587
|
+
switch (matchResult_20) {
|
|
4588
|
+
case 0: {
|
|
4589
|
+
const find = (items_5_mut_3, current_1_mut_3) => {
|
|
4590
|
+
find:
|
|
4591
|
+
while (true) {
|
|
4592
|
+
const items_5 = items_5_mut_3, current_1 = current_1_mut_3;
|
|
4593
|
+
if (!isEmpty(items_5)) {
|
|
4594
|
+
if (equals(current_1, index)) {
|
|
4595
|
+
return some(head_1(items_5));
|
|
4596
|
+
}
|
|
4597
|
+
else {
|
|
4598
|
+
items_5_mut_3 = tail_2(items_5);
|
|
4599
|
+
current_1_mut_3 = toInt64_unchecked(op_Addition(current_1, 1n));
|
|
4600
|
+
continue find;
|
|
4601
|
+
}
|
|
4602
|
+
}
|
|
4603
|
+
else {
|
|
4604
|
+
return undefined;
|
|
4605
|
+
}
|
|
4606
|
+
break;
|
|
4607
|
+
}
|
|
4608
|
+
};
|
|
4609
|
+
execution_46 = (new Execution$1(new Value(/* VOption */ 9, [(compare_1(index, 0n) < 0) ? undefined : find(values_3, 0n)]), defaultOf()));
|
|
4610
|
+
break;
|
|
2156
4611
|
}
|
|
2157
|
-
|
|
2158
|
-
|
|
4612
|
+
case 1: {
|
|
4613
|
+
execution_46 = (new Execution$1(new Value(/* VOption */ 9, [FSharpMap__TryFind(values_4, valueToMapKey(span_12, key_1))]), defaultOf()));
|
|
4614
|
+
break;
|
|
2159
4615
|
}
|
|
2160
|
-
|
|
4616
|
+
case 2: {
|
|
4617
|
+
execution_46 = (new Execution$1((() => {
|
|
4618
|
+
throw new EvalException(new EvalError$("Map index key must be string, int, bool, or a payload-free union case", span_12));
|
|
4619
|
+
})(), defaultOf()));
|
|
4620
|
+
break;
|
|
4621
|
+
}
|
|
4622
|
+
case 3: {
|
|
4623
|
+
execution_46 = (new Execution$1((() => {
|
|
4624
|
+
throw new EvalException(new EvalError$("List index must be int", span_12));
|
|
4625
|
+
})(), defaultOf()));
|
|
4626
|
+
break;
|
|
4627
|
+
}
|
|
4628
|
+
default:
|
|
4629
|
+
execution_46 = (new Execution$1((() => {
|
|
4630
|
+
throw new EvalException(new EvalError$("Index access requires a list or map value", span_12));
|
|
4631
|
+
})(), defaultOf()));
|
|
2161
4632
|
}
|
|
2162
|
-
default:
|
|
2163
|
-
matchResult_5 = 2;
|
|
2164
4633
|
}
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
4634
|
+
else {
|
|
4635
|
+
execution_46 = (new Execution$1(defaultOf(), (continuation_66) => {
|
|
4636
|
+
const execution_45 = body_63;
|
|
4637
|
+
if (Execution$1__get_IsImmediate(execution_45)) {
|
|
4638
|
+
let execution_44;
|
|
4639
|
+
const key_1 = execution_45.Value;
|
|
4640
|
+
let matchResult_21, index, values_3, values_4;
|
|
4641
|
+
switch (targetValue.tag) {
|
|
4642
|
+
case 5: {
|
|
4643
|
+
if (key_1.tag === 1) {
|
|
4644
|
+
matchResult_21 = 0;
|
|
4645
|
+
index = key_1.fields[0];
|
|
4646
|
+
values_3 = targetValue.fields[0];
|
|
4647
|
+
}
|
|
4648
|
+
else {
|
|
4649
|
+
matchResult_21 = 3;
|
|
4650
|
+
}
|
|
4651
|
+
break;
|
|
4652
|
+
}
|
|
4653
|
+
case 8: {
|
|
4654
|
+
switch (key_1.tag) {
|
|
4655
|
+
case 4: {
|
|
4656
|
+
matchResult_21 = 1;
|
|
4657
|
+
values_4 = targetValue.fields[0];
|
|
4658
|
+
break;
|
|
4659
|
+
}
|
|
4660
|
+
case 1: {
|
|
4661
|
+
matchResult_21 = 1;
|
|
4662
|
+
values_4 = targetValue.fields[0];
|
|
4663
|
+
break;
|
|
4664
|
+
}
|
|
4665
|
+
case 3: {
|
|
4666
|
+
matchResult_21 = 1;
|
|
4667
|
+
values_4 = targetValue.fields[0];
|
|
4668
|
+
break;
|
|
4669
|
+
}
|
|
4670
|
+
case 10: {
|
|
4671
|
+
if (key_1.fields[2] == null) {
|
|
4672
|
+
matchResult_21 = 1;
|
|
4673
|
+
values_4 = targetValue.fields[0];
|
|
4674
|
+
}
|
|
4675
|
+
else {
|
|
4676
|
+
matchResult_21 = 2;
|
|
4677
|
+
}
|
|
4678
|
+
break;
|
|
4679
|
+
}
|
|
4680
|
+
default:
|
|
4681
|
+
matchResult_21 = 2;
|
|
4682
|
+
}
|
|
4683
|
+
break;
|
|
4684
|
+
}
|
|
4685
|
+
default:
|
|
4686
|
+
matchResult_21 = 4;
|
|
4687
|
+
}
|
|
4688
|
+
switch (matchResult_21) {
|
|
4689
|
+
case 0: {
|
|
4690
|
+
const find = (items_5_mut_4, current_1_mut_4) => {
|
|
4691
|
+
find:
|
|
4692
|
+
while (true) {
|
|
4693
|
+
const items_5 = items_5_mut_4, current_1 = current_1_mut_4;
|
|
4694
|
+
if (!isEmpty(items_5)) {
|
|
4695
|
+
if (equals(current_1, index)) {
|
|
4696
|
+
return some(head_1(items_5));
|
|
4697
|
+
}
|
|
4698
|
+
else {
|
|
4699
|
+
items_5_mut_4 = tail_2(items_5);
|
|
4700
|
+
current_1_mut_4 = toInt64_unchecked(op_Addition(current_1, 1n));
|
|
4701
|
+
continue find;
|
|
4702
|
+
}
|
|
4703
|
+
}
|
|
4704
|
+
else {
|
|
4705
|
+
return undefined;
|
|
4706
|
+
}
|
|
4707
|
+
break;
|
|
4708
|
+
}
|
|
4709
|
+
};
|
|
4710
|
+
execution_44 = (new Execution$1(new Value(/* VOption */ 9, [(compare_1(index, 0n) < 0) ? undefined : find(values_3, 0n)]), defaultOf()));
|
|
4711
|
+
break;
|
|
4712
|
+
}
|
|
4713
|
+
case 1: {
|
|
4714
|
+
execution_44 = (new Execution$1(new Value(/* VOption */ 9, [FSharpMap__TryFind(values_4, valueToMapKey(span_12, key_1))]), defaultOf()));
|
|
4715
|
+
break;
|
|
4716
|
+
}
|
|
4717
|
+
case 2: {
|
|
4718
|
+
execution_44 = (new Execution$1((() => {
|
|
4719
|
+
throw new EvalException(new EvalError$("Map index key must be string, int, bool, or a payload-free union case", span_12));
|
|
4720
|
+
})(), defaultOf()));
|
|
4721
|
+
break;
|
|
4722
|
+
}
|
|
4723
|
+
case 3: {
|
|
4724
|
+
execution_44 = (new Execution$1((() => {
|
|
4725
|
+
throw new EvalException(new EvalError$("List index must be int", span_12));
|
|
4726
|
+
})(), defaultOf()));
|
|
4727
|
+
break;
|
|
4728
|
+
}
|
|
4729
|
+
default:
|
|
4730
|
+
execution_44 = (new Execution$1((() => {
|
|
4731
|
+
throw new EvalException(new EvalError$("Index access requires a list or map value", span_12));
|
|
4732
|
+
})(), defaultOf()));
|
|
4733
|
+
}
|
|
4734
|
+
const continuation_67 = continuation_66;
|
|
4735
|
+
if (Execution$1__get_IsImmediate(execution_44)) {
|
|
4736
|
+
return continuation_67(execution_44.Value);
|
|
2179
4737
|
}
|
|
2180
4738
|
else {
|
|
2181
|
-
|
|
2182
|
-
current_1_mut = toInt64_unchecked(op_Addition(current_1, 1n));
|
|
2183
|
-
continue loop;
|
|
4739
|
+
return execution_44.Resume(continuation_67);
|
|
2184
4740
|
}
|
|
2185
4741
|
}
|
|
2186
4742
|
else {
|
|
2187
|
-
return
|
|
4743
|
+
return execution_45.Resume((value_95) => {
|
|
4744
|
+
let execution_44;
|
|
4745
|
+
const key_1 = value_95;
|
|
4746
|
+
let matchResult_22, index, values_3, values_4;
|
|
4747
|
+
switch (targetValue.tag) {
|
|
4748
|
+
case 5: {
|
|
4749
|
+
if (key_1.tag === 1) {
|
|
4750
|
+
matchResult_22 = 0;
|
|
4751
|
+
index = key_1.fields[0];
|
|
4752
|
+
values_3 = targetValue.fields[0];
|
|
4753
|
+
}
|
|
4754
|
+
else {
|
|
4755
|
+
matchResult_22 = 3;
|
|
4756
|
+
}
|
|
4757
|
+
break;
|
|
4758
|
+
}
|
|
4759
|
+
case 8: {
|
|
4760
|
+
switch (key_1.tag) {
|
|
4761
|
+
case 4: {
|
|
4762
|
+
matchResult_22 = 1;
|
|
4763
|
+
values_4 = targetValue.fields[0];
|
|
4764
|
+
break;
|
|
4765
|
+
}
|
|
4766
|
+
case 1: {
|
|
4767
|
+
matchResult_22 = 1;
|
|
4768
|
+
values_4 = targetValue.fields[0];
|
|
4769
|
+
break;
|
|
4770
|
+
}
|
|
4771
|
+
case 3: {
|
|
4772
|
+
matchResult_22 = 1;
|
|
4773
|
+
values_4 = targetValue.fields[0];
|
|
4774
|
+
break;
|
|
4775
|
+
}
|
|
4776
|
+
case 10: {
|
|
4777
|
+
if (key_1.fields[2] == null) {
|
|
4778
|
+
matchResult_22 = 1;
|
|
4779
|
+
values_4 = targetValue.fields[0];
|
|
4780
|
+
}
|
|
4781
|
+
else {
|
|
4782
|
+
matchResult_22 = 2;
|
|
4783
|
+
}
|
|
4784
|
+
break;
|
|
4785
|
+
}
|
|
4786
|
+
default:
|
|
4787
|
+
matchResult_22 = 2;
|
|
4788
|
+
}
|
|
4789
|
+
break;
|
|
4790
|
+
}
|
|
4791
|
+
default:
|
|
4792
|
+
matchResult_22 = 4;
|
|
4793
|
+
}
|
|
4794
|
+
switch (matchResult_22) {
|
|
4795
|
+
case 0: {
|
|
4796
|
+
const find = (items_5_mut_5, current_1_mut_5) => {
|
|
4797
|
+
find:
|
|
4798
|
+
while (true) {
|
|
4799
|
+
const items_5 = items_5_mut_5, current_1 = current_1_mut_5;
|
|
4800
|
+
if (!isEmpty(items_5)) {
|
|
4801
|
+
if (equals(current_1, index)) {
|
|
4802
|
+
return some(head_1(items_5));
|
|
4803
|
+
}
|
|
4804
|
+
else {
|
|
4805
|
+
items_5_mut_5 = tail_2(items_5);
|
|
4806
|
+
current_1_mut_5 = toInt64_unchecked(op_Addition(current_1, 1n));
|
|
4807
|
+
continue find;
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
else {
|
|
4811
|
+
return undefined;
|
|
4812
|
+
}
|
|
4813
|
+
break;
|
|
4814
|
+
}
|
|
4815
|
+
};
|
|
4816
|
+
execution_44 = (new Execution$1(new Value(/* VOption */ 9, [(compare_1(index, 0n) < 0) ? undefined : find(values_3, 0n)]), defaultOf()));
|
|
4817
|
+
break;
|
|
4818
|
+
}
|
|
4819
|
+
case 1: {
|
|
4820
|
+
execution_44 = (new Execution$1(new Value(/* VOption */ 9, [FSharpMap__TryFind(values_4, valueToMapKey(span_12, key_1))]), defaultOf()));
|
|
4821
|
+
break;
|
|
4822
|
+
}
|
|
4823
|
+
case 2: {
|
|
4824
|
+
execution_44 = (new Execution$1((() => {
|
|
4825
|
+
throw new EvalException(new EvalError$("Map index key must be string, int, bool, or a payload-free union case", span_12));
|
|
4826
|
+
})(), defaultOf()));
|
|
4827
|
+
break;
|
|
4828
|
+
}
|
|
4829
|
+
case 3: {
|
|
4830
|
+
execution_44 = (new Execution$1((() => {
|
|
4831
|
+
throw new EvalException(new EvalError$("List index must be int", span_12));
|
|
4832
|
+
})(), defaultOf()));
|
|
4833
|
+
break;
|
|
4834
|
+
}
|
|
4835
|
+
default:
|
|
4836
|
+
execution_44 = (new Execution$1((() => {
|
|
4837
|
+
throw new EvalException(new EvalError$("Index access requires a list or map value", span_12));
|
|
4838
|
+
})(), defaultOf()));
|
|
4839
|
+
}
|
|
4840
|
+
const continuation_67 = continuation_66;
|
|
4841
|
+
return Execution$1__get_IsImmediate(execution_44) ? continuation_67(execution_44.Value) : execution_44.Resume(continuation_67);
|
|
4842
|
+
});
|
|
2188
4843
|
}
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
if (
|
|
2193
|
-
return
|
|
4844
|
+
}));
|
|
4845
|
+
}
|
|
4846
|
+
const continuation_70 = continuation_69;
|
|
4847
|
+
if (Execution$1__get_IsImmediate(execution_46)) {
|
|
4848
|
+
return continuation_70(execution_46.Value);
|
|
2194
4849
|
}
|
|
2195
4850
|
else {
|
|
2196
|
-
return
|
|
4851
|
+
return execution_46.Resume(continuation_70);
|
|
2197
4852
|
}
|
|
2198
4853
|
}
|
|
2199
|
-
case 1:
|
|
2200
|
-
return new Value(/* VOption */ 9, [FSharpMap__TryFind(mapValue, valueToMapKey(span_13, keyValue_1))]);
|
|
2201
|
-
case 2:
|
|
2202
|
-
throw new EvalException(new EvalError$("Map index key must be string, int, bool, or a payload-free union case", span_13));
|
|
2203
|
-
case 3:
|
|
2204
|
-
throw new EvalException(new EvalError$("List index must be int", span_13));
|
|
2205
|
-
default:
|
|
2206
|
-
throw new EvalException(new EvalError$("Index access requires a list or map value", span_13));
|
|
2207
|
-
}
|
|
2208
|
-
}
|
|
2209
|
-
case 23: {
|
|
2210
|
-
const h = evalExpr(runtime, typeDefs, env, expr.fields[0]);
|
|
2211
|
-
const t = evalExpr(runtime, typeDefs, env, expr.fields[1]);
|
|
2212
|
-
if (t.tag === 5) {
|
|
2213
|
-
return new Value(/* VList */ 5, [cons(h, t.fields[0])]);
|
|
2214
|
-
}
|
|
2215
|
-
else {
|
|
2216
|
-
throw new EvalException(new EvalError$("Right side of \'::\' must be list", expr.fields[2]));
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
case 24: {
|
|
2220
|
-
const av = evalExpr(runtime, typeDefs, env, expr.fields[0]);
|
|
2221
|
-
const bv = evalExpr(runtime, typeDefs, env, expr.fields[1]);
|
|
2222
|
-
let matchResult_6, xs_1, ys;
|
|
2223
|
-
if (av.tag === 5) {
|
|
2224
|
-
if (bv.tag === 5) {
|
|
2225
|
-
matchResult_6 = 0;
|
|
2226
|
-
xs_1 = av.fields[0];
|
|
2227
|
-
ys = bv.fields[0];
|
|
2228
|
-
}
|
|
2229
4854
|
else {
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
4855
|
+
return execution_47.Resume((value_96) => {
|
|
4856
|
+
let execution_46;
|
|
4857
|
+
const targetValue = value_96;
|
|
4858
|
+
const body_63 = evalExpr(runtime, typeDefs, env, keyExpr_1);
|
|
4859
|
+
if (Execution$1__get_IsImmediate(body_63)) {
|
|
4860
|
+
const key_1 = body_63.Value;
|
|
4861
|
+
let matchResult_23, index, values_3, values_4;
|
|
4862
|
+
switch (targetValue.tag) {
|
|
4863
|
+
case 5: {
|
|
4864
|
+
if (key_1.tag === 1) {
|
|
4865
|
+
matchResult_23 = 0;
|
|
4866
|
+
index = key_1.fields[0];
|
|
4867
|
+
values_3 = targetValue.fields[0];
|
|
4868
|
+
}
|
|
4869
|
+
else {
|
|
4870
|
+
matchResult_23 = 3;
|
|
4871
|
+
}
|
|
4872
|
+
break;
|
|
4873
|
+
}
|
|
4874
|
+
case 8: {
|
|
4875
|
+
switch (key_1.tag) {
|
|
4876
|
+
case 4: {
|
|
4877
|
+
matchResult_23 = 1;
|
|
4878
|
+
values_4 = targetValue.fields[0];
|
|
4879
|
+
break;
|
|
4880
|
+
}
|
|
4881
|
+
case 1: {
|
|
4882
|
+
matchResult_23 = 1;
|
|
4883
|
+
values_4 = targetValue.fields[0];
|
|
4884
|
+
break;
|
|
4885
|
+
}
|
|
4886
|
+
case 3: {
|
|
4887
|
+
matchResult_23 = 1;
|
|
4888
|
+
values_4 = targetValue.fields[0];
|
|
4889
|
+
break;
|
|
4890
|
+
}
|
|
4891
|
+
case 10: {
|
|
4892
|
+
if (key_1.fields[2] == null) {
|
|
4893
|
+
matchResult_23 = 1;
|
|
4894
|
+
values_4 = targetValue.fields[0];
|
|
4895
|
+
}
|
|
4896
|
+
else {
|
|
4897
|
+
matchResult_23 = 2;
|
|
4898
|
+
}
|
|
4899
|
+
break;
|
|
4900
|
+
}
|
|
4901
|
+
default:
|
|
4902
|
+
matchResult_23 = 2;
|
|
4903
|
+
}
|
|
4904
|
+
break;
|
|
4905
|
+
}
|
|
4906
|
+
default:
|
|
4907
|
+
matchResult_23 = 4;
|
|
4908
|
+
}
|
|
4909
|
+
switch (matchResult_23) {
|
|
4910
|
+
case 0: {
|
|
4911
|
+
const find = (items_5_mut_6, current_1_mut_6) => {
|
|
4912
|
+
find:
|
|
4913
|
+
while (true) {
|
|
4914
|
+
const items_5 = items_5_mut_6, current_1 = current_1_mut_6;
|
|
4915
|
+
if (!isEmpty(items_5)) {
|
|
4916
|
+
if (equals(current_1, index)) {
|
|
4917
|
+
return some(head_1(items_5));
|
|
4918
|
+
}
|
|
4919
|
+
else {
|
|
4920
|
+
items_5_mut_6 = tail_2(items_5);
|
|
4921
|
+
current_1_mut_6 = toInt64_unchecked(op_Addition(current_1, 1n));
|
|
4922
|
+
continue find;
|
|
4923
|
+
}
|
|
4924
|
+
}
|
|
4925
|
+
else {
|
|
4926
|
+
return undefined;
|
|
4927
|
+
}
|
|
4928
|
+
break;
|
|
4929
|
+
}
|
|
4930
|
+
};
|
|
4931
|
+
execution_46 = (new Execution$1(new Value(/* VOption */ 9, [(compare_1(index, 0n) < 0) ? undefined : find(values_3, 0n)]), defaultOf()));
|
|
4932
|
+
break;
|
|
4933
|
+
}
|
|
4934
|
+
case 1: {
|
|
4935
|
+
execution_46 = (new Execution$1(new Value(/* VOption */ 9, [FSharpMap__TryFind(values_4, valueToMapKey(span_12, key_1))]), defaultOf()));
|
|
4936
|
+
break;
|
|
4937
|
+
}
|
|
4938
|
+
case 2: {
|
|
4939
|
+
execution_46 = (new Execution$1((() => {
|
|
4940
|
+
throw new EvalException(new EvalError$("Map index key must be string, int, bool, or a payload-free union case", span_12));
|
|
4941
|
+
})(), defaultOf()));
|
|
4942
|
+
break;
|
|
4943
|
+
}
|
|
4944
|
+
case 3: {
|
|
4945
|
+
execution_46 = (new Execution$1((() => {
|
|
4946
|
+
throw new EvalException(new EvalError$("List index must be int", span_12));
|
|
4947
|
+
})(), defaultOf()));
|
|
4948
|
+
break;
|
|
4949
|
+
}
|
|
4950
|
+
default:
|
|
4951
|
+
execution_46 = (new Execution$1((() => {
|
|
4952
|
+
throw new EvalException(new EvalError$("Index access requires a list or map value", span_12));
|
|
4953
|
+
})(), defaultOf()));
|
|
4954
|
+
}
|
|
2267
4955
|
}
|
|
2268
4956
|
else {
|
|
2269
|
-
|
|
4957
|
+
execution_46 = (new Execution$1(defaultOf(), (continuation_66) => {
|
|
4958
|
+
const execution_45 = body_63;
|
|
4959
|
+
if (Execution$1__get_IsImmediate(execution_45)) {
|
|
4960
|
+
let execution_44;
|
|
4961
|
+
const key_1 = execution_45.Value;
|
|
4962
|
+
let matchResult_24, index, values_3, values_4;
|
|
4963
|
+
switch (targetValue.tag) {
|
|
4964
|
+
case 5: {
|
|
4965
|
+
if (key_1.tag === 1) {
|
|
4966
|
+
matchResult_24 = 0;
|
|
4967
|
+
index = key_1.fields[0];
|
|
4968
|
+
values_3 = targetValue.fields[0];
|
|
4969
|
+
}
|
|
4970
|
+
else {
|
|
4971
|
+
matchResult_24 = 3;
|
|
4972
|
+
}
|
|
4973
|
+
break;
|
|
4974
|
+
}
|
|
4975
|
+
case 8: {
|
|
4976
|
+
switch (key_1.tag) {
|
|
4977
|
+
case 4: {
|
|
4978
|
+
matchResult_24 = 1;
|
|
4979
|
+
values_4 = targetValue.fields[0];
|
|
4980
|
+
break;
|
|
4981
|
+
}
|
|
4982
|
+
case 1: {
|
|
4983
|
+
matchResult_24 = 1;
|
|
4984
|
+
values_4 = targetValue.fields[0];
|
|
4985
|
+
break;
|
|
4986
|
+
}
|
|
4987
|
+
case 3: {
|
|
4988
|
+
matchResult_24 = 1;
|
|
4989
|
+
values_4 = targetValue.fields[0];
|
|
4990
|
+
break;
|
|
4991
|
+
}
|
|
4992
|
+
case 10: {
|
|
4993
|
+
if (key_1.fields[2] == null) {
|
|
4994
|
+
matchResult_24 = 1;
|
|
4995
|
+
values_4 = targetValue.fields[0];
|
|
4996
|
+
}
|
|
4997
|
+
else {
|
|
4998
|
+
matchResult_24 = 2;
|
|
4999
|
+
}
|
|
5000
|
+
break;
|
|
5001
|
+
}
|
|
5002
|
+
default:
|
|
5003
|
+
matchResult_24 = 2;
|
|
5004
|
+
}
|
|
5005
|
+
break;
|
|
5006
|
+
}
|
|
5007
|
+
default:
|
|
5008
|
+
matchResult_24 = 4;
|
|
5009
|
+
}
|
|
5010
|
+
switch (matchResult_24) {
|
|
5011
|
+
case 0: {
|
|
5012
|
+
const find = (items_5_mut_7, current_1_mut_7) => {
|
|
5013
|
+
find:
|
|
5014
|
+
while (true) {
|
|
5015
|
+
const items_5 = items_5_mut_7, current_1 = current_1_mut_7;
|
|
5016
|
+
if (!isEmpty(items_5)) {
|
|
5017
|
+
if (equals(current_1, index)) {
|
|
5018
|
+
return some(head_1(items_5));
|
|
5019
|
+
}
|
|
5020
|
+
else {
|
|
5021
|
+
items_5_mut_7 = tail_2(items_5);
|
|
5022
|
+
current_1_mut_7 = toInt64_unchecked(op_Addition(current_1, 1n));
|
|
5023
|
+
continue find;
|
|
5024
|
+
}
|
|
5025
|
+
}
|
|
5026
|
+
else {
|
|
5027
|
+
return undefined;
|
|
5028
|
+
}
|
|
5029
|
+
break;
|
|
5030
|
+
}
|
|
5031
|
+
};
|
|
5032
|
+
execution_44 = (new Execution$1(new Value(/* VOption */ 9, [(compare_1(index, 0n) < 0) ? undefined : find(values_3, 0n)]), defaultOf()));
|
|
5033
|
+
break;
|
|
5034
|
+
}
|
|
5035
|
+
case 1: {
|
|
5036
|
+
execution_44 = (new Execution$1(new Value(/* VOption */ 9, [FSharpMap__TryFind(values_4, valueToMapKey(span_12, key_1))]), defaultOf()));
|
|
5037
|
+
break;
|
|
5038
|
+
}
|
|
5039
|
+
case 2: {
|
|
5040
|
+
execution_44 = (new Execution$1((() => {
|
|
5041
|
+
throw new EvalException(new EvalError$("Map index key must be string, int, bool, or a payload-free union case", span_12));
|
|
5042
|
+
})(), defaultOf()));
|
|
5043
|
+
break;
|
|
5044
|
+
}
|
|
5045
|
+
case 3: {
|
|
5046
|
+
execution_44 = (new Execution$1((() => {
|
|
5047
|
+
throw new EvalException(new EvalError$("List index must be int", span_12));
|
|
5048
|
+
})(), defaultOf()));
|
|
5049
|
+
break;
|
|
5050
|
+
}
|
|
5051
|
+
default:
|
|
5052
|
+
execution_44 = (new Execution$1((() => {
|
|
5053
|
+
throw new EvalException(new EvalError$("Index access requires a list or map value", span_12));
|
|
5054
|
+
})(), defaultOf()));
|
|
5055
|
+
}
|
|
5056
|
+
const continuation_67 = continuation_66;
|
|
5057
|
+
if (Execution$1__get_IsImmediate(execution_44)) {
|
|
5058
|
+
return continuation_67(execution_44.Value);
|
|
5059
|
+
}
|
|
5060
|
+
else {
|
|
5061
|
+
return execution_44.Resume(continuation_67);
|
|
5062
|
+
}
|
|
5063
|
+
}
|
|
5064
|
+
else {
|
|
5065
|
+
return execution_45.Resume((value_95) => {
|
|
5066
|
+
let execution_44;
|
|
5067
|
+
const key_1 = value_95;
|
|
5068
|
+
let matchResult_25, index, values_3, values_4;
|
|
5069
|
+
switch (targetValue.tag) {
|
|
5070
|
+
case 5: {
|
|
5071
|
+
if (key_1.tag === 1) {
|
|
5072
|
+
matchResult_25 = 0;
|
|
5073
|
+
index = key_1.fields[0];
|
|
5074
|
+
values_3 = targetValue.fields[0];
|
|
5075
|
+
}
|
|
5076
|
+
else {
|
|
5077
|
+
matchResult_25 = 3;
|
|
5078
|
+
}
|
|
5079
|
+
break;
|
|
5080
|
+
}
|
|
5081
|
+
case 8: {
|
|
5082
|
+
switch (key_1.tag) {
|
|
5083
|
+
case 4: {
|
|
5084
|
+
matchResult_25 = 1;
|
|
5085
|
+
values_4 = targetValue.fields[0];
|
|
5086
|
+
break;
|
|
5087
|
+
}
|
|
5088
|
+
case 1: {
|
|
5089
|
+
matchResult_25 = 1;
|
|
5090
|
+
values_4 = targetValue.fields[0];
|
|
5091
|
+
break;
|
|
5092
|
+
}
|
|
5093
|
+
case 3: {
|
|
5094
|
+
matchResult_25 = 1;
|
|
5095
|
+
values_4 = targetValue.fields[0];
|
|
5096
|
+
break;
|
|
5097
|
+
}
|
|
5098
|
+
case 10: {
|
|
5099
|
+
if (key_1.fields[2] == null) {
|
|
5100
|
+
matchResult_25 = 1;
|
|
5101
|
+
values_4 = targetValue.fields[0];
|
|
5102
|
+
}
|
|
5103
|
+
else {
|
|
5104
|
+
matchResult_25 = 2;
|
|
5105
|
+
}
|
|
5106
|
+
break;
|
|
5107
|
+
}
|
|
5108
|
+
default:
|
|
5109
|
+
matchResult_25 = 2;
|
|
5110
|
+
}
|
|
5111
|
+
break;
|
|
5112
|
+
}
|
|
5113
|
+
default:
|
|
5114
|
+
matchResult_25 = 4;
|
|
5115
|
+
}
|
|
5116
|
+
switch (matchResult_25) {
|
|
5117
|
+
case 0: {
|
|
5118
|
+
const find = (items_5_mut_8, current_1_mut_8) => {
|
|
5119
|
+
find:
|
|
5120
|
+
while (true) {
|
|
5121
|
+
const items_5 = items_5_mut_8, current_1 = current_1_mut_8;
|
|
5122
|
+
if (!isEmpty(items_5)) {
|
|
5123
|
+
if (equals(current_1, index)) {
|
|
5124
|
+
return some(head_1(items_5));
|
|
5125
|
+
}
|
|
5126
|
+
else {
|
|
5127
|
+
items_5_mut_8 = tail_2(items_5);
|
|
5128
|
+
current_1_mut_8 = toInt64_unchecked(op_Addition(current_1, 1n));
|
|
5129
|
+
continue find;
|
|
5130
|
+
}
|
|
5131
|
+
}
|
|
5132
|
+
else {
|
|
5133
|
+
return undefined;
|
|
5134
|
+
}
|
|
5135
|
+
break;
|
|
5136
|
+
}
|
|
5137
|
+
};
|
|
5138
|
+
execution_44 = (new Execution$1(new Value(/* VOption */ 9, [(compare_1(index, 0n) < 0) ? undefined : find(values_3, 0n)]), defaultOf()));
|
|
5139
|
+
break;
|
|
5140
|
+
}
|
|
5141
|
+
case 1: {
|
|
5142
|
+
execution_44 = (new Execution$1(new Value(/* VOption */ 9, [FSharpMap__TryFind(values_4, valueToMapKey(span_12, key_1))]), defaultOf()));
|
|
5143
|
+
break;
|
|
5144
|
+
}
|
|
5145
|
+
case 2: {
|
|
5146
|
+
execution_44 = (new Execution$1((() => {
|
|
5147
|
+
throw new EvalException(new EvalError$("Map index key must be string, int, bool, or a payload-free union case", span_12));
|
|
5148
|
+
})(), defaultOf()));
|
|
5149
|
+
break;
|
|
5150
|
+
}
|
|
5151
|
+
case 3: {
|
|
5152
|
+
execution_44 = (new Execution$1((() => {
|
|
5153
|
+
throw new EvalException(new EvalError$("List index must be int", span_12));
|
|
5154
|
+
})(), defaultOf()));
|
|
5155
|
+
break;
|
|
5156
|
+
}
|
|
5157
|
+
default:
|
|
5158
|
+
execution_44 = (new Execution$1((() => {
|
|
5159
|
+
throw new EvalException(new EvalError$("Index access requires a list or map value", span_12));
|
|
5160
|
+
})(), defaultOf()));
|
|
5161
|
+
}
|
|
5162
|
+
const continuation_67 = continuation_66;
|
|
5163
|
+
return Execution$1__get_IsImmediate(execution_44) ? continuation_67(execution_44.Value) : execution_44.Resume(continuation_67);
|
|
5164
|
+
});
|
|
5165
|
+
}
|
|
5166
|
+
}));
|
|
2270
5167
|
}
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
matchResult_7 = 2;
|
|
5168
|
+
const continuation_70 = continuation_69;
|
|
5169
|
+
return Execution$1__get_IsImmediate(execution_46) ? continuation_70(execution_46.Value) : execution_46.Resume(continuation_70);
|
|
5170
|
+
});
|
|
2275
5171
|
}
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
5172
|
+
});
|
|
5173
|
+
}
|
|
5174
|
+
}
|
|
5175
|
+
case 18: {
|
|
5176
|
+
const body_70 = evalExpr(runtime, typeDefs, env, a_2);
|
|
5177
|
+
if (Execution$1__get_IsImmediate(body_70)) {
|
|
5178
|
+
const av = body_70.Value;
|
|
5179
|
+
const body_68 = evalExpr(runtime, typeDefs, env, b_1);
|
|
5180
|
+
if (Execution$1__get_IsImmediate(body_68)) {
|
|
5181
|
+
const bv = body_68.Value;
|
|
5182
|
+
const op_1 = (expr.tag === 23) ? "::" : ((expr.tag === 24) ? "@" : ((expr.tag === 25) ? expr.fields[0] : ""));
|
|
5183
|
+
if (op_1 === "|>") {
|
|
5184
|
+
return applyFunctionValue(runtime, typeDefs, span_13, bv, av);
|
|
2283
5185
|
}
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
case "|>":
|
|
2287
|
-
return applyFunctionValue(runtime, evalExpr, typeDefs, span_16, bv_1, av_1);
|
|
2288
|
-
case "+":
|
|
2289
|
-
return arith((x_5) => ((y_5) => toInt64_unchecked(op_Addition(x_5, y_5))), (x_6) => ((y_6) => (x_6 + y_6)));
|
|
2290
|
-
case "-":
|
|
2291
|
-
return arith((x_7) => ((y_7) => toInt64_unchecked(op_Subtraction(x_7, y_7))), (x_8) => ((y_8) => (x_8 - y_8)));
|
|
2292
|
-
case "*":
|
|
2293
|
-
return arith((x_9) => ((y_9) => toInt64_unchecked(op_Multiply(x_9, y_9))), (x_10) => ((y_10) => (x_10 * y_10)));
|
|
2294
|
-
case "/": {
|
|
2295
|
-
let matchResult_8, x_11, y_11, x_12, y_12;
|
|
2296
|
-
switch (av_1.tag) {
|
|
2297
|
-
case 1: {
|
|
2298
|
-
if (bv_1.tag === 1) {
|
|
2299
|
-
matchResult_8 = 0;
|
|
2300
|
-
x_11 = av_1.fields[0];
|
|
2301
|
-
y_11 = bv_1.fields[0];
|
|
2302
|
-
}
|
|
2303
|
-
else {
|
|
2304
|
-
matchResult_8 = 2;
|
|
2305
|
-
}
|
|
2306
|
-
break;
|
|
2307
|
-
}
|
|
2308
|
-
case 2: {
|
|
2309
|
-
if (bv_1.tag === 2) {
|
|
2310
|
-
matchResult_8 = 1;
|
|
2311
|
-
x_12 = av_1.fields[0];
|
|
2312
|
-
y_12 = bv_1.fields[0];
|
|
2313
|
-
}
|
|
2314
|
-
else {
|
|
2315
|
-
matchResult_8 = 2;
|
|
2316
|
-
}
|
|
2317
|
-
break;
|
|
2318
|
-
}
|
|
2319
|
-
default:
|
|
2320
|
-
matchResult_8 = 2;
|
|
2321
|
-
}
|
|
2322
|
-
switch (matchResult_8) {
|
|
2323
|
-
case 0:
|
|
2324
|
-
return new Value(/* VInt */ 1, [toInt64_unchecked(op_Division(x_11, y_11))]);
|
|
2325
|
-
case 1:
|
|
2326
|
-
return new Value(/* VFloat */ 2, [x_12 / y_12]);
|
|
2327
|
-
default:
|
|
2328
|
-
throw new EvalException(new EvalError$("Numeric operands required", span_16));
|
|
2329
|
-
}
|
|
5186
|
+
else {
|
|
5187
|
+
return new Execution$1(binaryOperator(span_13, op_1, av, bv), defaultOf());
|
|
2330
5188
|
}
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
5189
|
+
}
|
|
5190
|
+
else {
|
|
5191
|
+
return new Execution$1(defaultOf(), (continuation_72) => {
|
|
5192
|
+
const execution_49 = body_68;
|
|
5193
|
+
if (Execution$1__get_IsImmediate(execution_49)) {
|
|
5194
|
+
let execution_48;
|
|
5195
|
+
const bv = execution_49.Value;
|
|
5196
|
+
const op_1 = (expr.tag === 23) ? "::" : ((expr.tag === 24) ? "@" : ((expr.tag === 25) ? expr.fields[0] : ""));
|
|
5197
|
+
execution_48 = ((op_1 === "|>") ? applyFunctionValue(runtime, typeDefs, span_13, bv, av) : (new Execution$1(binaryOperator(span_13, op_1, av, bv), defaultOf())));
|
|
5198
|
+
const continuation_73 = continuation_72;
|
|
5199
|
+
if (Execution$1__get_IsImmediate(execution_48)) {
|
|
5200
|
+
return continuation_73(execution_48.Value);
|
|
2338
5201
|
}
|
|
2339
5202
|
else {
|
|
2340
|
-
|
|
5203
|
+
return execution_48.Resume(continuation_73);
|
|
2341
5204
|
}
|
|
2342
5205
|
}
|
|
2343
5206
|
else {
|
|
2344
|
-
|
|
5207
|
+
return execution_49.Resume((value_99) => {
|
|
5208
|
+
let execution_48;
|
|
5209
|
+
const bv = value_99;
|
|
5210
|
+
const op_1 = (expr.tag === 23) ? "::" : ((expr.tag === 24) ? "@" : ((expr.tag === 25) ? expr.fields[0] : ""));
|
|
5211
|
+
execution_48 = ((op_1 === "|>") ? applyFunctionValue(runtime, typeDefs, span_13, bv, av) : (new Execution$1(binaryOperator(span_13, op_1, av, bv), defaultOf())));
|
|
5212
|
+
const continuation_73 = continuation_72;
|
|
5213
|
+
return Execution$1__get_IsImmediate(execution_48) ? continuation_73(execution_48.Value) : execution_48.Resume(continuation_73);
|
|
5214
|
+
});
|
|
2345
5215
|
}
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
y_15 = bv_1.fields[0];
|
|
5216
|
+
});
|
|
5217
|
+
}
|
|
5218
|
+
}
|
|
5219
|
+
else {
|
|
5220
|
+
return new Execution$1(defaultOf(), (continuation_75) => {
|
|
5221
|
+
const execution_51 = body_70;
|
|
5222
|
+
if (Execution$1__get_IsImmediate(execution_51)) {
|
|
5223
|
+
let execution_50;
|
|
5224
|
+
const av = execution_51.Value;
|
|
5225
|
+
const body_68 = evalExpr(runtime, typeDefs, env, b_1);
|
|
5226
|
+
if (Execution$1__get_IsImmediate(body_68)) {
|
|
5227
|
+
const bv = body_68.Value;
|
|
5228
|
+
const op_1 = (expr.tag === 23) ? "::" : ((expr.tag === 24) ? "@" : ((expr.tag === 25) ? expr.fields[0] : ""));
|
|
5229
|
+
execution_50 = ((op_1 === "|>") ? applyFunctionValue(runtime, typeDefs, span_13, bv, av) : (new Execution$1(binaryOperator(span_13, op_1, av, bv), defaultOf())));
|
|
5230
|
+
}
|
|
5231
|
+
else {
|
|
5232
|
+
execution_50 = (new Execution$1(defaultOf(), (continuation_72) => {
|
|
5233
|
+
const execution_49 = body_68;
|
|
5234
|
+
if (Execution$1__get_IsImmediate(execution_49)) {
|
|
5235
|
+
let execution_48;
|
|
5236
|
+
const bv = execution_49.Value;
|
|
5237
|
+
const op_1 = (expr.tag === 23) ? "::" : ((expr.tag === 24) ? "@" : ((expr.tag === 25) ? expr.fields[0] : ""));
|
|
5238
|
+
execution_48 = ((op_1 === "|>") ? applyFunctionValue(runtime, typeDefs, span_13, bv, av) : (new Execution$1(binaryOperator(span_13, op_1, av, bv), defaultOf())));
|
|
5239
|
+
const continuation_73 = continuation_72;
|
|
5240
|
+
if (Execution$1__get_IsImmediate(execution_48)) {
|
|
5241
|
+
return continuation_73(execution_48.Value);
|
|
5242
|
+
}
|
|
5243
|
+
else {
|
|
5244
|
+
return execution_48.Resume(continuation_73);
|
|
5245
|
+
}
|
|
2377
5246
|
}
|
|
2378
5247
|
else {
|
|
2379
|
-
|
|
5248
|
+
return execution_49.Resume((value_99) => {
|
|
5249
|
+
let execution_48;
|
|
5250
|
+
const bv = value_99;
|
|
5251
|
+
const op_1 = (expr.tag === 23) ? "::" : ((expr.tag === 24) ? "@" : ((expr.tag === 25) ? expr.fields[0] : ""));
|
|
5252
|
+
execution_48 = ((op_1 === "|>") ? applyFunctionValue(runtime, typeDefs, span_13, bv, av) : (new Execution$1(binaryOperator(span_13, op_1, av, bv), defaultOf())));
|
|
5253
|
+
const continuation_73 = continuation_72;
|
|
5254
|
+
return Execution$1__get_IsImmediate(execution_48) ? continuation_73(execution_48.Value) : execution_48.Resume(continuation_73);
|
|
5255
|
+
});
|
|
2380
5256
|
}
|
|
2381
|
-
|
|
2382
|
-
}
|
|
2383
|
-
default:
|
|
2384
|
-
matchResult_10 = 2;
|
|
5257
|
+
}));
|
|
2385
5258
|
}
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
throw new EvalException(new EvalError$("Numeric operands required", span_16));
|
|
5259
|
+
const continuation_76 = continuation_75;
|
|
5260
|
+
if (Execution$1__get_IsImmediate(execution_50)) {
|
|
5261
|
+
return continuation_76(execution_50.Value);
|
|
5262
|
+
}
|
|
5263
|
+
else {
|
|
5264
|
+
return execution_50.Resume(continuation_76);
|
|
2393
5265
|
}
|
|
2394
5266
|
}
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
5267
|
+
else {
|
|
5268
|
+
return execution_51.Resume((value_100) => {
|
|
5269
|
+
let execution_50;
|
|
5270
|
+
const av = value_100;
|
|
5271
|
+
const body_68 = evalExpr(runtime, typeDefs, env, b_1);
|
|
5272
|
+
if (Execution$1__get_IsImmediate(body_68)) {
|
|
5273
|
+
const bv = body_68.Value;
|
|
5274
|
+
const op_1 = (expr.tag === 23) ? "::" : ((expr.tag === 24) ? "@" : ((expr.tag === 25) ? expr.fields[0] : ""));
|
|
5275
|
+
execution_50 = ((op_1 === "|>") ? applyFunctionValue(runtime, typeDefs, span_13, bv, av) : (new Execution$1(binaryOperator(span_13, op_1, av, bv), defaultOf())));
|
|
2403
5276
|
}
|
|
2404
5277
|
else {
|
|
2405
|
-
|
|
5278
|
+
execution_50 = (new Execution$1(defaultOf(), (continuation_72) => {
|
|
5279
|
+
const execution_49 = body_68;
|
|
5280
|
+
if (Execution$1__get_IsImmediate(execution_49)) {
|
|
5281
|
+
let execution_48;
|
|
5282
|
+
const bv = execution_49.Value;
|
|
5283
|
+
const op_1 = (expr.tag === 23) ? "::" : ((expr.tag === 24) ? "@" : ((expr.tag === 25) ? expr.fields[0] : ""));
|
|
5284
|
+
execution_48 = ((op_1 === "|>") ? applyFunctionValue(runtime, typeDefs, span_13, bv, av) : (new Execution$1(binaryOperator(span_13, op_1, av, bv), defaultOf())));
|
|
5285
|
+
const continuation_73 = continuation_72;
|
|
5286
|
+
if (Execution$1__get_IsImmediate(execution_48)) {
|
|
5287
|
+
return continuation_73(execution_48.Value);
|
|
5288
|
+
}
|
|
5289
|
+
else {
|
|
5290
|
+
return execution_48.Resume(continuation_73);
|
|
5291
|
+
}
|
|
5292
|
+
}
|
|
5293
|
+
else {
|
|
5294
|
+
return execution_49.Resume((value_99) => {
|
|
5295
|
+
let execution_48;
|
|
5296
|
+
const bv = value_99;
|
|
5297
|
+
const op_1 = (expr.tag === 23) ? "::" : ((expr.tag === 24) ? "@" : ((expr.tag === 25) ? expr.fields[0] : ""));
|
|
5298
|
+
execution_48 = ((op_1 === "|>") ? applyFunctionValue(runtime, typeDefs, span_13, bv, av) : (new Execution$1(binaryOperator(span_13, op_1, av, bv), defaultOf())));
|
|
5299
|
+
const continuation_73 = continuation_72;
|
|
5300
|
+
return Execution$1__get_IsImmediate(execution_48) ? continuation_73(execution_48.Value) : execution_48.Resume(continuation_73);
|
|
5301
|
+
});
|
|
5302
|
+
}
|
|
5303
|
+
}));
|
|
2406
5304
|
}
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
}
|
|
2411
|
-
switch (matchResult_11) {
|
|
2412
|
-
case 0:
|
|
2413
|
-
return new Value(/* VBool */ 3, [(op === "&&") ? (x_16 && y_16) : (x_16 ? true : y_16)]);
|
|
2414
|
-
default:
|
|
2415
|
-
throw new EvalException(new EvalError$("Boolean operands required", span_16));
|
|
2416
|
-
}
|
|
5305
|
+
const continuation_76 = continuation_75;
|
|
5306
|
+
return Execution$1__get_IsImmediate(execution_50) ? continuation_76(execution_50.Value) : execution_50.Resume(continuation_76);
|
|
5307
|
+
});
|
|
2417
5308
|
}
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
5309
|
+
});
|
|
5310
|
+
}
|
|
5311
|
+
}
|
|
5312
|
+
case 19: {
|
|
5313
|
+
const body_72 = evalExpr(runtime, typeDefs, env, expr.fields[0]);
|
|
5314
|
+
if (Execution$1__get_IsImmediate(body_72)) {
|
|
5315
|
+
return new Execution$1(new Value(/* VOption */ 9, [body_72.Value]), defaultOf());
|
|
5316
|
+
}
|
|
5317
|
+
else {
|
|
5318
|
+
return new Execution$1(defaultOf(), (continuation_78) => {
|
|
5319
|
+
const execution_53 = body_72;
|
|
5320
|
+
if (Execution$1__get_IsImmediate(execution_53)) {
|
|
5321
|
+
const execution_52 = new Execution$1(new Value(/* VOption */ 9, [execution_53.Value]), defaultOf());
|
|
5322
|
+
const continuation_79 = continuation_78;
|
|
5323
|
+
if (Execution$1__get_IsImmediate(execution_52)) {
|
|
5324
|
+
return continuation_79(execution_52.Value);
|
|
2421
5325
|
}
|
|
2422
5326
|
else {
|
|
2423
|
-
|
|
5327
|
+
return execution_52.Resume(continuation_79);
|
|
2424
5328
|
}
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
5329
|
+
}
|
|
5330
|
+
else {
|
|
5331
|
+
return execution_53.Resume((value_104) => {
|
|
5332
|
+
const execution_52 = new Execution$1(new Value(/* VOption */ 9, [value_104]), defaultOf());
|
|
5333
|
+
const continuation_79 = continuation_78;
|
|
5334
|
+
return Execution$1__get_IsImmediate(execution_52) ? continuation_79(execution_52.Value) : execution_52.Resume(continuation_79);
|
|
5335
|
+
});
|
|
5336
|
+
}
|
|
5337
|
+
});
|
|
5338
|
+
}
|
|
5339
|
+
}
|
|
5340
|
+
case 20: {
|
|
5341
|
+
const sb = StringBuilder_$ctor();
|
|
5342
|
+
const second_1 = () => (new Execution$1(new Value(/* VString */ 4, [toString(sb)]), defaultOf()));
|
|
5343
|
+
const body_75 = Execution_Builder__For_Z3A5BE4A(Execution_execution, expr.fields[0], (_arg_29) => {
|
|
5344
|
+
const part = _arg_29;
|
|
5345
|
+
if (part.tag === 1) {
|
|
5346
|
+
const body_74 = evalExpr(runtime, typeDefs, env, part.fields[0]);
|
|
5347
|
+
if (Execution$1__get_IsImmediate(body_74)) {
|
|
5348
|
+
StringBuilder__Append_Z721C83C5(sb, valueToInterpolationString(body_74.Value));
|
|
5349
|
+
return new Execution$1(undefined, defaultOf());
|
|
5350
|
+
}
|
|
5351
|
+
else {
|
|
5352
|
+
return new Execution$1(defaultOf(), (continuation_81) => {
|
|
5353
|
+
const execution_55 = body_74;
|
|
5354
|
+
if (Execution$1__get_IsImmediate(execution_55)) {
|
|
5355
|
+
let execution_54;
|
|
5356
|
+
StringBuilder__Append_Z721C83C5(sb, valueToInterpolationString(execution_55.Value));
|
|
5357
|
+
execution_54 = (new Execution$1(undefined, defaultOf()));
|
|
5358
|
+
const continuation_82 = continuation_81;
|
|
5359
|
+
if (Execution$1__get_IsImmediate(execution_54)) {
|
|
5360
|
+
return continuation_82(execution_54.Value);
|
|
5361
|
+
}
|
|
5362
|
+
else {
|
|
5363
|
+
return execution_54.Resume(continuation_82);
|
|
5364
|
+
}
|
|
2432
5365
|
}
|
|
2433
5366
|
else {
|
|
2434
|
-
|
|
5367
|
+
return execution_55.Resume((value_110) => {
|
|
5368
|
+
let execution_54;
|
|
5369
|
+
StringBuilder__Append_Z721C83C5(sb, valueToInterpolationString(value_110));
|
|
5370
|
+
execution_54 = (new Execution$1(undefined, defaultOf()));
|
|
5371
|
+
const continuation_82 = continuation_81;
|
|
5372
|
+
return Execution$1__get_IsImmediate(execution_54) ? continuation_82(execution_54.Value) : execution_54.Resume(continuation_82);
|
|
5373
|
+
});
|
|
2435
5374
|
}
|
|
2436
|
-
}
|
|
2437
|
-
else {
|
|
2438
|
-
matchResult_12 = 1;
|
|
2439
|
-
}
|
|
2440
|
-
switch (matchResult_12) {
|
|
2441
|
-
case 0:
|
|
2442
|
-
return new Value(/* VList */ 5, [append(xs_3, ys_1)]);
|
|
2443
|
-
default:
|
|
2444
|
-
throw new EvalException(new EvalError$("Both sides of \'@\' must be lists", span_16));
|
|
2445
|
-
}
|
|
5375
|
+
});
|
|
2446
5376
|
}
|
|
2447
|
-
default:
|
|
2448
|
-
throw new EvalException(new EvalError$(toText(printf("Unknown operator %s"))(op), span_16));
|
|
2449
|
-
}
|
|
2450
|
-
}
|
|
2451
|
-
case 26:
|
|
2452
|
-
return new Value(/* VOption */ 9, [evalExpr(runtime, typeDefs, env, expr.fields[0])]);
|
|
2453
|
-
case 27:
|
|
2454
|
-
return new Value(/* VOption */ 9, [undefined]);
|
|
2455
|
-
case 28: {
|
|
2456
|
-
const name_12 = expr.fields[0];
|
|
2457
|
-
const matchValue_25 = FSharpMap__TryFind(typeDefs, name_12);
|
|
2458
|
-
if (matchValue_25 == null) {
|
|
2459
|
-
throw new EvalException(new EvalError$(concat("Unknown type \'", name_12, "\'"), expr.fields[1]));
|
|
2460
|
-
}
|
|
2461
|
-
else {
|
|
2462
|
-
return new Value(/* VTypeToken */ 12, [matchValue_25]);
|
|
2463
|
-
}
|
|
2464
|
-
}
|
|
2465
|
-
case 29: {
|
|
2466
|
-
const name_13 = expr.fields[0];
|
|
2467
|
-
if (FSharpMap__ContainsKey(env, name_13)) {
|
|
2468
|
-
return new Value(/* VString */ 4, [name_13]);
|
|
2469
5377
|
}
|
|
2470
5378
|
else {
|
|
2471
|
-
|
|
5379
|
+
StringBuilder__Append_Z721C83C5(sb, part.fields[0]);
|
|
5380
|
+
return new Execution$1(undefined, defaultOf());
|
|
2472
5381
|
}
|
|
5382
|
+
});
|
|
5383
|
+
if (Execution$1__get_IsImmediate(body_75)) {
|
|
5384
|
+
return second_1();
|
|
2473
5385
|
}
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
const
|
|
2480
|
-
if (
|
|
2481
|
-
|
|
5386
|
+
else {
|
|
5387
|
+
return new Execution$1(defaultOf(), (continuation_84) => {
|
|
5388
|
+
const execution_57 = body_75;
|
|
5389
|
+
if (Execution$1__get_IsImmediate(execution_57)) {
|
|
5390
|
+
const execution_56 = second_1();
|
|
5391
|
+
const continuation_85 = continuation_84;
|
|
5392
|
+
if (Execution$1__get_IsImmediate(execution_56)) {
|
|
5393
|
+
return continuation_85(execution_56.Value);
|
|
2482
5394
|
}
|
|
2483
5395
|
else {
|
|
2484
|
-
|
|
5396
|
+
return execution_56.Resume(continuation_85);
|
|
2485
5397
|
}
|
|
2486
5398
|
}
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
5399
|
+
else {
|
|
5400
|
+
return execution_57.Resume((value_113) => {
|
|
5401
|
+
const execution_56 = second_1();
|
|
5402
|
+
const continuation_85 = continuation_84;
|
|
5403
|
+
return Execution$1__get_IsImmediate(execution_56) ? continuation_85(execution_56.Value) : execution_56.Resume(continuation_85);
|
|
5404
|
+
});
|
|
5405
|
+
}
|
|
5406
|
+
});
|
|
2492
5407
|
}
|
|
2493
|
-
default:
|
|
2494
|
-
return Value.VUnit;
|
|
2495
5408
|
}
|
|
2496
|
-
|
|
5409
|
+
default:
|
|
5410
|
+
return new Execution$1((() => {
|
|
5411
|
+
throw new Exception("Immediate expressions are handled before compound evaluation.");
|
|
5412
|
+
})(), defaultOf());
|
|
2497
5413
|
}
|
|
2498
5414
|
}
|
|
2499
5415
|
|
|
2500
5416
|
export function invokeValue(typeDefs, fnValue, args) {
|
|
2501
|
-
const runtime = new RuntimeState({}, true, [], undefined);
|
|
5417
|
+
const runtime = new RuntimeState({}, new FSharpRef(true), [], new FSharpRef(undefined));
|
|
2502
5418
|
const applyMany = (currentValue_mut, remainingArgs_mut) => {
|
|
2503
5419
|
applyMany:
|
|
2504
5420
|
while (true) {
|
|
@@ -2527,7 +5443,7 @@ export function invokeValue(typeDefs, fnValue, args) {
|
|
|
2527
5443
|
if (exprAcc.tag === 4) {
|
|
2528
5444
|
if (!isEmpty(argsAcc)) {
|
|
2529
5445
|
matchResult = 0;
|
|
2530
|
-
nextArg =
|
|
5446
|
+
nextArg = head_1(argsAcc);
|
|
2531
5447
|
nextBody = exprAcc.fields[1];
|
|
2532
5448
|
param = exprAcc.fields[0];
|
|
2533
5449
|
rest = tail_2(argsAcc);
|
|
@@ -2552,13 +5468,13 @@ export function invokeValue(typeDefs, fnValue, args) {
|
|
|
2552
5468
|
break;
|
|
2553
5469
|
}
|
|
2554
5470
|
};
|
|
2555
|
-
const patternInput = bindLambdaChain(add(currentValue.fields[0],
|
|
2556
|
-
currentValue_mut = evalExpr(runtime, typeDefs, patternInput[0], patternInput[1]);
|
|
5471
|
+
const patternInput = bindLambdaChain(add(currentValue.fields[0], head_1(remainingArgs), currentValue.fields[2].contents), currentValue.fields[1], tail_2(remainingArgs));
|
|
5472
|
+
currentValue_mut = Execution_run(evalExpr(runtime, typeDefs, patternInput[0], patternInput[1]));
|
|
2557
5473
|
remainingArgs_mut = patternInput[2];
|
|
2558
5474
|
continue applyMany;
|
|
2559
5475
|
}
|
|
2560
5476
|
default: {
|
|
2561
|
-
currentValue_mut = applyFunctionValue(runtime,
|
|
5477
|
+
currentValue_mut = Execution_run(applyFunctionValue(runtime, typeDefs, unknownSpan, currentValue, head_1(remainingArgs)));
|
|
2562
5478
|
remainingArgs_mut = tail_2(remainingArgs);
|
|
2563
5479
|
continue applyMany;
|
|
2564
5480
|
}
|
|
@@ -2574,9 +5490,7 @@ export function invokeValue(typeDefs, fnValue, args) {
|
|
|
2574
5490
|
return applyMany(fnValue, args);
|
|
2575
5491
|
}
|
|
2576
5492
|
finally {
|
|
2577
|
-
|
|
2578
|
-
runtime.Active = false;
|
|
2579
|
-
});
|
|
5493
|
+
runtime.Active.contents = false;
|
|
2580
5494
|
}
|
|
2581
5495
|
}
|
|
2582
5496
|
|
|
@@ -2662,13 +5576,13 @@ function evaluateStatements(runtime, typeDefs, initialEnv, program) {
|
|
|
2662
5576
|
}
|
|
2663
5577
|
}
|
|
2664
5578
|
else {
|
|
2665
|
-
const v = evalExpr(runtime, typeDefs, env, expr);
|
|
5579
|
+
const v = Execution_run(evalExpr(runtime, typeDefs, env, expr));
|
|
2666
5580
|
env = add(name, v, env);
|
|
2667
5581
|
}
|
|
2668
5582
|
break;
|
|
2669
5583
|
}
|
|
2670
5584
|
case 2: {
|
|
2671
|
-
const matchValue = patternMatch(typeDefs, stmt.fields[0], evalExpr(runtime, typeDefs, env, stmt.fields[1]));
|
|
5585
|
+
const matchValue = patternMatch(typeDefs, stmt.fields[0], Execution_run(evalExpr(runtime, typeDefs, env, stmt.fields[1])));
|
|
2672
5586
|
if (matchValue == null) {
|
|
2673
5587
|
throw new EvalException(new EvalError$("Let pattern did not match value", stmt.fields[4]));
|
|
2674
5588
|
}
|
|
@@ -2699,7 +5613,7 @@ function evaluateStatements(runtime, typeDefs, initialEnv, program) {
|
|
|
2699
5613
|
break;
|
|
2700
5614
|
}
|
|
2701
5615
|
case 4: {
|
|
2702
|
-
lastValue = evalExpr(runtime, typeDefs, env, stmt.fields[0].Expr);
|
|
5616
|
+
lastValue = Execution_run(evalExpr(runtime, typeDefs, env, stmt.fields[0].Expr));
|
|
2703
5617
|
break;
|
|
2704
5618
|
}
|
|
2705
5619
|
default:
|
|
@@ -2719,25 +5633,23 @@ function evaluateStatements(runtime, typeDefs, initialEnv, program) {
|
|
|
2719
5633
|
}
|
|
2720
5634
|
|
|
2721
5635
|
export function evalProgramFromState(state, program) {
|
|
2722
|
-
const runtime = new RuntimeState({}, true, [], undefined);
|
|
5636
|
+
const runtime = new RuntimeState({}, new FSharpRef(true), [], new FSharpRef(undefined));
|
|
2723
5637
|
try {
|
|
2724
5638
|
return evaluateStatements(runtime, state.TypeDefs, state.Env, program);
|
|
2725
5639
|
}
|
|
2726
5640
|
finally {
|
|
2727
|
-
|
|
2728
|
-
runtime.Active = false;
|
|
2729
|
-
});
|
|
5641
|
+
runtime.Active.contents = false;
|
|
2730
5642
|
}
|
|
2731
5643
|
}
|
|
2732
5644
|
|
|
2733
|
-
|
|
5645
|
+
function evaluateRegistered(registration, program) {
|
|
2734
5646
|
const externs = registration.Functions;
|
|
2735
|
-
const runtime = new RuntimeState({}, true, [], undefined);
|
|
5647
|
+
const runtime = new RuntimeState({}, new FSharpRef(true), [], new FSharpRef(undefined));
|
|
2736
5648
|
const option_1 = tryFind_1((ext) => contains(ext.Name, builtinReservedNames), externs);
|
|
2737
5649
|
if (option_1 != null) {
|
|
2738
5650
|
throw new EvalException(new EvalError$(concat("Host extern \'", option_1.Name, "\' collides with reserved stdlib symbol"), unknownSpan));
|
|
2739
5651
|
}
|
|
2740
|
-
const decls = ofList(append(map((def) => [def.Name, def],
|
|
5652
|
+
const decls = ofList(append(map((def) => [def.Name, def], typeDefs_2), choose((_arg) => {
|
|
2741
5653
|
if (_arg.tag === 0) {
|
|
2742
5654
|
const def_1 = _arg.fields[0];
|
|
2743
5655
|
return [def_1.Name, def_1];
|
|
@@ -2871,15 +5783,22 @@ export function evalProgramWithRegistrationState(registration, program) {
|
|
|
2871
5783
|
Compare: (x_7, y_8) => (comparePrimitives(x_7, y_8) | 0),
|
|
2872
5784
|
}), list_15);
|
|
2873
5785
|
env = fold_1((acc_2, tupledArg_9) => FSharpMap__Add(acc_2, tupledArg_9[0], tupledArg_9[1]), env, constructorValues_1);
|
|
2874
|
-
|
|
5786
|
+
try {
|
|
5787
|
+
return evaluateStatements(runtime, typeDefs_1, env, program);
|
|
5788
|
+
}
|
|
5789
|
+
catch (error) {
|
|
5790
|
+
throw error;
|
|
5791
|
+
}
|
|
2875
5792
|
}
|
|
2876
5793
|
finally {
|
|
2877
|
-
|
|
2878
|
-
runtime.Active = false;
|
|
2879
|
-
});
|
|
5794
|
+
runtime.Active.contents = false;
|
|
2880
5795
|
}
|
|
2881
5796
|
}
|
|
2882
5797
|
|
|
5798
|
+
export function evalProgramWithRegistrationState(registration, program) {
|
|
5799
|
+
return evaluateRegistered(registration, program);
|
|
5800
|
+
}
|
|
5801
|
+
|
|
2883
5802
|
export function evalProgramWithExterns(externs, program) {
|
|
2884
5803
|
return evalProgramWithRegistrationState(ofExterns(externs), program).LastValue;
|
|
2885
5804
|
}
|