@magnusopera/fscript 0.86.2 → 0.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FScript.Language/BuiltinFunctions.js +81 -48
- package/dist/FScript.Language/Eval.js +47 -55
- package/dist/FScript.Language/Lexer.js +10 -2
- package/dist/FScript.Language/Parser.js +8 -8
- package/dist/FScript.Language/TaskSharingAnalysis.js +191 -181
- package/dist/FScript.Language/TypeInfer.js +182 -162
- package/package.json +1 -1
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
|
|
2
2
|
import { Span_$reflection, Span, Position } from "./Span.js";
|
|
3
|
-
import { find
|
|
4
|
-
import { curry2, curry3, uncurry2, compare, disposeSafe, getEnumerator, Exception, stringHash, compareArrays, equals, comparePrimitives } from "../fable_modules/fable-library-js.5.24.0/Util.js";
|
|
3
|
+
import { find, toSeq, containsKey, iterate as iterate_2, FSharpMap__Add, values as values_4, FSharpMap__get_Keys, keys, toList, FSharpMap__get_Item, FSharpMap__get_Count, forAll, FSharpMap__ContainsKey, filter, ofList, exists as exists_1, add, fold as fold_1, remove, map, FSharpMap__TryFind, tryFind, isEmpty, empty } from "../fable_modules/fable-library-js.5.24.0/Map.js";
|
|
4
|
+
import { defaultOf, safeHash, curry2, curry3, uncurry2, arrayHash, equalArrays, compare, disposeSafe, getEnumerator, Exception, stringHash, compareArrays, equals, comparePrimitives } from "../fable_modules/fable-library-js.5.24.0/Util.js";
|
|
5
5
|
import { PurityContractsModule_empty, Types_generalize, Types_freshNumeric, PurityContracts_$reflection, Scheme_$reflection, Type_$reflection, Types_freshVar, Types_typeToString, Scheme, Type as Type_1 } from "./Types.js";
|
|
6
|
-
import { exactlyOne, replicate, map2, sortBy, mapIndexed, tryFind as tryFind_1, indexed, collect, unzip, append, reverse, iterate, tryFindIndex, choose, tail as
|
|
6
|
+
import { exactlyOne, replicate, map2, sortBy, mapIndexed, tryFind as tryFind_1, indexed, collect, unzip, append, reverse, iterate, tryFindIndex, choose, tail as tail_6, cons, head as head_4, isEmpty as isEmpty_1, empty as empty_2, ofArray, singleton, zip, length, exists, fold, map as map_1 } from "../fable_modules/fable-library-js.5.24.0/List.js";
|
|
7
7
|
import { toList as toList_2, ofSeq, contains, add as add_1, empty as empty_1, FSharpSet__Add, FSharpSet__Contains } from "../fable_modules/fable-library-js.5.24.0/Set.js";
|
|
8
8
|
import { EvalException, TypeException, TypeError$ } from "./Error.js";
|
|
9
9
|
import { endsWith, split, join, concat, isNullOrWhiteSpace, printf, toText } from "../fable_modules/fable-library-js.5.24.0/String.js";
|
|
10
10
|
import { orElse, value as value_42, toArray, flatten, defaultArg } from "../fable_modules/fable-library-js.5.24.0/Option.js";
|
|
11
|
-
import { Union, Record } from "../fable_modules/fable-library-js.5.24.0/Types.js";
|
|
11
|
+
import { FSharpRef, Union, Record } from "../fable_modules/fable-library-js.5.24.0/Types.js";
|
|
12
12
|
import { Attribute, Expr, Ast_spanOfPattern, Ast_spanOfExpr, Attribute_$reflection, BackendImport_$reflection, Pattern_$reflection, TypeDef_$reflection, Expr_$reflection } from "./Ast.js";
|
|
13
13
|
import { array_type, class_type, tuple_type, list_type, bool_type, float64_type, int64_type, option_type, union_type, int32_type, string_type, record_type } from "../fable_modules/fable-library-js.5.24.0/Reflection.js";
|
|
14
|
-
import { exists as exists_2, forAll as forAll_1, tryPick, tryFind as tryFind_2,
|
|
15
|
-
import { last as last_2, setItem, item as
|
|
14
|
+
import { exists as exists_2, forAll as forAll_1, tryPick, tryFind as tryFind_2, foldBack, iterate as iterate_1, filter as filter_1, map as map_2, toList as toList_1 } from "../fable_modules/fable-library-js.5.24.0/Seq.js";
|
|
15
|
+
import { last as last_2, setItem, item as item_22 } from "../fable_modules/fable-library-js.5.24.0/Array.js";
|
|
16
16
|
import { distinct } from "../fable_modules/fable-library-js.5.24.0/Seq2.js";
|
|
17
17
|
import { builtinReservedNames, builtinSchemes } from "./BuiltinSignatures.js";
|
|
18
18
|
import { ofExterns, typeDefinitions } from "./HostInterop.js";
|
|
19
19
|
import { typeDefs as typeDefs_2 } from "./BuiltinTypes.js";
|
|
20
|
+
import { Dictionary } from "../fable_modules/fable-library-js.5.24.0/MutableMap.js";
|
|
20
21
|
import { rangeDouble } from "../fable_modules/fable-library-js.5.24.0/Range.js";
|
|
22
|
+
import { tryGetValue, getItemFromDict, addToDict } from "../fable_modules/fable-library-js.5.24.0/MapUtil.js";
|
|
21
23
|
|
|
22
24
|
const unknownSpan = new Span(new Position(undefined, 0, 0), new Position(undefined, 0, 0));
|
|
23
25
|
|
|
@@ -1849,7 +1851,7 @@ function withLocalBindings(telemetry, names, work) {
|
|
|
1849
1851
|
if (isEmpty_1(matchValue_1)) {
|
|
1850
1852
|
}
|
|
1851
1853
|
else {
|
|
1852
|
-
t.ScopeStack =
|
|
1854
|
+
t.ScopeStack = tail_6(matchValue_1);
|
|
1853
1855
|
}
|
|
1854
1856
|
}
|
|
1855
1857
|
}
|
|
@@ -1883,7 +1885,7 @@ function applySubstToCapturedLocals(telemetry, startIndex, subst) {
|
|
|
1883
1885
|
if (telemetry != null) {
|
|
1884
1886
|
const t = telemetry;
|
|
1885
1887
|
for (let i = startIndex; i <= (t.LocalVariableTypes.length - 1); i++) {
|
|
1886
|
-
const entry =
|
|
1888
|
+
const entry = item_22(i, t.LocalVariableTypes);
|
|
1887
1889
|
entry.Type = applyType(subst, entry.Type);
|
|
1888
1890
|
}
|
|
1889
1891
|
}
|
|
@@ -1895,7 +1897,7 @@ function applySubstToCapturedExpressions(telemetry, startIndex, subst) {
|
|
|
1895
1897
|
else {
|
|
1896
1898
|
const t = telemetry;
|
|
1897
1899
|
for (let i = startIndex; i <= (t.ExpressionTypes.length - 1); i++) {
|
|
1898
|
-
const item =
|
|
1900
|
+
const item = item_22(i, t.ExpressionTypes);
|
|
1899
1901
|
setItem(t.ExpressionTypes, i, new ResolvedExpressionType(item.Expr, applyType(subst, item.Type), item.Span));
|
|
1900
1902
|
}
|
|
1901
1903
|
}
|
|
@@ -1979,7 +1981,7 @@ function resolveNamedRecordByShape(typeDefs, shape, span) {
|
|
|
1979
1981
|
if (isEmpty_1(matches)) {
|
|
1980
1982
|
throw new TypeException(new TypeError$(concat("No declared record type matches shape ", Types_typeToString(new Type_1(/* TRecord */ 8, [shape]))), span));
|
|
1981
1983
|
}
|
|
1982
|
-
else if (isEmpty_1(
|
|
1984
|
+
else if (isEmpty_1(tail_6(matches))) {
|
|
1983
1985
|
return new Type_1(/* TNamed */ 12, [head_4(matches)]);
|
|
1984
1986
|
}
|
|
1985
1987
|
else {
|
|
@@ -2015,7 +2017,7 @@ function resolveNamedRecordByFieldSet(typeDefs, fields, span) {
|
|
|
2015
2017
|
if (isEmpty_1(matches)) {
|
|
2016
2018
|
throw new TypeException(new TypeError$(concat("No declared record type matches fields ", concat("{ ", join("; ", toList_2(fields)), " }")), span));
|
|
2017
2019
|
}
|
|
2018
|
-
else if (isEmpty_1(
|
|
2020
|
+
else if (isEmpty_1(tail_6(matches))) {
|
|
2019
2021
|
return head_4(matches);
|
|
2020
2022
|
}
|
|
2021
2023
|
else {
|
|
@@ -2045,7 +2047,7 @@ function resolveReferencedTypeName(knownNames, name, span) {
|
|
|
2045
2047
|
if (isEmpty_1(matches)) {
|
|
2046
2048
|
return name;
|
|
2047
2049
|
}
|
|
2048
|
-
else if (isEmpty_1(
|
|
2050
|
+
else if (isEmpty_1(tail_6(matches))) {
|
|
2049
2051
|
return head_4(matches);
|
|
2050
2052
|
}
|
|
2051
2053
|
else {
|
|
@@ -2939,13 +2941,13 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2939
2941
|
const item_1 = enumerator_5["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
2940
2942
|
const patternInput_27 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sAcc_3, env), item_1);
|
|
2941
2943
|
sAcc_3 = compose(patternInput_27[0], sAcc_3);
|
|
2942
|
-
inferred_1 =
|
|
2944
|
+
inferred_1 = cons(applyType(sAcc_3, patternInput_27[1]), inferred_1);
|
|
2943
2945
|
}
|
|
2944
2946
|
}
|
|
2945
2947
|
finally {
|
|
2946
2948
|
disposeSafe(enumerator_5);
|
|
2947
2949
|
}
|
|
2948
|
-
const tRes_6 = new Type_1(/* TTuple */ 7, [inferred_1]);
|
|
2950
|
+
const tRes_6 = new Type_1(/* TTuple */ 7, [reverse(inferred_1)]);
|
|
2949
2951
|
return [sAcc_3, tRes_6, asTyped(telemetry, expr, tRes_6)];
|
|
2950
2952
|
}
|
|
2951
2953
|
case 16: {
|
|
@@ -4031,12 +4033,16 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4031
4033
|
}), expressions);
|
|
4032
4034
|
let nextSymbol = 0;
|
|
4033
4035
|
const symbols = [];
|
|
4036
|
+
const symbolsByLocation = new Dictionary([], {
|
|
4037
|
+
Equals: equalArrays,
|
|
4038
|
+
GetHashCode: (x_1) => (arrayHash(x_1) | 0),
|
|
4039
|
+
});
|
|
4034
4040
|
const references = [];
|
|
4035
4041
|
const patternBindingIds = [];
|
|
4036
4042
|
const normalizeTypeVariables = (value_3) => {
|
|
4037
4043
|
let next = 0;
|
|
4038
4044
|
let mapping_3 = empty({
|
|
4039
|
-
Compare: (
|
|
4045
|
+
Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
|
|
4040
4046
|
});
|
|
4041
4047
|
const normalize_1 = (_arg_5) => {
|
|
4042
4048
|
let matchValue_1;
|
|
@@ -4137,8 +4143,8 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4137
4143
|
let option_5, _arg, variables, mapping_1, normalize;
|
|
4138
4144
|
const id_2 = nextSymbol | 0;
|
|
4139
4145
|
nextSymbol = ((nextSymbol + 1) | 0);
|
|
4140
|
-
|
|
4141
|
-
Compare: (
|
|
4146
|
+
const symbol = new ResolvedSymbol(id_2, name_2, kind, span, (option_5 = scheme, (option_5 != null) ? ((_arg = option_5, (variables = _arg.fields[0], (mapping_1 = ofList(mapIndexed((index, variable) => [variable, index], variables), {
|
|
4147
|
+
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
4142
4148
|
}), (normalize = ((_arg_1) => {
|
|
4143
4149
|
switch (_arg_1.tag) {
|
|
4144
4150
|
case 15: {
|
|
@@ -4175,15 +4181,20 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4175
4181
|
default:
|
|
4176
4182
|
return _arg_1;
|
|
4177
4183
|
}
|
|
4178
|
-
}), new Scheme(toList_1(rangeDouble(0, 1, length(variables) - 1)), normalize(_arg.fields[1]))))))) : undefined))
|
|
4184
|
+
}), new Scheme(toList_1(rangeDouble(0, 1, length(variables) - 1)), normalize(_arg.fields[1]))))))) : undefined));
|
|
4185
|
+
void (symbols.push(symbol));
|
|
4186
|
+
const key_2 = [kind, name_2, span];
|
|
4187
|
+
if (!symbolsByLocation.has(key_2)) {
|
|
4188
|
+
addToDict(symbolsByLocation, key_2, symbol);
|
|
4189
|
+
}
|
|
4179
4190
|
return id_2 | 0;
|
|
4180
4191
|
};
|
|
4181
4192
|
const syntheticSpan = new Span(new Position(undefined, 0, 0), new Position(undefined, 0, 0));
|
|
4182
4193
|
let globalEnvironment = empty({
|
|
4183
|
-
Compare: (
|
|
4194
|
+
Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
|
|
4184
4195
|
});
|
|
4185
4196
|
const enumerator = getEnumerator(sortBy((tuple) => tuple[0], toList(builtinSchemes), {
|
|
4186
|
-
Compare: (
|
|
4197
|
+
Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
|
|
4187
4198
|
}));
|
|
4188
4199
|
try {
|
|
4189
4200
|
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
@@ -4196,7 +4207,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4196
4207
|
disposeSafe(enumerator);
|
|
4197
4208
|
}
|
|
4198
4209
|
const enumerator_1 = getEnumerator(sortBy((_arg_9) => _arg_9.Name, externs, {
|
|
4199
|
-
Compare: (
|
|
4210
|
+
Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
|
|
4200
4211
|
}));
|
|
4201
4212
|
try {
|
|
4202
4213
|
while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
|
|
@@ -4265,7 +4276,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4265
4276
|
case 1: {
|
|
4266
4277
|
const name_5 = statement.fields[0];
|
|
4267
4278
|
globalEnvironment = add(name_5, allocate(name_5, ResolvedSymbolKind.DeclarationSymbol, statement.fields[5], Types_generalize(empty({
|
|
4268
|
-
Compare: (
|
|
4279
|
+
Compare: (x_7, y_7) => (comparePrimitives(x_7, y_7) | 0),
|
|
4269
4280
|
}), statement.fields[2])), globalEnvironment);
|
|
4270
4281
|
break;
|
|
4271
4282
|
}
|
|
@@ -4276,7 +4287,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4276
4287
|
const forLoopVar_5 = enumerator_8["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
4277
4288
|
const name_6 = forLoopVar_5[0];
|
|
4278
4289
|
globalEnvironment = add(name_6, allocate(name_6, ResolvedSymbolKind.DeclarationSymbol, statement.fields[4], Types_generalize(empty({
|
|
4279
|
-
Compare: (
|
|
4290
|
+
Compare: (x_8, y_8) => (comparePrimitives(x_8, y_8) | 0),
|
|
4280
4291
|
}), forLoopVar_5[1])), globalEnvironment);
|
|
4281
4292
|
}
|
|
4282
4293
|
}
|
|
@@ -4292,7 +4303,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4292
4303
|
const forLoopVar_6 = enumerator_9["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
4293
4304
|
const name_7 = forLoopVar_6[0];
|
|
4294
4305
|
globalEnvironment = add(name_7, allocate(name_7, ResolvedSymbolKind.DeclarationSymbol, forLoopVar_6[3], Types_generalize(empty({
|
|
4295
|
-
Compare: (
|
|
4306
|
+
Compare: (x_9, y_9) => (comparePrimitives(x_9, y_9) | 0),
|
|
4296
4307
|
}), forLoopVar_6[2])), globalEnvironment);
|
|
4297
4308
|
}
|
|
4298
4309
|
}
|
|
@@ -4335,7 +4346,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4335
4346
|
const option_8 = tryFind(name_9, environment);
|
|
4336
4347
|
if (option_8 != null) {
|
|
4337
4348
|
const id_6 = option_8 | 0;
|
|
4338
|
-
const symbol_1 =
|
|
4349
|
+
const symbol_1 = item_22(id_6, symbols);
|
|
4339
4350
|
void (references.push(new ResolvedSymbolReference(id_6, name_9, symbol_1.Kind, normalizeTypeVariables(defaultArg(tryFind(expression, expressionTypes), Type_1.TUnit)), span_5)));
|
|
4340
4351
|
}
|
|
4341
4352
|
};
|
|
@@ -4396,7 +4407,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4396
4407
|
}
|
|
4397
4408
|
};
|
|
4398
4409
|
return bind(empty({
|
|
4399
|
-
Compare: (
|
|
4410
|
+
Compare: (x_10, y_10) => (comparePrimitives(x_10, y_10) | 0),
|
|
4400
4411
|
}), environment_1, pattern)[1];
|
|
4401
4412
|
};
|
|
4402
4413
|
const visit = (environment_2_mut, expression_1_mut) => {
|
|
@@ -4406,7 +4417,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4406
4417
|
const visitSame = (item_13) => {
|
|
4407
4418
|
visit(environment_2, item_13);
|
|
4408
4419
|
};
|
|
4409
|
-
let matchResult_1, name_11, span_8, name_12, span_9, name_13, span_10, body, parameter, argument_2, fn, condition, whenFalse, whenTrue, binding, body_1, name_14, recursive, span_11, binding_1, body_2, pattern_2, bindings_9, body_3, cases_3, target, body_5, name_16,
|
|
4420
|
+
let matchResult_1, name_11, span_8, name_12, span_9, name_13, span_10, body, parameter, argument_2, fn, condition, whenFalse, whenTrue, binding, body_1, name_14, recursive, span_11, binding_1, body_2, pattern_2, bindings_9, body_3, cases_3, target, body_5, name_16, source, span_14, items_3, fields_5, entries, fields_6, target_1, fieldName_1, moduleName_1, span_15, target_2, item_14, first, last, parts;
|
|
4410
4421
|
switch (expression_1.tag) {
|
|
4411
4422
|
case 0:
|
|
4412
4423
|
case 1:
|
|
@@ -4501,7 +4512,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4501
4512
|
matchResult_1 = 10;
|
|
4502
4513
|
body_5 = expression_1.fields[2];
|
|
4503
4514
|
name_16 = expression_1.fields[0];
|
|
4504
|
-
|
|
4515
|
+
source = expression_1.fields[1];
|
|
4505
4516
|
span_14 = expression_1.fields[3];
|
|
4506
4517
|
break;
|
|
4507
4518
|
}
|
|
@@ -4679,7 +4690,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4679
4690
|
break;
|
|
4680
4691
|
}
|
|
4681
4692
|
case 10: {
|
|
4682
|
-
visitSame(
|
|
4693
|
+
visitSame(source);
|
|
4683
4694
|
environment_2_mut = add(name_16, allocate(name_16, ResolvedSymbolKind.LocalSymbol, span_14, undefined), environment_2);
|
|
4684
4695
|
expression_1_mut = body_5;
|
|
4685
4696
|
continue visit;
|
|
@@ -4746,14 +4757,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4746
4757
|
break;
|
|
4747
4758
|
}
|
|
4748
4759
|
};
|
|
4749
|
-
const allocated = (kind_2, name_17, span_16) => (
|
|
4750
|
-
if (equals(symbol_2.Kind, kind_2) && (symbol_2.Name === name_17)) {
|
|
4751
|
-
return equals(symbol_2.Span, span_16);
|
|
4752
|
-
}
|
|
4753
|
-
else {
|
|
4754
|
-
return false;
|
|
4755
|
-
}
|
|
4756
|
-
}, symbols).SymbolId | 0);
|
|
4760
|
+
const allocated = (kind_2, name_17, span_16) => (getItemFromDict(symbolsByLocation, [kind_2, name_17, span_16]).SymbolId | 0);
|
|
4757
4761
|
let resolutionEnvironment = builtinEnvironment;
|
|
4758
4762
|
const enumerator_12 = getEnumerator(typed);
|
|
4759
4763
|
try {
|
|
@@ -4826,23 +4830,46 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4826
4830
|
disposeSafe(enumerator_12);
|
|
4827
4831
|
}
|
|
4828
4832
|
const resolvedReferences = toList_1(references);
|
|
4829
|
-
|
|
4833
|
+
const referenceOccurrences = new Dictionary([], {
|
|
4834
|
+
Equals: equals,
|
|
4835
|
+
GetHashCode: (x_11) => (safeHash(x_11) | 0),
|
|
4836
|
+
});
|
|
4837
|
+
const enumerator_15 = getEnumerator(resolvedReferences);
|
|
4838
|
+
try {
|
|
4839
|
+
while (enumerator_15["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4840
|
+
const reference = enumerator_15["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
4841
|
+
let matchValue_3;
|
|
4842
|
+
let outArg = defaultOf();
|
|
4843
|
+
matchValue_3 = [tryGetValue(referenceOccurrences, reference.Span, new FSharpRef(() => outArg, (v) => {
|
|
4844
|
+
outArg = v;
|
|
4845
|
+
})), outArg];
|
|
4846
|
+
if (matchValue_3[0]) {
|
|
4847
|
+
void (matchValue_3[1].push(reference));
|
|
4848
|
+
}
|
|
4849
|
+
else {
|
|
4850
|
+
addToDict(referenceOccurrences, reference.Span, [reference]);
|
|
4851
|
+
}
|
|
4852
|
+
}
|
|
4853
|
+
}
|
|
4854
|
+
finally {
|
|
4855
|
+
disposeSafe(enumerator_15);
|
|
4856
|
+
}
|
|
4830
4857
|
const finalType = (expression_6) => normalizeTypeVariables(defaultArg(tryFind(expression_6, expressionTypes), Type_1.TUnit));
|
|
4831
|
-
const declarations = ofList(append(map_1((definition_4) => [definition_4.Name, definition_4], typeDefs_2), choose((
|
|
4832
|
-
if (
|
|
4833
|
-
const definition_5 =
|
|
4858
|
+
const declarations = ofList(append(map_1((definition_4) => [definition_4.Name, definition_4], typeDefs_2), choose((_arg_21) => {
|
|
4859
|
+
if (_arg_21.tag === 0) {
|
|
4860
|
+
const definition_5 = _arg_21.fields[0];
|
|
4834
4861
|
return [definition_5.Name, definition_5];
|
|
4835
4862
|
}
|
|
4836
4863
|
else {
|
|
4837
4864
|
return undefined;
|
|
4838
4865
|
}
|
|
4839
4866
|
}, typed)), {
|
|
4840
|
-
Compare: (
|
|
4867
|
+
Compare: (x_12, y_12) => (comparePrimitives(x_12, y_12) | 0),
|
|
4841
4868
|
});
|
|
4842
4869
|
const resolvedTypeDefinitions = fold_1((state_5, name_23, definition_7) => add(name_23, definition_7, state_5), map((name_22, definition_6) => {
|
|
4843
4870
|
if (isEmpty_1(definition_6.Cases)) {
|
|
4844
4871
|
return new Type_1(/* TRecord */ 8, [ofList(map_1((tupledArg_8) => [tupledArg_8[0], typeFromRef(declarations, singleton(name_22), tupledArg_8[1])], definition_6.Fields), {
|
|
4845
|
-
Compare: (
|
|
4872
|
+
Compare: (x_13, y_13) => (comparePrimitives(x_13, y_13) | 0),
|
|
4846
4873
|
})]);
|
|
4847
4874
|
}
|
|
4848
4875
|
else {
|
|
@@ -4850,30 +4877,23 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4850
4877
|
let option_17;
|
|
4851
4878
|
return [tupledArg_9[0], (option_17 = tupledArg_9[1], (option_17 != null) ? typeFromRef(declarations, singleton(name_22), option_17) : undefined)];
|
|
4852
4879
|
}, definition_6.Cases), {
|
|
4853
|
-
Compare: (
|
|
4880
|
+
Compare: (x_14, y_14) => (comparePrimitives(x_14, y_14) | 0),
|
|
4854
4881
|
})]);
|
|
4855
4882
|
}
|
|
4856
4883
|
}, declarations), hostDefinitions);
|
|
4857
|
-
const resolvedLiteral = (
|
|
4858
|
-
switch (
|
|
4884
|
+
const resolvedLiteral = (_arg_22) => {
|
|
4885
|
+
switch (_arg_22.tag) {
|
|
4859
4886
|
case 1:
|
|
4860
|
-
return new ResolvedLiteral(/* ResolvedFloat */ 2, [
|
|
4887
|
+
return new ResolvedLiteral(/* ResolvedFloat */ 2, [_arg_22.fields[0]]);
|
|
4861
4888
|
case 2:
|
|
4862
|
-
return new ResolvedLiteral(/* ResolvedBool */ 3, [
|
|
4889
|
+
return new ResolvedLiteral(/* ResolvedBool */ 3, [_arg_22.fields[0]]);
|
|
4863
4890
|
case 3:
|
|
4864
|
-
return new ResolvedLiteral(/* ResolvedString */ 4, [
|
|
4891
|
+
return new ResolvedLiteral(/* ResolvedString */ 4, [_arg_22.fields[0]]);
|
|
4865
4892
|
default:
|
|
4866
|
-
return new ResolvedLiteral(/* ResolvedInt */ 1, [
|
|
4893
|
+
return new ResolvedLiteral(/* ResolvedInt */ 1, [_arg_22.fields[0]]);
|
|
4867
4894
|
}
|
|
4868
4895
|
};
|
|
4869
|
-
const symbolAt = (kind_3, name_24, span_21) =>
|
|
4870
|
-
if (equals(symbol_3.Kind, kind_3) && (symbol_3.Name === name_24)) {
|
|
4871
|
-
return equals(symbol_3.Span, span_21);
|
|
4872
|
-
}
|
|
4873
|
-
else {
|
|
4874
|
-
return false;
|
|
4875
|
-
}
|
|
4876
|
-
}, symbols);
|
|
4896
|
+
const symbolAt = (kind_3, name_24, span_21) => getItemFromDict(symbolsByLocation, [kind_3, name_24, span_21]);
|
|
4877
4897
|
const bindingAt = (kind_4, name_25, span_22, bindingType) => {
|
|
4878
4898
|
let option_21, option_19;
|
|
4879
4899
|
return new ResolvedBinding(equals(kind_4, ResolvedSymbolKind.PatternBindingSymbol) ? ((option_21 = ((option_19 = tryFind_2((arg_2) => equals(span_22, arg_2[0]), patternBindingIds), (option_19 != null) ? option_19[1] : undefined)), (option_21 != null) ? option_21 : symbolAt(kind_4, name_25, span_22).SymbolId)) : symbolAt(kind_4, name_25, span_22).SymbolId, name_25, bindingType, span_22);
|
|
@@ -4922,18 +4942,18 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4922
4942
|
break;
|
|
4923
4943
|
}
|
|
4924
4944
|
case 1: {
|
|
4925
|
-
const
|
|
4945
|
+
const matchValue_5 = tryFind(expected.fields[0], resolvedTypeDefinitions);
|
|
4926
4946
|
let matchResult_3, values_1;
|
|
4927
|
-
if (
|
|
4928
|
-
switch (
|
|
4947
|
+
if (matchValue_5 != null) {
|
|
4948
|
+
switch (matchValue_5.tag) {
|
|
4929
4949
|
case 8: {
|
|
4930
4950
|
matchResult_3 = 0;
|
|
4931
|
-
values_1 =
|
|
4951
|
+
values_1 = matchValue_5.fields[0];
|
|
4932
4952
|
break;
|
|
4933
4953
|
}
|
|
4934
4954
|
case 17: {
|
|
4935
4955
|
matchResult_3 = 0;
|
|
4936
|
-
values_1 =
|
|
4956
|
+
values_1 = matchValue_5.fields[1];
|
|
4937
4957
|
break;
|
|
4938
4958
|
}
|
|
4939
4959
|
default:
|
|
@@ -4950,14 +4970,14 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4950
4970
|
}
|
|
4951
4971
|
default:
|
|
4952
4972
|
fieldTypes = empty({
|
|
4953
|
-
Compare: (
|
|
4973
|
+
Compare: (x_16, y_17) => (comparePrimitives(x_16, y_17) | 0),
|
|
4954
4974
|
});
|
|
4955
4975
|
}
|
|
4956
4976
|
break;
|
|
4957
4977
|
}
|
|
4958
4978
|
default:
|
|
4959
4979
|
fieldTypes = empty({
|
|
4960
|
-
Compare: (
|
|
4980
|
+
Compare: (x_17, y_18) => (comparePrimitives(x_17, y_18) | 0),
|
|
4961
4981
|
});
|
|
4962
4982
|
}
|
|
4963
4983
|
return make(new ResolvedPatternNode(/* ResolvedRecordPattern */ 6, [map_1((tupledArg_10) => {
|
|
@@ -4980,12 +5000,12 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
4980
5000
|
switch (expected.tag) {
|
|
4981
5001
|
case 12: {
|
|
4982
5002
|
const name_30 = expected.fields[0];
|
|
4983
|
-
const
|
|
5003
|
+
const matchValue_6 = tryFind(name_30, resolvedTypeDefinitions);
|
|
4984
5004
|
let matchResult_4, cases_5;
|
|
4985
|
-
if (
|
|
4986
|
-
if (
|
|
5005
|
+
if (matchValue_6 != null) {
|
|
5006
|
+
if (matchValue_6.tag === 13) {
|
|
4987
5007
|
matchResult_4 = 0;
|
|
4988
|
-
cases_5 =
|
|
5008
|
+
cases_5 = matchValue_6.fields[1];
|
|
4989
5009
|
}
|
|
4990
5010
|
else {
|
|
4991
5011
|
matchResult_4 = 1;
|
|
@@ -5041,35 +5061,35 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5041
5061
|
}
|
|
5042
5062
|
};
|
|
5043
5063
|
const resolveExpression = (expression_8) => {
|
|
5044
|
-
let
|
|
5064
|
+
let x_15, matchValue_8;
|
|
5045
5065
|
const expressionType = finalType(expression_8);
|
|
5046
|
-
let
|
|
5066
|
+
let reference_2;
|
|
5047
5067
|
const expression_7 = expression_8;
|
|
5048
5068
|
const span_23 = Ast_spanOfExpr(expression_7);
|
|
5049
5069
|
const expectedName = (expression_7.tag === 2) ? expression_7.fields[0] : ((expression_7.tag === 29) ? expression_7.fields[0] : ((expression_7.tag === 28) ? expression_7.fields[0] : ((expression_7.tag === 21) ? ((expression_7.fields[0].tag === 2) ? concat(expression_7.fields[0].fields[0], ".", expression_7.fields[1]) : undefined) : undefined)));
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
continue consume;
|
|
5064
|
-
}
|
|
5065
|
-
}
|
|
5066
|
-
else {
|
|
5067
|
-
return undefined;
|
|
5068
|
-
}
|
|
5069
|
-
break;
|
|
5070
|
+
let matchValue_4;
|
|
5071
|
+
let outArg_1 = defaultOf();
|
|
5072
|
+
matchValue_4 = [tryGetValue(referenceOccurrences, span_23, new FSharpRef(() => outArg_1, (v_1) => {
|
|
5073
|
+
outArg_1 = v_1;
|
|
5074
|
+
})), outArg_1];
|
|
5075
|
+
if (matchValue_4[0]) {
|
|
5076
|
+
const occurrences_1 = matchValue_4[1];
|
|
5077
|
+
let index_1 = 0;
|
|
5078
|
+
while ((index_1 < occurrences_1.length) && !forAll_1((x_15 = item_22(index_1, occurrences_1).Name, (y_16) => (x_15 === y_16)), toArray(expectedName))) {
|
|
5079
|
+
index_1 = ((index_1 + 1) | 0);
|
|
5080
|
+
}
|
|
5081
|
+
if (index_1 === occurrences_1.length) {
|
|
5082
|
+
reference_2 = undefined;
|
|
5070
5083
|
}
|
|
5071
|
-
|
|
5072
|
-
|
|
5084
|
+
else {
|
|
5085
|
+
const reference_1 = item_22(index_1, occurrences_1);
|
|
5086
|
+
occurrences_1.splice(index_1, 1);
|
|
5087
|
+
reference_2 = reference_1;
|
|
5088
|
+
}
|
|
5089
|
+
}
|
|
5090
|
+
else {
|
|
5091
|
+
reference_2 = undefined;
|
|
5092
|
+
}
|
|
5073
5093
|
let primitive;
|
|
5074
5094
|
if (expression_8.tag === 25) {
|
|
5075
5095
|
const op = expression_8.fields[0];
|
|
@@ -5236,7 +5256,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5236
5256
|
primitive = undefined;
|
|
5237
5257
|
}
|
|
5238
5258
|
let node_1;
|
|
5239
|
-
let matchResult_7, value_26, inner_1, body_6, parameter_2, argument_4, fn_1, condition_1, whenFalse_1, whenTrue_1, left_1, right, head_2,
|
|
5259
|
+
let matchResult_7, value_26, inner_1, body_6, parameter_2, argument_4, fn_1, condition_1, whenFalse_1, whenTrue_1, left_1, right, head_2, tail_4, left_2, right_1, left_3, right_2, head_3, tail_5, items_5, items_6, fields_8, name_34, target_3, item_19, body_7, name_35, recursive_2, span_25, value_28, body_8, pattern_6, value_29, bindings_12, body_9, value_31, body_10, name_37, source_4, span_27, cases_9, target_4, first_1, last_1, fields_9, target_5, fields_10, target_6, index_2, target_7, name_40, name_41, parts_1, entries_1;
|
|
5240
5260
|
switch (expression_8.tag) {
|
|
5241
5261
|
case 1: {
|
|
5242
5262
|
matchResult_7 = 1;
|
|
@@ -5282,7 +5302,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5282
5302
|
case "::": {
|
|
5283
5303
|
matchResult_7 = 8;
|
|
5284
5304
|
head_2 = expression_8.fields[1];
|
|
5285
|
-
|
|
5305
|
+
tail_4 = expression_8.fields[2];
|
|
5286
5306
|
break;
|
|
5287
5307
|
}
|
|
5288
5308
|
case "@": {
|
|
@@ -5308,7 +5328,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5308
5328
|
case 23: {
|
|
5309
5329
|
matchResult_7 = 11;
|
|
5310
5330
|
head_3 = expression_8.fields[0];
|
|
5311
|
-
|
|
5331
|
+
tail_5 = expression_8.fields[1];
|
|
5312
5332
|
break;
|
|
5313
5333
|
}
|
|
5314
5334
|
case 15: {
|
|
@@ -5332,7 +5352,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5332
5352
|
break;
|
|
5333
5353
|
}
|
|
5334
5354
|
case 21: {
|
|
5335
|
-
if (
|
|
5355
|
+
if (reference_2 != null) {
|
|
5336
5356
|
matchResult_7 = 15;
|
|
5337
5357
|
}
|
|
5338
5358
|
else {
|
|
@@ -5344,7 +5364,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5344
5364
|
}
|
|
5345
5365
|
case 26: {
|
|
5346
5366
|
matchResult_7 = 17;
|
|
5347
|
-
|
|
5367
|
+
item_19 = expression_8.fields[0];
|
|
5348
5368
|
break;
|
|
5349
5369
|
}
|
|
5350
5370
|
case 27: {
|
|
@@ -5382,7 +5402,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5382
5402
|
matchResult_7 = 23;
|
|
5383
5403
|
body_10 = expression_8.fields[2];
|
|
5384
5404
|
name_37 = expression_8.fields[0];
|
|
5385
|
-
|
|
5405
|
+
source_4 = expression_8.fields[1];
|
|
5386
5406
|
span_27 = expression_8.fields[3];
|
|
5387
5407
|
break;
|
|
5388
5408
|
}
|
|
@@ -5412,7 +5432,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5412
5432
|
}
|
|
5413
5433
|
case 22: {
|
|
5414
5434
|
matchResult_7 = 28;
|
|
5415
|
-
|
|
5435
|
+
index_2 = expression_8.fields[1];
|
|
5416
5436
|
target_7 = expression_8.fields[0];
|
|
5417
5437
|
break;
|
|
5418
5438
|
}
|
|
@@ -5449,7 +5469,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5449
5469
|
break;
|
|
5450
5470
|
}
|
|
5451
5471
|
case 2: {
|
|
5452
|
-
node_1 = (new ResolvedExpressionNode(/* ResolvedReference */ 1, [value_42(
|
|
5472
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedReference */ 1, [value_42(reference_2)]));
|
|
5453
5473
|
break;
|
|
5454
5474
|
}
|
|
5455
5475
|
case 3: {
|
|
@@ -5473,7 +5493,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5473
5493
|
break;
|
|
5474
5494
|
}
|
|
5475
5495
|
case 8: {
|
|
5476
|
-
node_1 = (new ResolvedExpressionNode(/* ResolvedCons */ 13, [resolveExpression(head_2), resolveExpression(
|
|
5496
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedCons */ 13, [resolveExpression(head_2), resolveExpression(tail_4)]));
|
|
5477
5497
|
break;
|
|
5478
5498
|
}
|
|
5479
5499
|
case 9: {
|
|
@@ -5485,7 +5505,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5485
5505
|
break;
|
|
5486
5506
|
}
|
|
5487
5507
|
case 11: {
|
|
5488
|
-
node_1 = (new ResolvedExpressionNode(/* ResolvedCons */ 13, [resolveExpression(head_3), resolveExpression(
|
|
5508
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedCons */ 13, [resolveExpression(head_3), resolveExpression(tail_5)]));
|
|
5489
5509
|
break;
|
|
5490
5510
|
}
|
|
5491
5511
|
case 12: {
|
|
@@ -5501,7 +5521,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5501
5521
|
break;
|
|
5502
5522
|
}
|
|
5503
5523
|
case 15: {
|
|
5504
|
-
node_1 = (new ResolvedExpressionNode(/* ResolvedReference */ 1, [value_42(
|
|
5524
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedReference */ 1, [value_42(reference_2)]));
|
|
5505
5525
|
break;
|
|
5506
5526
|
}
|
|
5507
5527
|
case 16: {
|
|
@@ -5509,7 +5529,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5509
5529
|
break;
|
|
5510
5530
|
}
|
|
5511
5531
|
case 17: {
|
|
5512
|
-
node_1 = (new ResolvedExpressionNode(/* ResolvedSome */ 11, [resolveExpression(
|
|
5532
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedSome */ 11, [resolveExpression(item_19)]));
|
|
5513
5533
|
break;
|
|
5514
5534
|
}
|
|
5515
5535
|
case 18: {
|
|
@@ -5538,8 +5558,8 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5538
5558
|
break;
|
|
5539
5559
|
}
|
|
5540
5560
|
case 23: {
|
|
5541
|
-
const resolvedSource = resolveExpression(
|
|
5542
|
-
node_1 = (new ResolvedExpressionNode(/* ResolvedForEach */ 24, [bindingAt(ResolvedSymbolKind.LocalSymbol, name_37, span_27, (
|
|
5561
|
+
const resolvedSource = resolveExpression(source_4);
|
|
5562
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedForEach */ 24, [bindingAt(ResolvedSymbolKind.LocalSymbol, name_37, span_27, (matchValue_8 = resolvedSource.Type, (matchValue_8.tag === 5) ? matchValue_8.fields[0] : Types_freshVar())), resolvedSource, resolveExpression(body_10)]));
|
|
5543
5563
|
break;
|
|
5544
5564
|
}
|
|
5545
5565
|
case 24: {
|
|
@@ -5563,7 +5583,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5563
5583
|
break;
|
|
5564
5584
|
}
|
|
5565
5585
|
case 28: {
|
|
5566
|
-
node_1 = (new ResolvedExpressionNode(/* ResolvedIndexGet */ 21, [resolveExpression(target_7), resolveExpression(
|
|
5586
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedIndexGet */ 21, [resolveExpression(target_7), resolveExpression(index_2)]));
|
|
5567
5587
|
break;
|
|
5568
5588
|
}
|
|
5569
5589
|
case 29: {
|
|
@@ -5571,57 +5591,57 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5571
5591
|
break;
|
|
5572
5592
|
}
|
|
5573
5593
|
case 30: {
|
|
5574
|
-
node_1 = (new ResolvedExpressionNode(/* ResolvedTypeToken */ 25, [
|
|
5594
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedTypeToken */ 25, [find(name_41, resolvedTypeDefinitions)]));
|
|
5575
5595
|
break;
|
|
5576
5596
|
}
|
|
5577
5597
|
case 31: {
|
|
5578
|
-
node_1 = (new ResolvedExpressionNode(/* ResolvedInterpolate */ 22, [map_1((
|
|
5579
|
-
if (
|
|
5580
|
-
return new ResolvedInterpolationPart(/* ResolvedValuePart */ 1, [resolveExpression(
|
|
5598
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedInterpolate */ 22, [map_1((_arg_24) => {
|
|
5599
|
+
if (_arg_24.tag === 1) {
|
|
5600
|
+
return new ResolvedInterpolationPart(/* ResolvedValuePart */ 1, [resolveExpression(_arg_24.fields[0])]);
|
|
5581
5601
|
}
|
|
5582
5602
|
else {
|
|
5583
|
-
return new ResolvedInterpolationPart(/* ResolvedTextPart */ 0, [
|
|
5603
|
+
return new ResolvedInterpolationPart(/* ResolvedTextPart */ 0, [_arg_24.fields[0]]);
|
|
5584
5604
|
}
|
|
5585
5605
|
}, parts_1)]));
|
|
5586
5606
|
break;
|
|
5587
5607
|
}
|
|
5588
5608
|
default:
|
|
5589
|
-
node_1 = (new ResolvedExpressionNode(/* ResolvedMap */ 23, [map_1((
|
|
5590
|
-
if (
|
|
5591
|
-
return new ResolvedMapEntry(/* ResolvedSpread */ 1, [resolveExpression(
|
|
5609
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedMap */ 23, [map_1((_arg_25) => {
|
|
5610
|
+
if (_arg_25.tag === 1) {
|
|
5611
|
+
return new ResolvedMapEntry(/* ResolvedSpread */ 1, [resolveExpression(_arg_25.fields[0])]);
|
|
5592
5612
|
}
|
|
5593
5613
|
else {
|
|
5594
|
-
return new ResolvedMapEntry(/* ResolvedKeyValue */ 0, [resolveExpression(
|
|
5614
|
+
return new ResolvedMapEntry(/* ResolvedKeyValue */ 0, [resolveExpression(_arg_25.fields[0]), resolveExpression(_arg_25.fields[1])]);
|
|
5595
5615
|
}
|
|
5596
5616
|
}, entries_1)]));
|
|
5597
5617
|
}
|
|
5598
|
-
const children = (node_1.tag === 11) ? singleton(node_1.fields[0]) : ((node_1.tag === 17) ? singleton(node_1.fields[0]) : ((node_1.tag === 3) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 4) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 13) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 14) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 19) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 21) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 5) ? ofArray([node_1.fields[0], node_1.fields[1], node_1.fields[2]]) : ((node_1.tag === 6) ? node_1.fields[1] : ((node_1.tag === 7) ? node_1.fields[0] : ((node_1.tag === 8) ? node_1.fields[0] : ((node_1.tag === 9) ? map_1((tuple_6) => tuple_6[1], node_1.fields[0]) : ((node_1.tag === 10) ? singleton(node_1.fields[0]) : ((node_1.tag === 15) ? ofArray([node_1.fields[2], node_1.fields[3]]) : ((node_1.tag === 16) ? append(map_1((
|
|
5599
|
-
if (
|
|
5600
|
-
return
|
|
5618
|
+
const children = (node_1.tag === 11) ? singleton(node_1.fields[0]) : ((node_1.tag === 17) ? singleton(node_1.fields[0]) : ((node_1.tag === 3) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 4) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 13) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 14) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 19) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 21) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 5) ? ofArray([node_1.fields[0], node_1.fields[1], node_1.fields[2]]) : ((node_1.tag === 6) ? node_1.fields[1] : ((node_1.tag === 7) ? node_1.fields[0] : ((node_1.tag === 8) ? node_1.fields[0] : ((node_1.tag === 9) ? map_1((tuple_6) => tuple_6[1], node_1.fields[0]) : ((node_1.tag === 10) ? singleton(node_1.fields[0]) : ((node_1.tag === 15) ? ofArray([node_1.fields[2], node_1.fields[3]]) : ((node_1.tag === 16) ? append(map_1((_arg_26) => _arg_26.Value, node_1.fields[0]), singleton(node_1.fields[1])) : ((node_1.tag === 18) ? cons(node_1.fields[0], collect((case$) => append(ofArray(toArray(case$.Guard)), singleton(case$.Body)), node_1.fields[1])) : ((node_1.tag === 20) ? cons(node_1.fields[1], map_1((tuple_7) => tuple_7[1], node_1.fields[2])) : ((node_1.tag === 22) ? choose((_arg_27) => {
|
|
5619
|
+
if (_arg_27.tag === 1) {
|
|
5620
|
+
return _arg_27.fields[0];
|
|
5601
5621
|
}
|
|
5602
5622
|
else {
|
|
5603
5623
|
return undefined;
|
|
5604
5624
|
}
|
|
5605
|
-
}, node_1.fields[0]) : ((node_1.tag === 23) ? collect((
|
|
5606
|
-
if (
|
|
5607
|
-
return singleton(
|
|
5625
|
+
}, node_1.fields[0]) : ((node_1.tag === 23) ? collect((_arg_28) => {
|
|
5626
|
+
if (_arg_28.tag === 1) {
|
|
5627
|
+
return singleton(_arg_28.fields[0]);
|
|
5608
5628
|
}
|
|
5609
5629
|
else {
|
|
5610
|
-
return ofArray([
|
|
5630
|
+
return ofArray([_arg_28.fields[0], _arg_28.fields[1]]);
|
|
5611
5631
|
}
|
|
5612
5632
|
}, node_1.fields[0]) : ((node_1.tag === 24) ? ofArray([node_1.fields[1], node_1.fields[2]]) : ((node_1.tag === 0) ? empty_2() : ((node_1.tag === 1) ? empty_2() : ((node_1.tag === 12) ? empty_2() : ((node_1.tag === 25) ? empty_2() : singleton(node_1.fields[1])))))))))))))))))))))))));
|
|
5613
5633
|
let coercion;
|
|
5614
|
-
const recordShape = (
|
|
5615
|
-
switch (
|
|
5634
|
+
const recordShape = (_arg_29) => {
|
|
5635
|
+
switch (_arg_29.tag) {
|
|
5616
5636
|
case 8:
|
|
5617
|
-
return
|
|
5637
|
+
return _arg_29.fields[0];
|
|
5618
5638
|
case 12: {
|
|
5619
|
-
const
|
|
5639
|
+
const matchValue_9 = tryFind(_arg_29.fields[0], resolvedTypeDefinitions);
|
|
5620
5640
|
let matchResult_8, fields_14;
|
|
5621
|
-
if (
|
|
5622
|
-
if (
|
|
5641
|
+
if (matchValue_9 != null) {
|
|
5642
|
+
if (matchValue_9.tag === 8) {
|
|
5623
5643
|
matchResult_8 = 0;
|
|
5624
|
-
fields_14 =
|
|
5644
|
+
fields_14 = matchValue_9.fields[0];
|
|
5625
5645
|
}
|
|
5626
5646
|
else {
|
|
5627
5647
|
matchResult_8 = 1;
|
|
@@ -5643,15 +5663,15 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5643
5663
|
};
|
|
5644
5664
|
const conversion = (targetType, sourceType) => {
|
|
5645
5665
|
let targetFields, sourceFields;
|
|
5646
|
-
const
|
|
5647
|
-
const
|
|
5666
|
+
const matchValue_10 = recordShape(targetType);
|
|
5667
|
+
const matchValue_11 = recordShape(sourceType);
|
|
5648
5668
|
let matchResult_9, sourceFields_1, targetFields_1;
|
|
5649
|
-
if (
|
|
5650
|
-
if (
|
|
5651
|
-
if ((targetFields =
|
|
5669
|
+
if (matchValue_10 != null) {
|
|
5670
|
+
if (matchValue_11 != null) {
|
|
5671
|
+
if ((targetFields = matchValue_10, (sourceFields = matchValue_11, !equals(targetType, sourceType) && forAll((name_43, targetField) => exists_2((y_19) => equals(targetField, y_19), toArray(tryFind(name_43, sourceFields))), targetFields)))) {
|
|
5652
5672
|
matchResult_9 = 0;
|
|
5653
|
-
sourceFields_1 =
|
|
5654
|
-
targetFields_1 =
|
|
5673
|
+
sourceFields_1 = matchValue_11;
|
|
5674
|
+
targetFields_1 = matchValue_10;
|
|
5655
5675
|
}
|
|
5656
5676
|
else {
|
|
5657
5677
|
matchResult_9 = 1;
|
|
@@ -5672,13 +5692,13 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5672
5692
|
}
|
|
5673
5693
|
};
|
|
5674
5694
|
const callParameter = (fn_2) => {
|
|
5675
|
-
let
|
|
5695
|
+
let option_35, signature;
|
|
5676
5696
|
let inferred_3;
|
|
5677
|
-
const
|
|
5678
|
-
inferred_3 = ((
|
|
5679
|
-
const
|
|
5680
|
-
if (
|
|
5681
|
-
return orElse((
|
|
5697
|
+
const matchValue_13 = fn_2.Type;
|
|
5698
|
+
inferred_3 = ((matchValue_13.tag === 11) ? matchValue_13.fields[0] : undefined);
|
|
5699
|
+
const matchValue_14 = fn_2.Node;
|
|
5700
|
+
if (matchValue_14.tag === 1) {
|
|
5701
|
+
return orElse((option_35 = item_22(matchValue_14.fields[0].SymbolId, symbols).Scheme, (option_35 != null) ? ((signature = option_35.fields[1], (signature.tag === 11) ? ((signature.fields[0].tag === 8) ? (new Type_1(/* TRecord */ 8, [signature.fields[0].fields[0]])) : undefined) : undefined)) : undefined), inferred_3);
|
|
5682
5702
|
}
|
|
5683
5703
|
else {
|
|
5684
5704
|
return inferred_3;
|
|
@@ -5686,25 +5706,25 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5686
5706
|
};
|
|
5687
5707
|
switch (node_1.tag) {
|
|
5688
5708
|
case 3: {
|
|
5689
|
-
const
|
|
5690
|
-
coercion = ((
|
|
5709
|
+
const option_38 = callParameter(node_1.fields[0]);
|
|
5710
|
+
coercion = ((option_38 != null) ? conversion(option_38, node_1.fields[1].Type) : undefined);
|
|
5691
5711
|
break;
|
|
5692
5712
|
}
|
|
5693
5713
|
case 4: {
|
|
5694
|
-
const
|
|
5695
|
-
coercion = ((
|
|
5714
|
+
const option_40 = callParameter(node_1.fields[1]);
|
|
5715
|
+
coercion = ((option_40 != null) ? conversion(option_40, node_1.fields[0].Type) : undefined);
|
|
5696
5716
|
break;
|
|
5697
5717
|
}
|
|
5698
5718
|
default:
|
|
5699
5719
|
coercion = undefined;
|
|
5700
5720
|
}
|
|
5701
|
-
return new ResolvedExpression(expressionType, Ast_spanOfExpr(expression_8),
|
|
5721
|
+
return new ResolvedExpression(expressionType, Ast_spanOfExpr(expression_8), reference_2, primitive, coercion, node_1, children);
|
|
5702
5722
|
};
|
|
5703
5723
|
const resolvedStatements = map2((declaredAttributes, statement_2) => {
|
|
5704
|
-
let
|
|
5724
|
+
let option_42, import$_1, option_46;
|
|
5705
5725
|
const roots = (statement_2.tag === 2) ? singleton(statement_2.fields[1]) : ((statement_2.tag === 3) ? map_1((tupledArg_18) => tupledArg_18[1], statement_2.fields[0]) : ((statement_2.tag === 5) ? singleton(statement_2.fields[0].Expr) : ((statement_2.tag === 4) ? empty_2() : ((statement_2.tag === 0) ? empty_2() : singleton(statement_2.fields[1])))));
|
|
5706
5726
|
const export$ = (statement_2.tag === 1) ? (statement_2.fields[4] ? (new ResolvedExport(statement_2.fields[0], statement_2.fields[5])) : undefined) : ((statement_2.tag === 2) ? (statement_2.fields[3] ? (new ResolvedExport("<pattern>", statement_2.fields[4])) : undefined) : ((statement_2.tag === 3) ? (statement_2.fields[1] ? (new ResolvedExport(join(",", map_1((tupledArg_19) => tupledArg_19[0], statement_2.fields[0])), statement_2.fields[2])) : undefined) : undefined));
|
|
5707
|
-
const attributes = (statement_2.tag === 1) ? (statement_2.fields[4] ? singleton(new Attribute("Export", empty_2(), statement_2.fields[5])) : empty_2()) : ((statement_2.tag === 2) ? (statement_2.fields[3] ? singleton(new Attribute("Export", empty_2(), statement_2.fields[4])) : empty_2()) : ((statement_2.tag === 3) ? (statement_2.fields[1] ? singleton(new Attribute("Export", empty_2(), statement_2.fields[2])) : empty_2()) : ((statement_2.tag === 4) ? singleton(new Attribute("Import", ofArray([statement_2.fields[2].ModulePath, statement_2.fields[2].MemberName]), statement_2.fields[2].Span)) : ((statement_2.tag === 0) ? defaultArg((
|
|
5727
|
+
const attributes = (statement_2.tag === 1) ? (statement_2.fields[4] ? singleton(new Attribute("Export", empty_2(), statement_2.fields[5])) : empty_2()) : ((statement_2.tag === 2) ? (statement_2.fields[3] ? singleton(new Attribute("Export", empty_2(), statement_2.fields[4])) : empty_2()) : ((statement_2.tag === 3) ? (statement_2.fields[1] ? singleton(new Attribute("Export", empty_2(), statement_2.fields[2])) : empty_2()) : ((statement_2.tag === 4) ? singleton(new Attribute("Import", ofArray([statement_2.fields[2].ModulePath, statement_2.fields[2].MemberName]), statement_2.fields[2].Span)) : ((statement_2.tag === 0) ? defaultArg((option_42 = statement_2.fields[0].Import, (option_42 != null) ? ((import$_1 = option_42, singleton(new Attribute("Import", ofArray([import$_1.ModulePath, import$_1.MemberName]), import$_1.Span)))) : undefined), empty_2()) : empty_2()))));
|
|
5708
5728
|
const patterns = (statement_2.tag === 2) ? singleton(resolvePattern(finalType(statement_2.fields[1]), statement_2.fields[0])) : empty_2();
|
|
5709
5729
|
const resolvedRoots = map_1(resolveExpression, roots);
|
|
5710
5730
|
const declarationBinding = (name_47, span_32, bindingType_1) => bindingAt(ResolvedSymbolKind.DeclarationSymbol, name_47, span_32, bindingType_1);
|
|
@@ -5717,7 +5737,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5717
5737
|
const name_51 = statement_2.fields[0];
|
|
5718
5738
|
const inferred_4 = statement_2.fields[2];
|
|
5719
5739
|
node_2 = (new ResolvedStatementNode(/* ResolvedValueDeclaration */ 1, [new ResolvedValueDeclaration(declarationBinding(name_51, span_34, normalizeTypeVariables(inferred_4)), declarationScheme(name_51, span_34, Types_generalize(empty({
|
|
5720
|
-
Compare: (
|
|
5740
|
+
Compare: (x_18, y_20) => (comparePrimitives(x_18, y_20) | 0),
|
|
5721
5741
|
}), inferred_4)), statement_2.fields[3], exactlyOne(resolvedRoots))]));
|
|
5722
5742
|
break;
|
|
5723
5743
|
}
|
|
@@ -5727,7 +5747,7 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5727
5747
|
const name_52 = tupledArg_22[0];
|
|
5728
5748
|
const normalized_2 = normalizeTypeVariables(tupledArg_22[1]);
|
|
5729
5749
|
return [declarationBinding(name_52, span_35, normalized_2), declarationScheme(name_52, span_35, Types_generalize(empty({
|
|
5730
|
-
Compare: (
|
|
5750
|
+
Compare: (x_19, y_21) => (comparePrimitives(x_19, y_21) | 0),
|
|
5731
5751
|
}), normalized_2))];
|
|
5732
5752
|
}, toList(statement_2.fields[2]));
|
|
5733
5753
|
node_2 = (new ResolvedStatementNode(/* ResolvedPatternDeclaration */ 2, [new ResolvedPatternDeclaration(exactlyOne(patterns), exactlyOne(resolvedRoots), resolvedBindings)]));
|
|
@@ -5735,12 +5755,12 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5735
5755
|
}
|
|
5736
5756
|
case 3: {
|
|
5737
5757
|
node_2 = (new ResolvedStatementNode(/* ResolvedRecursiveDeclarations */ 3, [map_1((tupledArg_23) => {
|
|
5738
|
-
const
|
|
5739
|
-
const span_36 =
|
|
5740
|
-
const name_53 =
|
|
5741
|
-
const inferred_5 =
|
|
5758
|
+
const _arg_37 = tupledArg_23[0];
|
|
5759
|
+
const span_36 = _arg_37[3];
|
|
5760
|
+
const name_53 = _arg_37[0];
|
|
5761
|
+
const inferred_5 = _arg_37[2];
|
|
5742
5762
|
return new ResolvedValueDeclaration(declarationBinding(name_53, span_36, normalizeTypeVariables(inferred_5)), declarationScheme(name_53, span_36, Types_generalize(empty({
|
|
5743
|
-
Compare: (
|
|
5763
|
+
Compare: (x_20, y_22) => (comparePrimitives(x_20, y_22) | 0),
|
|
5744
5764
|
}), inferred_5)), true, tupledArg_23[1]);
|
|
5745
5765
|
}, zip(statement_2.fields[0], resolvedRoots))]));
|
|
5746
5766
|
break;
|
|
@@ -5759,13 +5779,13 @@ export function inferResolvedProgramWithRegistration(registration, program) {
|
|
|
5759
5779
|
default: {
|
|
5760
5780
|
const definition_10 = statement_2.fields[0];
|
|
5761
5781
|
node_2 = (new ResolvedStatementNode(/* ResolvedTypeDeclaration */ 0, [new ResolvedTypeDeclaration(bindingAt(ResolvedSymbolKind.TypeSymbol, definition_10.Name, definition_10.Span, new Type_1(/* TNamed */ 12, [definition_10.Name])), definition_10.IsRecursive, FSharpMap__get_Item(resolvedTypeDefinitions, definition_10.Name), map_1((tupledArg_20) => [tupledArg_20[0], typeFromRef(declarations, singleton(definition_10.Name), tupledArg_20[1])], definition_10.Fields), map_1((tupledArg_21) => {
|
|
5762
|
-
let
|
|
5763
|
-
return [tupledArg_21[0], (
|
|
5764
|
-
}, definition_10.Cases), (
|
|
5782
|
+
let option_45;
|
|
5783
|
+
return [tupledArg_21[0], (option_45 = tupledArg_21[1], (option_45 != null) ? typeFromRef(declarations, singleton(definition_10.Name), option_45) : undefined)];
|
|
5784
|
+
}, definition_10.Cases), (option_46 = definition_10.Import, (option_46 != null) ? importMetadata(option_46) : undefined))]));
|
|
5765
5785
|
}
|
|
5766
5786
|
}
|
|
5767
5787
|
return new ResolvedStatement((statement_2.tag === 1) ? statement_2.fields[5] : ((statement_2.tag === 2) ? statement_2.fields[4] : ((statement_2.tag === 3) ? statement_2.fields[2] : ((statement_2.tag === 4) ? statement_2.fields[3] : ((statement_2.tag === 5) ? statement_2.fields[0].Span : statement_2.fields[0].Span)))), sortBy((attribute) => [attribute.Span.Start.Line, attribute.Span.Start.Column], append(declaredAttributes, attributes), {
|
|
5768
|
-
Compare: (
|
|
5788
|
+
Compare: (x_21, y_23) => (compareArrays(x_21, y_23) | 0),
|
|
5769
5789
|
}), export$, node_2, patterns, resolvedRoots);
|
|
5770
5790
|
}, patternInput[0], typed);
|
|
5771
5791
|
return new ResolvedProgram(PurityContractsModule_empty, typed, append(map_1((tupledArg_24) => {
|