@glutinum/cli 1.0.0-beta.7 → 1.0.0-beta.8
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/Glutinum.Converter/Hosting.js +2 -2
- package/dist/Glutinum.Converter/Packages.js +12 -21
- package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
- package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
- package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
- package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +178 -0
- package/dist/Glutinum.Converter/Reader/MemberTypes.js +126 -0
- package/dist/Glutinum.Converter/Reader/TypeNode.js +48 -1941
- package/dist/Glutinum.Converter/Reader/UtilityType.js +803 -0
- package/dist/Glutinum.Converter/Reader/Utils.js +87 -47
- package/dist/Glutinum.Converter/Transform.js +83 -961
- package/dist/Glutinum.Converter/Transformer/Exports.js +704 -0
- package/dist/Glutinum.Converter/Transformer/TypeParameter.js +219 -0
- package/package.json +1 -1
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { GlueReExport, GlueTypeReference, GlueClassDeclaration, GlueLiteral__ToText, GlueIndexSignature, GlueLiteral, GlueMember__TryGetAccessor, GlueMember__get_Documentation, GluePrimitive, GlueProperty, GlueAccessor, GlueMethod, GlueMethodSignature, GlueSubstitution_mentionedTypeParameters, GlueFunctionType, GlueParameter, GlueTypeUnion, GlueFunctionDeclaration, GlueVariable, GlueType__get_Name, GlueConstructor, GlueType, GlueTypeLiteral, GlueMember, GlueTypeParameter, GlueSubstitution_substitute, GlueSubstitution_substituteParameter, GlueInterface, GlueTypeAliasDeclaration_$reflection, GlueType_$reflection } from "./GlueAST.js";
|
|
2
|
+
import { Record } from "../fable_modules/fable-library-js.5.17.2/Types.js";
|
|
3
|
+
import { int32_type, bool_type, array_type, list_type, record_type, class_type, string_type } from "../fable_modules/fable-library-js.5.17.2/Reflection.js";
|
|
4
|
+
import { Reporter__get_HasIterable, Reporter__get_HasReadonlyArray, Reporter__get_HasRegEpx, Reporter__get_Errors, Reporter__get_Warnings, TransformState_Create_Z68CEF8E2, TypeLiteralsMemory_$ctor, Reporter_$ctor, TransformContext__ToList, importDefaultAttribute, TransformContext_$ctor_Z1635F75A, TypeLiteralsMemory__EnterFileModule_Z721C83C5, TransformContext__get__Reporter, TransformContext__set_SiblingTypeNames_2FCB1351, importAttribute, TypeLiteralsMemory__LeaveModule, TypeLiteralsMemory__EnterModule_Z721C83C5, TransformContext__ExposeTypeAlias_1CE4A880, TransformContext__AddWarning_Z721C83C5, sanitizeTypeNameAndPushScope, ImportSource, TransformContext__get_ImportSource, TransformContext__get_TypeMemory, sanitizeMemberNameAndPushScope, TransformContext__AddError_Z721C83C5, TypeLiteralsMemory__Remember_74C8CBB, TransformContext__get_TypeLiteralsMemory, TransformContext__get_Root, TypeLiteralsMemory__TryReference_433E080, TransformContext__get_State, TransformContext__get_FullName, TransformContext__ExposeType_Z1D58A540, TransformContext__PushScope_27AED5E3, sanitizeNameAndPushScope, TransformContext__NewTypeName, TransformContext__get_CurrentScopeName, TransformContext__ExposeIterable, TransformContext__ReferenceName_Z721C83C5, TransformContext__get_OriginalScopeName, TransformContext__ExposeTypeAlias_Z721C83C5, TransformContext__ExposeReadonlyArray, ImportSource_$reflection, TransformContext_$reflection } from "./Transformer/Context.js";
|
|
5
|
+
import { GlueReExport, GlueVariable, GlueTypeReference, GlueClassDeclaration, GlueLiteral__ToText, GlueIndexSignature, GlueLiteral, GlueMember__TryGetAccessor, GlueMember__get_Documentation, GluePrimitive, GlueProperty, GlueAccessor, GlueFunctionDeclaration, GlueMethod, GlueMethodSignature, GlueSubstitution_mentionedTypeParameters, GlueFunctionType, GlueParameter, GlueTypeUnion, GlueType, GlueTypeLiteral, GlueMember, GlueTypeParameter, GlueSubstitution_substitute, GlueSubstitution_substituteParameter, GlueInterface, GlueTypeAliasDeclaration_$reflection } from "./GlueAST.js";
|
|
7
6
|
import { transformComment, TransformCommentResult_$reflection } from "./Transformer/Comment.js";
|
|
8
|
-
import {
|
|
7
|
+
import { SealedTypeInfo, TransformDeclarationTypeParametersResult, TransformTypeParametersResult, TransformResult_Create_403667D8, mapFSharpType, mapFsharpParameter, TransformDeclarationTypeParametersResult_$reflection } from "./Transformer/TypeParameter.js";
|
|
8
|
+
import { FSharpModule, FSharpSingleErasedCaseUnion, FSharpJSApi, FSharpEnum, FSharpEnumCase, FSharpLiteral, FSharpUnionCaseNamed, FSharpClass, FSharpConstructor, FSharpExplicitField, FSharpMemberInfoBody, FSharpAccessibility, FSharpStaticMemberInfo, FSharpMember, FSharpMemberInfo, FSharpAccessor, FSharpParameter, FSharpThisType, FSharpPrimitive, FSharpTypeAlias, FSharpDelegate, FSharpFunctionType, FSharpTypeReference, FSharpUnion, FSharpUnionCase, FSharpTypeParameter, FSharpMapped, FSharpInterface, FSharpAttribute, FSharpType, FSharpType_$reflection } from "./FsharpAST.js";
|
|
9
|
+
import { ofSeq as ofSeq_1, empty as empty_3, add, contains as contains_2, ofList, FSharpSet__Contains } from "../fable_modules/fable-library-js.5.17.2/Set.js";
|
|
9
10
|
import { aggregatedExports, replaceSelfReference, isUnitAlias, typedArrayNames, transformPrimitive, requiredBeforeParamArray, isDataObject, Interface_makePartial, tryUnwrapOption, iteratorNames } from "./Transformer/Utils.js";
|
|
10
|
-
import { value as value_7,
|
|
11
|
-
import { zip, mapFold, item, concat as concat_1, reverse, iterate, cons, foldBack, fold, tryFind, ofSeq
|
|
12
|
-
import { aliasArities,
|
|
11
|
+
import { value as value_7, toArray, defaultArg } from "../fable_modules/fable-library-js.5.17.2/Option.js";
|
|
12
|
+
import { zip, mapFold, tryPick, item, concat as concat_1, reverse, iterate, cons, foldBack, fold, sortBy, tryFind, ofSeq, forAll, truncate, contains, exists, partition, mapIndexed, filter, append, length, collect, tryLast, choose, tryHead, singleton, empty, ofArray, map, head as head_1, tail as tail_1, isEmpty } from "../fable_modules/fable-library-js.5.17.2/List.js";
|
|
13
|
+
import { aliasArities, membersNameUndeclaredTypeParameters, mentionsTypeParameter, ownTypeParameterDefaults, typeParameterNames as typeParameterNames_2, unconstrained, memberTypeParameterNames, typeArguments, declaredTypeParameters as declaredTypeParameters_1 } from "./Transformer/TypeParameters.js";
|
|
13
14
|
import { List_groupBy, List_distinct } from "../fable_modules/fable-library-js.5.17.2/Seq2.js";
|
|
14
|
-
import { uncurry2, curry2, Lazy, structuralHash, Exception, numberHash, int32ToString,
|
|
15
|
-
import { replace, trim,
|
|
16
|
-
import { resolveMembers,
|
|
17
|
-
import { FSharpMap__TryFind, exists as exists_1, empty as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { map as map_2, empty as empty_1, forAll, singleton as singleton_1, append as append_1, delay, toList } from "../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
21
|
-
import { isLetterOrDigit } from "../fable_modules/fable-library-js.5.17.2/Char.js";
|
|
22
|
-
import { defaultMaxOverloads, expandMembers as expandMembers_2, expandParameters } from "./Transformer/UnionOverloads.js";
|
|
23
|
-
import { isMap, keysModule, isMapNamed, expandMembers as expandMembers_1, expandFunction } from "./Transformer/KeyOfMaps.js";
|
|
24
|
-
import { applyWith as applyWith_1, disambiguateOverloads, aliasesOf, parametersSignature, Aliases_get_Empty, distinctBySignature } from "./Merge.js";
|
|
15
|
+
import { uncurry2, curry2, Lazy, structuralHash, Exception, numberHash, int32ToString, comparePrimitives, safeHash, equals, stringHash } from "../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
16
|
+
import { replace, trim, interpolate, concat } from "../fable_modules/fable-library-js.5.17.2/String.js";
|
|
17
|
+
import { resolveMembers, isConditionalAlias, isInterfaceDeclaration } from "./Transformer/Conditionals.js";
|
|
18
|
+
import { FSharpMap__TryFind, exists as exists_1, empty as empty_2, ofList as ofList_1, FSharpMap__ContainsKey, FSharpMap__get_Item, map as map_1 } from "../fable_modules/fable-library-js.5.17.2/Map.js";
|
|
19
|
+
import { removeSurroundingQuotes, sanitizeTypeNameWithResult, sanitizeTypeName } from "./Utils/Naming.js";
|
|
20
|
+
import { map as map_2, append as append_1, empty as empty_1, singleton as singleton_1, delay, toList } from "../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
25
21
|
import { capitalizeFirstLetter } from "./Utils/String.js";
|
|
22
|
+
import { addToSet } from "../fable_modules/fable-library-js.5.17.2/MapUtil.js";
|
|
26
23
|
import { expandMembers } from "./Transformer/AnyFunctionOverloads.js";
|
|
24
|
+
import { isMap, keysModule, isMapNamed, expandMembers as expandMembers_1 } from "./Transformer/KeyOfMaps.js";
|
|
25
|
+
import { defaultMaxOverloads, expandMembers as expandMembers_2 } from "./Transformer/UnionOverloads.js";
|
|
26
|
+
import { applyWith as applyWith_1, disambiguateOverloads, aliasesOf, parametersSignature, Aliases_get_Empty, distinctBySignature } from "./Merge.js";
|
|
27
27
|
import { min } from "../fable_modules/fable-library-js.5.17.2/Double.js";
|
|
28
28
|
import { inheritsIterable, asMethods, tryCallableHeritage } from "./Transformer/CallableProperties.js";
|
|
29
29
|
import { withoutBaseClassProperties, withoutBasesOfBases, isInheritableType, isSelfHeritage, isArrayHeritage, isErrorHeritage, withoutRedeclaredBases } from "./Transformer/Heritage.js";
|
|
@@ -31,63 +31,10 @@ import { contains as contains_1 } from "../fable_modules/fable-library-js.5.17.2
|
|
|
31
31
|
import { isCandidate, tryResolveMembers } from "./Transformer/ParamObjectCandidate.js";
|
|
32
32
|
import { op_UnaryNegation_Int32 } from "../fable_modules/fable-library-js.5.17.2/Int32.js";
|
|
33
33
|
import { transformEnum } from "./Transformer/Enum.js";
|
|
34
|
-
import {
|
|
35
|
-
import { apply as
|
|
36
|
-
import { apply as
|
|
37
|
-
|
|
38
|
-
class ExportScope extends Record {
|
|
39
|
-
constructor(Context, IsTopLevel, DefaultExportedDeclarations, ExportEqualsNames, DeclaredValueNames, ExportEqualsMembers, ExportEqualsCalls) {
|
|
40
|
-
super();
|
|
41
|
-
this.Context = Context;
|
|
42
|
-
this.IsTopLevel = IsTopLevel;
|
|
43
|
-
this.DefaultExportedDeclarations = DefaultExportedDeclarations;
|
|
44
|
-
this.ExportEqualsNames = ExportEqualsNames;
|
|
45
|
-
this.DeclaredValueNames = DeclaredValueNames;
|
|
46
|
-
this.ExportEqualsMembers = ExportEqualsMembers;
|
|
47
|
-
this.ExportEqualsCalls = ExportEqualsCalls;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function ExportScope_$reflection() {
|
|
52
|
-
return record_type("Glutinum.Converter.Transform.ExportScope", [], ExportScope, () => [["Context", TransformContext_$reflection()], ["IsTopLevel", bool_type], ["DefaultExportedDeclarations", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type])], ["ExportEqualsNames", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type])], ["DeclaredValueNames", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type])], ["ExportEqualsMembers", class_type("System.Collections.Generic.Dictionary`2", [string_type, string_type])], ["ExportEqualsCalls", class_type("System.Collections.Generic.HashSet`1", [string_type])]]);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
class ExportMembers extends Record {
|
|
56
|
-
constructor(Members, Names, Prepended) {
|
|
57
|
-
super();
|
|
58
|
-
this.Members = Members;
|
|
59
|
-
this.Names = Names;
|
|
60
|
-
this.Prepended = Prepended;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function ExportMembers_$reflection() {
|
|
65
|
-
return record_type("Glutinum.Converter.Transform.ExportMembers", [], ExportMembers, () => [["Members", list_type(FSharpMember_$reflection())], ["Names", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type])], ["Prepended", list_type(GlueType_$reflection())]]);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
class TransformTypeParametersResult extends Record {
|
|
69
|
-
constructor(TypeParameters, SealedTypes) {
|
|
70
|
-
super();
|
|
71
|
-
this.TypeParameters = TypeParameters;
|
|
72
|
-
this.SealedTypes = SealedTypes;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function TransformTypeParametersResult_$reflection() {
|
|
77
|
-
return record_type("Glutinum.Converter.Transform.TransformTypeParametersResult", [], TransformTypeParametersResult, () => [["TypeParameters", list_type(FSharpTypeParameter_$reflection())], ["SealedTypes", list_type(TypeParameter_SealedTypeInfo_$reflection())]]);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
class TransformDeclarationTypeParametersResult extends Record {
|
|
81
|
-
constructor(TypeParameters, SealedTypeArguments) {
|
|
82
|
-
super();
|
|
83
|
-
this.TypeParameters = TypeParameters;
|
|
84
|
-
this.SealedTypeArguments = SealedTypeArguments;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function TransformDeclarationTypeParametersResult_$reflection() {
|
|
89
|
-
return record_type("Glutinum.Converter.Transform.TransformDeclarationTypeParametersResult", [], TransformDeclarationTypeParametersResult, () => [["TypeParameters", list_type(FSharpTypeParameter_$reflection())], ["SealedTypeArguments", option_type(list_type(FSharpTypeParameter_$reflection()))]]);
|
|
90
|
-
}
|
|
34
|
+
import { Transforms, transformExports } from "./Transformer/Exports.js";
|
|
35
|
+
import { apply as apply_1 } from "./DelegateExtensions.js";
|
|
36
|
+
import { apply as apply_2 } from "./FreeTypeParameters.js";
|
|
37
|
+
import { apply as apply_3 } from "./Abbreviations.js";
|
|
91
38
|
|
|
92
39
|
class AliasScope extends Record {
|
|
93
40
|
constructor(Name, Context, Declaration, XmlDoc, TypeParameters) {
|
|
@@ -493,7 +440,7 @@ function unwrapOptionIfAlreadyOptional(context, typ, isOptional) {
|
|
|
493
440
|
|
|
494
441
|
function transformTupleType(context, glueTypes) {
|
|
495
442
|
if (!isEmpty(glueTypes)) {
|
|
496
|
-
if (isEmpty(
|
|
443
|
+
if (isEmpty(tail_1(glueTypes))) {
|
|
497
444
|
return new FSharpType(/* ResizeArray */ 14, [transformType(context, head_1(glueTypes))]);
|
|
498
445
|
}
|
|
499
446
|
else {
|
|
@@ -822,7 +769,7 @@ function transformUnionType(context, cases) {
|
|
|
822
769
|
});
|
|
823
770
|
let matchResult, single;
|
|
824
771
|
if (!isEmpty(caseTypes)) {
|
|
825
|
-
if (isEmpty(
|
|
772
|
+
if (isEmpty(tail_1(caseTypes))) {
|
|
826
773
|
matchResult = 0;
|
|
827
774
|
single = head_1(caseTypes);
|
|
828
775
|
}
|
|
@@ -912,7 +859,7 @@ function transformFunctionType(context, functionTypeInfo) {
|
|
|
912
859
|
const paremeters = filter((parameter) => (parameter.Name !== "this"), functionTypeInfo.Parameters);
|
|
913
860
|
let matchResult;
|
|
914
861
|
if (!isEmpty(paremeters)) {
|
|
915
|
-
if (isEmpty(
|
|
862
|
+
if (isEmpty(tail_1(paremeters))) {
|
|
916
863
|
matchResult = 0;
|
|
917
864
|
}
|
|
918
865
|
else {
|
|
@@ -953,7 +900,7 @@ function transformFunctionType(context, functionTypeInfo) {
|
|
|
953
900
|
}
|
|
954
901
|
}, append(functionTypeInfo.TypeParameters, map(unconstrained, filter((name) => !FSharpSet__Contains(declared, name), functionTypeInfo.OwnTypeParameterNames))))));
|
|
955
902
|
const name_2 = TransformContext__NewTypeName(context);
|
|
956
|
-
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(/* Delegate */ 20, [new FSharpDelegate(empty(), name_2, typParameters.TypeParameters, requiredBeforeParamArray(map((arg) =>
|
|
903
|
+
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(/* Delegate */ 20, [new FSharpDelegate(empty(), name_2, typParameters.TypeParameters, requiredBeforeParamArray(map((arg) => mapFsharpParameter(typParameters.SealedTypes, transformParameter(context, arg)), paremeters)), mapFSharpType(typParameters.SealedTypes, transformCallbackReturnType(TransformContext__PushScope_27AED5E3(context, "ReturnType"), functionTypeInfo.Type)))]));
|
|
957
904
|
const ownDefaults_1 = map_1((_arg_1, glueType) => transformType(context, glueType), ownTypeParameterDefaults(functionTypeInfo));
|
|
958
905
|
return new FSharpType(/* TypeAlias */ 9, [new FSharpTypeAlias(empty(), TransformContext__ReferenceName_Z721C83C5(context, name_2), empty(), FSharpType.Discard, map((typeParameter_2) => {
|
|
959
906
|
let matchResult_1, info_1;
|
|
@@ -1113,7 +1060,7 @@ function transformType(context_mut, glueType_mut) {
|
|
|
1113
1060
|
}
|
|
1114
1061
|
else if (glueType.fields[0].Name === "Readonly") {
|
|
1115
1062
|
if (!isEmpty(glueType.fields[0].TypeArguments)) {
|
|
1116
|
-
if (isEmpty(
|
|
1063
|
+
if (isEmpty(tail_1(glueType.fields[0].TypeArguments))) {
|
|
1117
1064
|
if (glueType.fields[0].IsStandardLibrary) {
|
|
1118
1065
|
matchResult = 11;
|
|
1119
1066
|
argument = head_1(glueType.fields[0].TypeArguments);
|
|
@@ -1523,650 +1470,6 @@ function transformType(context_mut, glueType_mut) {
|
|
|
1523
1470
|
}
|
|
1524
1471
|
}
|
|
1525
1472
|
|
|
1526
|
-
function withoutFreeTypeParameters(members) {
|
|
1527
|
-
const erase = (declared, typ) => {
|
|
1528
|
-
const declaredNames = ofList(choose((_arg) => {
|
|
1529
|
-
if (_arg.tag === 0) {
|
|
1530
|
-
return undefined;
|
|
1531
|
-
}
|
|
1532
|
-
else {
|
|
1533
|
-
return _arg.fields[0].Name;
|
|
1534
|
-
}
|
|
1535
|
-
}, declared), {
|
|
1536
|
-
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
1537
|
-
});
|
|
1538
|
-
const free = map((name_1) => (new TypeParameter_SealedTypeInfo(name_1, FSharpType.Object$)), filter((name) => !FSharpSet__Contains(declaredNames, name), List_distinct(namedTypeParameters(typ), {
|
|
1539
|
-
Equals: (x_1, y_1) => (x_1 === y_1),
|
|
1540
|
-
GetHashCode: (x_1) => (stringHash(x_1) | 0),
|
|
1541
|
-
})));
|
|
1542
|
-
if (isEmpty(free)) {
|
|
1543
|
-
return typ;
|
|
1544
|
-
}
|
|
1545
|
-
else {
|
|
1546
|
-
return TypeParameter_mapFSharpType(free, typ);
|
|
1547
|
-
}
|
|
1548
|
-
};
|
|
1549
|
-
const eraseInfo = (info_1) => {
|
|
1550
|
-
const Type = erase(info_1.TypeParameters, info_1.Type);
|
|
1551
|
-
return new FSharpMemberInfo(info_1.Attributes, info_1.Name, info_1.OriginalName, info_1.TypeParameters, map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, erase(info_1.TypeParameters, parameter.Type), parameter.OriginalGlueMember)), info_1.Parameters), Type, info_1.IsOptional, info_1.IsStatic, info_1.Accessor, info_1.Accessibility, info_1.XmlDoc, info_1.Body);
|
|
1552
|
-
};
|
|
1553
|
-
return map((_arg_1) => {
|
|
1554
|
-
switch (_arg_1.tag) {
|
|
1555
|
-
case 1:
|
|
1556
|
-
return new FSharpMember(/* Property */ 1, [eraseInfo(_arg_1.fields[0])]);
|
|
1557
|
-
case 2:
|
|
1558
|
-
return new FSharpMember(/* StaticMember */ 2, [_arg_1.fields[0]]);
|
|
1559
|
-
default:
|
|
1560
|
-
return new FSharpMember(/* Method */ 0, [eraseInfo(_arg_1.fields[0])]);
|
|
1561
|
-
}
|
|
1562
|
-
}, members);
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
function exportMembers(members, names) {
|
|
1566
|
-
return new ExportMembers(members, names, empty());
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
function throughDefault(scope, memberName, emit) {
|
|
1570
|
-
let matchValue;
|
|
1571
|
-
let outArg = defaultOf();
|
|
1572
|
-
matchValue = [tryGetValue(scope.ExportEqualsMembers, memberName, new FSharpRef(() => outArg, (v) => {
|
|
1573
|
-
outArg = v;
|
|
1574
|
-
})), outArg];
|
|
1575
|
-
let matchResult;
|
|
1576
|
-
if (matchValue[0]) {
|
|
1577
|
-
if (scope.IsTopLevel) {
|
|
1578
|
-
matchResult = 0;
|
|
1579
|
-
}
|
|
1580
|
-
else {
|
|
1581
|
-
matchResult = 1;
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
else {
|
|
1585
|
-
matchResult = 1;
|
|
1586
|
-
}
|
|
1587
|
-
switch (matchResult) {
|
|
1588
|
-
case 0: {
|
|
1589
|
-
const emit_1 = scope.ExportEqualsCalls.has(memberName) ? "$0($1...)" : emit;
|
|
1590
|
-
return toList(delay(() => append_1(importDefaultAttribute(matchValue[1], TransformContext__get_ImportSource(scope.Context)), delay(() => singleton_1(new FSharpAttribute(/* Text */ 0, [concat("Emit(\"", emit_1, "\")")]))))));
|
|
1591
|
-
}
|
|
1592
|
-
default:
|
|
1593
|
-
return undefined;
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
function exportProperty(scope) {
|
|
1598
|
-
return new FSharpMemberInfo(empty(), "", "", empty(), empty(), FSharpType.Discard, false, scope.IsTopLevel, undefined, FSharpAccessibility.Public, empty(), FSharpMemberInfoBody.NativeOnly);
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
function moduleNames(seenNames, moduleDeclaration) {
|
|
1602
|
-
const sanitizedName = sanitizeTypeName(moduleDeclaration.Name);
|
|
1603
|
-
const withSuffix = sanitizeTypeName(removeSurroundingQuotes(moduleDeclaration.Name) + "_");
|
|
1604
|
-
return [sanitizedName, withSuffix, FSharpSet__Contains(seenNames, sanitizedName) ? withSuffix : sanitizedName];
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
function exportVariable(scope, info) {
|
|
1608
|
-
let bind$0040;
|
|
1609
|
-
const patternInput = sanitizeMemberNameAndPushScope(scope.IsTopLevel, info.Name, scope.Context);
|
|
1610
|
-
const name = patternInput[0];
|
|
1611
|
-
const context_1 = TransformContext__PushScope_27AED5E3(patternInput[1], "Type");
|
|
1612
|
-
const xmlDocInfo = transformComment(info.Documentation);
|
|
1613
|
-
return exportMembers(singleton(new FSharpMember(/* Property */ 1, [(bind$0040 = exportProperty(scope), new FSharpMemberInfo(toList(delay(() => {
|
|
1614
|
-
let matchValue;
|
|
1615
|
-
return append_1((matchValue = throughDefault(scope, info.Name, concat("$0.", info.Name)), (matchValue == null) ? (scope.IsTopLevel ? importAttribute(info.Name, TransformContext__get_ImportSource(context_1)) : singleton_1(new FSharpAttribute(/* EmitMacroProperty */ 19, [info.Name]))) : matchValue), delay(() => xmlDocInfo.ObsoleteAttributes));
|
|
1616
|
-
})), name, info.Name, bind$0040.TypeParameters, bind$0040.Parameters, transformType(context_1, info.Type), bind$0040.IsOptional, bind$0040.IsStatic, bind$0040.Accessor, bind$0040.Accessibility, xmlDocInfo.XmlDoc, bind$0040.Body))])), singleton_2(name, {
|
|
1617
|
-
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
1618
|
-
}));
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
function exportFunction(scope, seenNames, exports, info) {
|
|
1622
|
-
let specifier;
|
|
1623
|
-
const patternInput = sanitizeMemberNameAndPushScope(scope.IsTopLevel, info.Name, scope.Context);
|
|
1624
|
-
const name = patternInput[0];
|
|
1625
|
-
const context = patternInput[1];
|
|
1626
|
-
const xmlDocInfo = transformComment(info.Documentation);
|
|
1627
|
-
const typeParameters = transformTypeParameters(context, info.TypeParameters);
|
|
1628
|
-
const method = new FSharpMemberInfo(toList(delay(() => {
|
|
1629
|
-
let matchValue;
|
|
1630
|
-
return append_1((matchValue = throughDefault(scope, info.Name, concat("$0.", info.Name, "($1...)")), (matchValue == null) ? (scope.IsTopLevel ? (FSharpSet__Contains(scope.DefaultExportedDeclarations, info.Name) ? importDefaultAttribute(info.Name, TransformContext__get_ImportSource(context)) : importAttribute(info.Name, TransformContext__get_ImportSource(context))) : singleton_1(new FSharpAttribute(/* EmitMacroInvoke */ 18, [info.Name]))) : matchValue), delay(() => xmlDocInfo.ObsoleteAttributes));
|
|
1631
|
-
})), name, info.Name, typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) => TypeParameter_mapFsharpParameter(typeParameters.SealedTypes, transformParameter(context, arg)), info.Parameters)), TypeParameter_mapFSharpType(typeParameters.SealedTypes, transformType(context, info.Type)), false, scope.IsTopLevel, undefined, FSharpAccessibility.Public, xmlDocInfo.XmlDoc, FSharpMemberInfoBody.NativeOnly);
|
|
1632
|
-
let runtimeName;
|
|
1633
|
-
const matchValue_1 = TransformContext__get_ImportSource(context);
|
|
1634
|
-
let matchResult, specifier_1;
|
|
1635
|
-
if (matchValue_1.tag === 0) {
|
|
1636
|
-
if ((specifier = matchValue_1.fields[0], ((((((scope.IsTopLevel && FSharpSet__Contains(scope.DefaultExportedDeclarations, info.Name)) && (specifier !== "REPLACE_ME_WITH_MODULE_NAME")) && !(specifier.indexOf("/") >= 0)) && forAll((c) => {
|
|
1637
|
-
if (isLetterOrDigit(c)) {
|
|
1638
|
-
return true;
|
|
1639
|
-
}
|
|
1640
|
-
else {
|
|
1641
|
-
return c === "_";
|
|
1642
|
-
}
|
|
1643
|
-
}, specifier.split(""))) && (specifier !== name)) && !FSharpSet__Contains(seenNames, specifier)) && !exists((_arg) => {
|
|
1644
|
-
let matchResult_1, other, other_1;
|
|
1645
|
-
switch (_arg.tag) {
|
|
1646
|
-
case 6: {
|
|
1647
|
-
matchResult_1 = 0;
|
|
1648
|
-
other = _arg.fields[0];
|
|
1649
|
-
break;
|
|
1650
|
-
}
|
|
1651
|
-
case 25: {
|
|
1652
|
-
if (_arg.fields[0].tag === 6) {
|
|
1653
|
-
matchResult_1 = 0;
|
|
1654
|
-
other = _arg.fields[0].fields[0];
|
|
1655
|
-
}
|
|
1656
|
-
else {
|
|
1657
|
-
matchResult_1 = 2;
|
|
1658
|
-
}
|
|
1659
|
-
break;
|
|
1660
|
-
}
|
|
1661
|
-
case 2: {
|
|
1662
|
-
matchResult_1 = 1;
|
|
1663
|
-
other_1 = _arg.fields[0];
|
|
1664
|
-
break;
|
|
1665
|
-
}
|
|
1666
|
-
default:
|
|
1667
|
-
matchResult_1 = 2;
|
|
1668
|
-
}
|
|
1669
|
-
switch (matchResult_1) {
|
|
1670
|
-
case 0:
|
|
1671
|
-
return other.Name === specifier;
|
|
1672
|
-
case 1:
|
|
1673
|
-
return other_1.Name === specifier;
|
|
1674
|
-
default:
|
|
1675
|
-
return false;
|
|
1676
|
-
}
|
|
1677
|
-
}, exports))) {
|
|
1678
|
-
matchResult = 0;
|
|
1679
|
-
specifier_1 = matchValue_1.fields[0];
|
|
1680
|
-
}
|
|
1681
|
-
else {
|
|
1682
|
-
matchResult = 1;
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
else {
|
|
1686
|
-
matchResult = 1;
|
|
1687
|
-
}
|
|
1688
|
-
switch (matchResult) {
|
|
1689
|
-
case 0: {
|
|
1690
|
-
runtimeName = specifier_1;
|
|
1691
|
-
break;
|
|
1692
|
-
}
|
|
1693
|
-
default:
|
|
1694
|
-
runtimeName = undefined;
|
|
1695
|
-
}
|
|
1696
|
-
return exportMembers(toList(delay(() => append_1(singleton_1(new FSharpMember(/* Method */ 0, [method])), delay(() => {
|
|
1697
|
-
const matchValue_2 = runtimeName;
|
|
1698
|
-
if (matchValue_2 == null) {
|
|
1699
|
-
return empty_1();
|
|
1700
|
-
}
|
|
1701
|
-
else {
|
|
1702
|
-
return singleton_1(new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(method.Attributes, matchValue_2, method.OriginalName, method.TypeParameters, method.Parameters, method.Type, method.IsOptional, method.IsStatic, method.Accessor, method.Accessibility, method.XmlDoc, method.Body)]));
|
|
1703
|
-
}
|
|
1704
|
-
})))), ofList(toList(delay(() => append_1(singleton_1(name), delay(() => ofArray(toArray(runtimeName)))))), {
|
|
1705
|
-
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
1706
|
-
}));
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
function exportClass(scope, isDefaultExport, info) {
|
|
1710
|
-
const patternInput = sanitizeNameAndPushScope(info.Name, scope.Context);
|
|
1711
|
-
const name = patternInput[0];
|
|
1712
|
-
const context = patternInput[1];
|
|
1713
|
-
return exportMembers(map((constructorInfo_1) => {
|
|
1714
|
-
const xmlDocInfo = transformComment(constructorInfo_1.Documentation);
|
|
1715
|
-
const typParameters = transformTypeParameters(context, info.TypeParameters);
|
|
1716
|
-
return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(toList(delay(() => append_1(scope.IsTopLevel ? append_1(isDefaultExport ? importDefaultAttribute(info.Name, TransformContext__get_ImportSource(context)) : importAttribute(info.Name, TransformContext__get_ImportSource(context)), delay(() => singleton_1(FSharpAttribute.EmitConstructor))) : singleton_1(new FSharpAttribute(/* EmitMacroConstructor */ 17, [info.Name])), delay(() => xmlDocInfo.ObsoleteAttributes)))), name, info.Name, typParameters.TypeParameters, requiredBeforeParamArray(map((arg) => TypeParameter_mapFsharpParameter(typParameters.SealedTypes, transformParameter(context, arg)), constructorInfo_1.Parameters)), new FSharpType(/* Mapped */ 7, [new FSharpMapped(sanitizeTypeName(info.Name), typParameters.TypeParameters)]), false, scope.IsTopLevel, undefined, FSharpAccessibility.Public, xmlDocInfo.XmlDoc, FSharpMemberInfoBody.NativeOnly)]);
|
|
1717
|
-
}, isEmpty(info.Constructors) ? singleton(new GlueConstructor(empty(), empty())) : collect((constructorInfo) => map((parameters) => (new GlueConstructor(constructorInfo.Documentation, parameters)), expandParameters(TransformContext__get_State(context).MaxOverloads, TransformContext__get_TypeMemory(context), constructorInfo.Parameters)), info.Constructors)), singleton_2(name, {
|
|
1718
|
-
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
1719
|
-
}));
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
function exportModule(scope, seenNames, moduleDeclaration) {
|
|
1723
|
-
let bind$0040, typ_2;
|
|
1724
|
-
const context = scope.Context;
|
|
1725
|
-
const patternInput = moduleNames(seenNames, moduleDeclaration);
|
|
1726
|
-
const mangledName = patternInput[2];
|
|
1727
|
-
const exportTypeName = moduleDeclaration.IsTopLevel ? concat(patternInput[1], ".Exports") : concat(patternInput[0], ".Exports");
|
|
1728
|
-
const isAmbientModule = moduleDeclaration.Name.startsWith("\"") ? true : moduleDeclaration.Name.startsWith("\'");
|
|
1729
|
-
const exportEqualsType = tryPick((_arg) => {
|
|
1730
|
-
let matchResult, name_1, typ_1;
|
|
1731
|
-
if (_arg.tag === 25) {
|
|
1732
|
-
if (_arg.fields[0].tag === 2) {
|
|
1733
|
-
if (_arg.fields[0].fields[0].Name.startsWith("export=")) {
|
|
1734
|
-
matchResult = 0;
|
|
1735
|
-
name_1 = _arg.fields[0].fields[0].Name;
|
|
1736
|
-
typ_1 = _arg.fields[0].fields[0].Type;
|
|
1737
|
-
}
|
|
1738
|
-
else {
|
|
1739
|
-
matchResult = 1;
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
else {
|
|
1743
|
-
matchResult = 1;
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
else {
|
|
1747
|
-
matchResult = 1;
|
|
1748
|
-
}
|
|
1749
|
-
switch (matchResult) {
|
|
1750
|
-
case 0:
|
|
1751
|
-
return typ_1;
|
|
1752
|
-
default:
|
|
1753
|
-
return undefined;
|
|
1754
|
-
}
|
|
1755
|
-
}, moduleDeclaration.Types);
|
|
1756
|
-
const xmlDocInfo = transformComment(moduleDeclaration.Documentation);
|
|
1757
|
-
const namespaceValues = (scope.IsTopLevel && (FSharpSet__Contains(scope.ExportEqualsNames, moduleDeclaration.Name) ? true : FSharpSet__Contains(scope.DefaultExportedDeclarations, moduleDeclaration.Name))) ? choose((_arg_1) => {
|
|
1758
|
-
let info, info_1;
|
|
1759
|
-
let matchResult_1, info_2, info_3;
|
|
1760
|
-
switch (_arg_1.tag) {
|
|
1761
|
-
case 6: {
|
|
1762
|
-
if ((info = _arg_1.fields[0], !FSharpSet__Contains(scope.DeclaredValueNames, info.Name) && !FSharpSet__Contains(seenNames, info.Name))) {
|
|
1763
|
-
matchResult_1 = 0;
|
|
1764
|
-
info_2 = _arg_1.fields[0];
|
|
1765
|
-
}
|
|
1766
|
-
else {
|
|
1767
|
-
matchResult_1 = 2;
|
|
1768
|
-
}
|
|
1769
|
-
break;
|
|
1770
|
-
}
|
|
1771
|
-
case 2: {
|
|
1772
|
-
if ((info_1 = _arg_1.fields[0], !FSharpSet__Contains(scope.DeclaredValueNames, info_1.Name) && !FSharpSet__Contains(seenNames, info_1.Name))) {
|
|
1773
|
-
matchResult_1 = 1;
|
|
1774
|
-
info_3 = _arg_1.fields[0];
|
|
1775
|
-
}
|
|
1776
|
-
else {
|
|
1777
|
-
matchResult_1 = 2;
|
|
1778
|
-
}
|
|
1779
|
-
break;
|
|
1780
|
-
}
|
|
1781
|
-
default:
|
|
1782
|
-
matchResult_1 = 2;
|
|
1783
|
-
}
|
|
1784
|
-
switch (matchResult_1) {
|
|
1785
|
-
case 0: {
|
|
1786
|
-
scope.ExportEqualsMembers.set(info_2.Name, moduleDeclaration.Name);
|
|
1787
|
-
return new GlueType(/* FunctionDeclaration */ 6, [info_2]);
|
|
1788
|
-
}
|
|
1789
|
-
case 1: {
|
|
1790
|
-
scope.ExportEqualsMembers.set(info_3.Name, moduleDeclaration.Name);
|
|
1791
|
-
return new GlueType(/* Variable */ 2, [info_3]);
|
|
1792
|
-
}
|
|
1793
|
-
default:
|
|
1794
|
-
return undefined;
|
|
1795
|
-
}
|
|
1796
|
-
}, moduleDeclaration.Types) : empty();
|
|
1797
|
-
return new ExportMembers(singleton(new FSharpMember(/* Property */ 1, [(bind$0040 = exportProperty(scope), new FSharpMemberInfo(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => (isAmbientModule ? singleton_1(new FSharpAttribute(/* ImportAll */ 4, [removeSurroundingQuotes(moduleDeclaration.Name)])) : (scope.IsTopLevel ? importAllAttribute(removeSurroundingQuotes(moduleDeclaration.Name), TransformContext__get_ImportSource(context)) : singleton_1(new FSharpAttribute(/* EmitMacroProperty */ 19, [removeSurroundingQuotes(moduleDeclaration.Name)])))))))), mangledName, concat(moduleDeclaration.Name, ".Exports"), bind$0040.TypeParameters, bind$0040.Parameters, (exportEqualsType == null) ? (new FSharpType(/* Mapped */ 7, [new FSharpMapped(exportTypeName, empty())])) : ((typ_2 = exportEqualsType, transformType(TransformContext__PushScope_27AED5E3(context, mangledName), typ_2))), bind$0040.IsOptional, scope.IsTopLevel ? true : isAmbientModule, FSharpAccessor.ReadOnly, bind$0040.Accessibility, xmlDocInfo.XmlDoc, bind$0040.Body))])), singleton_2(mangledName, {
|
|
1798
|
-
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
1799
|
-
}), namespaceValues);
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
function exportEqualsVariable(scope, name, typ) {
|
|
1803
|
-
const patternInput = sanitizeMemberNameAndPushScope(true, substring(name, "export=".length), scope.Context);
|
|
1804
|
-
const name_1 = patternInput[0];
|
|
1805
|
-
const context = patternInput[1];
|
|
1806
|
-
let property;
|
|
1807
|
-
const bind$0040 = exportProperty(scope);
|
|
1808
|
-
property = (new FSharpMemberInfo(importDefaultAttribute(name_1, TransformContext__get_ImportSource(context)), name_1, name_1, bind$0040.TypeParameters, bind$0040.Parameters, transformType(context, typ), bind$0040.IsOptional, true, bind$0040.Accessor, bind$0040.Accessibility, bind$0040.XmlDoc, bind$0040.Body));
|
|
1809
|
-
const withoutThis = (memberType) => {
|
|
1810
|
-
if (memberType.tag === 17) {
|
|
1811
|
-
return typ;
|
|
1812
|
-
}
|
|
1813
|
-
else {
|
|
1814
|
-
return memberType;
|
|
1815
|
-
}
|
|
1816
|
-
};
|
|
1817
|
-
const objectMembers = (typ.tag === 13) ? defaultArg(tryPick((_arg) => {
|
|
1818
|
-
let matchResult, info_1;
|
|
1819
|
-
if (_arg.tag === 1) {
|
|
1820
|
-
if (_arg.fields[0].FullName === typ.fields[0].FullName) {
|
|
1821
|
-
matchResult = 0;
|
|
1822
|
-
info_1 = _arg.fields[0];
|
|
1823
|
-
}
|
|
1824
|
-
else {
|
|
1825
|
-
matchResult = 1;
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
else {
|
|
1829
|
-
matchResult = 1;
|
|
1830
|
-
}
|
|
1831
|
-
switch (matchResult) {
|
|
1832
|
-
case 0:
|
|
1833
|
-
return info_1.Members;
|
|
1834
|
-
default:
|
|
1835
|
-
return undefined;
|
|
1836
|
-
}
|
|
1837
|
-
}, TransformContext__get_TypeMemory(context)), empty()) : ((typ.tag === 22) ? typ.fields[0].Members : empty());
|
|
1838
|
-
const memberExports = filter((glueType) => (GlueType__get_Name(glueType) !== name_1), choose((_arg_1) => {
|
|
1839
|
-
let matchResult_1, info_5, info_6, info_7;
|
|
1840
|
-
switch (_arg_1.tag) {
|
|
1841
|
-
case 1: {
|
|
1842
|
-
if (!_arg_1.fields[0].IsStatic) {
|
|
1843
|
-
matchResult_1 = 0;
|
|
1844
|
-
info_5 = _arg_1.fields[0];
|
|
1845
|
-
}
|
|
1846
|
-
else {
|
|
1847
|
-
matchResult_1 = 3;
|
|
1848
|
-
}
|
|
1849
|
-
break;
|
|
1850
|
-
}
|
|
1851
|
-
case 6: {
|
|
1852
|
-
matchResult_1 = 1;
|
|
1853
|
-
info_6 = _arg_1.fields[0];
|
|
1854
|
-
break;
|
|
1855
|
-
}
|
|
1856
|
-
case 0: {
|
|
1857
|
-
if (!_arg_1.fields[0].IsStatic) {
|
|
1858
|
-
matchResult_1 = 2;
|
|
1859
|
-
info_7 = _arg_1.fields[0];
|
|
1860
|
-
}
|
|
1861
|
-
else {
|
|
1862
|
-
matchResult_1 = 3;
|
|
1863
|
-
}
|
|
1864
|
-
break;
|
|
1865
|
-
}
|
|
1866
|
-
default:
|
|
1867
|
-
matchResult_1 = 3;
|
|
1868
|
-
}
|
|
1869
|
-
switch (matchResult_1) {
|
|
1870
|
-
case 0:
|
|
1871
|
-
return new GlueType(/* Variable */ 2, [new GlueVariable(info_5.Documentation, info_5.Name, info_5.Type)]);
|
|
1872
|
-
case 1:
|
|
1873
|
-
return new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(info_6.Documentation, true, info_6.Name, withoutThis(info_6.Type), info_6.Parameters, empty())]);
|
|
1874
|
-
case 2:
|
|
1875
|
-
return new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(info_7.Documentation, true, info_7.Name, withoutThis(info_7.Type), info_7.Parameters, empty())]);
|
|
1876
|
-
default:
|
|
1877
|
-
return undefined;
|
|
1878
|
-
}
|
|
1879
|
-
}, objectMembers));
|
|
1880
|
-
const calls = collect((_arg_2) => {
|
|
1881
|
-
if (_arg_2.tag === 4) {
|
|
1882
|
-
const info_8 = _arg_2.fields[0];
|
|
1883
|
-
return map((parameters) => (new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(empty(), true, name_1, withoutThis(info_8.Type), parameters, info_8.TypeParameters)])), expandParameters(TransformContext__get_State(context).MaxOverloads, TransformContext__get_TypeMemory(context), info_8.Parameters));
|
|
1884
|
-
}
|
|
1885
|
-
else {
|
|
1886
|
-
return empty();
|
|
1887
|
-
}
|
|
1888
|
-
}, objectMembers);
|
|
1889
|
-
const enumerator = getEnumerator(memberExports);
|
|
1890
|
-
try {
|
|
1891
|
-
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1892
|
-
const memberExport = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1893
|
-
scope.ExportEqualsMembers.set(GlueType__get_Name(memberExport), name_1);
|
|
1894
|
-
}
|
|
1895
|
-
}
|
|
1896
|
-
finally {
|
|
1897
|
-
disposeSafe(enumerator);
|
|
1898
|
-
}
|
|
1899
|
-
if (!isEmpty(calls)) {
|
|
1900
|
-
scope.ExportEqualsMembers.set(name_1, name_1);
|
|
1901
|
-
addToSet(name_1, scope.ExportEqualsCalls);
|
|
1902
|
-
}
|
|
1903
|
-
return new ExportMembers(isEmpty(calls) ? singleton(new FSharpMember(/* Property */ 1, [property])) : empty(), singleton_2(name_1, {
|
|
1904
|
-
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
1905
|
-
}), append(calls, memberExports));
|
|
1906
|
-
}
|
|
1907
|
-
|
|
1908
|
-
function exportDefaultModule(scope, seenNames, moduleDeclaration) {
|
|
1909
|
-
let bind$0040;
|
|
1910
|
-
const patternInput = moduleNames(seenNames, moduleDeclaration);
|
|
1911
|
-
const name = patternInput[2];
|
|
1912
|
-
const xmlDocInfo = transformComment(moduleDeclaration.Documentation);
|
|
1913
|
-
return exportMembers(singleton(new FSharpMember(/* Property */ 1, [(bind$0040 = exportProperty(scope), new FSharpMemberInfo(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => importDefaultAttribute(moduleDeclaration.Name, TransformContext__get_ImportSource(scope.Context)))))), name, concat(moduleDeclaration.Name, ".Exports"), bind$0040.TypeParameters, bind$0040.Parameters, new FSharpType(/* Mapped */ 7, [new FSharpMapped(concat(patternInput[1], ".Exports"), empty())]), bind$0040.IsOptional, true, FSharpAccessor.ReadOnly, bind$0040.Accessibility, xmlDocInfo.XmlDoc, bind$0040.Body))])), singleton_2(name, {
|
|
1914
|
-
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
1915
|
-
}));
|
|
1916
|
-
}
|
|
1917
|
-
|
|
1918
|
-
function exportDefault(scope, seenNames, glueType) {
|
|
1919
|
-
let bind$0040;
|
|
1920
|
-
const patternInput = sanitizeMemberNameAndPushScope(true, GlueType__get_Name(glueType), scope.Context);
|
|
1921
|
-
const name = patternInput[0];
|
|
1922
|
-
const context = patternInput[1];
|
|
1923
|
-
const name_1 = FSharpSet__Contains(seenNames, name) ? concat(name, "_") : name;
|
|
1924
|
-
const context_1 = (glueType.tag === 2) ? TransformContext__PushScope_27AED5E3(context, "Type") : context;
|
|
1925
|
-
return exportMembers(singleton(new FSharpMember(/* Property */ 1, [(bind$0040 = exportProperty(scope), new FSharpMemberInfo(importDefaultAttribute(GlueType__get_Name(glueType), TransformContext__get_ImportSource(context_1)), name_1, GlueType__get_Name(glueType), bind$0040.TypeParameters, bind$0040.Parameters, transformType(context_1, glueType), bind$0040.IsOptional, true, bind$0040.Accessor, bind$0040.Accessibility, bind$0040.XmlDoc, bind$0040.Body))])), singleton_2(name_1, {
|
|
1926
|
-
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
1927
|
-
}));
|
|
1928
|
-
}
|
|
1929
|
-
|
|
1930
|
-
function transformExports(context, isTopLevel, exports) {
|
|
1931
|
-
let members_2;
|
|
1932
|
-
const context_1 = TransformContext__PushScope_27AED5E3(context, "Exports");
|
|
1933
|
-
const exportEqualsNames = ofSeq(choose((_arg) => {
|
|
1934
|
-
let matchResult, name_1;
|
|
1935
|
-
if (_arg.tag === 25) {
|
|
1936
|
-
if (_arg.fields[0].tag === 2) {
|
|
1937
|
-
if (_arg.fields[0].fields[0].Name.startsWith("export=")) {
|
|
1938
|
-
matchResult = 0;
|
|
1939
|
-
name_1 = _arg.fields[0].fields[0].Name;
|
|
1940
|
-
}
|
|
1941
|
-
else {
|
|
1942
|
-
matchResult = 1;
|
|
1943
|
-
}
|
|
1944
|
-
}
|
|
1945
|
-
else {
|
|
1946
|
-
matchResult = 1;
|
|
1947
|
-
}
|
|
1948
|
-
}
|
|
1949
|
-
else {
|
|
1950
|
-
matchResult = 1;
|
|
1951
|
-
}
|
|
1952
|
-
switch (matchResult) {
|
|
1953
|
-
case 0:
|
|
1954
|
-
return substring(name_1, "export=".length);
|
|
1955
|
-
default:
|
|
1956
|
-
return undefined;
|
|
1957
|
-
}
|
|
1958
|
-
}, exports), {
|
|
1959
|
-
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
1960
|
-
});
|
|
1961
|
-
const sortedExports = sortBy((_arg_3) => {
|
|
1962
|
-
if (_arg_3.tag === 11) {
|
|
1963
|
-
return 1;
|
|
1964
|
-
}
|
|
1965
|
-
else {
|
|
1966
|
-
return 0;
|
|
1967
|
-
}
|
|
1968
|
-
}, collect((_arg_2) => {
|
|
1969
|
-
let info_2;
|
|
1970
|
-
let matchResult_1, info_1, glueType;
|
|
1971
|
-
switch (_arg_2.tag) {
|
|
1972
|
-
case 6: {
|
|
1973
|
-
matchResult_1 = 0;
|
|
1974
|
-
info_1 = _arg_2.fields[0];
|
|
1975
|
-
break;
|
|
1976
|
-
}
|
|
1977
|
-
case 25: {
|
|
1978
|
-
if (_arg_2.fields[0].tag === 6) {
|
|
1979
|
-
matchResult_1 = 0;
|
|
1980
|
-
info_1 = _arg_2.fields[0].fields[0];
|
|
1981
|
-
}
|
|
1982
|
-
else {
|
|
1983
|
-
matchResult_1 = 1;
|
|
1984
|
-
glueType = _arg_2;
|
|
1985
|
-
}
|
|
1986
|
-
break;
|
|
1987
|
-
}
|
|
1988
|
-
default: {
|
|
1989
|
-
matchResult_1 = 1;
|
|
1990
|
-
glueType = _arg_2;
|
|
1991
|
-
}
|
|
1992
|
-
}
|
|
1993
|
-
switch (matchResult_1) {
|
|
1994
|
-
case 0:
|
|
1995
|
-
return collect((info_4) => map((Item) => (new GlueType(/* FunctionDeclaration */ 6, [Item])), collect(TransformMembers_withDictionaryParameterOverloadsOfFunction, map((parameters) => (new GlueFunctionDeclaration(info_4.Documentation, info_4.IsDeclared, info_4.Name, info_4.Type, parameters, info_4.TypeParameters)), expandParameters(TransformContext__get_State(context_1).MaxOverloads, TransformContext__get_TypeMemory(context_1), info_4.Parameters)))), collect(TransformMembers_withDefaultedTypeParameterOverloadsOfFunction, (info_2 = expandFunction(TransformContext__get_State(context_1).KeyOfMaps, info_1), resolveFunction(TransformContext__get_State(context_1).Conditionals, info_2))));
|
|
1996
|
-
default:
|
|
1997
|
-
return singleton(glueType);
|
|
1998
|
-
}
|
|
1999
|
-
}, filter((_arg_1) => {
|
|
2000
|
-
if (_arg_1.tag === 2) {
|
|
2001
|
-
return !FSharpSet__Contains(exportEqualsNames, _arg_1.fields[0].Name);
|
|
2002
|
-
}
|
|
2003
|
-
else {
|
|
2004
|
-
return true;
|
|
2005
|
-
}
|
|
2006
|
-
}, exports)), {
|
|
2007
|
-
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
2008
|
-
});
|
|
2009
|
-
const scope = new ExportScope(context_1, isTopLevel, ofSeq(choose((_arg_4) => {
|
|
2010
|
-
let name_2;
|
|
2011
|
-
let matchResult_2, info_8, name_3;
|
|
2012
|
-
if (_arg_4.tag === 25) {
|
|
2013
|
-
switch (_arg_4.fields[0].tag) {
|
|
2014
|
-
case 6: {
|
|
2015
|
-
matchResult_2 = 0;
|
|
2016
|
-
info_8 = _arg_4.fields[0].fields[0];
|
|
2017
|
-
break;
|
|
2018
|
-
}
|
|
2019
|
-
case 2: {
|
|
2020
|
-
if ((name_2 = _arg_4.fields[0].fields[0].Name, exists((_arg_5) => {
|
|
2021
|
-
switch (_arg_5.tag) {
|
|
2022
|
-
case 12:
|
|
2023
|
-
return _arg_5.fields[0].Name === name_2;
|
|
2024
|
-
case 6:
|
|
2025
|
-
return _arg_5.fields[0].Name === name_2;
|
|
2026
|
-
default:
|
|
2027
|
-
return false;
|
|
2028
|
-
}
|
|
2029
|
-
}, sortedExports))) {
|
|
2030
|
-
matchResult_2 = 1;
|
|
2031
|
-
name_3 = _arg_4.fields[0].fields[0].Name;
|
|
2032
|
-
}
|
|
2033
|
-
else {
|
|
2034
|
-
matchResult_2 = 2;
|
|
2035
|
-
}
|
|
2036
|
-
break;
|
|
2037
|
-
}
|
|
2038
|
-
default:
|
|
2039
|
-
matchResult_2 = 2;
|
|
2040
|
-
}
|
|
2041
|
-
}
|
|
2042
|
-
else {
|
|
2043
|
-
matchResult_2 = 2;
|
|
2044
|
-
}
|
|
2045
|
-
switch (matchResult_2) {
|
|
2046
|
-
case 0:
|
|
2047
|
-
return info_8.Name;
|
|
2048
|
-
case 1:
|
|
2049
|
-
return name_3;
|
|
2050
|
-
default:
|
|
2051
|
-
return undefined;
|
|
2052
|
-
}
|
|
2053
|
-
}, exports), {
|
|
2054
|
-
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
2055
|
-
}), exportEqualsNames, ofSeq(choose((_arg_6) => {
|
|
2056
|
-
let matchResult_3, info_9, info_10, info_11;
|
|
2057
|
-
switch (_arg_6.tag) {
|
|
2058
|
-
case 6: {
|
|
2059
|
-
matchResult_3 = 0;
|
|
2060
|
-
info_9 = _arg_6.fields[0];
|
|
2061
|
-
break;
|
|
2062
|
-
}
|
|
2063
|
-
case 25: {
|
|
2064
|
-
switch (_arg_6.fields[0].tag) {
|
|
2065
|
-
case 6: {
|
|
2066
|
-
matchResult_3 = 0;
|
|
2067
|
-
info_9 = _arg_6.fields[0].fields[0];
|
|
2068
|
-
break;
|
|
2069
|
-
}
|
|
2070
|
-
case 12: {
|
|
2071
|
-
matchResult_3 = 2;
|
|
2072
|
-
info_11 = _arg_6.fields[0].fields[0];
|
|
2073
|
-
break;
|
|
2074
|
-
}
|
|
2075
|
-
default:
|
|
2076
|
-
matchResult_3 = 3;
|
|
2077
|
-
}
|
|
2078
|
-
break;
|
|
2079
|
-
}
|
|
2080
|
-
case 2: {
|
|
2081
|
-
matchResult_3 = 1;
|
|
2082
|
-
info_10 = _arg_6.fields[0];
|
|
2083
|
-
break;
|
|
2084
|
-
}
|
|
2085
|
-
case 12: {
|
|
2086
|
-
matchResult_3 = 2;
|
|
2087
|
-
info_11 = _arg_6.fields[0];
|
|
2088
|
-
break;
|
|
2089
|
-
}
|
|
2090
|
-
default:
|
|
2091
|
-
matchResult_3 = 3;
|
|
2092
|
-
}
|
|
2093
|
-
switch (matchResult_3) {
|
|
2094
|
-
case 0:
|
|
2095
|
-
return info_9.Name;
|
|
2096
|
-
case 1:
|
|
2097
|
-
return info_10.Name;
|
|
2098
|
-
case 2:
|
|
2099
|
-
return info_11.Name;
|
|
2100
|
-
default:
|
|
2101
|
-
return undefined;
|
|
2102
|
-
}
|
|
2103
|
-
}, exports), {
|
|
2104
|
-
Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
|
|
2105
|
-
}), new Map([]), new Set([]));
|
|
2106
|
-
const apply_1 = (acc_mut, seenNames_mut, glueTypes_mut) => {
|
|
2107
|
-
apply_1:
|
|
2108
|
-
while (true) {
|
|
2109
|
-
const acc = acc_mut, seenNames = seenNames_mut, glueTypes = glueTypes_mut;
|
|
2110
|
-
let info_12;
|
|
2111
|
-
let matchResult_4, name_5, tail_1, head, tail_2;
|
|
2112
|
-
if (!isEmpty(glueTypes)) {
|
|
2113
|
-
if (head_1(glueTypes).tag === 25) {
|
|
2114
|
-
if (head_1(glueTypes).fields[0].tag === 2) {
|
|
2115
|
-
if (FSharpSet__Contains(scope.DefaultExportedDeclarations, head_1(glueTypes).fields[0].fields[0].Name)) {
|
|
2116
|
-
matchResult_4 = 1;
|
|
2117
|
-
name_5 = head_1(glueTypes).fields[0].fields[0].Name;
|
|
2118
|
-
tail_1 = tail_3(glueTypes);
|
|
2119
|
-
}
|
|
2120
|
-
else {
|
|
2121
|
-
matchResult_4 = 2;
|
|
2122
|
-
head = head_1(glueTypes);
|
|
2123
|
-
tail_2 = tail_3(glueTypes);
|
|
2124
|
-
}
|
|
2125
|
-
}
|
|
2126
|
-
else {
|
|
2127
|
-
matchResult_4 = 2;
|
|
2128
|
-
head = head_1(glueTypes);
|
|
2129
|
-
tail_2 = tail_3(glueTypes);
|
|
2130
|
-
}
|
|
2131
|
-
}
|
|
2132
|
-
else {
|
|
2133
|
-
matchResult_4 = 2;
|
|
2134
|
-
head = head_1(glueTypes);
|
|
2135
|
-
tail_2 = tail_3(glueTypes);
|
|
2136
|
-
}
|
|
2137
|
-
}
|
|
2138
|
-
else {
|
|
2139
|
-
matchResult_4 = 0;
|
|
2140
|
-
}
|
|
2141
|
-
switch (matchResult_4) {
|
|
2142
|
-
case 0:
|
|
2143
|
-
return acc;
|
|
2144
|
-
case 1: {
|
|
2145
|
-
acc_mut = acc;
|
|
2146
|
-
seenNames_mut = seenNames;
|
|
2147
|
-
glueTypes_mut = tail_1;
|
|
2148
|
-
continue apply_1;
|
|
2149
|
-
}
|
|
2150
|
-
default: {
|
|
2151
|
-
const added = (head.tag === 2) ? exportVariable(scope, head.fields[0]) : ((head.tag === 6) ? exportFunction(scope, seenNames, glueTypes, head.fields[0]) : ((head.tag === 12) ? (((info_12 = head.fields[0], !info_12.IsExported && !FSharpSet__Contains(scope.DefaultExportedDeclarations, info_12.Name))) ? exportMembers(empty(), empty_2({
|
|
2152
|
-
Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
|
|
2153
|
-
})) : exportClass(scope, FSharpSet__Contains(scope.DefaultExportedDeclarations, head.fields[0].Name), head.fields[0])) : ((head.tag === 25) ? ((head.fields[0].tag === 12) ? exportClass(scope, true, head.fields[0].fields[0]) : ((head.fields[0].tag === 2) ? (head.fields[0].fields[0].Name.startsWith("export=") ? (isTopLevel ? exportEqualsVariable(scope, head.fields[0].fields[0].Name, head.fields[0].fields[0].Type) : exportMembers(empty(), empty_2({
|
|
2154
|
-
Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
|
|
2155
|
-
}))) : exportDefault(scope, seenNames, head.fields[0])) : ((head.fields[0].tag === 11) ? exportDefaultModule(scope, seenNames, head.fields[0].fields[0]) : exportDefault(scope, seenNames, head.fields[0])))) : ((head.tag === 11) ? exportModule(scope, seenNames, head.fields[0]) : toFail(printf("Could not generate exportMembers for: %A"))(head)))));
|
|
2156
|
-
acc_mut = append(acc, added.Members);
|
|
2157
|
-
seenNames_mut = union(seenNames, added.Names);
|
|
2158
|
-
glueTypes_mut = append(added.Prepended, tail_2);
|
|
2159
|
-
continue apply_1;
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
break;
|
|
2163
|
-
}
|
|
2164
|
-
};
|
|
2165
|
-
return new FSharpType(/* Interface */ 5, [new FSharpInterface(ofArray([FSharpAttribute.AbstractClass, FSharpAttribute.Erase]), "Exports", empty(), "Exports", empty(), (members_2 = withoutFreeTypeParameters(apply_1(empty(), empty_2({
|
|
2166
|
-
Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
|
|
2167
|
-
}), sortedExports)), distinctBySignature(Aliases_get_Empty(), members_2)), empty())]);
|
|
2168
|
-
}
|
|
2169
|
-
|
|
2170
1473
|
function transformParameter(context, parameter) {
|
|
2171
1474
|
const patternInput = sanitizeNameAndPushScope(parameter.Name, context);
|
|
2172
1475
|
const asArray = (glueType) => {
|
|
@@ -2186,7 +1489,7 @@ function transformParameter(context, parameter) {
|
|
|
2186
1489
|
case 13: {
|
|
2187
1490
|
if (glueType.fields[0].Name === "ReadonlyArray") {
|
|
2188
1491
|
if (!isEmpty(glueType.fields[0].TypeArguments)) {
|
|
2189
|
-
if (isEmpty(
|
|
1492
|
+
if (isEmpty(tail_1(glueType.fields[0].TypeArguments))) {
|
|
2190
1493
|
if (glueType.fields[0].IsStandardLibrary) {
|
|
2191
1494
|
matchResult = 1;
|
|
2192
1495
|
elementType_1 = head_1(glueType.fields[0].TypeArguments);
|
|
@@ -2243,7 +1546,7 @@ function transformParameter(context, parameter) {
|
|
|
2243
1546
|
const parameter_1 = new GlueParameter(parameter.Name, parameter.IsOptional, parameter.IsSpread, asArray(parameter.Type));
|
|
2244
1547
|
let typ;
|
|
2245
1548
|
const computedType = unwrapOptionIfAlreadyOptional(patternInput[1], parameter_1.Type, parameter_1.IsOptional);
|
|
2246
|
-
typ = (parameter_1.IsSpread ? ((computedType.tag === 14) ? computedType.fields[0] : ((computedType.tag === 11) ? ((computedType.fields[0].Name === "ResizeArray") ? (!isEmpty(computedType.fields[0].TypeArguments) ? (isEmpty(
|
|
1549
|
+
typ = (parameter_1.IsSpread ? ((computedType.tag === 14) ? computedType.fields[0] : ((computedType.tag === 11) ? ((computedType.fields[0].Name === "ResizeArray") ? (!isEmpty(computedType.fields[0].TypeArguments) ? (isEmpty(tail_1(computedType.fields[0].TypeArguments)) ? head_1(computedType.fields[0].TypeArguments) : computedType) : computedType) : computedType) : computedType)) : computedType);
|
|
2247
1550
|
return new FSharpParameter(toList(delay(() => (parameter_1.IsSpread ? singleton_1(FSharpAttribute.ParamArray) : empty_1()))), patternInput[0], parameter_1.IsOptional, typ, undefined);
|
|
2248
1551
|
}
|
|
2249
1552
|
|
|
@@ -2465,11 +1768,11 @@ function TransformMembers_defaultsOf(parameters, typeParameters) {
|
|
|
2465
1768
|
}, typeParameters), {
|
|
2466
1769
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
2467
1770
|
});
|
|
2468
|
-
if (
|
|
1771
|
+
if (forAll((typeParameter_1) => FSharpMap__ContainsKey(defaults, typeParameter_1.Name), typeParameters)) {
|
|
2469
1772
|
return map_1((_arg, default__1) => GlueSubstitution_substitute(defaults, default__1), defaults);
|
|
2470
1773
|
}
|
|
2471
1774
|
else {
|
|
2472
|
-
return
|
|
1775
|
+
return empty_2({
|
|
2473
1776
|
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
2474
1777
|
});
|
|
2475
1778
|
}
|
|
@@ -2512,7 +1815,7 @@ function TransformMembers_isAnyDictionary(glueType) {
|
|
|
2512
1815
|
}
|
|
2513
1816
|
switch (matchResult) {
|
|
2514
1817
|
case 0:
|
|
2515
|
-
return
|
|
1818
|
+
return forAll((_arg) => {
|
|
2516
1819
|
let matchResult_1;
|
|
2517
1820
|
if (_arg.tag === 5) {
|
|
2518
1821
|
switch (_arg.fields[0].Type.tag) {
|
|
@@ -2553,7 +1856,7 @@ function TransformMembers_tryDictionarySignature(typeParameters, parameters) {
|
|
|
2553
1856
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
2554
1857
|
});
|
|
2555
1858
|
const hasDictionary = exists((parameter_1) => TransformMembers_isAnyDictionary(parameter_1.Type), parameters);
|
|
2556
|
-
const allTold =
|
|
1859
|
+
const allTold = forAll((typeParameter) => FSharpSet__Contains(told, typeParameter.Name), typeParameters);
|
|
2557
1860
|
if (hasDictionary && allTold) {
|
|
2558
1861
|
const taken = new Set(map((_arg) => _arg.Name, typeParameters));
|
|
2559
1862
|
const added = [];
|
|
@@ -2584,7 +1887,7 @@ function TransformMembers_tryDictionarySignature(typeParameters, parameters) {
|
|
|
2584
1887
|
return parameter_3;
|
|
2585
1888
|
}
|
|
2586
1889
|
}, parameters);
|
|
2587
|
-
return [append(typeParameters,
|
|
1890
|
+
return [append(typeParameters, ofSeq(added)), parameters_1];
|
|
2588
1891
|
}
|
|
2589
1892
|
else {
|
|
2590
1893
|
return undefined;
|
|
@@ -2674,7 +1977,7 @@ function TransformMembers_trySpecializeStringLiteralMethod(methodName, parameter
|
|
|
2674
1977
|
return undefined;
|
|
2675
1978
|
}
|
|
2676
1979
|
else {
|
|
2677
|
-
const remainingParameters =
|
|
1980
|
+
const remainingParameters = tail_1(parameters);
|
|
2678
1981
|
const matchValue = head_1(parameters).Type;
|
|
2679
1982
|
let matchResult, literalValue;
|
|
2680
1983
|
if (matchValue.tag === 8) {
|
|
@@ -2936,7 +2239,7 @@ function TransformMembers_methodMember(context, methodInfo) {
|
|
|
2936
2239
|
}
|
|
2937
2240
|
else {
|
|
2938
2241
|
const typeParameters = transformTypeParameters(context_1, TransformMembers_withoutReferenceConstraints(methodInfo.TypeParameters));
|
|
2939
|
-
return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => patternInput[2])))), name, methodInfo.Name, typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) =>
|
|
2242
|
+
return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => patternInput[2])))), name, methodInfo.Name, typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) => mapFsharpParameter(typeParameters.SealedTypes, transformParameter(context_1, arg)), parameters)), mapFSharpType(typeParameters.SealedTypes, transformType(context_1, methodInfo.Type)), methodInfo.IsOptional, methodInfo.IsStatic, undefined, FSharpAccessibility.Public, xmlDocInfo.XmlDoc, FSharpMemberInfoBody.NativeOnly)]);
|
|
2940
2243
|
}
|
|
2941
2244
|
}
|
|
2942
2245
|
|
|
@@ -2944,7 +2247,7 @@ function TransformMembers_callSignatureMember(context, info) {
|
|
|
2944
2247
|
const patternInput = sanitizeNameAndPushScope("Invoke", context);
|
|
2945
2248
|
const context_1 = patternInput[1];
|
|
2946
2249
|
const typeParameters = transformTypeParameters(context_1, TransformMembers_withoutReferenceConstraints(info.TypeParameters));
|
|
2947
|
-
return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(singleton(FSharpAttribute.EmitSelfInvoke), patternInput[0], "Invoke", typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) =>
|
|
2250
|
+
return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(singleton(FSharpAttribute.EmitSelfInvoke), patternInput[0], "Invoke", typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) => mapFsharpParameter(typeParameters.SealedTypes, transformParameter(context_1, arg)), info.Parameters)), mapFSharpType(typeParameters.SealedTypes, transformType(context_1, info.Type)), false, false, undefined, FSharpAccessibility.Public, empty(), FSharpMemberInfoBody.NativeOnly)]);
|
|
2948
2251
|
}
|
|
2949
2252
|
|
|
2950
2253
|
function TransformMembers_propertyMember(context, info) {
|
|
@@ -3006,7 +2309,7 @@ function TransformMembers_methodSignatureMember(context, info) {
|
|
|
3006
2309
|
const patternInput_1 = sanitizeNameAndPushScope(patternInput[0], context);
|
|
3007
2310
|
const context_1 = patternInput_1[1];
|
|
3008
2311
|
const typeParameters = transformTypeParameters(context_1, TransformMembers_withoutReferenceConstraints(info.TypeParameters));
|
|
3009
|
-
return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => patternInput[2])))), patternInput_1[0], info.Name, typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) =>
|
|
2312
|
+
return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => patternInput[2])))), patternInput_1[0], info.Name, typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) => mapFsharpParameter(typeParameters.SealedTypes, transformParameter(context_1, arg)), patternInput[1])), mapFSharpType(typeParameters.SealedTypes, transformType(context_1, info.Type)), false, false, undefined, FSharpAccessibility.Public, xmlDocInfo.XmlDoc, FSharpMemberInfoBody.NativeOnly)]);
|
|
3010
2313
|
}
|
|
3011
2314
|
|
|
3012
2315
|
function TransformMembers_constructSignatureMember(context, info) {
|
|
@@ -3185,7 +2488,7 @@ function tryParameterCombinations(parameters) {
|
|
|
3185
2488
|
return undefined;
|
|
3186
2489
|
}
|
|
3187
2490
|
}, unionInfo_1.Cases);
|
|
3188
|
-
matchValue_1 = (
|
|
2491
|
+
matchValue_1 = (forAll((option) => (option != null), cases) ? choose((x) => x, cases) : undefined);
|
|
3189
2492
|
break;
|
|
3190
2493
|
}
|
|
3191
2494
|
default:
|
|
@@ -3294,7 +2597,7 @@ function tryTransformCallableInterface(context, info) {
|
|
|
3294
2597
|
if (isEmpty(matchValue)) {
|
|
3295
2598
|
if (!isEmpty(matchValue_1)) {
|
|
3296
2599
|
if (head_1(matchValue_1).tag === 13) {
|
|
3297
|
-
if (isEmpty(
|
|
2600
|
+
if (isEmpty(tail_1(matchValue_1))) {
|
|
3298
2601
|
if (tryCallableHeritage(TransformContext__get_TypeMemory(context), head_1(matchValue_1)) != null) {
|
|
3299
2602
|
matchResult = 1;
|
|
3300
2603
|
heritage_1 = head_1(matchValue_1);
|
|
@@ -3317,7 +2620,7 @@ function tryTransformCallableInterface(context, info) {
|
|
|
3317
2620
|
}
|
|
3318
2621
|
}
|
|
3319
2622
|
else if (head_1(matchValue).tag === 4) {
|
|
3320
|
-
if (isEmpty(
|
|
2623
|
+
if (isEmpty(tail_1(matchValue))) {
|
|
3321
2624
|
if (isEmpty(matchValue_1)) {
|
|
3322
2625
|
if (isDeclaredOnce) {
|
|
3323
2626
|
matchResult = 0;
|
|
@@ -3726,35 +3029,7 @@ function transformRecord(context, name, typeParameters, recordInfo) {
|
|
|
3726
3029
|
return new FSharpType(/* Interface */ 5, [new FSharpInterface(ofArray([FSharpAttribute.AllowNullLiteral, FSharpAttribute.Interface]), patternInput[0], empty(), "", transformDeclarationTypeParameters(context_1, typeParameters).TypeParameters, singleton(new FSharpMember(/* Property */ 1, [new FSharpMemberInfo(singleton(FSharpAttribute.EmitIndexer), "Item", "Item", empty(), parameters, transformType(context_1, recordInfo.ValueType), false, false, FSharpAccessor.ReadWrite, FSharpAccessibility.Public, empty(), FSharpMemberInfoBody.NativeOnly)])), empty())]);
|
|
3727
3030
|
}
|
|
3728
3031
|
|
|
3729
|
-
|
|
3730
|
-
constructor(TypeParameterName, FSharpType) {
|
|
3731
|
-
super();
|
|
3732
|
-
this.TypeParameterName = TypeParameterName;
|
|
3733
|
-
this.FSharpType = FSharpType;
|
|
3734
|
-
}
|
|
3735
|
-
}
|
|
3736
|
-
|
|
3737
|
-
function TypeParameter_SealedTypeInfo_$reflection() {
|
|
3738
|
-
return record_type("Glutinum.Converter.Transform.TypeParameter.SealedTypeInfo", [], TypeParameter_SealedTypeInfo, () => [["TypeParameterName", string_type], ["FSharpType", FSharpType_$reflection()]]);
|
|
3739
|
-
}
|
|
3740
|
-
|
|
3741
|
-
class TypeParameter_TransformResult extends Record {
|
|
3742
|
-
constructor(FSharpTypeParameter, SealedTypeOpt) {
|
|
3743
|
-
super();
|
|
3744
|
-
this.FSharpTypeParameter = FSharpTypeParameter;
|
|
3745
|
-
this.SealedTypeOpt = SealedTypeOpt;
|
|
3746
|
-
}
|
|
3747
|
-
}
|
|
3748
|
-
|
|
3749
|
-
function TypeParameter_TransformResult_$reflection() {
|
|
3750
|
-
return record_type("Glutinum.Converter.Transform.TypeParameter.TransformResult", [], TypeParameter_TransformResult, () => [["FSharpTypeParameter", FSharpTypeParameter_$reflection()], ["SealedTypeOpt", option_type(TypeParameter_SealedTypeInfo_$reflection())]]);
|
|
3751
|
-
}
|
|
3752
|
-
|
|
3753
|
-
function TypeParameter_TransformResult_Create_403667D8(typeParameterName, default_, constraint_, sealedType) {
|
|
3754
|
-
return new TypeParameter_TransformResult(new FSharpTypeParameter(/* FSharpTypeParameter */ 1, [FSharpTypeParameterInfo_Create_Z6CFD3565(typeParameterName, unwrap(constraint_), unwrap(default_))]), (sealedType == null) ? undefined : (new TypeParameter_SealedTypeInfo(typeParameterName, sealedType)));
|
|
3755
|
-
}
|
|
3756
|
-
|
|
3757
|
-
function TypeParameter_transformWith(withDefault, context, typeParameter) {
|
|
3032
|
+
function TypeParameterTransform_transformWith(withDefault, context, typeParameter) {
|
|
3758
3033
|
let default_;
|
|
3759
3034
|
if (withDefault) {
|
|
3760
3035
|
let mapping;
|
|
@@ -3795,18 +3070,18 @@ function TypeParameter_transformWith(withDefault, context, typeParameter) {
|
|
|
3795
3070
|
}
|
|
3796
3071
|
switch (matchResult) {
|
|
3797
3072
|
case 0:
|
|
3798
|
-
return
|
|
3073
|
+
return TransformResult_Create_403667D8(typeParameter.Name, default_);
|
|
3799
3074
|
case 1: {
|
|
3800
3075
|
const matchValue_1 = transformType(TransformContext__PushScope_27AED5E3(context, sanitizeTypeName(typeParameter.Name)), constraintType);
|
|
3801
3076
|
if (matchValue_1.tag === 11) {
|
|
3802
|
-
return
|
|
3077
|
+
return TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, matchValue_1);
|
|
3803
3078
|
}
|
|
3804
3079
|
else {
|
|
3805
|
-
return
|
|
3080
|
+
return TransformResult_Create_403667D8(typeParameter.Name, default_, matchValue_1);
|
|
3806
3081
|
}
|
|
3807
3082
|
}
|
|
3808
3083
|
case 2:
|
|
3809
|
-
return
|
|
3084
|
+
return TransformResult_Create_403667D8(typeParameter.Name, default_);
|
|
3810
3085
|
default: {
|
|
3811
3086
|
const matchValue_2 = transformType(TransformContext__PushScope_27AED5E3(context, sanitizeTypeName(typeParameter.Name)), constraintType_1);
|
|
3812
3087
|
let matchResult_1, fsharpType_2;
|
|
@@ -3849,183 +3124,30 @@ function TypeParameter_transformWith(withDefault, context, typeParameter) {
|
|
|
3849
3124
|
}
|
|
3850
3125
|
switch (matchResult_1) {
|
|
3851
3126
|
case 0:
|
|
3852
|
-
return
|
|
3127
|
+
return TransformResult_Create_403667D8(typeParameter.Name, default_);
|
|
3853
3128
|
case 1:
|
|
3854
|
-
return
|
|
3129
|
+
return TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, fsharpType_2);
|
|
3855
3130
|
case 2:
|
|
3856
|
-
return
|
|
3131
|
+
return TransformResult_Create_403667D8(typeParameter.Name, default_);
|
|
3857
3132
|
default:
|
|
3858
|
-
return
|
|
3859
|
-
}
|
|
3860
|
-
}
|
|
3861
|
-
}
|
|
3862
|
-
}
|
|
3863
|
-
|
|
3864
|
-
function TypeParameter_transform(context, typeParameter) {
|
|
3865
|
-
return TypeParameter_transformWith(true, context, typeParameter);
|
|
3866
|
-
}
|
|
3867
|
-
|
|
3868
|
-
function TypeParameter_mapFSharpType(seadledTypes, typ) {
|
|
3869
|
-
let matchResult, typeParameter, info_1, info_2, innerType, typeReference, unionInfo, types, typ_7, functionInfo, alias;
|
|
3870
|
-
switch (typ.tag) {
|
|
3871
|
-
case 0:
|
|
3872
|
-
case 2:
|
|
3873
|
-
case 4:
|
|
3874
|
-
case 5:
|
|
3875
|
-
case 6:
|
|
3876
|
-
case 8:
|
|
3877
|
-
case 10:
|
|
3878
|
-
case 15:
|
|
3879
|
-
case 17:
|
|
3880
|
-
case 18:
|
|
3881
|
-
case 19:
|
|
3882
|
-
case 20:
|
|
3883
|
-
case 21: {
|
|
3884
|
-
matchResult = 10;
|
|
3885
|
-
break;
|
|
3886
|
-
}
|
|
3887
|
-
case 7: {
|
|
3888
|
-
if (typ.fields[0].Name.startsWith("\'")) {
|
|
3889
|
-
matchResult = 1;
|
|
3890
|
-
info_1 = typ.fields[0];
|
|
3891
|
-
}
|
|
3892
|
-
else {
|
|
3893
|
-
matchResult = 2;
|
|
3894
|
-
info_2 = typ.fields[0];
|
|
3133
|
+
return TransformResult_Create_403667D8(typeParameter.Name, default_);
|
|
3895
3134
|
}
|
|
3896
|
-
break;
|
|
3897
|
-
}
|
|
3898
|
-
case 3: {
|
|
3899
|
-
matchResult = 3;
|
|
3900
|
-
innerType = typ.fields[0];
|
|
3901
|
-
break;
|
|
3902
3135
|
}
|
|
3903
|
-
case 11: {
|
|
3904
|
-
matchResult = 4;
|
|
3905
|
-
typeReference = typ.fields[0];
|
|
3906
|
-
break;
|
|
3907
|
-
}
|
|
3908
|
-
case 1: {
|
|
3909
|
-
matchResult = 5;
|
|
3910
|
-
unionInfo = typ.fields[0];
|
|
3911
|
-
break;
|
|
3912
|
-
}
|
|
3913
|
-
case 12: {
|
|
3914
|
-
matchResult = 6;
|
|
3915
|
-
types = typ.fields[0];
|
|
3916
|
-
break;
|
|
3917
|
-
}
|
|
3918
|
-
case 14: {
|
|
3919
|
-
matchResult = 7;
|
|
3920
|
-
typ_7 = typ.fields[0];
|
|
3921
|
-
break;
|
|
3922
|
-
}
|
|
3923
|
-
case 16: {
|
|
3924
|
-
matchResult = 8;
|
|
3925
|
-
functionInfo = typ.fields[0];
|
|
3926
|
-
break;
|
|
3927
|
-
}
|
|
3928
|
-
case 9: {
|
|
3929
|
-
matchResult = 9;
|
|
3930
|
-
alias = typ.fields[0];
|
|
3931
|
-
break;
|
|
3932
|
-
}
|
|
3933
|
-
default: {
|
|
3934
|
-
matchResult = 0;
|
|
3935
|
-
typeParameter = typ.fields[0];
|
|
3936
|
-
}
|
|
3937
|
-
}
|
|
3938
|
-
switch (matchResult) {
|
|
3939
|
-
case 0: {
|
|
3940
|
-
const needMapping = tryFind((mapperInfo) => (mapperInfo.TypeParameterName === typeParameter), seadledTypes);
|
|
3941
|
-
if (needMapping == null) {
|
|
3942
|
-
return typ;
|
|
3943
|
-
}
|
|
3944
|
-
else {
|
|
3945
|
-
return needMapping.FSharpType;
|
|
3946
|
-
}
|
|
3947
|
-
}
|
|
3948
|
-
case 1: {
|
|
3949
|
-
const matchValue = tryFind((mapperInfo_2) => (mapperInfo_2.TypeParameterName === substring(info_1.Name, 1)), seadledTypes);
|
|
3950
|
-
if (matchValue == null) {
|
|
3951
|
-
return typ;
|
|
3952
|
-
}
|
|
3953
|
-
else {
|
|
3954
|
-
return matchValue.FSharpType;
|
|
3955
|
-
}
|
|
3956
|
-
}
|
|
3957
|
-
case 2:
|
|
3958
|
-
return new FSharpType(/* Mapped */ 7, [new FSharpMapped(info_2.Name, map((_arg) => {
|
|
3959
|
-
if (_arg.tag === 1) {
|
|
3960
|
-
const paramInfo = _arg.fields[0];
|
|
3961
|
-
const matchValue_1 = tryFind((mapperInfo_4) => (mapperInfo_4.TypeParameterName === paramInfo.Name), seadledTypes);
|
|
3962
|
-
if (matchValue_1 == null) {
|
|
3963
|
-
return new FSharpTypeParameter(/* FSharpTypeParameter */ 1, [paramInfo]);
|
|
3964
|
-
}
|
|
3965
|
-
else {
|
|
3966
|
-
return new FSharpTypeParameter(/* FSharpType */ 0, [matchValue_1.FSharpType]);
|
|
3967
|
-
}
|
|
3968
|
-
}
|
|
3969
|
-
else {
|
|
3970
|
-
return new FSharpTypeParameter(/* FSharpType */ 0, [TypeParameter_mapFSharpType(seadledTypes, _arg.fields[0])]);
|
|
3971
|
-
}
|
|
3972
|
-
}, info_2.TypeParameters))]);
|
|
3973
|
-
case 3:
|
|
3974
|
-
return new FSharpType(/* Option */ 3, [TypeParameter_mapFSharpType(seadledTypes, innerType)]);
|
|
3975
|
-
case 4:
|
|
3976
|
-
return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(typeReference.Name, typeReference.FullName, typeReference.ModulePath, map((typ_2) => TypeParameter_mapFSharpType(seadledTypes, typ_2), typeReference.TypeArguments), typeReference.Type)]);
|
|
3977
|
-
case 5:
|
|
3978
|
-
return new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, map((case$) => {
|
|
3979
|
-
switch (case$.tag) {
|
|
3980
|
-
case 1:
|
|
3981
|
-
return new FSharpUnionCase(/* Typed */ 1, [TypeParameter_mapFSharpType(seadledTypes, case$.fields[0])]);
|
|
3982
|
-
case 2:
|
|
3983
|
-
return new FSharpUnionCase(/* Field */ 2, [case$.fields[0], TypeParameter_mapFSharpType(seadledTypes, case$.fields[1])]);
|
|
3984
|
-
case 3:
|
|
3985
|
-
return new FSharpUnionCase(/* NamedFields */ 3, [case$.fields[0], map((tupledArg) => [tupledArg[0], TypeParameter_mapFSharpType(seadledTypes, tupledArg[1])], case$.fields[1])]);
|
|
3986
|
-
default:
|
|
3987
|
-
return case$;
|
|
3988
|
-
}
|
|
3989
|
-
}, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants)]);
|
|
3990
|
-
case 6:
|
|
3991
|
-
return new FSharpType(/* Tuple */ 12, [map((typ_6) => TypeParameter_mapFSharpType(seadledTypes, typ_6), types)]);
|
|
3992
|
-
case 7:
|
|
3993
|
-
return new FSharpType(/* ResizeArray */ 14, [TypeParameter_mapFSharpType(seadledTypes, typ_7)]);
|
|
3994
|
-
case 8:
|
|
3995
|
-
return new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => TypeParameter_mapFsharpParameter(seadledTypes, parameter), functionInfo.Parameters), TypeParameter_mapFSharpType(seadledTypes, functionInfo.ReturnType))]);
|
|
3996
|
-
case 9:
|
|
3997
|
-
return new FSharpType(/* TypeAlias */ 9, [new FSharpTypeAlias(alias.Attributes, alias.Name, alias.XmlDoc, alias.Type, map((_arg_1) => {
|
|
3998
|
-
if (_arg_1.tag === 0) {
|
|
3999
|
-
return new FSharpTypeParameter(/* FSharpType */ 0, [TypeParameter_mapFSharpType(seadledTypes, _arg_1.fields[0])]);
|
|
4000
|
-
}
|
|
4001
|
-
else {
|
|
4002
|
-
const matchValue_2 = tryFind((mapperInfo_6) => (mapperInfo_6.TypeParameterName === _arg_1.fields[0].Name), seadledTypes);
|
|
4003
|
-
if (matchValue_2 == null) {
|
|
4004
|
-
return _arg_1;
|
|
4005
|
-
}
|
|
4006
|
-
else {
|
|
4007
|
-
return new FSharpTypeParameter(/* FSharpType */ 0, [matchValue_2.FSharpType]);
|
|
4008
|
-
}
|
|
4009
|
-
}
|
|
4010
|
-
}, alias.TypeParameters))]);
|
|
4011
|
-
default:
|
|
4012
|
-
return typ;
|
|
4013
3136
|
}
|
|
4014
3137
|
}
|
|
4015
3138
|
|
|
4016
|
-
function
|
|
4017
|
-
|
|
4018
|
-
return new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, parameter.IsOptional ? defaultArg(tryUnwrapOption(typ), typ) : typ, parameter.OriginalGlueMember);
|
|
3139
|
+
function TypeParameterTransform_transform(context, typeParameter) {
|
|
3140
|
+
return TypeParameterTransform_transformWith(true, context, typeParameter);
|
|
4019
3141
|
}
|
|
4020
3142
|
|
|
4021
3143
|
function transformTypeParameters(context, typeParameters) {
|
|
4022
|
-
const transformedTypeParameters = map((typeParameter) =>
|
|
3144
|
+
const transformedTypeParameters = map((typeParameter) => TypeParameterTransform_transformWith(false, context, typeParameter), typeParameters);
|
|
4023
3145
|
const sealedTypes = choose((_arg) => _arg.SealedTypeOpt, transformedTypeParameters);
|
|
4024
3146
|
return new TransformTypeParametersResult(map((_arg_2) => _arg_2.FSharpTypeParameter, filter((_arg_1) => (_arg_1.SealedTypeOpt == null), transformedTypeParameters)), sealedTypes);
|
|
4025
3147
|
}
|
|
4026
3148
|
|
|
4027
3149
|
function transformDeclarationTypeParameters(context, typeParameters) {
|
|
4028
|
-
const transformedTypeParameters = map((typeParameter) =>
|
|
3150
|
+
const transformedTypeParameters = map((typeParameter) => TypeParameterTransform_transform(context, typeParameter), typeParameters);
|
|
4029
3151
|
return new TransformDeclarationTypeParametersResult(map((_arg) => _arg.FSharpTypeParameter, transformedTypeParameters), exists((_arg_1) => (_arg_1.SealedTypeOpt != null), transformedTypeParameters) ? map((result) => {
|
|
4030
3152
|
const matchValue = result.SealedTypeOpt;
|
|
4031
3153
|
if (matchValue == null) {
|
|
@@ -4138,7 +3260,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
|
|
|
4138
3260
|
return undefined;
|
|
4139
3261
|
}
|
|
4140
3262
|
}, aliasCases_1);
|
|
4141
|
-
if (
|
|
3263
|
+
if (forAll((option) => (option != null), resolved)) {
|
|
4142
3264
|
return collect(value_7, resolved);
|
|
4143
3265
|
}
|
|
4144
3266
|
else {
|
|
@@ -4278,7 +3400,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
|
|
|
4278
3400
|
default:
|
|
4279
3401
|
return singleton(case$);
|
|
4280
3402
|
}
|
|
4281
|
-
}, cases_4) : cases_4)),
|
|
3403
|
+
}, cases_4) : cases_4)), forAll(isLiteral, withAliases) ? withAliases : flattenCasesWith(false, cases_5))));
|
|
4282
3404
|
const otherCases = patternInput[1];
|
|
4283
3405
|
const flattenedCases = patternInput[0];
|
|
4284
3406
|
const isStringEnumCompatible = (!isEmpty(flattenedCases) && exists((_arg_5) => {
|
|
@@ -4300,7 +3422,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
|
|
|
4300
3422
|
default:
|
|
4301
3423
|
return false;
|
|
4302
3424
|
}
|
|
4303
|
-
}, flattenedCases)) &&
|
|
3425
|
+
}, flattenedCases)) && forAll((_arg_6) => {
|
|
4304
3426
|
let matchResult_6;
|
|
4305
3427
|
if (_arg_6.tag === 8) {
|
|
4306
3428
|
switch (_arg_6.fields[0].tag) {
|
|
@@ -4324,7 +3446,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
|
|
|
4324
3446
|
return false;
|
|
4325
3447
|
}
|
|
4326
3448
|
}, flattenedCases);
|
|
4327
|
-
const isNumericOnly = !isEmpty(flattenedCases) &&
|
|
3449
|
+
const isNumericOnly = !isEmpty(flattenedCases) && forAll((_arg_7) => {
|
|
4328
3450
|
let matchResult_7;
|
|
4329
3451
|
if (_arg_7.tag === 8) {
|
|
4330
3452
|
if (_arg_7.fields[0].tag === 1) {
|
|
@@ -4429,7 +3551,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
|
|
|
4429
3551
|
else {
|
|
4430
3552
|
return [caseInfo_1, add(caseInfo_1.Name, usedNames)];
|
|
4431
3553
|
}
|
|
4432
|
-
},
|
|
3554
|
+
}, empty_3({
|
|
4433
3555
|
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
4434
3556
|
}), caseInfos)[0];
|
|
4435
3557
|
let matchValue_3;
|
|
@@ -4443,7 +3565,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
|
|
|
4443
3565
|
return undefined;
|
|
4444
3566
|
}
|
|
4445
3567
|
}, _arg_10.fields[0].Members);
|
|
4446
|
-
if (
|
|
3568
|
+
if (forAll((option_2) => (option_2 != null), properties)) {
|
|
4447
3569
|
return choose((x_2) => x_2, properties);
|
|
4448
3570
|
}
|
|
4449
3571
|
else {
|
|
@@ -4454,7 +3576,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
|
|
|
4454
3576
|
return undefined;
|
|
4455
3577
|
}
|
|
4456
3578
|
}, otherCases);
|
|
4457
|
-
if ((isEmpty(flattenedCases) && (length(casesProperties) >= 2)) &&
|
|
3579
|
+
if ((isEmpty(flattenedCases) && (length(casesProperties) >= 2)) && forAll((option_3) => (option_3 != null), casesProperties)) {
|
|
4458
3580
|
const casesProperties_1 = choose((x_3) => x_3, casesProperties);
|
|
4459
3581
|
matchValue_3 = tryPick((candidate_1) => {
|
|
4460
3582
|
const tagValues = map((properties_1) => {
|
|
@@ -4513,7 +3635,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
|
|
|
4513
3635
|
return undefined;
|
|
4514
3636
|
}
|
|
4515
3637
|
}, casesProperties_1);
|
|
4516
|
-
if (
|
|
3638
|
+
if (forAll((option_6) => (option_6 != null), tagValues) && (length(List_distinct(tagValues, {
|
|
4517
3639
|
Equals: equals,
|
|
4518
3640
|
GetHashCode: (x_4) => (structuralHash(x_4) | 0),
|
|
4519
3641
|
})) === length(tagValues))) {
|
|
@@ -4818,7 +3940,7 @@ function aliasOfUnion(scope, cases, unionType) {
|
|
|
4818
3940
|
let matchResult_1, single, others_3;
|
|
4819
3941
|
if (!isEmpty(matchValue_1[0])) {
|
|
4820
3942
|
if (!isEmpty(matchValue_1[1])) {
|
|
4821
|
-
if (isEmpty(
|
|
3943
|
+
if (isEmpty(tail_1(matchValue_1[1]))) {
|
|
4822
3944
|
matchResult_1 = 0;
|
|
4823
3945
|
single = head_1(matchValue_1[1]);
|
|
4824
3946
|
}
|
|
@@ -4942,7 +4064,7 @@ function aliasOfTypeReference(scope, typeReference) {
|
|
|
4942
4064
|
let matchResult, members;
|
|
4943
4065
|
if (!isEmpty(matchValue)) {
|
|
4944
4066
|
if (head_1(matchValue).tag === 20) {
|
|
4945
|
-
if (isEmpty(
|
|
4067
|
+
if (isEmpty(tail_1(matchValue))) {
|
|
4946
4068
|
matchResult = 0;
|
|
4947
4069
|
members = head_1(matchValue).fields[0];
|
|
4948
4070
|
}
|
|
@@ -5052,8 +4174,8 @@ function aliasOfConstructorType(scope, constructSignature) {
|
|
|
5052
4174
|
const context = scope.Context;
|
|
5053
4175
|
const matchValue = scope.Declaration.TypeParameters;
|
|
5054
4176
|
if (!isEmpty(matchValue)) {
|
|
5055
|
-
if (isEmpty(
|
|
5056
|
-
return new FSharpType(/* SingleErasedCaseUnion */ 2, [new FSharpSingleErasedCaseUnion(toList(delay(() => scope.XmlDoc.ObsoleteAttributes)), scope.Name, scope.XmlDoc.XmlDoc,
|
|
4177
|
+
if (isEmpty(tail_1(matchValue))) {
|
|
4178
|
+
return new FSharpType(/* SingleErasedCaseUnion */ 2, [new FSharpSingleErasedCaseUnion(toList(delay(() => scope.XmlDoc.ObsoleteAttributes)), scope.Name, scope.XmlDoc.XmlDoc, TypeParameterTransform_transform(context, head_1(matchValue)).FSharpTypeParameter)]);
|
|
5057
4179
|
}
|
|
5058
4180
|
else {
|
|
5059
4181
|
TransformContext__AddWarning_Z721C83C5(context, concat(scope.Declaration.Name, " contains a ConstructorType with multiple type parameters, please open an issue at https://github.com/glutinum-org/cli/issues"));
|
|
@@ -5231,9 +4353,9 @@ function ReExport_isExpressible(glueType_mut) {
|
|
|
5231
4353
|
continue ReExport_isExpressible;
|
|
5232
4354
|
}
|
|
5233
4355
|
case 2:
|
|
5234
|
-
return
|
|
4356
|
+
return forAll(ReExport_isExpressible, glueType.fields[0].fields[0]);
|
|
5235
4357
|
case 3:
|
|
5236
|
-
return
|
|
4358
|
+
return forAll(ReExport_isExpressible, glueType.fields[0]);
|
|
5237
4359
|
default:
|
|
5238
4360
|
return false;
|
|
5239
4361
|
}
|
|
@@ -5242,7 +4364,7 @@ function ReExport_isExpressible(glueType_mut) {
|
|
|
5242
4364
|
}
|
|
5243
4365
|
|
|
5244
4366
|
function ReExport_canForwardConstraints(typeParameters) {
|
|
5245
|
-
return
|
|
4367
|
+
return forAll((typeParameter) => {
|
|
5246
4368
|
const matchValue = typeParameter.Constraint;
|
|
5247
4369
|
let matchResult, constraintType;
|
|
5248
4370
|
if (matchValue != null) {
|
|
@@ -5393,7 +4515,7 @@ function exposeSpecializedAlias(name_mut, acc_mut, tailedTypeParameters_mut, typ
|
|
|
5393
4515
|
return acc;
|
|
5394
4516
|
}
|
|
5395
4517
|
else {
|
|
5396
|
-
const tail =
|
|
4518
|
+
const tail = tail_1(typeParameters);
|
|
5397
4519
|
const head = head_1(typeParameters);
|
|
5398
4520
|
if (head.tag === 1) {
|
|
5399
4521
|
const typeParameter = head.fields[0];
|
|
@@ -5403,8 +4525,8 @@ function exposeSpecializedAlias(name_mut, acc_mut, tailedTypeParameters_mut, typ
|
|
|
5403
4525
|
const orderedTail = reverse(tail);
|
|
5404
4526
|
let tailedTypeParameters_1;
|
|
5405
4527
|
let substitute;
|
|
5406
|
-
const seadledTypes = singleton(new
|
|
5407
|
-
substitute = ((typ) =>
|
|
4528
|
+
const seadledTypes = singleton(new SealedTypeInfo(typeParameter.Name, defaultType));
|
|
4529
|
+
substitute = ((typ) => mapFSharpType(seadledTypes, typ));
|
|
5408
4530
|
tailedTypeParameters_1 = map((_arg) => {
|
|
5409
4531
|
if (_arg.tag === 0) {
|
|
5410
4532
|
return new FSharpTypeParameter(/* FSharpType */ 0, [substitute(_arg.fields[0])]);
|
|
@@ -5532,7 +4654,7 @@ function keysModuleOf(context, interfaceInfo, fsharpInterface) {
|
|
|
5532
4654
|
}
|
|
5533
4655
|
|
|
5534
4656
|
function transformToFsharp(context, glueTypes) {
|
|
5535
|
-
TransformContext__set_SiblingTypeNames_2FCB1351(context,
|
|
4657
|
+
TransformContext__set_SiblingTypeNames_2FCB1351(context, ofSeq_1(map(sanitizeTypeName, choose((_arg) => {
|
|
5536
4658
|
switch (_arg.tag) {
|
|
5537
4659
|
case 1:
|
|
5538
4660
|
return _arg.fields[0].Name;
|
|
@@ -5749,7 +4871,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
|
|
|
5749
4871
|
default:
|
|
5750
4872
|
return glueType_3;
|
|
5751
4873
|
}
|
|
5752
|
-
}, (exportEqualsNames =
|
|
4874
|
+
}, (exportEqualsNames = ofSeq_1(choose((_arg) => {
|
|
5753
4875
|
let matchResult_1, name;
|
|
5754
4876
|
if (_arg.tag === 25) {
|
|
5755
4877
|
if (_arg.fields[0].tag === 2) {
|
|
@@ -5782,7 +4904,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
|
|
|
5782
4904
|
default:
|
|
5783
4905
|
return undefined;
|
|
5784
4906
|
}
|
|
5785
|
-
}), (declaredNames =
|
|
4907
|
+
}), (declaredNames = ofSeq_1(choose((_arg_1) => {
|
|
5786
4908
|
let matchResult_2, info_3, info_4, glueType_1;
|
|
5787
4909
|
switch (_arg_1.tag) {
|
|
5788
4910
|
case 12: {
|
|
@@ -5984,7 +5106,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
|
|
|
5984
5106
|
return undefined;
|
|
5985
5107
|
}
|
|
5986
5108
|
}, glueAst_2);
|
|
5987
|
-
const defaultExported =
|
|
5109
|
+
const defaultExported = ofSeq_1(choose((_arg_4) => {
|
|
5988
5110
|
let matchResult_7, info_14, name_8;
|
|
5989
5111
|
if (_arg_4.tag === 25) {
|
|
5990
5112
|
switch (_arg_4.fields[0].tag) {
|
|
@@ -6021,7 +5143,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
|
|
|
6021
5143
|
}, glueAst_2), {
|
|
6022
5144
|
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
6023
5145
|
});
|
|
6024
|
-
const classes_1 =
|
|
5146
|
+
const classes_1 = ofSeq_1(map((_arg_5) => _arg_5.Name, filter((info_15) => {
|
|
6025
5147
|
if (info_15.IsExported) {
|
|
6026
5148
|
return true;
|
|
6027
5149
|
}
|
|
@@ -6031,7 +5153,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
|
|
|
6031
5153
|
}, classDeclarations)), {
|
|
6032
5154
|
Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
|
|
6033
5155
|
});
|
|
6034
|
-
const constructorVariables =
|
|
5156
|
+
const constructorVariables = ofSeq_1(choose((_arg_6) => {
|
|
6035
5157
|
let matchResult_8, name_10, members_1, name_11;
|
|
6036
5158
|
if (_arg_6.tag === 2) {
|
|
6037
5159
|
switch (_arg_6.fields[0].Type.tag) {
|
|
@@ -6122,7 +5244,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
|
|
|
6122
5244
|
exportsType_1 = undefined;
|
|
6123
5245
|
}
|
|
6124
5246
|
else {
|
|
6125
|
-
const matchValue_2 = transformExports(rootTransformContext, isTopLevel, exports_1);
|
|
5247
|
+
const matchValue_2 = transformExports(new Transforms(transformType, transformParameter, transformTypeParameters, TransformMembers_withDefaultedTypeParameterOverloadsOfFunction, TransformMembers_withDictionaryParameterOverloadsOfFunction), rootTransformContext, isTopLevel, exports_1);
|
|
6126
5248
|
let matchResult_10, exportsType;
|
|
6127
5249
|
if (matchValue_2.tag === 5) {
|
|
6128
5250
|
if (isEmpty(matchValue_2.fields[0].Members)) {
|
|
@@ -6158,7 +5280,7 @@ export function applyWithOptions(options, typeMemory, glueAst) {
|
|
|
6158
5280
|
const typeLiteralsMemory = TypeLiteralsMemory_$ctor();
|
|
6159
5281
|
const transformed = transform(typeMemory, TransformState_Create_Z68CEF8E2(typeMemory, options.MaxOverloads), reporter, typeLiteralsMemory, options.Source, true, glueAst);
|
|
6160
5282
|
const aliases = aliasesOf(transformed);
|
|
6161
|
-
return new TransformResult(disambiguateOverloads(aliases, apply_2(apply_3(
|
|
5283
|
+
return new TransformResult(disambiguateOverloads(aliases, apply_1(apply_2(apply_3(applyWith_1(aliases, transformed))))), Reporter__get_Warnings(reporter), Reporter__get_Errors(reporter), Reporter__get_HasRegEpx(reporter), Reporter__get_HasReadonlyArray(reporter), Reporter__get_HasIterable(reporter));
|
|
6162
5284
|
}
|
|
6163
5285
|
|
|
6164
5286
|
export function applyWithSource(source, typeMemory, glueAst) {
|
|
@@ -6166,7 +5288,7 @@ export function applyWithSource(source, typeMemory, glueAst) {
|
|
|
6166
5288
|
}
|
|
6167
5289
|
|
|
6168
5290
|
export function applyWith(importSpecifier, typeMemory, glueAst) {
|
|
6169
|
-
return applyWithSource(new ImportSource(/* Module */ 0, [importSpecifier,
|
|
5291
|
+
return applyWithSource(new ImportSource(/* Module */ 0, [importSpecifier, empty_2({
|
|
6170
5292
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
6171
5293
|
})]), typeMemory, glueAst);
|
|
6172
5294
|
}
|