@magnusopera/fscript 0.93.0 → 0.94.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,528 @@
|
|
|
1
|
+
|
|
2
|
+
import { Record } from "../fable_modules/fable-library-js.5.27.0/Types.js";
|
|
3
|
+
import { array_type, string_type, record_type, option_type, class_type, int32_type } from "../fable_modules/fable-library-js.5.27.0/Reflection.js";
|
|
4
|
+
import { intersect, FSharpSet__get_IsEmpty, add as add_1, contains, fold as fold_2, union, empty } from "../fable_modules/fable-library-js.5.27.0/Set.js";
|
|
5
|
+
import { compare, equals, curry2, uncurry2, comparePrimitives } from "../fable_modules/fable-library-js.5.27.0/Util.js";
|
|
6
|
+
import { remove, FSharpMap__Remove, FSharpMap__Add, FSharpMap__TryFind, FSharpMap__ContainsKey, filter, ofList, values as values_3, map, tryFind, add, fold as fold_1, empty as empty_1 } from "../fable_modules/fable-library-js.5.27.0/Map.js";
|
|
7
|
+
import { exists, choose, fold as fold_3, map as map_2, toList } from "../fable_modules/fable-library-js.5.27.0/Seq.js";
|
|
8
|
+
import { exists as exists_1, min, choose as choose_1, forAll, filter as filter_1, singleton, map as map_1, head, tail, isEmpty, fold } from "../fable_modules/fable-library-js.5.27.0/List.js";
|
|
9
|
+
import { toArray, defaultArg } from "../fable_modules/fable-library-js.5.27.0/Option.js";
|
|
10
|
+
import { Scheme, Scheme_$reflection, Types_expand, Type, Types_ftvType } from "./Types.js";
|
|
11
|
+
import { min as min_1 } from "../fable_modules/fable-library-js.5.27.0/Double.js";
|
|
12
|
+
|
|
13
|
+
export class OpaqueEffect extends Record {
|
|
14
|
+
constructor(Live, Latent, FactoryDelay) {
|
|
15
|
+
super();
|
|
16
|
+
this.Live = Live;
|
|
17
|
+
this.Latent = Latent;
|
|
18
|
+
this.FactoryDelay = FactoryDelay;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function OpaqueEffect_$reflection() {
|
|
23
|
+
return record_type("FScript.Language.OpaqueInference.OpaqueEffect", [], OpaqueEffect, () => [["Live", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [int32_type])], ["Latent", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [int32_type, class_type("Microsoft.FSharp.Collections.FSharpSet`1", [int32_type])])], ["FactoryDelay", option_type(int32_type)]]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const noOpaque = new OpaqueEffect(empty({
|
|
27
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
28
|
+
}), empty_1({
|
|
29
|
+
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
30
|
+
}), undefined);
|
|
31
|
+
|
|
32
|
+
export function combineOpaqueEffects(effects) {
|
|
33
|
+
const effects_1 = toList(effects);
|
|
34
|
+
const combined_1 = fold((combined, effect) => (new OpaqueEffect(union(combined.Live, effect.Live), fold_1((latent, depth, variables) => add(depth, union(defaultArg(tryFind(depth, latent), empty({
|
|
35
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
36
|
+
})), variables), latent), combined.Latent, effect.Latent), undefined)), noOpaque, effects_1);
|
|
37
|
+
let matchResult, effect_1;
|
|
38
|
+
if (!isEmpty(effects_1)) {
|
|
39
|
+
if (isEmpty(tail(effects_1))) {
|
|
40
|
+
matchResult = 0;
|
|
41
|
+
effect_1 = head(effects_1);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
matchResult = 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
matchResult = 1;
|
|
49
|
+
}
|
|
50
|
+
switch (matchResult) {
|
|
51
|
+
case 0:
|
|
52
|
+
return new OpaqueEffect(combined_1.Live, combined_1.Latent, effect_1.FactoryDelay);
|
|
53
|
+
default:
|
|
54
|
+
return combined_1;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function mapOpaqueEffect(mapType, effect) {
|
|
59
|
+
const apply = (variables) => fold_2((result, variable) => union(result, Types_ftvType(mapType(new Type(/* TVar */ 17, [variable])))), empty({
|
|
60
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
61
|
+
}), variables);
|
|
62
|
+
return new OpaqueEffect(apply(effect.Live), map(uncurry2((_arg) => apply), effect.Latent), effect.FactoryDelay);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function opaqueVariables(typeDefs, typ) {
|
|
66
|
+
const collect = (visited, typ_1) => {
|
|
67
|
+
if (contains(typ_1, visited)) {
|
|
68
|
+
return empty({
|
|
69
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const nested = curry2(collect)(add_1(typ_1, visited));
|
|
74
|
+
let matchResult, item, fields;
|
|
75
|
+
switch (typ_1.tag) {
|
|
76
|
+
case 13: {
|
|
77
|
+
matchResult = 0;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
case 12: {
|
|
81
|
+
matchResult = 1;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
case 11: {
|
|
85
|
+
matchResult = 2;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case 5: {
|
|
89
|
+
matchResult = 3;
|
|
90
|
+
item = typ_1.fields[0];
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case 10: {
|
|
94
|
+
matchResult = 3;
|
|
95
|
+
item = typ_1.fields[0];
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
case 6: {
|
|
99
|
+
matchResult = 3;
|
|
100
|
+
item = typ_1.fields[0];
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
case 7: {
|
|
104
|
+
matchResult = 4;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
case 8: {
|
|
108
|
+
matchResult = 5;
|
|
109
|
+
fields = typ_1.fields[0];
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case 20: {
|
|
113
|
+
matchResult = 5;
|
|
114
|
+
fields = typ_1.fields[1];
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
case 15: {
|
|
118
|
+
matchResult = 6;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
case 9: {
|
|
122
|
+
matchResult = 7;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
default:
|
|
126
|
+
matchResult = 8;
|
|
127
|
+
}
|
|
128
|
+
switch (matchResult) {
|
|
129
|
+
case 0: {
|
|
130
|
+
const matchValue = tryFind(typ_1.fields[0], typeDefs);
|
|
131
|
+
let matchResult_1;
|
|
132
|
+
if (matchValue != null) {
|
|
133
|
+
if (matchValue.tag === 14) {
|
|
134
|
+
if (matchValue.fields[1].tag === 19) {
|
|
135
|
+
matchResult_1 = 0;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
matchResult_1 = 1;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
matchResult_1 = 1;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
matchResult_1 = 1;
|
|
147
|
+
}
|
|
148
|
+
switch (matchResult_1) {
|
|
149
|
+
case 0: {
|
|
150
|
+
const list_1 = map_1(Types_ftvType, typ_1.fields[1]);
|
|
151
|
+
return fold(union, empty({
|
|
152
|
+
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
153
|
+
}), list_1);
|
|
154
|
+
}
|
|
155
|
+
default: {
|
|
156
|
+
const expanded = Types_expand(typeDefs, typ_1);
|
|
157
|
+
if (equals(expanded, typ_1)) {
|
|
158
|
+
return empty({
|
|
159
|
+
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
return nested(expanded);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
case 1: {
|
|
169
|
+
const expanded_1 = Types_expand(typeDefs, typ_1);
|
|
170
|
+
if (equals(expanded_1, typ_1)) {
|
|
171
|
+
return empty({
|
|
172
|
+
Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
return nested(expanded_1);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
case 2:
|
|
180
|
+
return empty({
|
|
181
|
+
Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
|
|
182
|
+
});
|
|
183
|
+
case 3:
|
|
184
|
+
return nested(item);
|
|
185
|
+
case 4: {
|
|
186
|
+
const list_3 = map_1(nested, typ_1.fields[0]);
|
|
187
|
+
return fold(union, empty({
|
|
188
|
+
Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
|
|
189
|
+
}), list_3);
|
|
190
|
+
}
|
|
191
|
+
case 5: {
|
|
192
|
+
const source_1 = map_2(nested, values_3(fields));
|
|
193
|
+
return fold_3(union, empty({
|
|
194
|
+
Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
|
|
195
|
+
}), source_1);
|
|
196
|
+
}
|
|
197
|
+
case 6: {
|
|
198
|
+
const source_4 = map_2(nested, choose((x_7) => x_7, values_3(typ_1.fields[1])));
|
|
199
|
+
return fold_3(union, empty({
|
|
200
|
+
Compare: (x_8, y_7) => (comparePrimitives(x_8, y_7) | 0),
|
|
201
|
+
}), source_4);
|
|
202
|
+
}
|
|
203
|
+
case 7:
|
|
204
|
+
return union(nested(typ_1.fields[0]), nested(typ_1.fields[1]));
|
|
205
|
+
default:
|
|
206
|
+
return empty({
|
|
207
|
+
Compare: (x_9, y_8) => (comparePrimitives(x_9, y_8) | 0),
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
return collect(empty({
|
|
213
|
+
Compare: (x_10, y_9) => (compare(x_10, y_9) | 0),
|
|
214
|
+
}), typ);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export function recursiveOpaqueEffects(effects) {
|
|
218
|
+
const combined = combineOpaqueEffects(effects);
|
|
219
|
+
let latent;
|
|
220
|
+
const source = values_3(combined.Latent);
|
|
221
|
+
latent = fold_3(union, empty({
|
|
222
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
223
|
+
}), source);
|
|
224
|
+
return new OpaqueEffect(combined.Live, FSharpSet__get_IsEmpty(latent) ? empty_1({
|
|
225
|
+
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
226
|
+
}) : ofList(singleton([1, latent]), {
|
|
227
|
+
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
228
|
+
}), combined.FactoryDelay);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export function retainOpaqueEffect(typ, effect) {
|
|
232
|
+
const variables = Types_ftvType(typ);
|
|
233
|
+
return new OpaqueEffect(intersect(variables, effect.Live), filter((_arg_1, variables_1) => !FSharpSet__get_IsEmpty(variables_1), map((_arg, set$) => intersect(variables, set$), effect.Latent)), effect.FactoryDelay);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export class InferenceEnv extends Record {
|
|
237
|
+
constructor(Schemes, OpaqueEffects, Frames) {
|
|
238
|
+
super();
|
|
239
|
+
this.Schemes = Schemes;
|
|
240
|
+
this.OpaqueEffects = OpaqueEffects;
|
|
241
|
+
this.Frames = Frames;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export function InferenceEnv_$reflection() {
|
|
246
|
+
return record_type("FScript.Language.OpaqueInference.InferenceEnv", [], InferenceEnv, () => [["Schemes", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, Scheme_$reflection()])], ["OpaqueEffects", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, OpaqueEffect_$reflection()])], ["Frames", array_type(array_type(OpaqueEffect_$reflection()))]]);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export function InferenceEnv__ContainsKey_Z721C83C5(env, name) {
|
|
250
|
+
return FSharpMap__ContainsKey(env.Schemes, name);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export function InferenceEnv__TryFind_Z721C83C5(env, name) {
|
|
254
|
+
return FSharpMap__TryFind(env.Schemes, name);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export function InferenceEnv__Add_Z72D39050(env, name, scheme) {
|
|
258
|
+
return new InferenceEnv(FSharpMap__Add(env.Schemes, name, scheme), FSharpMap__Remove(env.OpaqueEffects, name), env.Frames);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export function InferenceEnv__AddValue_Z1D943954(env, name, scheme, effect) {
|
|
262
|
+
const effect_1 = retainOpaqueEffect(scheme.fields[1], effect);
|
|
263
|
+
return new InferenceEnv(FSharpMap__Add(env.Schemes, name, scheme), equals(effect_1, noOpaque) ? FSharpMap__Remove(env.OpaqueEffects, name) : FSharpMap__Add(env.OpaqueEffects, name, effect_1), env.Frames);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function generalizeValue(typeDefs, effect, generalize, typ) {
|
|
267
|
+
const patternInput = generalize(typ);
|
|
268
|
+
const live = union(effect.Live, opaqueVariables(typeDefs, typ));
|
|
269
|
+
return new Scheme(filter_1((variable) => !contains(variable, live), patternInput.fields[0]), patternInput.fields[1]);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export function factoryDelay(known_mut, expression_mut) {
|
|
273
|
+
factoryDelay:
|
|
274
|
+
while (true) {
|
|
275
|
+
const known = known_mut, expression = expression_mut;
|
|
276
|
+
let matchValue_8, matchValue_9;
|
|
277
|
+
const delay = (expression_1) => factoryDelay(known, expression_1);
|
|
278
|
+
const all = (values) => {
|
|
279
|
+
let matchValue;
|
|
280
|
+
const delays = map_1(delay, values);
|
|
281
|
+
if (forAll((option) => (option != null), delays)) {
|
|
282
|
+
return (matchValue = choose_1((x) => x, delays), isEmpty(matchValue) ? 0 : min(matchValue, {
|
|
283
|
+
Compare: (x_1, y) => (comparePrimitives(x_1, y) | 0),
|
|
284
|
+
}));
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
return undefined;
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
let matchResult, value_1, value_2, body_1, parameter, argument_1, fn_1, condition, left, right, items, fields, body_2, name_1, value_3, cases, target;
|
|
291
|
+
switch (expression.tag) {
|
|
292
|
+
case 2:
|
|
293
|
+
case 0:
|
|
294
|
+
case 1:
|
|
295
|
+
case 28:
|
|
296
|
+
case 29:
|
|
297
|
+
case 30: {
|
|
298
|
+
matchResult = 1;
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
case 3: {
|
|
302
|
+
matchResult = 0;
|
|
303
|
+
value_1 = expression.fields[0];
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
case 4: {
|
|
307
|
+
matchResult = 2;
|
|
308
|
+
value_2 = expression.fields[0];
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
case 22: {
|
|
312
|
+
matchResult = 2;
|
|
313
|
+
value_2 = expression.fields[0];
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
case 27: {
|
|
317
|
+
matchResult = 2;
|
|
318
|
+
value_2 = expression.fields[0];
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
case 5: {
|
|
322
|
+
matchResult = 3;
|
|
323
|
+
body_1 = expression.fields[1];
|
|
324
|
+
parameter = expression.fields[0];
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
case 6: {
|
|
328
|
+
matchResult = 4;
|
|
329
|
+
argument_1 = expression.fields[1];
|
|
330
|
+
fn_1 = expression.fields[0];
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
case 26: {
|
|
334
|
+
if (expression.fields[0] === "|>") {
|
|
335
|
+
matchResult = 4;
|
|
336
|
+
argument_1 = expression.fields[1];
|
|
337
|
+
fn_1 = expression.fields[2];
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
matchResult = 10;
|
|
341
|
+
}
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
case 7: {
|
|
345
|
+
matchResult = 5;
|
|
346
|
+
condition = expression.fields[0];
|
|
347
|
+
left = expression.fields[1];
|
|
348
|
+
right = expression.fields[2];
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
case 16: {
|
|
352
|
+
matchResult = 6;
|
|
353
|
+
items = expression.fields[0];
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
case 14: {
|
|
357
|
+
matchResult = 6;
|
|
358
|
+
items = expression.fields[0];
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
case 17: {
|
|
362
|
+
matchResult = 7;
|
|
363
|
+
fields = expression.fields[0];
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
case 18: {
|
|
367
|
+
matchResult = 7;
|
|
368
|
+
fields = expression.fields[0];
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
case 11: {
|
|
372
|
+
if (expression.fields[3]) {
|
|
373
|
+
matchResult = 10;
|
|
374
|
+
}
|
|
375
|
+
else if (delay(expression.fields[1]) != null) {
|
|
376
|
+
matchResult = 8;
|
|
377
|
+
body_2 = expression.fields[2];
|
|
378
|
+
name_1 = expression.fields[0];
|
|
379
|
+
value_3 = expression.fields[1];
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
matchResult = 10;
|
|
383
|
+
}
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
case 10: {
|
|
387
|
+
matchResult = 9;
|
|
388
|
+
cases = expression.fields[1];
|
|
389
|
+
target = expression.fields[0];
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
default:
|
|
393
|
+
matchResult = 10;
|
|
394
|
+
}
|
|
395
|
+
switch (matchResult) {
|
|
396
|
+
case 0:
|
|
397
|
+
return delay(value_1);
|
|
398
|
+
case 1:
|
|
399
|
+
return 0;
|
|
400
|
+
case 2:
|
|
401
|
+
return delay(value_2);
|
|
402
|
+
case 3: {
|
|
403
|
+
const option_2 = factoryDelay(FSharpMap__Remove(known, parameter.Name), body_1);
|
|
404
|
+
if (option_2 != null) {
|
|
405
|
+
return 1 + option_2;
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
return undefined;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
case 4: {
|
|
412
|
+
const matchValue_1 = forwardingFunction(known, fn_1);
|
|
413
|
+
const matchValue_2 = delay(argument_1);
|
|
414
|
+
let matchResult_1, argumentDelay, functionDelay;
|
|
415
|
+
if (matchValue_1 != null) {
|
|
416
|
+
if (matchValue_2 != null) {
|
|
417
|
+
matchResult_1 = 0;
|
|
418
|
+
argumentDelay = matchValue_2;
|
|
419
|
+
functionDelay = matchValue_1;
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
matchResult_1 = 1;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
matchResult_1 = 1;
|
|
427
|
+
}
|
|
428
|
+
switch (matchResult_1) {
|
|
429
|
+
case 0:
|
|
430
|
+
return functionDelay + argumentDelay;
|
|
431
|
+
default:
|
|
432
|
+
return undefined;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
case 5: {
|
|
436
|
+
const matchValue_4 = delay(condition);
|
|
437
|
+
const matchValue_5 = delay(left);
|
|
438
|
+
const matchValue_6 = delay(right);
|
|
439
|
+
let matchResult_2, left_1, right_1;
|
|
440
|
+
if (matchValue_4 != null) {
|
|
441
|
+
if (matchValue_5 != null) {
|
|
442
|
+
if (matchValue_6 != null) {
|
|
443
|
+
matchResult_2 = 0;
|
|
444
|
+
left_1 = matchValue_5;
|
|
445
|
+
right_1 = matchValue_6;
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
matchResult_2 = 1;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
matchResult_2 = 1;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
matchResult_2 = 1;
|
|
457
|
+
}
|
|
458
|
+
switch (matchResult_2) {
|
|
459
|
+
case 0:
|
|
460
|
+
return min_1(left_1, right_1);
|
|
461
|
+
default:
|
|
462
|
+
return undefined;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
case 6:
|
|
466
|
+
return all(items);
|
|
467
|
+
case 7:
|
|
468
|
+
return all(map_1((tuple) => tuple[1], fields));
|
|
469
|
+
case 8: {
|
|
470
|
+
known_mut = ((matchValue_8 = forwardingFunction(known, value_3), (matchValue_8 == null) ? FSharpMap__Remove(known, name_1) : FSharpMap__Add(known, name_1, matchValue_8)));
|
|
471
|
+
expression_mut = body_2;
|
|
472
|
+
continue factoryDelay;
|
|
473
|
+
}
|
|
474
|
+
case 9: {
|
|
475
|
+
const branches = map_1((tupledArg) => {
|
|
476
|
+
if (exists((value_5) => (factoryDelay(empty_1({
|
|
477
|
+
Compare: (x_3, y_2) => (comparePrimitives(x_3, y_2) | 0),
|
|
478
|
+
}), value_5) == null), toArray(tupledArg[1]))) {
|
|
479
|
+
return undefined;
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
return factoryDelay(empty_1({
|
|
483
|
+
Compare: (x_4, y_3) => (comparePrimitives(x_4, y_3) | 0),
|
|
484
|
+
}), tupledArg[2]);
|
|
485
|
+
}
|
|
486
|
+
}, cases);
|
|
487
|
+
if ((delay(target) == null) ? true : exists_1((option_4) => (option_4 == null), branches)) {
|
|
488
|
+
return undefined;
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
return (matchValue_9 = choose_1((x_5) => x_5, branches), isEmpty(matchValue_9) ? 0 : min(matchValue_9, {
|
|
492
|
+
Compare: (x_6, y_4) => (comparePrimitives(x_6, y_4) | 0),
|
|
493
|
+
}));
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
default:
|
|
497
|
+
return undefined;
|
|
498
|
+
}
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
export function forwardingFunction(known_mut, expression_mut) {
|
|
504
|
+
forwardingFunction:
|
|
505
|
+
while (true) {
|
|
506
|
+
const known = known_mut, expression = expression_mut;
|
|
507
|
+
switch (expression.tag) {
|
|
508
|
+
case 3: {
|
|
509
|
+
known_mut = known;
|
|
510
|
+
expression_mut = expression.fields[0];
|
|
511
|
+
continue forwardingFunction;
|
|
512
|
+
}
|
|
513
|
+
case 2:
|
|
514
|
+
return tryFind(expression.fields[0], known);
|
|
515
|
+
case 4: {
|
|
516
|
+
known_mut = known;
|
|
517
|
+
expression_mut = expression.fields[0];
|
|
518
|
+
continue forwardingFunction;
|
|
519
|
+
}
|
|
520
|
+
case 5:
|
|
521
|
+
return factoryDelay(remove(expression.fields[0].Name, known), expression.fields[1]);
|
|
522
|
+
default:
|
|
523
|
+
return undefined;
|
|
524
|
+
}
|
|
525
|
+
break;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|