@magnusopera/fscript 0.84.0 → 0.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,1272 @@
|
|
|
1
|
+
|
|
2
|
+
import { FSharpRef, Union, Record } from "../fable_modules/fable-library-js.5.13.0/Types.js";
|
|
3
|
+
import { union_type, option_type, int32_type, list_type, bool_type, record_type, class_type, string_type } from "../fable_modules/fable-library-js.5.13.0/Reflection.js";
|
|
4
|
+
import { contains, add as add_1, singleton as singleton_1, toList, FSharpSet__get_IsEmpty, difference, ofList as ofList_1, ofSeq, union, empty as empty_1 } from "../fable_modules/fable-library-js.5.13.0/Set.js";
|
|
5
|
+
import { compareArrays, stringHash, clear, curry2, int32ToString, curry3, defaultOf, disposeSafe, getEnumerator, safeHash, arrayHash, equalArrays, Exception, equals, compare, comparePrimitives } from "../fable_modules/fable-library-js.5.13.0/Util.js";
|
|
6
|
+
import { Span_$reflection } from "./Span.js";
|
|
7
|
+
import { ResolvedSymbolKind, ResolvedExpression_$reflection, ResolvedBinding_$reflection } from "./TypeInfer.js";
|
|
8
|
+
import { Type, Type_$reflection } from "./Types.js";
|
|
9
|
+
import { filter as filter_1, toList as toList_1, map as map_2, forAll, fold as fold_1, add, toSeq, tryFind, ofList, empty as empty_2 } from "../fable_modules/fable-library-js.5.13.0/Map.js";
|
|
10
|
+
import { ofArrayWithTail, contains as contains_1, tryPick, tryItem, tryHead, ofSeq as ofSeq_1, mapIndexed, length, indexed, ofArray, append, cons, filter, choose, singleton, head, tail as tail_2, isEmpty, collect, fold, map, empty as empty_3 } from "../fable_modules/fable-library-js.5.13.0/List.js";
|
|
11
|
+
import { defaultArg } from "../fable_modules/fable-library-js.5.13.0/Option.js";
|
|
12
|
+
import { sortBy, toArray, toList as toList_2, collect as collect_1, empty as empty_4, singleton as singleton_2, append as append_1, delay, map as map_1 } from "../fable_modules/fable-library-js.5.13.0/Seq.js";
|
|
13
|
+
import { concat, join } from "../fable_modules/fable-library-js.5.13.0/String.js";
|
|
14
|
+
import { HashSet } from "../fable_modules/fable-library-js.5.13.0/MutableSet.js";
|
|
15
|
+
import { Dictionary } from "../fable_modules/fable-library-js.5.13.0/MutableMap.js";
|
|
16
|
+
import { min, max } from "../fable_modules/fable-library-js.5.13.0/Double.js";
|
|
17
|
+
import { addToSet, addToDict, tryGetValue } from "../fable_modules/fable-library-js.5.13.0/MapUtil.js";
|
|
18
|
+
import { equals as equals_1 } from "../fable_modules/fable-library-js.5.13.0/BigInt.js";
|
|
19
|
+
import { addRangeInPlace } from "../fable_modules/fable-library-js.5.13.0/Array.js";
|
|
20
|
+
import { distinct as distinct_1 } from "../fable_modules/fable-library-js.5.13.0/Seq2.js";
|
|
21
|
+
import { builtinSchemes } from "./BuiltinSignatures.js";
|
|
22
|
+
import { rangeDouble } from "../fable_modules/fable-library-js.5.13.0/Range.js";
|
|
23
|
+
|
|
24
|
+
export class Options extends Record {
|
|
25
|
+
constructor(ThreadSafeTypes, ThreadSafeFunctions) {
|
|
26
|
+
super();
|
|
27
|
+
this.ThreadSafeTypes = ThreadSafeTypes;
|
|
28
|
+
this.ThreadSafeFunctions = ThreadSafeFunctions;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function Options_$reflection() {
|
|
33
|
+
return record_type("FScript.Language.TaskSharingAnalysis.Options", [], Options, () => [["ThreadSafeTypes", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type])], ["ThreadSafeFunctions", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type])]]);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const defaults = new Options(empty_1({
|
|
37
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
38
|
+
}), empty_1({
|
|
39
|
+
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
export class Diagnostic extends Record {
|
|
43
|
+
constructor(Code, Message, Span, RelatedSpan) {
|
|
44
|
+
super();
|
|
45
|
+
this.Code = Code;
|
|
46
|
+
this.Message = Message;
|
|
47
|
+
this.Span = Span;
|
|
48
|
+
this.RelatedSpan = RelatedSpan;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function Diagnostic_$reflection() {
|
|
53
|
+
return record_type("FScript.Language.TaskSharingAnalysis.Diagnostic", [], Diagnostic, () => [["Code", string_type], ["Message", string_type], ["Span", Span_$reflection()], ["RelatedSpan", Span_$reflection()]]);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
class Resource extends Record {
|
|
57
|
+
constructor(Key, Name, IsFunction) {
|
|
58
|
+
super();
|
|
59
|
+
this.Key = Key;
|
|
60
|
+
this.Name = Name;
|
|
61
|
+
this.IsFunction = IsFunction;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function Resource_$reflection() {
|
|
66
|
+
return record_type("FScript.Language.TaskSharingAnalysis.Resource", [], Resource, () => [["Key", string_type], ["Name", string_type], ["IsFunction", bool_type]]);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
class AbstractValue extends Record {
|
|
70
|
+
constructor(Resources, Fields, Callables, Tasks, Count) {
|
|
71
|
+
super();
|
|
72
|
+
this.Resources = Resources;
|
|
73
|
+
this.Fields = Fields;
|
|
74
|
+
this.Callables = Callables;
|
|
75
|
+
this.Tasks = Tasks;
|
|
76
|
+
this.Count = Count;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function AbstractValue_$reflection() {
|
|
81
|
+
return record_type("FScript.Language.TaskSharingAnalysis.AbstractValue", [], AbstractValue, () => [["Resources", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [Resource_$reflection()])], ["Fields", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, AbstractValue_$reflection()])], ["Callables", list_type(Callable_$reflection())], ["Tasks", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [int32_type])], ["Count", option_type(int32_type)]]);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
class Callable extends Union {
|
|
85
|
+
constructor(tag, fields) {
|
|
86
|
+
super();
|
|
87
|
+
this.tag = tag;
|
|
88
|
+
this.fields = fields;
|
|
89
|
+
}
|
|
90
|
+
cases() {
|
|
91
|
+
return ["Closure", "Function"];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function Callable_$reflection() {
|
|
96
|
+
return union_type("FScript.Language.TaskSharingAnalysis.Callable", [], Callable, () => [[["Item1", int32_type], ["Item2", ResolvedBinding_$reflection()], ["Item3", ResolvedExpression_$reflection()], ["Item4", record_type("Microsoft.FSharp.Core.FSharpRef`1", [class_type("Microsoft.FSharp.Collections.FSharpMap`2", [int32_type, AbstractValue_$reflection()])], FSharpRef, () => [["contents", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [int32_type, AbstractValue_$reflection()])]])]], [["Item1", string_type], ["Item2", int32_type], ["Item3", bool_type], ["Item4", Type_$reflection()], ["Item5", list_type(AbstractValue_$reflection())]]]);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const empty = new AbstractValue(empty_1({
|
|
100
|
+
Compare: (x, y) => (compare(x, y) | 0),
|
|
101
|
+
}), empty_2({
|
|
102
|
+
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
103
|
+
}), empty_3(), empty_1({
|
|
104
|
+
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
105
|
+
}), undefined);
|
|
106
|
+
|
|
107
|
+
function combine(values) {
|
|
108
|
+
let list_1, list_4;
|
|
109
|
+
let matchResult, value;
|
|
110
|
+
if (!isEmpty(values)) {
|
|
111
|
+
if (isEmpty(tail_2(values))) {
|
|
112
|
+
matchResult = 0;
|
|
113
|
+
value = head(values);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
matchResult = 1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
matchResult = 1;
|
|
121
|
+
}
|
|
122
|
+
switch (matchResult) {
|
|
123
|
+
case 0:
|
|
124
|
+
return value;
|
|
125
|
+
default:
|
|
126
|
+
return new AbstractValue((list_1 = map((_arg) => _arg.Resources, values), fold(union, empty_1({
|
|
127
|
+
Compare: (x, y) => (compare(x, y) | 0),
|
|
128
|
+
}), list_1)), empty.Fields, collect((_arg_1) => _arg_1.Callables, values), (list_4 = map((_arg_2) => _arg_2.Tasks, values), fold(union, empty_1({
|
|
129
|
+
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
130
|
+
}), list_4)), empty.Count);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function container(key, count, value) {
|
|
135
|
+
return new AbstractValue(value.Resources, ofList(singleton([key, value]), {
|
|
136
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
137
|
+
}), empty.Callables, empty.Tasks, count);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function contents(value) {
|
|
141
|
+
let option_1;
|
|
142
|
+
return defaultArg((option_1 = tryFind("$items", value.Fields), (option_1 != null) ? option_1 : tryFind("$value", value.Fields)), value);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Analyze a previously inferred tree. Provider implementations are never invoked.
|
|
147
|
+
* Unknown FFI results may alias arguments or other results from the same binding.
|
|
148
|
+
*/
|
|
149
|
+
export function analyze(registration, options, program) {
|
|
150
|
+
const hostTypes = ofList(map((item) => [item.Name, item], registration.Types), {
|
|
151
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
152
|
+
});
|
|
153
|
+
const declaredTypes = ofList(choose((statement) => {
|
|
154
|
+
const matchValue = statement.Node;
|
|
155
|
+
if (matchValue.tag === 0) {
|
|
156
|
+
const declaration = matchValue.fields[0];
|
|
157
|
+
return [declaration.Binding.Name, declaration];
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
}, program.ResolvedStatements), {
|
|
163
|
+
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
164
|
+
});
|
|
165
|
+
const hostUnions = ofList(map((item_1) => [item_1.Name, item_1.Cases], registration.Unions), {
|
|
166
|
+
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
167
|
+
});
|
|
168
|
+
const functions = ofList(map((item_2) => [item_2.Name, item_2.Arity], registration.Functions), {
|
|
169
|
+
Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
|
|
170
|
+
});
|
|
171
|
+
const knownTypes = union(ofSeq(map_1((tuple) => tuple[0], toSeq(hostTypes)), {
|
|
172
|
+
Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
|
|
173
|
+
}), ofList_1(map((_arg) => _arg.Name, registration.Unions), {
|
|
174
|
+
Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
|
|
175
|
+
}));
|
|
176
|
+
const knownFunctions = union(ofSeq(map_1((tuple_1) => tuple_1[0], toSeq(functions)), {
|
|
177
|
+
Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
|
|
178
|
+
}), ofList_1(map((_arg_1) => _arg_1.Name, filter((symbol) => {
|
|
179
|
+
if (equals(symbol.Kind, ResolvedSymbolKind.ExternSymbol)) {
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
return equals(symbol.Kind, ResolvedSymbolKind.BuiltinSymbol);
|
|
184
|
+
}
|
|
185
|
+
}, program.Symbols)), {
|
|
186
|
+
Compare: (x_7, y_7) => (comparePrimitives(x_7, y_7) | 0),
|
|
187
|
+
}));
|
|
188
|
+
const invalid = union(difference(options.ThreadSafeTypes, knownTypes), difference(options.ThreadSafeFunctions, knownFunctions));
|
|
189
|
+
if (!FSharpSet__get_IsEmpty(invalid)) {
|
|
190
|
+
throw new Exception(("Unknown thread-safety contract names: " + join(", ", toList(invalid))) + " (Parameter \'options\')");
|
|
191
|
+
}
|
|
192
|
+
const safeTypes = union(options.ThreadSafeTypes, program.Purity.PureTypes);
|
|
193
|
+
const safeFunctions = union(options.ThreadSafeFunctions, program.Purity.PureFunctions);
|
|
194
|
+
const diagnostics = [];
|
|
195
|
+
const reported = new HashSet([], {
|
|
196
|
+
Equals: equalArrays,
|
|
197
|
+
GetHashCode: (x_8) => (arrayHash(x_8) | 0),
|
|
198
|
+
});
|
|
199
|
+
const histories = new Dictionary([], {
|
|
200
|
+
Equals: equals,
|
|
201
|
+
GetHashCode: (x_9) => (safeHash(x_9) | 0),
|
|
202
|
+
});
|
|
203
|
+
const tasks = new Map([]);
|
|
204
|
+
const activeCalls = new Set([]);
|
|
205
|
+
let callSites = empty_3();
|
|
206
|
+
let nextTask = 0;
|
|
207
|
+
let task = 0;
|
|
208
|
+
let clock = ofList(singleton([0, 0]), {
|
|
209
|
+
Compare: (x_10, y_10) => (comparePrimitives(x_10, y_10) | 0),
|
|
210
|
+
});
|
|
211
|
+
const tick = () => {
|
|
212
|
+
clock = add(task, 1 + defaultArg(tryFind(task, clock), 0), clock);
|
|
213
|
+
};
|
|
214
|
+
const mergeClock = (left, right) => fold_1((state, key, value_1) => add(key, max(value_1, defaultArg(tryFind(key, state), 0)), state), left, right);
|
|
215
|
+
const before = (left_1, right_1) => forAll((key_1, value_3) => (value_3 <= defaultArg(tryFind(key_1, right_1), 0)), left_1);
|
|
216
|
+
const commonClock = (clocks) => {
|
|
217
|
+
if (!isEmpty(clocks)) {
|
|
218
|
+
return fold((state_1, other) => map_2((key_2, value_5) => (min(value_5, defaultArg(tryFind(key_2, other), 0)) | 0), state_1), head(clocks), tail_2(clocks));
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
return clock;
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const access = (span, resources) => {
|
|
225
|
+
tick();
|
|
226
|
+
const enumerator = getEnumerator(resources);
|
|
227
|
+
try {
|
|
228
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
229
|
+
const resource = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
230
|
+
let history;
|
|
231
|
+
let matchValue_1;
|
|
232
|
+
let outArg = defaultOf();
|
|
233
|
+
matchValue_1 = [tryGetValue(histories, resource, new FSharpRef(() => outArg, (v) => {
|
|
234
|
+
outArg = v;
|
|
235
|
+
})), outArg];
|
|
236
|
+
if (matchValue_1[0]) {
|
|
237
|
+
history = matchValue_1[1];
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
const values_1 = [];
|
|
241
|
+
addToDict(histories, resource, values_1);
|
|
242
|
+
history = values_1;
|
|
243
|
+
}
|
|
244
|
+
let enumerator_1 = getEnumerator(history);
|
|
245
|
+
try {
|
|
246
|
+
while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
|
|
247
|
+
const forLoopVar = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
248
|
+
const related = forLoopVar[2];
|
|
249
|
+
const previous = forLoopVar[1];
|
|
250
|
+
if (((forLoopVar[0] !== task) && !before(previous, clock)) && !before(clock, previous)) {
|
|
251
|
+
if (addToSet([resource.Key, related, span], reported)) {
|
|
252
|
+
void (diagnostics.push(new Diagnostic(resource.IsFunction ? "FST1002" : "FST1001", resource.IsFunction ? concat("Host function \'", resource.Name, "\' may be called by concurrent tasks; its thread safety is unknown.") : concat("Host value \'", resource.Name, "\' may be shared by concurrent tasks; its thread safety is unknown."), span, related)));
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
finally {
|
|
258
|
+
disposeSafe(enumerator_1);
|
|
259
|
+
}
|
|
260
|
+
void (history.push([task, clock, span]));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
finally {
|
|
264
|
+
disposeSafe(enumerator);
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
const fromType = (source_2, visited, typ) => {
|
|
268
|
+
let list_9, f2, mapping_9, f2_1, f2_2, mapping_12;
|
|
269
|
+
const nested = (typ_1) => fromType(source_2, visited, typ_1);
|
|
270
|
+
let matchResult, name_2, name_3, typ_3, typ_4, typ_5, types, fields_1, cases_2, key_3, value_8;
|
|
271
|
+
switch (typ.tag) {
|
|
272
|
+
case 17: {
|
|
273
|
+
if (!contains(typ.fields[0], safeTypes)) {
|
|
274
|
+
matchResult = 0;
|
|
275
|
+
name_2 = typ.fields[0];
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
matchResult = 9;
|
|
279
|
+
}
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
case 12: {
|
|
283
|
+
if (!contains(typ.fields[0], visited)) {
|
|
284
|
+
matchResult = 1;
|
|
285
|
+
name_3 = typ.fields[0];
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
matchResult = 9;
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
case 5: {
|
|
293
|
+
matchResult = 2;
|
|
294
|
+
typ_3 = typ.fields[0];
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
case 10: {
|
|
298
|
+
matchResult = 3;
|
|
299
|
+
typ_4 = typ.fields[0];
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
case 6: {
|
|
303
|
+
matchResult = 4;
|
|
304
|
+
typ_5 = typ.fields[0];
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
case 7: {
|
|
308
|
+
matchResult = 5;
|
|
309
|
+
types = typ.fields[0];
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
case 8: {
|
|
313
|
+
matchResult = 6;
|
|
314
|
+
fields_1 = typ.fields[0];
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
case 18: {
|
|
318
|
+
matchResult = 6;
|
|
319
|
+
fields_1 = typ.fields[1];
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
case 13: {
|
|
323
|
+
matchResult = 7;
|
|
324
|
+
cases_2 = typ.fields[1];
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
case 9: {
|
|
328
|
+
matchResult = 8;
|
|
329
|
+
key_3 = typ.fields[0];
|
|
330
|
+
value_8 = typ.fields[1];
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
default:
|
|
334
|
+
matchResult = 9;
|
|
335
|
+
}
|
|
336
|
+
switch (matchResult) {
|
|
337
|
+
case 0:
|
|
338
|
+
return new AbstractValue(singleton_1(new Resource((source_2 + ":") + name_2, name_2, false), {
|
|
339
|
+
Compare: (x_11, y_11) => (compare(x_11, y_11) | 0),
|
|
340
|
+
}), empty.Fields, empty.Callables, empty.Tasks, empty.Count);
|
|
341
|
+
case 1: {
|
|
342
|
+
const matchValue_2 = tryFind(name_3, hostTypes);
|
|
343
|
+
let matchResult_1, descriptor_1;
|
|
344
|
+
if (matchValue_2 != null) {
|
|
345
|
+
if (!contains(name_3, safeTypes)) {
|
|
346
|
+
matchResult_1 = 0;
|
|
347
|
+
descriptor_1 = matchValue_2;
|
|
348
|
+
}
|
|
349
|
+
else if (contains(name_3, safeTypes)) {
|
|
350
|
+
matchResult_1 = 1;
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
matchResult_1 = 2;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
else if (contains(name_3, safeTypes)) {
|
|
357
|
+
matchResult_1 = 1;
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
matchResult_1 = 2;
|
|
361
|
+
}
|
|
362
|
+
switch (matchResult_1) {
|
|
363
|
+
case 0: {
|
|
364
|
+
const value_7 = new AbstractValue(singleton_1(new Resource((source_2 + ":") + name_3, name_3, false), {
|
|
365
|
+
Compare: (x_12, y_12) => (compare(x_12, y_12) | 0),
|
|
366
|
+
}), empty.Fields, empty.Callables, empty.Tasks, empty.Count);
|
|
367
|
+
if (descriptor_1.HostManaged) {
|
|
368
|
+
return value_7;
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
return combine(cons(value_7, map((tupledArg) => fromType(source_2, add_1(name_3, visited), tupledArg[1]), toList_1(descriptor_1.Fields))));
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
case 1:
|
|
375
|
+
return empty;
|
|
376
|
+
default: {
|
|
377
|
+
const visited_1 = add_1(name_3, visited);
|
|
378
|
+
const matchValue_3 = tryFind(name_3, hostUnions);
|
|
379
|
+
const matchValue_4 = tryFind(name_3, declaredTypes);
|
|
380
|
+
if (matchValue_3 != null) {
|
|
381
|
+
return combine((list_9 = toList_1(matchValue_3), choose((f2 = ((mapping_9 = curry3(fromType)(source_2)(visited_1), (option_4) => {
|
|
382
|
+
const option_5 = option_4;
|
|
383
|
+
return (option_5 != null) ? mapping_9(option_5) : undefined;
|
|
384
|
+
})), (arg) => f2(arg[1])), list_9)));
|
|
385
|
+
}
|
|
386
|
+
else if (matchValue_4 != null) {
|
|
387
|
+
const declaration_1 = matchValue_4;
|
|
388
|
+
return combine(append(map((f2_1 = curry3(fromType)(source_2)(visited_1), (arg_1) => f2_1(arg_1[1])), declaration_1.Fields), choose((f2_2 = ((mapping_12 = curry3(fromType)(source_2)(visited_1), (option_6) => {
|
|
389
|
+
const option_7 = option_6;
|
|
390
|
+
return (option_7 != null) ? mapping_12(option_7) : undefined;
|
|
391
|
+
})), (arg_2) => f2_2(arg_2[1])), declaration_1.Cases)));
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
return empty;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
case 2:
|
|
400
|
+
return container("$items", undefined, nested(typ_3));
|
|
401
|
+
case 3:
|
|
402
|
+
return container("$value", undefined, nested(typ_4));
|
|
403
|
+
case 4:
|
|
404
|
+
return nested(typ_5);
|
|
405
|
+
case 5:
|
|
406
|
+
return combine(map(nested, types));
|
|
407
|
+
case 6: {
|
|
408
|
+
const values_4 = map_2((_arg_3, typ_6) => nested(typ_6), fields_1);
|
|
409
|
+
const bind$0040 = combine(map((tuple_5) => tuple_5[1], toList_1(values_4)));
|
|
410
|
+
return new AbstractValue(bind$0040.Resources, values_4, bind$0040.Callables, bind$0040.Tasks, bind$0040.Count);
|
|
411
|
+
}
|
|
412
|
+
case 7:
|
|
413
|
+
return combine(choose((arg_3) => {
|
|
414
|
+
const option_9 = arg_3[1];
|
|
415
|
+
if (option_9 != null) {
|
|
416
|
+
return nested(option_9);
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
return undefined;
|
|
420
|
+
}
|
|
421
|
+
}, toList_1(cases_2)));
|
|
422
|
+
case 8:
|
|
423
|
+
return combine(ofArray([nested(key_3), nested(value_8)]));
|
|
424
|
+
default:
|
|
425
|
+
return empty;
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
const unknown = (source_3, typ_7) => fromType(source_3, empty_1({
|
|
429
|
+
Compare: (x_13, y_13) => (comparePrimitives(x_13, y_13) | 0),
|
|
430
|
+
}), typ_7);
|
|
431
|
+
const references = (expression) => delay(() => {
|
|
432
|
+
let matchValue_6;
|
|
433
|
+
return append_1((matchValue_6 = expression.Node, (matchValue_6.tag === 1) ? singleton_2(matchValue_6.fields[0].SymbolId) : (empty_4())), delay(() => collect_1(references, expression.Children)));
|
|
434
|
+
});
|
|
435
|
+
const bindPattern = (env_1_mut, pattern_mut, value_9_mut) => {
|
|
436
|
+
bindPattern:
|
|
437
|
+
while (true) {
|
|
438
|
+
const env_1 = env_1_mut, pattern = pattern_mut, value_9 = value_9_mut;
|
|
439
|
+
let mapping_18, option_13;
|
|
440
|
+
const bind = (env_2, pattern_1) => bindPattern(env_2, pattern_1, value_9);
|
|
441
|
+
const matchValue_7 = pattern.Node;
|
|
442
|
+
let matchResult_2, binding_1, patterns, fields_2, a, b, pattern_4, pattern_5, entries, tail;
|
|
443
|
+
switch (matchValue_7.tag) {
|
|
444
|
+
case 1: {
|
|
445
|
+
matchResult_2 = 0;
|
|
446
|
+
binding_1 = matchValue_7.fields[0];
|
|
447
|
+
break;
|
|
448
|
+
}
|
|
449
|
+
case 5: {
|
|
450
|
+
matchResult_2 = 1;
|
|
451
|
+
patterns = matchValue_7.fields[0];
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
case 6: {
|
|
455
|
+
matchResult_2 = 2;
|
|
456
|
+
fields_2 = matchValue_7.fields[0];
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
case 4: {
|
|
460
|
+
matchResult_2 = 3;
|
|
461
|
+
a = matchValue_7.fields[0];
|
|
462
|
+
b = matchValue_7.fields[1];
|
|
463
|
+
break;
|
|
464
|
+
}
|
|
465
|
+
case 8: {
|
|
466
|
+
matchResult_2 = 4;
|
|
467
|
+
pattern_4 = matchValue_7.fields[0];
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
case 10: {
|
|
471
|
+
if (matchValue_7.fields[2] != null) {
|
|
472
|
+
matchResult_2 = 5;
|
|
473
|
+
pattern_5 = matchValue_7.fields[2];
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
matchResult_2 = 7;
|
|
477
|
+
}
|
|
478
|
+
break;
|
|
479
|
+
}
|
|
480
|
+
case 7: {
|
|
481
|
+
matchResult_2 = 6;
|
|
482
|
+
entries = matchValue_7.fields[0];
|
|
483
|
+
tail = matchValue_7.fields[1];
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
486
|
+
default:
|
|
487
|
+
matchResult_2 = 7;
|
|
488
|
+
}
|
|
489
|
+
switch (matchResult_2) {
|
|
490
|
+
case 0:
|
|
491
|
+
return add(binding_1.SymbolId, value_9, env_1);
|
|
492
|
+
case 1:
|
|
493
|
+
return fold((env_3, tupledArg_1) => bindPattern(env_3, tupledArg_1[1], defaultArg(tryFind(int32ToString(tupledArg_1[0]), value_9.Fields), value_9)), env_1, indexed(patterns));
|
|
494
|
+
case 2:
|
|
495
|
+
return fold((env_4, tupledArg_2) => bindPattern(env_4, tupledArg_2[1], defaultArg(tryFind(tupledArg_2[0], value_9.Fields), value_9)), env_1, fields_2);
|
|
496
|
+
case 3: {
|
|
497
|
+
env_1_mut = bindPattern(env_1, a, contents(value_9));
|
|
498
|
+
pattern_mut = b;
|
|
499
|
+
value_9_mut = value_9;
|
|
500
|
+
continue bindPattern;
|
|
501
|
+
}
|
|
502
|
+
case 4: {
|
|
503
|
+
env_1_mut = env_1;
|
|
504
|
+
pattern_mut = pattern_4;
|
|
505
|
+
value_9_mut = contents(value_9);
|
|
506
|
+
continue bindPattern;
|
|
507
|
+
}
|
|
508
|
+
case 5:
|
|
509
|
+
return bind(env_1, pattern_5);
|
|
510
|
+
case 6: {
|
|
511
|
+
const env_6 = fold((env_5, tupledArg_3) => bindPattern(bindPattern(env_5, tupledArg_3[0], contents(value_9)), tupledArg_3[1], contents(value_9)), env_1, entries);
|
|
512
|
+
return defaultArg((mapping_18 = curry2(bind)(env_6), (option_13 = tail, (option_13 != null) ? mapping_18(option_13) : undefined)), env_6);
|
|
513
|
+
}
|
|
514
|
+
default:
|
|
515
|
+
return env_1;
|
|
516
|
+
}
|
|
517
|
+
break;
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
const evaluate = (env_7) => ((expression_1) => {
|
|
521
|
+
let matchValue_11, matchValue_12, option_19, option_21;
|
|
522
|
+
const eval$ = evaluate(env_7);
|
|
523
|
+
const matchValue_8 = expression_1.Node;
|
|
524
|
+
switch (matchValue_8.tag) {
|
|
525
|
+
case 1: {
|
|
526
|
+
const reference_1 = matchValue_8.fields[0];
|
|
527
|
+
const matchValue_9 = tryFind(reference_1.SymbolId, env_7);
|
|
528
|
+
if (matchValue_9 == null) {
|
|
529
|
+
if (equals(reference_1.Kind, ResolvedSymbolKind.ExternSymbol) ? true : equals(reference_1.Kind, ResolvedSymbolKind.BuiltinSymbol)) {
|
|
530
|
+
const arity = (_arg_5) => {
|
|
531
|
+
if (_arg_5.tag === 11) {
|
|
532
|
+
return (1 + arity(_arg_5.fields[1])) | 0;
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
return 0;
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
const count = defaultArg(tryFind(reference_1.Name, functions), arity(reference_1.Type)) | 0;
|
|
539
|
+
const value_12 = new AbstractValue(empty.Resources, empty.Fields, singleton(new Callable(/* Function */ 1, [reference_1.Name, count, equals(reference_1.Kind, ResolvedSymbolKind.ExternSymbol), reference_1.Type, empty_3()])), empty.Tasks, empty.Count);
|
|
540
|
+
return (count === 0) ? invokeFunction(expression_1.Span)(expression_1.Type)(reference_1.Name)(equals(reference_1.Kind, ResolvedSymbolKind.ExternSymbol))(empty_3()) : value_12;
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
return unknown("symbol:" + int32ToString(reference_1.SymbolId), expression_1.Type);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
return matchValue_9;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
case 2: {
|
|
551
|
+
const binding = matchValue_8.fields[0];
|
|
552
|
+
const body = matchValue_8.fields[1];
|
|
553
|
+
const capturedIds = ofSeq(references(body), {
|
|
554
|
+
Compare: (x_14, y_14) => (comparePrimitives(x_14, y_14) | 0),
|
|
555
|
+
});
|
|
556
|
+
const captured = filter_1((id, _arg_4) => contains(id, capturedIds), env_7);
|
|
557
|
+
const captures = combine(map((tuple_7) => tuple_7[1], toList_1(captured)));
|
|
558
|
+
return new AbstractValue(captures.Resources, captures.Fields, singleton(new Callable(/* Closure */ 0, [binding.SymbolId, binding, body, new FSharpRef(captured)])), captures.Tasks, captures.Count);
|
|
559
|
+
}
|
|
560
|
+
case 3:
|
|
561
|
+
return apply(expression_1.Span)(expression_1.Type)(eval$(matchValue_8.fields[0]))(eval$(matchValue_8.fields[1]));
|
|
562
|
+
case 4: {
|
|
563
|
+
const argument_3 = eval$(matchValue_8.fields[0]);
|
|
564
|
+
return apply(expression_1.Span)(expression_1.Type)(eval$(matchValue_8.fields[1]))(argument_3);
|
|
565
|
+
}
|
|
566
|
+
case 15: {
|
|
567
|
+
const value_14 = eval$(matchValue_8.fields[2]);
|
|
568
|
+
const next = add(matchValue_8.fields[0].SymbolId, value_14, env_7);
|
|
569
|
+
if (matchValue_8.fields[1]) {
|
|
570
|
+
wireRecursive(next)(singleton(value_14));
|
|
571
|
+
}
|
|
572
|
+
return evaluate(next)(matchValue_8.fields[3]);
|
|
573
|
+
}
|
|
574
|
+
case 16: {
|
|
575
|
+
const values_7 = map((binding_4) => [binding_4.Binding.SymbolId, eval$(binding_4.Value)], matchValue_8.fields[0]);
|
|
576
|
+
const next_1 = fold((state_2, tupledArg_4) => add(tupledArg_4[0], tupledArg_4[1], state_2), env_7, values_7);
|
|
577
|
+
wireRecursive(next_1)(map((tuple_8) => tuple_8[1], values_7));
|
|
578
|
+
return evaluate(next_1)(matchValue_8.fields[1]);
|
|
579
|
+
}
|
|
580
|
+
case 5: {
|
|
581
|
+
const yes = matchValue_8.fields[1];
|
|
582
|
+
const no = matchValue_8.fields[2];
|
|
583
|
+
const condition = matchValue_8.fields[0];
|
|
584
|
+
eval$(condition);
|
|
585
|
+
const matchValue_10 = condition.Node;
|
|
586
|
+
let matchResult_3;
|
|
587
|
+
if (matchValue_10.tag === 0) {
|
|
588
|
+
if (matchValue_10.fields[0].tag === 3) {
|
|
589
|
+
if (matchValue_10.fields[0].fields[0]) {
|
|
590
|
+
matchResult_3 = 0;
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
matchResult_3 = 1;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
matchResult_3 = 2;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
matchResult_3 = 2;
|
|
602
|
+
}
|
|
603
|
+
switch (matchResult_3) {
|
|
604
|
+
case 0:
|
|
605
|
+
return eval$(yes);
|
|
606
|
+
case 1:
|
|
607
|
+
return eval$(no);
|
|
608
|
+
default:
|
|
609
|
+
return branches(ofArray([() => eval$(yes), () => eval$(no)]));
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
case 18: {
|
|
613
|
+
const value_17 = eval$(matchValue_8.fields[0]);
|
|
614
|
+
return branches(map((case$) => (() => {
|
|
615
|
+
const next_2 = bindPattern(env_7, case$.Pattern, value_17);
|
|
616
|
+
const option_17 = case$.Guard;
|
|
617
|
+
if (option_17 != null) {
|
|
618
|
+
evaluate(next_2)(option_17);
|
|
619
|
+
}
|
|
620
|
+
return evaluate(next_2)(case$.Body);
|
|
621
|
+
}), matchValue_8.fields[1]));
|
|
622
|
+
}
|
|
623
|
+
case 11:
|
|
624
|
+
return container("$value", undefined, eval$(matchValue_8.fields[0]));
|
|
625
|
+
case 8: {
|
|
626
|
+
const expressions = matchValue_8.fields[0];
|
|
627
|
+
return container("$items", length(expressions), combine(map(eval$, expressions)));
|
|
628
|
+
}
|
|
629
|
+
case 19: {
|
|
630
|
+
const last = matchValue_8.fields[1];
|
|
631
|
+
const first_1 = matchValue_8.fields[0];
|
|
632
|
+
eval$(first_1);
|
|
633
|
+
eval$(last);
|
|
634
|
+
return container("$items", (matchValue_11 = first_1.Node, (matchValue_12 = last.Node, (matchValue_11.tag === 0) ? ((matchValue_11.fields[0].tag === 1) ? ((matchValue_12.tag === 0) ? ((matchValue_12.fields[0].tag === 1) ? (equals_1(matchValue_11.fields[0].fields[0], matchValue_12.fields[0].fields[0]) ? 1 : 2) : undefined) : undefined) : undefined) : undefined)), empty);
|
|
635
|
+
}
|
|
636
|
+
case 13: {
|
|
637
|
+
const matchValue_14 = eval$(matchValue_8.fields[0]);
|
|
638
|
+
const rest_2 = eval$(matchValue_8.fields[1]);
|
|
639
|
+
return container("$items", (option_19 = rest_2.Count, (option_19 != null) ? (1 + option_19) : undefined), combine(ofArray([matchValue_14, contents(rest_2)])));
|
|
640
|
+
}
|
|
641
|
+
case 14: {
|
|
642
|
+
const matchValue_16 = eval$(matchValue_8.fields[0]);
|
|
643
|
+
const matchValue_17 = eval$(matchValue_8.fields[1]);
|
|
644
|
+
return container("$items", undefined, combine(ofArray([contents(matchValue_16), contents(matchValue_17)])));
|
|
645
|
+
}
|
|
646
|
+
case 21: {
|
|
647
|
+
eval$(matchValue_8.fields[1]);
|
|
648
|
+
return contents(eval$(matchValue_8.fields[0]));
|
|
649
|
+
}
|
|
650
|
+
case 23:
|
|
651
|
+
return container("$items", undefined, combine(collect((_arg_6) => {
|
|
652
|
+
if (_arg_6.tag === 1) {
|
|
653
|
+
return singleton(contents(eval$(_arg_6.fields[0])));
|
|
654
|
+
}
|
|
655
|
+
else {
|
|
656
|
+
return ofArray([eval$(_arg_6.fields[0]), eval$(_arg_6.fields[1])]);
|
|
657
|
+
}
|
|
658
|
+
}, matchValue_8.fields[0])));
|
|
659
|
+
case 7: {
|
|
660
|
+
const fields_3 = ofList(mapIndexed((index_2, value_25) => [int32ToString(index_2), eval$(value_25)], matchValue_8.fields[0]), {
|
|
661
|
+
Compare: (x_16, y_16) => (comparePrimitives(x_16, y_16) | 0),
|
|
662
|
+
});
|
|
663
|
+
const bind$0040_1 = combine(map((tuple_9) => tuple_9[1], toList_1(fields_3)));
|
|
664
|
+
return new AbstractValue(bind$0040_1.Resources, fields_3, empty_3(), empty_1({
|
|
665
|
+
Compare: (x_17, y_17) => (comparePrimitives(x_17, y_17) | 0),
|
|
666
|
+
}), bind$0040_1.Count);
|
|
667
|
+
}
|
|
668
|
+
case 9: {
|
|
669
|
+
const fields_4 = ofList(map((tupledArg_5) => [tupledArg_5[0], eval$(tupledArg_5[1])], matchValue_8.fields[0]), {
|
|
670
|
+
Compare: (x_18, y_18) => (comparePrimitives(x_18, y_18) | 0),
|
|
671
|
+
});
|
|
672
|
+
const bind$0040_2 = combine(map((tuple_10) => tuple_10[1], toList_1(fields_4)));
|
|
673
|
+
return new AbstractValue(bind$0040_2.Resources, fields_4, empty_3(), empty_1({
|
|
674
|
+
Compare: (x_19, y_19) => (comparePrimitives(x_19, y_19) | 0),
|
|
675
|
+
}), bind$0040_2.Count);
|
|
676
|
+
}
|
|
677
|
+
case 10: {
|
|
678
|
+
const name_6 = matchValue_8.fields[1];
|
|
679
|
+
const value_27 = eval$(matchValue_8.fields[0]);
|
|
680
|
+
access(expression_1.Span, value_27.Resources);
|
|
681
|
+
const matchValue_18 = tryFind(name_6, value_27.Fields);
|
|
682
|
+
if (matchValue_18 == null) {
|
|
683
|
+
const matchValue_19 = expression_1.Type;
|
|
684
|
+
switch (matchValue_19.tag) {
|
|
685
|
+
case 0:
|
|
686
|
+
case 1:
|
|
687
|
+
case 2:
|
|
688
|
+
case 3:
|
|
689
|
+
case 4:
|
|
690
|
+
case 14:
|
|
691
|
+
return empty;
|
|
692
|
+
default:
|
|
693
|
+
return combine(ofArray([value_27, unknown("field:" + name_6, expression_1.Type)]));
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
else {
|
|
697
|
+
return matchValue_18;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
case 20: {
|
|
701
|
+
const target_4 = eval$(matchValue_8.fields[1]);
|
|
702
|
+
access(expression_1.Span, target_4.Resources);
|
|
703
|
+
const fields_6 = fold((state_3, tupledArg_6) => add(tupledArg_6[0], eval$(tupledArg_6[1]), state_3), target_4.Fields, matchValue_8.fields[2]);
|
|
704
|
+
const bind$0040_3 = combine(cons(target_4, map((tuple_11) => tuple_11[1], toList_1(fields_6))));
|
|
705
|
+
return new AbstractValue(bind$0040_3.Resources, fields_6, empty_3(), empty_1({
|
|
706
|
+
Compare: (x_20, y_20) => (comparePrimitives(x_20, y_20) | 0),
|
|
707
|
+
}), bind$0040_3.Count);
|
|
708
|
+
}
|
|
709
|
+
case 6: {
|
|
710
|
+
const arg_9 = combine(map(eval$, matchValue_8.fields[1])).Resources;
|
|
711
|
+
access(expression_1.Span, arg_9);
|
|
712
|
+
return empty;
|
|
713
|
+
}
|
|
714
|
+
case 22: {
|
|
715
|
+
const enumerator_2 = getEnumerator(matchValue_8.fields[0]);
|
|
716
|
+
try {
|
|
717
|
+
while (enumerator_2["System.Collections.IEnumerator.MoveNext"]()) {
|
|
718
|
+
const part = enumerator_2["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
719
|
+
if (part.tag === 1) {
|
|
720
|
+
const arg_11 = eval$(part.fields[0]).Resources;
|
|
721
|
+
access(expression_1.Span, arg_11);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
finally {
|
|
726
|
+
disposeSafe(enumerator_2);
|
|
727
|
+
}
|
|
728
|
+
return empty;
|
|
729
|
+
}
|
|
730
|
+
case 24: {
|
|
731
|
+
const items = eval$(matchValue_8.fields[1]);
|
|
732
|
+
const next_3 = add(matchValue_8.fields[0].SymbolId, contents(items), env_7);
|
|
733
|
+
for (let forLoopVar_1 = 1; forLoopVar_1 <= defaultArg((option_21 = items.Count, (option_21 != null) ? min(2, option_21) : undefined), 2); forLoopVar_1++) {
|
|
734
|
+
evaluate(next_3)(matchValue_8.fields[2]);
|
|
735
|
+
}
|
|
736
|
+
return empty;
|
|
737
|
+
}
|
|
738
|
+
case 17: {
|
|
739
|
+
eval$(matchValue_8.fields[0]);
|
|
740
|
+
return empty;
|
|
741
|
+
}
|
|
742
|
+
default:
|
|
743
|
+
return empty;
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
const branches = (alternatives) => {
|
|
747
|
+
const snapshot = () => toList_2(map_1((pair) => [pair[0], ofSeq_1(pair[1])], histories));
|
|
748
|
+
const clock_1 = clock;
|
|
749
|
+
const matchValue_20 = snapshot();
|
|
750
|
+
const results = map((branch) => {
|
|
751
|
+
clock = clock_1;
|
|
752
|
+
histories.clear();
|
|
753
|
+
const enumerator_3 = getEnumerator(matchValue_20);
|
|
754
|
+
try {
|
|
755
|
+
while (enumerator_3["System.Collections.IEnumerator.MoveNext"]()) {
|
|
756
|
+
const forLoopVar_2 = enumerator_3["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
757
|
+
histories.set(forLoopVar_2[0], Array.from(forLoopVar_2[1]));
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
finally {
|
|
761
|
+
disposeSafe(enumerator_3);
|
|
762
|
+
}
|
|
763
|
+
return [branch(), clock, snapshot()];
|
|
764
|
+
}, alternatives);
|
|
765
|
+
histories.clear();
|
|
766
|
+
const enumerator_4 = getEnumerator(results);
|
|
767
|
+
try {
|
|
768
|
+
while (enumerator_4["System.Collections.IEnumerator.MoveNext"]()) {
|
|
769
|
+
const enumerator_5 = getEnumerator(enumerator_4["System.Collections.Generic.IEnumerator`1.get_Current"]()[2]);
|
|
770
|
+
try {
|
|
771
|
+
while (enumerator_5["System.Collections.IEnumerator.MoveNext"]()) {
|
|
772
|
+
const forLoopVar_4 = enumerator_5["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
773
|
+
const values_14 = forLoopVar_4[1];
|
|
774
|
+
const key_9 = forLoopVar_4[0];
|
|
775
|
+
let matchValue_21;
|
|
776
|
+
let outArg_1 = defaultOf();
|
|
777
|
+
matchValue_21 = [tryGetValue(histories, key_9, new FSharpRef(() => outArg_1, (v_1) => {
|
|
778
|
+
outArg_1 = v_1;
|
|
779
|
+
})), outArg_1];
|
|
780
|
+
if (matchValue_21[0]) {
|
|
781
|
+
addRangeInPlace(values_14, matchValue_21[1]);
|
|
782
|
+
}
|
|
783
|
+
else {
|
|
784
|
+
histories.set(key_9, Array.from(values_14));
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
finally {
|
|
789
|
+
disposeSafe(enumerator_5);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
finally {
|
|
794
|
+
disposeSafe(enumerator_4);
|
|
795
|
+
}
|
|
796
|
+
let enumerator_6 = getEnumerator(histories);
|
|
797
|
+
try {
|
|
798
|
+
while (enumerator_6["System.Collections.IEnumerator.MoveNext"]()) {
|
|
799
|
+
const pair_1 = enumerator_6["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
800
|
+
const distinct = toArray(distinct_1(pair_1[1], {
|
|
801
|
+
Equals: equalArrays,
|
|
802
|
+
GetHashCode: (x_21) => (arrayHash(x_21) | 0),
|
|
803
|
+
}));
|
|
804
|
+
clear(pair_1[1]);
|
|
805
|
+
addRangeInPlace(distinct, pair_1[1]);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
finally {
|
|
809
|
+
disposeSafe(enumerator_6);
|
|
810
|
+
}
|
|
811
|
+
clock = commonClock(map((tupledArg_7) => tupledArg_7[1], results));
|
|
812
|
+
const ownTime = fold((e_2, e_3) => (max(e_2, e_3) | 0), 0, map((tupledArg_8) => (defaultArg(tryFind(task, tupledArg_8[1]), 0) | 0), results)) | 0;
|
|
813
|
+
clock = add(task, ownTime, clock);
|
|
814
|
+
return combine(map((tupledArg_9) => tupledArg_9[0], results));
|
|
815
|
+
};
|
|
816
|
+
const wireRecursive = (env_8) => ((values_16) => {
|
|
817
|
+
const enumerator_7 = getEnumerator(values_16);
|
|
818
|
+
try {
|
|
819
|
+
while (enumerator_7["System.Collections.IEnumerator.MoveNext"]()) {
|
|
820
|
+
const enumerator_8 = getEnumerator(enumerator_7["System.Collections.Generic.IEnumerator`1.get_Current"]().Callables);
|
|
821
|
+
try {
|
|
822
|
+
while (enumerator_8["System.Collections.IEnumerator.MoveNext"]()) {
|
|
823
|
+
const callable = enumerator_8["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
824
|
+
if (callable.tag === 0) {
|
|
825
|
+
const ids = ofSeq(references(callable.fields[2]), {
|
|
826
|
+
Compare: (x_22, y_22) => (comparePrimitives(x_22, y_22) | 0),
|
|
827
|
+
});
|
|
828
|
+
callable.fields[3].contents = filter_1((id_2, _arg_13) => contains(id_2, ids), env_8);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
finally {
|
|
833
|
+
disposeSafe(enumerator_8);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
finally {
|
|
838
|
+
disposeSafe(enumerator_7);
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
const apply = (span_1) => ((resultType) => ((fn_4) => ((argument_4) => {
|
|
842
|
+
if (isEmpty(fn_4.Callables)) {
|
|
843
|
+
const arg_13 = union(fn_4.Resources, argument_4.Resources);
|
|
844
|
+
access(span_1, arg_13);
|
|
845
|
+
return combine(ofArray([fn_4, argument_4, unknown("unknown-call", resultType)]));
|
|
846
|
+
}
|
|
847
|
+
else {
|
|
848
|
+
const invoke = (_arg_14) => {
|
|
849
|
+
if (_arg_14.tag === 1) {
|
|
850
|
+
const signature = _arg_14.fields[3];
|
|
851
|
+
const name_8 = _arg_14.fields[0];
|
|
852
|
+
const external = _arg_14.fields[2];
|
|
853
|
+
const arity_1 = _arg_14.fields[1] | 0;
|
|
854
|
+
const arguments$_1 = append(_arg_14.fields[4], singleton(argument_4));
|
|
855
|
+
if (length(arguments$_1) >= arity_1) {
|
|
856
|
+
const returned = (count_2_mut, typ_8_mut) => {
|
|
857
|
+
returned:
|
|
858
|
+
while (true) {
|
|
859
|
+
const count_2 = count_2_mut, typ_8 = typ_8_mut;
|
|
860
|
+
if (count_2 === 0) {
|
|
861
|
+
return typ_8;
|
|
862
|
+
}
|
|
863
|
+
else if (typ_8.tag === 11) {
|
|
864
|
+
count_2_mut = (count_2 - 1);
|
|
865
|
+
typ_8_mut = typ_8.fields[1];
|
|
866
|
+
continue returned;
|
|
867
|
+
}
|
|
868
|
+
else {
|
|
869
|
+
return resultType;
|
|
870
|
+
}
|
|
871
|
+
break;
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
return invokeFunction(span_1)(returned(arity_1, signature))(name_8)(external)(arguments$_1);
|
|
875
|
+
}
|
|
876
|
+
else {
|
|
877
|
+
const bind$0040_4 = combine(arguments$_1);
|
|
878
|
+
return new AbstractValue(bind$0040_4.Resources, bind$0040_4.Fields, singleton(new Callable(/* Function */ 1, [name_8, arity_1, external, signature, arguments$_1])), bind$0040_4.Tasks, bind$0040_4.Count);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
else {
|
|
882
|
+
const id_3 = _arg_14.fields[0] | 0;
|
|
883
|
+
if (addToSet(id_3, activeCalls)) {
|
|
884
|
+
const previous_2 = callSites;
|
|
885
|
+
callSites = cons(span_1, previous_2);
|
|
886
|
+
try {
|
|
887
|
+
return evaluate(add(_arg_14.fields[1].SymbolId, argument_4, _arg_14.fields[3].contents))(_arg_14.fields[2]);
|
|
888
|
+
}
|
|
889
|
+
finally {
|
|
890
|
+
callSites = previous_2;
|
|
891
|
+
activeCalls.delete(id_3);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
else {
|
|
895
|
+
return combine(ofArray([fn_4, argument_4, unknown("recursive:" + int32ToString(id_3), resultType)]));
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
const matchValue_23 = fn_4.Callables;
|
|
900
|
+
let matchResult_4, only, alternatives_1;
|
|
901
|
+
if (!isEmpty(matchValue_23)) {
|
|
902
|
+
if (isEmpty(tail_2(matchValue_23))) {
|
|
903
|
+
matchResult_4 = 0;
|
|
904
|
+
only = head(matchValue_23);
|
|
905
|
+
}
|
|
906
|
+
else {
|
|
907
|
+
matchResult_4 = 1;
|
|
908
|
+
alternatives_1 = matchValue_23;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
else {
|
|
912
|
+
matchResult_4 = 1;
|
|
913
|
+
alternatives_1 = matchValue_23;
|
|
914
|
+
}
|
|
915
|
+
switch (matchResult_4) {
|
|
916
|
+
case 0:
|
|
917
|
+
return invoke(only);
|
|
918
|
+
default:
|
|
919
|
+
return branches(map((callable_1) => (() => invoke(callable_1)), alternatives_1));
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
})));
|
|
923
|
+
const invokeFunction = (span_2) => ((resultType_1) => ((name_9) => ((external_1) => ((arguments$_2) => {
|
|
924
|
+
let option_26;
|
|
925
|
+
let matchResult_5, thunk, value_39;
|
|
926
|
+
switch (name_9) {
|
|
927
|
+
case "Task.spawn": {
|
|
928
|
+
if (!isEmpty(arguments$_2)) {
|
|
929
|
+
if (isEmpty(tail_2(arguments$_2))) {
|
|
930
|
+
matchResult_5 = 0;
|
|
931
|
+
thunk = head(arguments$_2);
|
|
932
|
+
}
|
|
933
|
+
else {
|
|
934
|
+
matchResult_5 = 2;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
else {
|
|
938
|
+
matchResult_5 = 2;
|
|
939
|
+
}
|
|
940
|
+
break;
|
|
941
|
+
}
|
|
942
|
+
case "Task.await": {
|
|
943
|
+
if (!isEmpty(arguments$_2)) {
|
|
944
|
+
if (isEmpty(tail_2(arguments$_2))) {
|
|
945
|
+
matchResult_5 = 1;
|
|
946
|
+
value_39 = head(arguments$_2);
|
|
947
|
+
}
|
|
948
|
+
else {
|
|
949
|
+
matchResult_5 = 2;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
else {
|
|
953
|
+
matchResult_5 = 2;
|
|
954
|
+
}
|
|
955
|
+
break;
|
|
956
|
+
}
|
|
957
|
+
default:
|
|
958
|
+
matchResult_5 = 2;
|
|
959
|
+
}
|
|
960
|
+
switch (matchResult_5) {
|
|
961
|
+
case 0: {
|
|
962
|
+
const task_1 = task | 0;
|
|
963
|
+
const clock_3 = clock;
|
|
964
|
+
tick();
|
|
965
|
+
const forkClock = clock;
|
|
966
|
+
nextTask = ((nextTask + 1) | 0);
|
|
967
|
+
const child_1 = nextTask | 0;
|
|
968
|
+
task = (child_1 | 0);
|
|
969
|
+
clock = add(child_1, 0, forkClock);
|
|
970
|
+
access(defaultArg(tryHead(callSites), span_2), thunk.Resources);
|
|
971
|
+
const result_1 = apply(span_2)((resultType_1.tag === 6) ? resultType_1.fields[0] : Type.TUnit)(thunk)(empty);
|
|
972
|
+
tasks.set(child_1, [clock, result_1]);
|
|
973
|
+
task = (task_1 | 0);
|
|
974
|
+
clock = mergeClock(clock_3, forkClock);
|
|
975
|
+
tick();
|
|
976
|
+
return new AbstractValue(empty.Resources, empty.Fields, empty.Callables, singleton_1(child_1, {
|
|
977
|
+
Compare: (x_23, y_23) => (comparePrimitives(x_23, y_23) | 0),
|
|
978
|
+
}), empty.Count);
|
|
979
|
+
}
|
|
980
|
+
case 1: {
|
|
981
|
+
const completed = choose((id_4) => {
|
|
982
|
+
let matchValue_25;
|
|
983
|
+
let outArg_2 = defaultOf();
|
|
984
|
+
matchValue_25 = [tryGetValue(tasks, id_4, new FSharpRef(() => outArg_2, (v_2) => {
|
|
985
|
+
outArg_2 = v_2;
|
|
986
|
+
})), outArg_2];
|
|
987
|
+
if (matchValue_25[0]) {
|
|
988
|
+
return matchValue_25[1];
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
return undefined;
|
|
992
|
+
}
|
|
993
|
+
}, toList(value_39.Tasks));
|
|
994
|
+
if (!isEmpty(completed)) {
|
|
995
|
+
clock = mergeClock(clock, commonClock(map((tuple_12) => tuple_12[0], completed)));
|
|
996
|
+
}
|
|
997
|
+
tick();
|
|
998
|
+
return combine(map((tuple_13) => tuple_13[1], completed));
|
|
999
|
+
}
|
|
1000
|
+
default: {
|
|
1001
|
+
const inputs = combine(arguments$_2);
|
|
1002
|
+
if (external_1 && !contains(name_9, safeFunctions)) {
|
|
1003
|
+
const arg_17 = add_1(new Resource("function:" + name_9, name_9, true), inputs.Resources);
|
|
1004
|
+
access(span_2, arg_17);
|
|
1005
|
+
}
|
|
1006
|
+
const parameterTypes = (_arg_15) => {
|
|
1007
|
+
if (_arg_15.tag === 11) {
|
|
1008
|
+
return cons(_arg_15.fields[0], parameterTypes(_arg_15.fields[1]));
|
|
1009
|
+
}
|
|
1010
|
+
else {
|
|
1011
|
+
return empty_3();
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
const signature_1 = defaultArg((option_26 = tryFind(name_9, builtinSchemes), (option_26 != null) ? parameterTypes(option_26.fields[1]) : undefined), empty_3());
|
|
1015
|
+
const items_1 = combine(map(contents, filter((value_41) => isEmpty(value_41.Callables), arguments$_2)));
|
|
1016
|
+
const callbackResults = collect((tupledArg_10) => {
|
|
1017
|
+
let option_29, option_32;
|
|
1018
|
+
const callback = tupledArg_10[1];
|
|
1019
|
+
const callbackParameters = defaultArg((option_29 = tryItem(tupledArg_10[0], signature_1), (option_29 != null) ? parameterTypes(option_29) : undefined), empty_3());
|
|
1020
|
+
if (isEmpty(callback.Callables) ? true : isEmpty(callbackParameters)) {
|
|
1021
|
+
return empty_3();
|
|
1022
|
+
}
|
|
1023
|
+
else {
|
|
1024
|
+
const iterations = ((name_9.startsWith("List.") ? true : name_9.startsWith("Map.")) ? defaultArg((option_32 = tryPick((_arg_17) => _arg_17.Count, arguments$_2), (option_32 != null) ? min(2, option_32) : undefined), 2) : 1) | 0;
|
|
1025
|
+
return toList_2(delay(() => collect_1((matchValue_26) => singleton_2(fold((fn_5, typ_12) => apply(span_2)(typ_12)(fn_5)(items_1), callback, callbackParameters)), rangeDouble(1, 1, iterations))));
|
|
1026
|
+
}
|
|
1027
|
+
}, indexed(arguments$_2));
|
|
1028
|
+
const result_4 = unknown("result:" + name_9, resultType_1);
|
|
1029
|
+
let matchResult_6;
|
|
1030
|
+
switch (resultType_1.tag) {
|
|
1031
|
+
case 0:
|
|
1032
|
+
case 1:
|
|
1033
|
+
case 2:
|
|
1034
|
+
case 3:
|
|
1035
|
+
case 4:
|
|
1036
|
+
case 14: {
|
|
1037
|
+
matchResult_6 = 0;
|
|
1038
|
+
break;
|
|
1039
|
+
}
|
|
1040
|
+
case 5: {
|
|
1041
|
+
matchResult_6 = 1;
|
|
1042
|
+
break;
|
|
1043
|
+
}
|
|
1044
|
+
case 10: {
|
|
1045
|
+
matchResult_6 = 2;
|
|
1046
|
+
break;
|
|
1047
|
+
}
|
|
1048
|
+
case 9: {
|
|
1049
|
+
matchResult_6 = 3;
|
|
1050
|
+
break;
|
|
1051
|
+
}
|
|
1052
|
+
case 11: {
|
|
1053
|
+
if (external_1) {
|
|
1054
|
+
matchResult_6 = 4;
|
|
1055
|
+
}
|
|
1056
|
+
else {
|
|
1057
|
+
matchResult_6 = 5;
|
|
1058
|
+
}
|
|
1059
|
+
break;
|
|
1060
|
+
}
|
|
1061
|
+
default:
|
|
1062
|
+
matchResult_6 = 5;
|
|
1063
|
+
}
|
|
1064
|
+
switch (matchResult_6) {
|
|
1065
|
+
case 0:
|
|
1066
|
+
return empty;
|
|
1067
|
+
case 1:
|
|
1068
|
+
return container("$items", tryPick((_arg_18) => _arg_18.Count, arguments$_2), contains_1(name_9, ofArray(["List.map", "List.choose", "List.collect"]), {
|
|
1069
|
+
Equals: (x_24, y_24) => (x_24 === y_24),
|
|
1070
|
+
GetHashCode: (x_24) => (stringHash(x_24) | 0),
|
|
1071
|
+
}) ? combine(map(contents, callbackResults)) : combine(ofArray([items_1, contents(result_4)])));
|
|
1072
|
+
case 2:
|
|
1073
|
+
return container("$value", undefined, (name_9 === "Option.map") ? combine(callbackResults) : combine(ofArray([items_1, contents(result_4)])));
|
|
1074
|
+
case 3:
|
|
1075
|
+
return container("$items", undefined, combine(ofArrayWithTail([contents(inputs), result_4], callbackResults)));
|
|
1076
|
+
case 4: {
|
|
1077
|
+
const arity_2 = (_arg_19) => {
|
|
1078
|
+
if (_arg_19.tag === 11) {
|
|
1079
|
+
return (1 + arity_2(_arg_19.fields[1])) | 0;
|
|
1080
|
+
}
|
|
1081
|
+
else {
|
|
1082
|
+
return 0;
|
|
1083
|
+
}
|
|
1084
|
+
};
|
|
1085
|
+
const bind$0040_5 = combine(ofArray([result_4, inputs]));
|
|
1086
|
+
return new AbstractValue(bind$0040_5.Resources, bind$0040_5.Fields, singleton(new Callable(/* Function */ 1, [name_9 + " (returned function)", arity_2(resultType_1), true, resultType_1, empty_3()])), bind$0040_5.Tasks, bind$0040_5.Count);
|
|
1087
|
+
}
|
|
1088
|
+
default:
|
|
1089
|
+
return combine(ofArrayWithTail([result_4, inputs], callbackResults));
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
}))));
|
|
1094
|
+
let environment = empty_2({
|
|
1095
|
+
Compare: (x_25, y_25) => (comparePrimitives(x_25, y_25) | 0),
|
|
1096
|
+
});
|
|
1097
|
+
const entryFunctions = [];
|
|
1098
|
+
const remember = (binding_7, value_46) => {
|
|
1099
|
+
environment = add(binding_7.SymbolId, value_46, environment);
|
|
1100
|
+
if (!isEmpty(value_46.Callables)) {
|
|
1101
|
+
void (entryFunctions.push([value_46, binding_7.Type, binding_7.Span]));
|
|
1102
|
+
}
|
|
1103
|
+
};
|
|
1104
|
+
const enumerator_9 = getEnumerator(program.ResolvedStatements);
|
|
1105
|
+
try {
|
|
1106
|
+
while (enumerator_9["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1107
|
+
const matchValue_27 = enumerator_9["System.Collections.Generic.IEnumerator`1.get_Current"]().Node;
|
|
1108
|
+
switch (matchValue_27.tag) {
|
|
1109
|
+
case 1: {
|
|
1110
|
+
const declaration_2 = matchValue_27.fields[0];
|
|
1111
|
+
const value_47 = evaluate(environment)(declaration_2.Value);
|
|
1112
|
+
remember(declaration_2.Binding, value_47);
|
|
1113
|
+
if (declaration_2.IsRecursive) {
|
|
1114
|
+
wireRecursive(environment)(singleton(value_47));
|
|
1115
|
+
}
|
|
1116
|
+
break;
|
|
1117
|
+
}
|
|
1118
|
+
case 3: {
|
|
1119
|
+
const values_22 = map((declaration_3) => [declaration_3, evaluate(environment)(declaration_3.Value)], matchValue_27.fields[0]);
|
|
1120
|
+
const enumerator_10 = getEnumerator(values_22);
|
|
1121
|
+
try {
|
|
1122
|
+
while (enumerator_10["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1123
|
+
const forLoopVar_5 = enumerator_10["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1124
|
+
remember(forLoopVar_5[0].Binding, forLoopVar_5[1]);
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
finally {
|
|
1128
|
+
disposeSafe(enumerator_10);
|
|
1129
|
+
}
|
|
1130
|
+
wireRecursive(environment)(map((tuple_14) => tuple_14[1], values_22));
|
|
1131
|
+
break;
|
|
1132
|
+
}
|
|
1133
|
+
case 2: {
|
|
1134
|
+
const declaration_5 = matchValue_27.fields[0];
|
|
1135
|
+
const value_49 = evaluate(environment)(declaration_5.Value);
|
|
1136
|
+
const bound = bindPattern(environment, declaration_5.Pattern, value_49);
|
|
1137
|
+
const bindings_1 = (pattern_6_mut) => {
|
|
1138
|
+
bindings_1:
|
|
1139
|
+
while (true) {
|
|
1140
|
+
const pattern_6 = pattern_6_mut;
|
|
1141
|
+
let option_35;
|
|
1142
|
+
const matchValue_28 = pattern_6.Node;
|
|
1143
|
+
let matchResult_7, binding_8, patterns_1, fields_7, a_2, b_2, item_4, entries_2, tail_1;
|
|
1144
|
+
switch (matchValue_28.tag) {
|
|
1145
|
+
case 1: {
|
|
1146
|
+
matchResult_7 = 0;
|
|
1147
|
+
binding_8 = matchValue_28.fields[0];
|
|
1148
|
+
break;
|
|
1149
|
+
}
|
|
1150
|
+
case 5: {
|
|
1151
|
+
matchResult_7 = 1;
|
|
1152
|
+
patterns_1 = matchValue_28.fields[0];
|
|
1153
|
+
break;
|
|
1154
|
+
}
|
|
1155
|
+
case 6: {
|
|
1156
|
+
matchResult_7 = 2;
|
|
1157
|
+
fields_7 = matchValue_28.fields[0];
|
|
1158
|
+
break;
|
|
1159
|
+
}
|
|
1160
|
+
case 4: {
|
|
1161
|
+
matchResult_7 = 3;
|
|
1162
|
+
a_2 = matchValue_28.fields[0];
|
|
1163
|
+
b_2 = matchValue_28.fields[1];
|
|
1164
|
+
break;
|
|
1165
|
+
}
|
|
1166
|
+
case 8: {
|
|
1167
|
+
matchResult_7 = 4;
|
|
1168
|
+
item_4 = matchValue_28.fields[0];
|
|
1169
|
+
break;
|
|
1170
|
+
}
|
|
1171
|
+
case 10: {
|
|
1172
|
+
if (matchValue_28.fields[2] != null) {
|
|
1173
|
+
matchResult_7 = 4;
|
|
1174
|
+
item_4 = matchValue_28.fields[2];
|
|
1175
|
+
}
|
|
1176
|
+
else {
|
|
1177
|
+
matchResult_7 = 6;
|
|
1178
|
+
}
|
|
1179
|
+
break;
|
|
1180
|
+
}
|
|
1181
|
+
case 7: {
|
|
1182
|
+
matchResult_7 = 5;
|
|
1183
|
+
entries_2 = matchValue_28.fields[0];
|
|
1184
|
+
tail_1 = matchValue_28.fields[1];
|
|
1185
|
+
break;
|
|
1186
|
+
}
|
|
1187
|
+
default:
|
|
1188
|
+
matchResult_7 = 6;
|
|
1189
|
+
}
|
|
1190
|
+
switch (matchResult_7) {
|
|
1191
|
+
case 0:
|
|
1192
|
+
return singleton(binding_8);
|
|
1193
|
+
case 1:
|
|
1194
|
+
return collect(bindings_1, patterns_1);
|
|
1195
|
+
case 2:
|
|
1196
|
+
return collect((arg_18) => bindings_1(arg_18[1]), fields_7);
|
|
1197
|
+
case 3:
|
|
1198
|
+
return append(bindings_1(a_2), bindings_1(b_2));
|
|
1199
|
+
case 4: {
|
|
1200
|
+
pattern_6_mut = item_4;
|
|
1201
|
+
continue bindings_1;
|
|
1202
|
+
}
|
|
1203
|
+
case 5:
|
|
1204
|
+
return append(collect((tupledArg_11) => append(bindings_1(tupledArg_11[0]), bindings_1(tupledArg_11[1])), entries_2), defaultArg((option_35 = tail_1, (option_35 != null) ? bindings_1(option_35) : undefined), empty_3()));
|
|
1205
|
+
default:
|
|
1206
|
+
return empty_3();
|
|
1207
|
+
}
|
|
1208
|
+
break;
|
|
1209
|
+
}
|
|
1210
|
+
};
|
|
1211
|
+
const patternIds = ofList(map((binding_9) => [binding_9.Name, binding_9.SymbolId], bindings_1(declaration_5.Pattern)), {
|
|
1212
|
+
Compare: (x_26, y_26) => (comparePrimitives(x_26, y_26) | 0),
|
|
1213
|
+
});
|
|
1214
|
+
environment = fold((env_9, tupledArg_12) => {
|
|
1215
|
+
let option_38;
|
|
1216
|
+
const binding_10 = tupledArg_12[0];
|
|
1217
|
+
return add(binding_10.SymbolId, defaultArg((option_38 = tryFind(binding_10.Name, patternIds), (option_38 != null) ? tryFind(option_38, bound) : undefined), value_49), env_9);
|
|
1218
|
+
}, bound, declaration_5.Bindings);
|
|
1219
|
+
break;
|
|
1220
|
+
}
|
|
1221
|
+
case 5: {
|
|
1222
|
+
evaluate(environment)(matchValue_27.fields[0]);
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
default:
|
|
1226
|
+
undefined;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
finally {
|
|
1231
|
+
disposeSafe(enumerator_9);
|
|
1232
|
+
}
|
|
1233
|
+
let enumerator_11 = getEnumerator(entryFunctions);
|
|
1234
|
+
try {
|
|
1235
|
+
while (enumerator_11["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1236
|
+
const forLoopVar_6 = enumerator_11["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1237
|
+
const span_3 = forLoopVar_6[2];
|
|
1238
|
+
histories.clear();
|
|
1239
|
+
tasks.clear();
|
|
1240
|
+
activeCalls.clear();
|
|
1241
|
+
task = 0;
|
|
1242
|
+
clock = ofList(singleton([0, 0]), {
|
|
1243
|
+
Compare: (x_27, y_27) => (comparePrimitives(x_27, y_27) | 0),
|
|
1244
|
+
});
|
|
1245
|
+
const enter = (value_55_mut, typ_14_mut, index_4_mut) => {
|
|
1246
|
+
enter:
|
|
1247
|
+
while (true) {
|
|
1248
|
+
const value_55 = value_55_mut, typ_14 = typ_14_mut, index_4 = index_4_mut;
|
|
1249
|
+
if (typ_14.tag === 11) {
|
|
1250
|
+
const result_6 = typ_14.fields[1];
|
|
1251
|
+
value_55_mut = apply(span_3)(result_6)(value_55)(unknown((("entry:" + int32ToString(index_4)) + ":") + int32ToString(span_3.Start.Line), typ_14.fields[0]));
|
|
1252
|
+
typ_14_mut = result_6;
|
|
1253
|
+
index_4_mut = (index_4 + 1);
|
|
1254
|
+
continue enter;
|
|
1255
|
+
}
|
|
1256
|
+
break;
|
|
1257
|
+
}
|
|
1258
|
+
};
|
|
1259
|
+
enter(forLoopVar_6[0], forLoopVar_6[1], 0);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
finally {
|
|
1263
|
+
disposeSafe(enumerator_11);
|
|
1264
|
+
}
|
|
1265
|
+
return toList_2(sortBy((diagnostic) => [diagnostic.Span.Start.File, diagnostic.Span.Start.Line, diagnostic.Span.Start.Column, diagnostic.Code, diagnostic.RelatedSpan.Start.Line], distinct_1(diagnostics, {
|
|
1266
|
+
Equals: equals,
|
|
1267
|
+
GetHashCode: (x_28) => (safeHash(x_28) | 0),
|
|
1268
|
+
}), {
|
|
1269
|
+
Compare: (x_29, y_29) => (compareArrays(x_29, y_29) | 0),
|
|
1270
|
+
}));
|
|
1271
|
+
}
|
|
1272
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"Version":"5.13.0","FableOptions":{"TypedArrays":true,"ClampByteArrays":false,"Language":["JavaScript"],"Define":["FABLE_COMPILER","FABLE_COMPILER_5","FABLE_COMPILER_JAVASCRIPT"],"DebugMode":false,"OptimizeFSharpAst":false,"Verbosity":["Normal"],"FileExtension":".js","TriggeredByDependency":false,"NoReflection":false},"ProjectPath":"/home/runner/work/FScript/FScript/src/FScript.JavaScript/FScript.JavaScript.fsproj","SourcePaths":["/home/runner/work/FScript/FScript/src/FScript.Language/Span.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Error.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Token.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Ast.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Types.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Value.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Lexer.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Parser.fs","/home/runner/work/FScript/FScript/src/FScript.Language/IncludeResolver.fs","/home/runner/work/FScript/FScript/src/FScript.Language/BuiltinTypes.fs","/home/runner/work/FScript/FScript/src/FScript.Language/HostInterop.fs","/home/runner/work/FScript/FScript/src/FScript.Language/BuiltinSignatures.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Execution.fs","/home/runner/work/FScript/FScript/src/FScript.Language/BuiltinFunctions.fs","/home/runner/work/FScript/FScript/src/FScript.Language/TypeInfer.fs","/home/runner/work/FScript/FScript/src/FScript.Language/ExportSignatures.fs","/home/runner/work/FScript/FScript/src/FScript.Language/TaskFunctions.fs","/home/runner/work/FScript/FScript/src/FScript.Language/DebugHooks.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Eval.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Interactive.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Pretty.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Library.fs","/home/runner/work/FScript/FScript/src/FScript.JavaScript/Library.fs"],"FSharpOptions":["--define:FABLE_COMPILER","--define:FABLE_COMPILER_5","--define:FABLE_COMPILER_JAVASCRIPT","--define:TRACE","--define:RELEASE","--define:NETSTANDARD","--define:NETSTANDARD2_1","--define:NETSTANDARD1_0_OR_GREATER","--define:NETSTANDARD1_1_OR_GREATER","--define:NETSTANDARD1_2_OR_GREATER","--define:NETSTANDARD1_3_OR_GREATER","--define:NETSTANDARD1_4_OR_GREATER","--define:NETSTANDARD1_5_OR_GREATER","--define:NETSTANDARD1_6_OR_GREATER","--define:NETSTANDARD2_0_OR_GREATER","--define:NETSTANDARD2_1_OR_GREATER","--define:NULLABLE","--langversion:preview","--nowarn:FS0988","--noframework","--nologo","--simpleresolution","--nocopyfsharpcore","--nowin32manifest","--warn:3","--fullpaths","--flaterrors","--optimize-","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ValueTuple.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Threading.Thread.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Threading.Tasks.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Threading.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Text.RegularExpressions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Text.Encoding.Extensions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Text.Encoding.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.Numerics.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.InteropServices.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.Extensions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Reflection.Primitives.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Reflection.Extensions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Reflection.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Numerics.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Net.Requests.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.IO.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Globalization.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Diagnostics.Tracing.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Diagnostics.Tools.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Diagnostics.Debug.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Core.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Console.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ComponentModel.TypeConverter.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ComponentModel.Primitives.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ComponentModel.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Collections.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Collections.Concurrent.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/netstandard.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/mscorlib.dll","-r:/home/runner/.nuget/packages/fable.core/5.3.0/lib/netstandard2.0/Fable.Core.dll","-r:/home/runner/.nuget/packages/fable/5.13.0/tools/net10.0/any/FSharp.Core.dll"],"References":["/home/runner/work/FScript/FScript/src/FScript.Language/FScript.Language.fsproj"],"OutDir":["Some","/home/runner/work/FScript/FScript/src/FScript.JavaScript/dist"],"FableLibDir":"/home/runner/work/FScript/FScript/src/FScript.JavaScript/dist/fable_modules/fable-library-js.5.13.0","FableModulesDir":"/home/runner/work/FScript/FScript/src/FScript.JavaScript/dist/fable_modules","OutputType":["Library"],"TargetFramework":["Some","netstandard2.1"],"Exclude":[],"SourceMaps":false,"SourceMapsRoot":null,"TreatWarningsAsErrors":true}
|
|
1
|
+
{"Version":"5.13.0","FableOptions":{"TypedArrays":true,"ClampByteArrays":false,"Language":["JavaScript"],"Define":["FABLE_COMPILER","FABLE_COMPILER_5","FABLE_COMPILER_JAVASCRIPT"],"DebugMode":false,"OptimizeFSharpAst":false,"Verbosity":["Normal"],"FileExtension":".js","TriggeredByDependency":false,"NoReflection":false},"ProjectPath":"/home/runner/work/FScript/FScript/src/FScript.JavaScript/FScript.JavaScript.fsproj","SourcePaths":["/home/runner/work/FScript/FScript/src/FScript.Language/Span.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Error.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Token.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Ast.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Types.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Value.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Lexer.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Parser.fs","/home/runner/work/FScript/FScript/src/FScript.Language/IncludeResolver.fs","/home/runner/work/FScript/FScript/src/FScript.Language/BuiltinTypes.fs","/home/runner/work/FScript/FScript/src/FScript.Language/HostInterop.fs","/home/runner/work/FScript/FScript/src/FScript.Language/BuiltinSignatures.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Execution.fs","/home/runner/work/FScript/FScript/src/FScript.Language/BuiltinFunctions.fs","/home/runner/work/FScript/FScript/src/FScript.Language/TypeInfer.fs","/home/runner/work/FScript/FScript/src/FScript.Language/TaskSharingAnalysis.fs","/home/runner/work/FScript/FScript/src/FScript.Language/ExportSignatures.fs","/home/runner/work/FScript/FScript/src/FScript.Language/TaskFunctions.fs","/home/runner/work/FScript/FScript/src/FScript.Language/DebugHooks.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Eval.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Interactive.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Pretty.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Library.fs","/home/runner/work/FScript/FScript/src/FScript.JavaScript/Library.fs"],"FSharpOptions":["--define:FABLE_COMPILER","--define:FABLE_COMPILER_5","--define:FABLE_COMPILER_JAVASCRIPT","--define:TRACE","--define:RELEASE","--define:NETSTANDARD","--define:NETSTANDARD2_1","--define:NETSTANDARD1_0_OR_GREATER","--define:NETSTANDARD1_1_OR_GREATER","--define:NETSTANDARD1_2_OR_GREATER","--define:NETSTANDARD1_3_OR_GREATER","--define:NETSTANDARD1_4_OR_GREATER","--define:NETSTANDARD1_5_OR_GREATER","--define:NETSTANDARD1_6_OR_GREATER","--define:NETSTANDARD2_0_OR_GREATER","--define:NETSTANDARD2_1_OR_GREATER","--define:NULLABLE","--langversion:preview","--nowarn:FS0988","--noframework","--nologo","--simpleresolution","--nocopyfsharpcore","--nowin32manifest","--warn:3","--fullpaths","--flaterrors","--optimize-","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ValueTuple.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Threading.Thread.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Threading.Tasks.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Threading.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Text.RegularExpressions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Text.Encoding.Extensions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Text.Encoding.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.Numerics.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.InteropServices.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.Extensions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Reflection.Primitives.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Reflection.Extensions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Reflection.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Numerics.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Net.Requests.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.IO.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Globalization.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Diagnostics.Tracing.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Diagnostics.Tools.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Diagnostics.Debug.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Core.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Console.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ComponentModel.TypeConverter.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ComponentModel.Primitives.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ComponentModel.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Collections.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Collections.Concurrent.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/netstandard.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/mscorlib.dll","-r:/home/runner/.nuget/packages/fable.core/5.3.0/lib/netstandard2.0/Fable.Core.dll","-r:/home/runner/.nuget/packages/fable/5.13.0/tools/net10.0/any/FSharp.Core.dll"],"References":["/home/runner/work/FScript/FScript/src/FScript.Language/FScript.Language.fsproj"],"OutDir":["Some","/home/runner/work/FScript/FScript/src/FScript.JavaScript/dist"],"FableLibDir":"/home/runner/work/FScript/FScript/src/FScript.JavaScript/dist/fable_modules/fable-library-js.5.13.0","FableModulesDir":"/home/runner/work/FScript/FScript/src/FScript.JavaScript/dist/fable_modules","OutputType":["Library"],"TargetFramework":["Some","netstandard2.1"],"Exclude":[],"SourceMaps":false,"SourceMapsRoot":null,"TreatWarningsAsErrors":true}
|