@glutinum/cli 1.0.0-beta.6 → 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.
@@ -1,93 +1,40 @@
1
1
 
2
- import { FSharpRef, Record } from "../fable_modules/fable-library-js.5.17.2/Types.js";
3
- 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, TransformContext_$ctor_Z1635F75A, TransformContext__get__Reporter, TransformContext__set_SiblingTypeNames_2FCB1351, TypeLiteralsMemory__LeaveModule, TypeLiteralsMemory__EnterModule_Z721C83C5, TransformContext__ExposeTypeAlias_1CE4A880, TransformContext__AddWarning_Z721C83C5, sanitizeTypeNameAndPushScope, ImportSource, importAllAttribute, TransformContext__get_TypeMemory, importAttribute, sanitizeMemberNameAndPushScope, TransformContext__get_ImportSource, importDefaultAttribute, 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";
4
- import { int32_type, array_type, option_type, list_type, record_type, class_type, string_type, bool_type } from "../fable_modules/fable-library-js.5.17.2/Reflection.js";
5
- import { FSharpModule, FSharpSingleErasedCaseUnion, FSharpJSApi, FSharpEnum, FSharpEnumCase, FSharpLiteral, FSharpTypeParameterInfo_Create_Z6CFD3565, FSharpUnionCaseNamed, FSharpClass, FSharpConstructor, FSharpExplicitField, FSharpStaticMemberInfo, FSharpAccessor, FSharpMemberInfoBody, FSharpAccessibility, FSharpMember, FSharpMemberInfo, FSharpParameter, FSharpThisType, FSharpPrimitive, FSharpTypeAlias, FSharpDelegate, FSharpFunctionType, FSharpTypeReference, FSharpUnion, FSharpUnionCase, FSharpTypeParameter, FSharpMapped, FSharpInterface, FSharpAttribute, FSharpType, FSharpType_$reflection, FSharpTypeParameter_$reflection, FSharpMember_$reflection } from "./FsharpAST.js";
6
- import { GlueReExport, GlueClassDeclaration, GlueLiteral__ToText, GlueIndexSignature, GlueLiteral, GlueMember__TryGetAccessor, GlueMember__get_Documentation, GlueProperty, GlueAccessor, GlueMethod, GlueMethodSignature, GlueSubstitution_mentionedTypeParameters, GlueFunctionType, GlueParameter, GlueTypeUnion, GlueFunctionDeclaration, GlueVariable, GlueType__get_Name, GlueConstructor, GlueTypeReference, GluePrimitive, 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 { add, contains as contains_2, union, empty as empty_2, ofSeq, singleton as singleton_2, ofList, FSharpSet__Contains } from "../fable_modules/fable-library-js.5.17.2/Set.js";
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, unwrap, toArray, defaultArg } from "../fable_modules/fable-library-js.5.17.2/Option.js";
11
- import { zip, mapFold, item, concat as concat_1, reverse, iterate, cons, foldBack, fold, tryFind, ofSeq as ofSeq_1, forAll as forAll_1, sortBy, tryPick, truncate, contains, exists, partition, mapIndexed, filter, append, length, collect, tryLast, choose, tryHead, singleton, empty, ofArray, map, head as head_1, tail as tail_3, isEmpty } from "../fable_modules/fable-library-js.5.17.2/List.js";
12
- import { aliasArities, namedTypeParameters, membersNameUndeclaredTypeParameters, mentionsTypeParameter, ownTypeParameterDefaults, typeParameterNames as typeParameterNames_2, unconstrained, memberTypeParameterNames, typeArguments, declaredTypeParameters as declaredTypeParameters_1 } from "./Transformer/TypeParameters.js";
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, disposeSafe, getEnumerator, defaultOf, comparePrimitives, safeHash, equals, stringHash } from "../fable_modules/fable-library-js.5.17.2/Util.js";
15
- import { replace, trim, printf, toFail, substring, interpolate, concat } from "../fable_modules/fable-library-js.5.17.2/String.js";
16
- import { resolveMembers, resolveFunction, isConditionalAlias, genericDelegateTypeParameters, isInterfaceDeclaration } from "./Transformer/Conditionals.js";
17
- import { FSharpMap__TryFind, exists as exists_1, empty as empty_3, ofList as ofList_1, FSharpMap__ContainsKey, FSharpMap__get_Item, map as map_1 } from "../fable_modules/fable-library-js.5.17.2/Map.js";
18
- import { sanitizeTypeNameWithResult, removeSurroundingQuotes, sanitizeTypeName } from "./Utils/Naming.js";
19
- import { addToSet, tryGetValue } from "../fable_modules/fable-library-js.5.17.2/MapUtil.js";
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
- import { withoutBaseClassProperties, isInheritableType, isSelfHeritage, isArrayHeritage, isErrorHeritage, withoutRedeclaredBases } from "./Transformer/Heritage.js";
29
+ import { withoutBaseClassProperties, withoutBasesOfBases, isInheritableType, isSelfHeritage, isArrayHeritage, isErrorHeritage, withoutRedeclaredBases } from "./Transformer/Heritage.js";
30
30
  import { contains as contains_1 } from "../fable_modules/fable-library-js.5.17.2/Array.js";
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 { apply as apply_2 } from "./DelegateExtensions.js";
35
- import { apply as apply_3 } from "./FreeTypeParameters.js";
36
- import { apply as apply_4 } from "./Abbreviations.js";
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(tail_3(glueTypes))) {
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(tail_3(caseTypes))) {
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(tail_3(paremeters))) {
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) => TypeParameter_mapFsharpParameter(typParameters.SealedTypes, transformParameter(context, arg)), paremeters)), TypeParameter_mapFSharpType(typParameters.SealedTypes, transformCallbackReturnType(TransformContext__PushScope_27AED5E3(context, "ReturnType"), functionTypeInfo.Type)))]));
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;
@@ -1061,8 +1008,7 @@ function transformType(context_mut, glueType_mut) {
1061
1008
  transformType:
1062
1009
  while (true) {
1063
1010
  const context = context_mut, glueType = glueType_mut;
1064
- let typeReference_1;
1065
- let matchResult, constructSignature, primitiveInfo, glueType_21, thisTypeInfo, glueTypes, glueType_22, cases, typeReference_3, typeReference_4, typeReference_5, argument, typeReference_6, glueType_25, classDeclaration, name, functionTypeInfo, interfaceInfo, name_1, typeLiteralInfo, glueType_26, info, innerGlueType, namedTupleType, glueLiteral, functionDeclaration_1, functionDeclaration_2, members, references, members_1, utilityType, typeAliasDeclaration, mappedType;
1011
+ let matchResult, constructSignature, primitiveInfo, glueType_21, thisTypeInfo, glueTypes, glueType_22, cases, typeReference_2, typeReference_3, argument, typeReference_4, glueType_25, classDeclaration, name, functionTypeInfo, interfaceInfo, name_1, typeLiteralInfo, glueType_26, info, innerGlueType, namedTupleType, glueLiteral, functionDeclaration_1, functionDeclaration_2, members, references, members_1, utilityType, typeAliasDeclaration, mappedType;
1066
1012
  switch (glueType.tag) {
1067
1013
  case 29: {
1068
1014
  matchResult = 1;
@@ -1106,81 +1052,77 @@ function transformType(context_mut, glueType_mut) {
1106
1052
  case 13: {
1107
1053
  if (isConditionalAlias(TransformContext__get_State(context).Conditionals, glueType.fields[0].FullName)) {
1108
1054
  matchResult = 9;
1109
- typeReference_3 = glueType.fields[0];
1110
- }
1111
- else if ((typeReference_1 = glueType.fields[0], isEmpty(typeReference_1.TypeArguments) && !isEmpty(genericDelegateTypeParameters(TransformContext__get_State(context).Conditionals, typeReference_1.FullName)))) {
1112
- matchResult = 10;
1113
- typeReference_4 = glueType.fields[0];
1055
+ typeReference_2 = glueType.fields[0];
1114
1056
  }
1115
1057
  else if (mapTypeNameToFableCoreAwareName(context, glueType.fields[0]) === "obj") {
1116
- matchResult = 11;
1117
- typeReference_5 = glueType.fields[0];
1058
+ matchResult = 10;
1059
+ typeReference_3 = glueType.fields[0];
1118
1060
  }
1119
1061
  else if (glueType.fields[0].Name === "Readonly") {
1120
1062
  if (!isEmpty(glueType.fields[0].TypeArguments)) {
1121
- if (isEmpty(tail_3(glueType.fields[0].TypeArguments))) {
1063
+ if (isEmpty(tail_1(glueType.fields[0].TypeArguments))) {
1122
1064
  if (glueType.fields[0].IsStandardLibrary) {
1123
- matchResult = 12;
1065
+ matchResult = 11;
1124
1066
  argument = head_1(glueType.fields[0].TypeArguments);
1125
1067
  }
1126
1068
  else {
1127
- matchResult = 13;
1128
- typeReference_6 = glueType.fields[0];
1069
+ matchResult = 12;
1070
+ typeReference_4 = glueType.fields[0];
1129
1071
  }
1130
1072
  }
1131
1073
  else {
1132
- matchResult = 13;
1133
- typeReference_6 = glueType.fields[0];
1074
+ matchResult = 12;
1075
+ typeReference_4 = glueType.fields[0];
1134
1076
  }
1135
1077
  }
1136
1078
  else {
1137
- matchResult = 13;
1138
- typeReference_6 = glueType.fields[0];
1079
+ matchResult = 12;
1080
+ typeReference_4 = glueType.fields[0];
1139
1081
  }
1140
1082
  }
1141
1083
  else {
1142
- matchResult = 13;
1143
- typeReference_6 = glueType.fields[0];
1084
+ matchResult = 12;
1085
+ typeReference_4 = glueType.fields[0];
1144
1086
  }
1145
1087
  break;
1146
1088
  }
1147
1089
  case 14: {
1148
- matchResult = 14;
1090
+ matchResult = 13;
1149
1091
  glueType_25 = glueType.fields[0];
1150
1092
  break;
1151
1093
  }
1152
1094
  case 12: {
1153
- matchResult = 15;
1095
+ matchResult = 14;
1154
1096
  classDeclaration = glueType.fields[0];
1155
1097
  break;
1156
1098
  }
1157
1099
  case 16: {
1158
- matchResult = 16;
1100
+ matchResult = 15;
1159
1101
  name = glueType.fields[0];
1160
1102
  break;
1161
1103
  }
1162
1104
  case 15: {
1163
- matchResult = 17;
1105
+ matchResult = 16;
1164
1106
  functionTypeInfo = glueType.fields[0];
1165
1107
  break;
1166
1108
  }
1167
1109
  case 1: {
1168
- matchResult = 18;
1110
+ matchResult = 17;
1169
1111
  interfaceInfo = glueType.fields[0];
1170
1112
  break;
1171
1113
  }
1172
1114
  case 22: {
1173
1115
  if (isEmpty(glueType.fields[0].Members)) {
1174
- matchResult = 19;
1116
+ matchResult = 18;
1175
1117
  }
1176
1118
  else {
1177
1119
  const activePatternResult = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1178
1120
  if (activePatternResult != null) {
1179
- matchResult = 20;
1121
+ matchResult = 19;
1180
1122
  name_1 = activePatternResult;
1181
1123
  }
1182
1124
  else {
1183
- matchResult = 21;
1125
+ matchResult = 20;
1184
1126
  typeLiteralInfo = glueType.fields[0];
1185
1127
  }
1186
1128
  }
@@ -1189,11 +1131,11 @@ function transformType(context_mut, glueType_mut) {
1189
1131
  case 25: {
1190
1132
  const activePatternResult_1 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1191
1133
  if (activePatternResult_1 != null) {
1192
- matchResult = 20;
1134
+ matchResult = 19;
1193
1135
  name_1 = activePatternResult_1;
1194
1136
  }
1195
1137
  else {
1196
- matchResult = 22;
1138
+ matchResult = 21;
1197
1139
  glueType_26 = glueType.fields[0];
1198
1140
  }
1199
1141
  break;
@@ -1201,11 +1143,11 @@ function transformType(context_mut, glueType_mut) {
1201
1143
  case 2: {
1202
1144
  const activePatternResult_2 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1203
1145
  if (activePatternResult_2 != null) {
1204
- matchResult = 20;
1146
+ matchResult = 19;
1205
1147
  name_1 = activePatternResult_2;
1206
1148
  }
1207
1149
  else {
1208
- matchResult = 23;
1150
+ matchResult = 22;
1209
1151
  info = glueType.fields[0];
1210
1152
  }
1211
1153
  break;
@@ -1213,11 +1155,11 @@ function transformType(context_mut, glueType_mut) {
1213
1155
  case 9: {
1214
1156
  const activePatternResult_3 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1215
1157
  if (activePatternResult_3 != null) {
1216
- matchResult = 20;
1158
+ matchResult = 19;
1217
1159
  name_1 = activePatternResult_3;
1218
1160
  }
1219
1161
  else {
1220
- matchResult = 24;
1162
+ matchResult = 23;
1221
1163
  innerGlueType = glueType.fields[0];
1222
1164
  }
1223
1165
  break;
@@ -1225,11 +1167,11 @@ function transformType(context_mut, glueType_mut) {
1225
1167
  case 19: {
1226
1168
  const activePatternResult_4 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1227
1169
  if (activePatternResult_4 != null) {
1228
- matchResult = 20;
1170
+ matchResult = 19;
1229
1171
  name_1 = activePatternResult_4;
1230
1172
  }
1231
1173
  else {
1232
- matchResult = 25;
1174
+ matchResult = 24;
1233
1175
  namedTupleType = glueType.fields[0];
1234
1176
  }
1235
1177
  break;
@@ -1237,22 +1179,22 @@ function transformType(context_mut, glueType_mut) {
1237
1179
  case 0: {
1238
1180
  const activePatternResult_5 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1239
1181
  if (activePatternResult_5 != null) {
1240
- matchResult = 20;
1182
+ matchResult = 19;
1241
1183
  name_1 = activePatternResult_5;
1242
1184
  }
1243
1185
  else {
1244
- matchResult = 26;
1186
+ matchResult = 25;
1245
1187
  }
1246
1188
  break;
1247
1189
  }
1248
1190
  case 8: {
1249
1191
  const activePatternResult_6 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1250
1192
  if (activePatternResult_6 != null) {
1251
- matchResult = 20;
1193
+ matchResult = 19;
1252
1194
  name_1 = activePatternResult_6;
1253
1195
  }
1254
1196
  else {
1255
- matchResult = 27;
1197
+ matchResult = 26;
1256
1198
  glueLiteral = glueType.fields[0];
1257
1199
  }
1258
1200
  break;
@@ -1260,15 +1202,15 @@ function transformType(context_mut, glueType_mut) {
1260
1202
  case 6: {
1261
1203
  const activePatternResult_7 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1262
1204
  if (activePatternResult_7 != null) {
1263
- matchResult = 20;
1205
+ matchResult = 19;
1264
1206
  name_1 = activePatternResult_7;
1265
1207
  }
1266
1208
  else if (!isEmpty(glueType.fields[0].TypeParameters)) {
1267
- matchResult = 28;
1209
+ matchResult = 27;
1268
1210
  functionDeclaration_1 = glueType.fields[0];
1269
1211
  }
1270
1212
  else {
1271
- matchResult = 29;
1213
+ matchResult = 28;
1272
1214
  functionDeclaration_2 = glueType.fields[0];
1273
1215
  }
1274
1216
  break;
@@ -1276,11 +1218,11 @@ function transformType(context_mut, glueType_mut) {
1276
1218
  case 21: {
1277
1219
  const activePatternResult_8 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1278
1220
  if (activePatternResult_8 != null) {
1279
- matchResult = 20;
1221
+ matchResult = 19;
1280
1222
  name_1 = activePatternResult_8;
1281
1223
  }
1282
1224
  else {
1283
- matchResult = 30;
1225
+ matchResult = 29;
1284
1226
  members = glueType.fields[1];
1285
1227
  references = glueType.fields[0];
1286
1228
  }
@@ -1289,11 +1231,11 @@ function transformType(context_mut, glueType_mut) {
1289
1231
  case 20: {
1290
1232
  const activePatternResult_9 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1291
1233
  if (activePatternResult_9 != null) {
1292
- matchResult = 20;
1234
+ matchResult = 19;
1293
1235
  name_1 = activePatternResult_9;
1294
1236
  }
1295
1237
  else {
1296
- matchResult = 31;
1238
+ matchResult = 30;
1297
1239
  members_1 = glueType.fields[0];
1298
1240
  }
1299
1241
  break;
@@ -1301,11 +1243,11 @@ function transformType(context_mut, glueType_mut) {
1301
1243
  case 27: {
1302
1244
  const activePatternResult_10 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1303
1245
  if (activePatternResult_10 != null) {
1304
- matchResult = 20;
1246
+ matchResult = 19;
1305
1247
  name_1 = activePatternResult_10;
1306
1248
  }
1307
1249
  else {
1308
- matchResult = 32;
1250
+ matchResult = 31;
1309
1251
  utilityType = glueType.fields[0];
1310
1252
  }
1311
1253
  break;
@@ -1313,11 +1255,11 @@ function transformType(context_mut, glueType_mut) {
1313
1255
  case 5: {
1314
1256
  const activePatternResult_11 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1315
1257
  if (activePatternResult_11 != null) {
1316
- matchResult = 20;
1258
+ matchResult = 19;
1317
1259
  name_1 = activePatternResult_11;
1318
1260
  }
1319
1261
  else {
1320
- matchResult = 33;
1262
+ matchResult = 32;
1321
1263
  typeAliasDeclaration = glueType.fields[0];
1322
1264
  }
1323
1265
  break;
@@ -1325,11 +1267,11 @@ function transformType(context_mut, glueType_mut) {
1325
1267
  case 28: {
1326
1268
  const activePatternResult_12 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1327
1269
  if (activePatternResult_12 != null) {
1328
- matchResult = 20;
1270
+ matchResult = 19;
1329
1271
  name_1 = activePatternResult_12;
1330
1272
  }
1331
1273
  else {
1332
- matchResult = 34;
1274
+ matchResult = 33;
1333
1275
  mappedType = glueType.fields[0];
1334
1276
  }
1335
1277
  break;
@@ -1337,844 +1279,195 @@ function transformType(context_mut, glueType_mut) {
1337
1279
  case 10: {
1338
1280
  const activePatternResult_13 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1339
1281
  if (activePatternResult_13 != null) {
1340
- matchResult = 20;
1282
+ matchResult = 19;
1341
1283
  name_1 = activePatternResult_13;
1342
1284
  }
1343
1285
  else {
1344
- matchResult = 35;
1286
+ matchResult = 34;
1345
1287
  }
1346
1288
  break;
1347
1289
  }
1348
1290
  case 11: {
1349
1291
  const activePatternResult_14 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1350
1292
  if (activePatternResult_14 != null) {
1351
- matchResult = 20;
1293
+ matchResult = 19;
1352
1294
  name_1 = activePatternResult_14;
1353
1295
  }
1354
1296
  else {
1355
- matchResult = 36;
1297
+ matchResult = 35;
1356
1298
  }
1357
1299
  break;
1358
1300
  }
1359
1301
  case 33: {
1360
1302
  const activePatternResult_15 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1361
1303
  if (activePatternResult_15 != null) {
1362
- matchResult = 20;
1304
+ matchResult = 19;
1363
1305
  name_1 = activePatternResult_15;
1364
1306
  }
1365
1307
  else {
1366
- matchResult = 37;
1308
+ matchResult = 36;
1367
1309
  }
1368
1310
  break;
1369
1311
  }
1370
1312
  case 31: {
1371
1313
  const activePatternResult_16 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1372
1314
  if (activePatternResult_16 != null) {
1373
- matchResult = 20;
1315
+ matchResult = 19;
1374
1316
  name_1 = activePatternResult_16;
1375
1317
  }
1376
1318
  else {
1377
- matchResult = 38;
1319
+ matchResult = 37;
1378
1320
  }
1379
1321
  break;
1380
1322
  }
1381
1323
  case 32: {
1382
1324
  const activePatternResult_17 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1383
1325
  if (activePatternResult_17 != null) {
1384
- matchResult = 20;
1326
+ matchResult = 19;
1385
1327
  name_1 = activePatternResult_17;
1386
1328
  }
1387
- else {
1388
- matchResult = 38;
1389
- }
1390
- break;
1391
- }
1392
- case 4: {
1393
- const activePatternResult_18 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1394
- if (activePatternResult_18 != null) {
1395
- matchResult = 20;
1396
- name_1 = activePatternResult_18;
1397
- }
1398
- else {
1399
- matchResult = 38;
1400
- }
1401
- break;
1402
- }
1403
- default:
1404
- matchResult = 0;
1405
- }
1406
- switch (matchResult) {
1407
- case 0:
1408
- return FSharpType.Object$;
1409
- case 1: {
1410
- context_mut = context;
1411
- glueType_mut = (new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(singleton(new GlueMember(/* ConstructSignature */ 7, [constructSignature])), undefined)]));
1412
- continue transformType;
1413
- }
1414
- case 2:
1415
- return new FSharpType(/* Primitive */ 8, [transformPrimitive(primitiveInfo)]);
1416
- case 3:
1417
- return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.String$]);
1418
- case 4:
1419
- return new FSharpType(/* Option */ 3, [transformType(context, glueType_21)]);
1420
- case 5:
1421
- return new FSharpType(/* ThisType */ 15, [new FSharpThisType(sanitizeTypeName(thisTypeInfo.Name), declaredTypeParameters_1(map((_arg) => _arg.Name, thisTypeInfo.TypeParameters)))]);
1422
- case 6:
1423
- return transformTupleType(context, glueTypes);
1424
- case 7:
1425
- return transformReadOnlyModifier(context, glueType_22);
1426
- case 8:
1427
- return transformUnionType(context, cases);
1428
- case 9:
1429
- return FSharpType.Object$;
1430
- case 10: {
1431
- context_mut = context;
1432
- glueType_mut = (new GlueType(/* TypeReference */ 13, [new GlueTypeReference(typeReference_4.Name, typeReference_4.FullName, typeReference_4.ModulePath, map((_arg_1) => (new GlueType(/* Primitive */ 3, [GluePrimitive.Any])), genericDelegateTypeParameters(TransformContext__get_State(context).Conditionals, typeReference_4.FullName)), typeReference_4.IsStandardLibrary)]));
1433
- continue transformType;
1434
- }
1435
- case 11:
1436
- return FSharpType.Object$;
1437
- case 12: {
1438
- context_mut = context;
1439
- glueType_mut = argument;
1440
- continue transformType;
1441
- }
1442
- case 13:
1443
- return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(mapTypeNameToFableCoreAwareName(context, typeReference_6), typeReference_6.FullName, typeReference_6.ModulePath, (typeReference_6.IsStandardLibrary && FSharpSet__Contains(typedArrayNames, typeReference_6.Name)) ? empty() : ((typeReference_6.IsStandardLibrary && FSharpSet__Contains(iteratorNames, typeReference_6.Name)) ? map((glueType_23) => transformType(context, glueType_23), truncate(1, typeReference_6.TypeArguments)) : map((glueType_24) => transformType(context, glueType_24), typeReference_6.TypeArguments)), FSharpType.Discard)]);
1444
- case 14:
1445
- return new FSharpType(/* ResizeArray */ 14, [transformType(TransformContext__PushScope_27AED5E3(context, "Item"), glueType_25)]);
1446
- case 15:
1447
- return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(classDeclaration.Name, classDeclaration.Name, empty(), empty(), FSharpType.Discard)]);
1448
- case 16:
1449
- return new FSharpType(/* TypeParameter */ 13, [name]);
1450
- case 17:
1451
- return transformFunctionType(context, functionTypeInfo);
1452
- case 18: {
1453
- const matchValue = tryTransformCallableInterface(context, interfaceInfo);
1454
- if (matchValue == null) {
1455
- return new FSharpType(/* Interface */ 5, [transformInterface(context, interfaceInfo)]);
1456
- }
1457
- else {
1458
- return matchValue;
1459
- }
1460
- }
1461
- case 19:
1462
- return FSharpType.Object$;
1463
- case 20:
1464
- return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(name_1, TransformContext__get_FullName(context), empty(), empty(), FSharpType.Discard)]);
1465
- case 21:
1466
- return transformTypeLiteral(context, typeLiteralInfo);
1467
- case 22: {
1468
- context_mut = context;
1469
- glueType_mut = glueType_26;
1470
- continue transformType;
1471
- }
1472
- case 23: {
1473
- context_mut = context;
1474
- glueType_mut = info.Type;
1475
- continue transformType;
1476
- }
1477
- case 24: {
1478
- const matchValue_1 = TypeAliasDeclaration_tryTransformKeyOf(TransformContext__get_CurrentScopeName(context), innerGlueType);
1479
- if (matchValue_1 == null) {
1480
- return FSharpType.Object$;
1481
- }
1482
- else {
1483
- TransformContext__ExposeType_Z1D58A540(context, matchValue_1);
1484
- return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), empty(), FSharpType.Discard)]);
1485
- }
1486
- }
1487
- case 25: {
1488
- context_mut = context;
1489
- glueType_mut = namedTupleType.Type;
1490
- continue transformType;
1491
- }
1492
- case 26:
1493
- return FSharpType.Object$;
1494
- case 27:
1495
- switch (glueLiteral.tag) {
1496
- case 1:
1497
- return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.Int]);
1498
- case 2:
1499
- return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.Float]);
1500
- case 3:
1501
- return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.Bool]);
1502
- case 4:
1503
- return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.Null]);
1504
- default:
1505
- return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.String$]);
1506
- }
1507
- case 28:
1508
- return FSharpType.Object$;
1509
- case 29:
1510
- return new FSharpType(/* Function */ 16, [new FSharpFunctionType(requiredBeforeParamArray(map((parameter) => transformParameter(context, parameter), functionDeclaration_2.Parameters)), transformType(context, functionDeclaration_2.Type))]);
1511
- case 30:
1512
- return transformIntersectionOfReferences(context, references, members);
1513
- case 31:
1514
- return transformIntersectionType(context, members_1);
1515
- case 32:
1516
- return UtilityType_transform(context, utilityType);
1517
- case 33:
1518
- return new FSharpType(/* Mapped */ 7, [new FSharpMapped(typeAliasDeclaration.Name, empty())]);
1519
- case 34:
1520
- return transformMappedType(context, mappedType);
1521
- case 35:
1522
- return FSharpType.Object$;
1523
- case 36:
1524
- return FSharpType.Object$;
1525
- case 37:
1526
- return FSharpType.Object$;
1527
- default: {
1528
- TransformContext__AddError_Z721C83C5(context, `Could not transform type: ${interpolate("%A%P()", [glueType])}`);
1529
- return FSharpType.Discard;
1530
- }
1531
- }
1532
- break;
1533
- }
1534
- }
1535
-
1536
- function withoutFreeTypeParameters(members) {
1537
- const erase = (declared, typ) => {
1538
- const declaredNames = ofList(choose((_arg) => {
1539
- if (_arg.tag === 0) {
1540
- return undefined;
1541
- }
1542
- else {
1543
- return _arg.fields[0].Name;
1544
- }
1545
- }, declared), {
1546
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1547
- });
1548
- const free = map((name_1) => (new TypeParameter_SealedTypeInfo(name_1, FSharpType.Object$)), filter((name) => !FSharpSet__Contains(declaredNames, name), List_distinct(namedTypeParameters(typ), {
1549
- Equals: (x_1, y_1) => (x_1 === y_1),
1550
- GetHashCode: (x_1) => (stringHash(x_1) | 0),
1551
- })));
1552
- if (isEmpty(free)) {
1553
- return typ;
1554
- }
1555
- else {
1556
- return TypeParameter_mapFSharpType(free, typ);
1557
- }
1558
- };
1559
- const eraseInfo = (info_1) => {
1560
- const Type = erase(info_1.TypeParameters, info_1.Type);
1561
- 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);
1562
- };
1563
- return map((_arg_1) => {
1564
- switch (_arg_1.tag) {
1565
- case 1:
1566
- return new FSharpMember(/* Property */ 1, [eraseInfo(_arg_1.fields[0])]);
1567
- case 2:
1568
- return new FSharpMember(/* StaticMember */ 2, [_arg_1.fields[0]]);
1569
- default:
1570
- return new FSharpMember(/* Method */ 0, [eraseInfo(_arg_1.fields[0])]);
1571
- }
1572
- }, members);
1573
- }
1574
-
1575
- function exportMembers(members, names) {
1576
- return new ExportMembers(members, names, empty());
1577
- }
1578
-
1579
- function throughDefault(scope, memberName, emit) {
1580
- let matchValue;
1581
- let outArg = defaultOf();
1582
- matchValue = [tryGetValue(scope.ExportEqualsMembers, memberName, new FSharpRef(() => outArg, (v) => {
1583
- outArg = v;
1584
- })), outArg];
1585
- let matchResult;
1586
- if (matchValue[0]) {
1587
- if (scope.IsTopLevel) {
1588
- matchResult = 0;
1589
- }
1590
- else {
1591
- matchResult = 1;
1592
- }
1593
- }
1594
- else {
1595
- matchResult = 1;
1596
- }
1597
- switch (matchResult) {
1598
- case 0: {
1599
- const emit_1 = scope.ExportEqualsCalls.has(memberName) ? "$0($1...)" : emit;
1600
- return toList(delay(() => append_1(importDefaultAttribute(matchValue[1], TransformContext__get_ImportSource(scope.Context)), delay(() => singleton_1(new FSharpAttribute(/* Text */ 0, [concat("Emit(\"", emit_1, "\")")]))))));
1601
- }
1602
- default:
1603
- return undefined;
1604
- }
1605
- }
1606
-
1607
- function exportProperty(scope) {
1608
- return new FSharpMemberInfo(empty(), "", "", empty(), empty(), FSharpType.Discard, false, scope.IsTopLevel, undefined, FSharpAccessibility.Public, empty(), FSharpMemberInfoBody.NativeOnly);
1609
- }
1610
-
1611
- function moduleNames(seenNames, moduleDeclaration) {
1612
- const sanitizedName = sanitizeTypeName(moduleDeclaration.Name);
1613
- const withSuffix = sanitizeTypeName(removeSurroundingQuotes(moduleDeclaration.Name) + "_");
1614
- return [sanitizedName, withSuffix, FSharpSet__Contains(seenNames, sanitizedName) ? withSuffix : sanitizedName];
1615
- }
1616
-
1617
- function exportVariable(scope, info) {
1618
- let bind$0040;
1619
- const patternInput = sanitizeMemberNameAndPushScope(scope.IsTopLevel, info.Name, scope.Context);
1620
- const name = patternInput[0];
1621
- const context_1 = TransformContext__PushScope_27AED5E3(patternInput[1], "Type");
1622
- const xmlDocInfo = transformComment(info.Documentation);
1623
- return exportMembers(singleton(new FSharpMember(/* Property */ 1, [(bind$0040 = exportProperty(scope), new FSharpMemberInfo(toList(delay(() => {
1624
- let matchValue;
1625
- 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));
1626
- })), 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, {
1627
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1628
- }));
1629
- }
1630
-
1631
- function exportFunction(scope, seenNames, exports, info) {
1632
- let specifier;
1633
- const patternInput = sanitizeMemberNameAndPushScope(scope.IsTopLevel, info.Name, scope.Context);
1634
- const name = patternInput[0];
1635
- const context = patternInput[1];
1636
- const xmlDocInfo = transformComment(info.Documentation);
1637
- const typeParameters = transformTypeParameters(context, info.TypeParameters);
1638
- const method = new FSharpMemberInfo(toList(delay(() => {
1639
- let matchValue;
1640
- 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));
1641
- })), 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);
1642
- let runtimeName;
1643
- const matchValue_1 = TransformContext__get_ImportSource(context);
1644
- let matchResult, specifier_1;
1645
- if (matchValue_1.tag === 0) {
1646
- 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) => {
1647
- if (isLetterOrDigit(c)) {
1648
- return true;
1649
- }
1650
- else {
1651
- return c === "_";
1652
- }
1653
- }, specifier.split(""))) && (specifier !== name)) && !FSharpSet__Contains(seenNames, specifier)) && !exists((_arg) => {
1654
- let matchResult_1, other, other_1;
1655
- switch (_arg.tag) {
1656
- case 6: {
1657
- matchResult_1 = 0;
1658
- other = _arg.fields[0];
1659
- break;
1660
- }
1661
- case 25: {
1662
- if (_arg.fields[0].tag === 6) {
1663
- matchResult_1 = 0;
1664
- other = _arg.fields[0].fields[0];
1665
- }
1666
- else {
1667
- matchResult_1 = 2;
1668
- }
1669
- break;
1670
- }
1671
- case 2: {
1672
- matchResult_1 = 1;
1673
- other_1 = _arg.fields[0];
1674
- break;
1675
- }
1676
- default:
1677
- matchResult_1 = 2;
1678
- }
1679
- switch (matchResult_1) {
1680
- case 0:
1681
- return other.Name === specifier;
1682
- case 1:
1683
- return other_1.Name === specifier;
1684
- default:
1685
- return false;
1686
- }
1687
- }, exports))) {
1688
- matchResult = 0;
1689
- specifier_1 = matchValue_1.fields[0];
1690
- }
1691
- else {
1692
- matchResult = 1;
1693
- }
1694
- }
1695
- else {
1696
- matchResult = 1;
1697
- }
1698
- switch (matchResult) {
1699
- case 0: {
1700
- runtimeName = specifier_1;
1701
- break;
1702
- }
1703
- default:
1704
- runtimeName = undefined;
1705
- }
1706
- return exportMembers(toList(delay(() => append_1(singleton_1(new FSharpMember(/* Method */ 0, [method])), delay(() => {
1707
- const matchValue_2 = runtimeName;
1708
- if (matchValue_2 == null) {
1709
- return empty_1();
1710
- }
1711
- else {
1712
- 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)]));
1713
- }
1714
- })))), ofList(toList(delay(() => append_1(singleton_1(name), delay(() => ofArray(toArray(runtimeName)))))), {
1715
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1716
- }));
1717
- }
1718
-
1719
- function exportClass(scope, isDefaultExport, info) {
1720
- const patternInput = sanitizeNameAndPushScope(info.Name, scope.Context);
1721
- const name = patternInput[0];
1722
- const context = patternInput[1];
1723
- return exportMembers(map((constructorInfo_1) => {
1724
- const xmlDocInfo = transformComment(constructorInfo_1.Documentation);
1725
- const typParameters = transformTypeParameters(context, info.TypeParameters);
1726
- 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)]);
1727
- }, 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, {
1728
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1729
- }));
1730
- }
1731
-
1732
- function exportModule(scope, seenNames, moduleDeclaration) {
1733
- let bind$0040, typ_2;
1734
- const context = scope.Context;
1735
- const patternInput = moduleNames(seenNames, moduleDeclaration);
1736
- const mangledName = patternInput[2];
1737
- const exportTypeName = moduleDeclaration.IsTopLevel ? concat(patternInput[1], ".Exports") : concat(patternInput[0], ".Exports");
1738
- const isAmbientModule = moduleDeclaration.Name.startsWith("\"") ? true : moduleDeclaration.Name.startsWith("\'");
1739
- const exportEqualsType = tryPick((_arg) => {
1740
- let matchResult, name_1, typ_1;
1741
- if (_arg.tag === 25) {
1742
- if (_arg.fields[0].tag === 2) {
1743
- if (_arg.fields[0].fields[0].Name.startsWith("export=")) {
1744
- matchResult = 0;
1745
- name_1 = _arg.fields[0].fields[0].Name;
1746
- typ_1 = _arg.fields[0].fields[0].Type;
1747
- }
1748
- else {
1749
- matchResult = 1;
1750
- }
1751
- }
1752
- else {
1753
- matchResult = 1;
1754
- }
1755
- }
1756
- else {
1757
- matchResult = 1;
1758
- }
1759
- switch (matchResult) {
1760
- case 0:
1761
- return typ_1;
1762
- default:
1763
- return undefined;
1764
- }
1765
- }, moduleDeclaration.Types);
1766
- const xmlDocInfo = transformComment(moduleDeclaration.Documentation);
1767
- const namespaceValues = (scope.IsTopLevel && (FSharpSet__Contains(scope.ExportEqualsNames, moduleDeclaration.Name) ? true : FSharpSet__Contains(scope.DefaultExportedDeclarations, moduleDeclaration.Name))) ? choose((_arg_1) => {
1768
- let info, info_1;
1769
- let matchResult_1, info_2, info_3;
1770
- switch (_arg_1.tag) {
1771
- case 6: {
1772
- if ((info = _arg_1.fields[0], !FSharpSet__Contains(scope.DeclaredValueNames, info.Name) && !FSharpSet__Contains(seenNames, info.Name))) {
1773
- matchResult_1 = 0;
1774
- info_2 = _arg_1.fields[0];
1775
- }
1776
- else {
1777
- matchResult_1 = 2;
1778
- }
1779
- break;
1780
- }
1781
- case 2: {
1782
- if ((info_1 = _arg_1.fields[0], !FSharpSet__Contains(scope.DeclaredValueNames, info_1.Name) && !FSharpSet__Contains(seenNames, info_1.Name))) {
1783
- matchResult_1 = 1;
1784
- info_3 = _arg_1.fields[0];
1785
- }
1786
- else {
1787
- matchResult_1 = 2;
1788
- }
1789
- break;
1790
- }
1791
- default:
1792
- matchResult_1 = 2;
1793
- }
1794
- switch (matchResult_1) {
1795
- case 0: {
1796
- scope.ExportEqualsMembers.set(info_2.Name, moduleDeclaration.Name);
1797
- return new GlueType(/* FunctionDeclaration */ 6, [info_2]);
1798
- }
1799
- case 1: {
1800
- scope.ExportEqualsMembers.set(info_3.Name, moduleDeclaration.Name);
1801
- return new GlueType(/* Variable */ 2, [info_3]);
1802
- }
1803
- default:
1804
- return undefined;
1805
- }
1806
- }, moduleDeclaration.Types) : empty();
1807
- 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, {
1808
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1809
- }), namespaceValues);
1810
- }
1811
-
1812
- function exportEqualsVariable(scope, name, typ) {
1813
- const patternInput = sanitizeMemberNameAndPushScope(true, substring(name, "export=".length), scope.Context);
1814
- const name_1 = patternInput[0];
1815
- const context = patternInput[1];
1816
- let property;
1817
- const bind$0040 = exportProperty(scope);
1818
- 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));
1819
- const withoutThis = (memberType) => {
1820
- if (memberType.tag === 17) {
1821
- return typ;
1822
- }
1823
- else {
1824
- return memberType;
1825
- }
1826
- };
1827
- const objectMembers = (typ.tag === 13) ? defaultArg(tryPick((_arg) => {
1828
- let matchResult, info_1;
1829
- if (_arg.tag === 1) {
1830
- if (_arg.fields[0].FullName === typ.fields[0].FullName) {
1831
- matchResult = 0;
1832
- info_1 = _arg.fields[0];
1833
- }
1834
- else {
1835
- matchResult = 1;
1836
- }
1837
- }
1838
- else {
1839
- matchResult = 1;
1840
- }
1841
- switch (matchResult) {
1842
- case 0:
1843
- return info_1.Members;
1844
- default:
1845
- return undefined;
1846
- }
1847
- }, TransformContext__get_TypeMemory(context)), empty()) : ((typ.tag === 22) ? typ.fields[0].Members : empty());
1848
- const memberExports = filter((glueType) => (GlueType__get_Name(glueType) !== name_1), choose((_arg_1) => {
1849
- let matchResult_1, info_5, info_6, info_7;
1850
- switch (_arg_1.tag) {
1851
- case 1: {
1852
- if (!_arg_1.fields[0].IsStatic) {
1853
- matchResult_1 = 0;
1854
- info_5 = _arg_1.fields[0];
1855
- }
1856
- else {
1857
- matchResult_1 = 3;
1858
- }
1859
- break;
1860
- }
1861
- case 6: {
1862
- matchResult_1 = 1;
1863
- info_6 = _arg_1.fields[0];
1864
- break;
1865
- }
1866
- case 0: {
1867
- if (!_arg_1.fields[0].IsStatic) {
1868
- matchResult_1 = 2;
1869
- info_7 = _arg_1.fields[0];
1870
- }
1871
- else {
1872
- matchResult_1 = 3;
1873
- }
1874
- break;
1875
- }
1876
- default:
1877
- matchResult_1 = 3;
1878
- }
1879
- switch (matchResult_1) {
1880
- case 0:
1881
- return new GlueType(/* Variable */ 2, [new GlueVariable(info_5.Documentation, info_5.Name, info_5.Type)]);
1882
- case 1:
1883
- return new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(info_6.Documentation, true, info_6.Name, withoutThis(info_6.Type), info_6.Parameters, empty())]);
1884
- case 2:
1885
- return new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(info_7.Documentation, true, info_7.Name, withoutThis(info_7.Type), info_7.Parameters, empty())]);
1886
- default:
1887
- return undefined;
1888
- }
1889
- }, objectMembers));
1890
- const calls = collect((_arg_2) => {
1891
- if (_arg_2.tag === 4) {
1892
- const info_8 = _arg_2.fields[0];
1893
- 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));
1894
- }
1895
- else {
1896
- return empty();
1897
- }
1898
- }, objectMembers);
1899
- const enumerator = getEnumerator(memberExports);
1900
- try {
1901
- while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
1902
- const memberExport = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
1903
- scope.ExportEqualsMembers.set(GlueType__get_Name(memberExport), name_1);
1904
- }
1905
- }
1906
- finally {
1907
- disposeSafe(enumerator);
1908
- }
1909
- if (!isEmpty(calls)) {
1910
- scope.ExportEqualsMembers.set(name_1, name_1);
1911
- addToSet(name_1, scope.ExportEqualsCalls);
1912
- }
1913
- return new ExportMembers(isEmpty(calls) ? singleton(new FSharpMember(/* Property */ 1, [property])) : empty(), singleton_2(name_1, {
1914
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1915
- }), append(calls, memberExports));
1916
- }
1917
-
1918
- function exportDefaultModule(scope, seenNames, moduleDeclaration) {
1919
- let bind$0040;
1920
- const patternInput = moduleNames(seenNames, moduleDeclaration);
1921
- const name = patternInput[2];
1922
- const xmlDocInfo = transformComment(moduleDeclaration.Documentation);
1923
- 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, {
1924
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1925
- }));
1926
- }
1927
-
1928
- function exportDefault(scope, seenNames, glueType) {
1929
- let bind$0040;
1930
- const patternInput = sanitizeMemberNameAndPushScope(true, GlueType__get_Name(glueType), scope.Context);
1931
- const name = patternInput[0];
1932
- const context = patternInput[1];
1933
- const name_1 = FSharpSet__Contains(seenNames, name) ? concat(name, "_") : name;
1934
- const context_1 = (glueType.tag === 2) ? TransformContext__PushScope_27AED5E3(context, "Type") : context;
1935
- 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, {
1936
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1937
- }));
1938
- }
1939
-
1940
- function transformExports(context, isTopLevel, exports) {
1941
- let members_2;
1942
- const context_1 = TransformContext__PushScope_27AED5E3(context, "Exports");
1943
- const exportEqualsNames = ofSeq(choose((_arg) => {
1944
- let matchResult, name_1;
1945
- if (_arg.tag === 25) {
1946
- if (_arg.fields[0].tag === 2) {
1947
- if (_arg.fields[0].fields[0].Name.startsWith("export=")) {
1948
- matchResult = 0;
1949
- name_1 = _arg.fields[0].fields[0].Name;
1950
- }
1951
- else {
1952
- matchResult = 1;
1953
- }
1954
- }
1955
- else {
1956
- matchResult = 1;
1957
- }
1958
- }
1959
- else {
1960
- matchResult = 1;
1961
- }
1962
- switch (matchResult) {
1963
- case 0:
1964
- return substring(name_1, "export=".length);
1965
- default:
1966
- return undefined;
1967
- }
1968
- }, exports), {
1969
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1970
- });
1971
- const sortedExports = sortBy((_arg_3) => {
1972
- if (_arg_3.tag === 11) {
1973
- return 1;
1974
- }
1975
- else {
1976
- return 0;
1977
- }
1978
- }, collect((_arg_2) => {
1979
- let info_2;
1980
- let matchResult_1, info_1, glueType;
1981
- switch (_arg_2.tag) {
1982
- case 6: {
1983
- matchResult_1 = 0;
1984
- info_1 = _arg_2.fields[0];
1985
- break;
1986
- }
1987
- case 25: {
1988
- if (_arg_2.fields[0].tag === 6) {
1989
- matchResult_1 = 0;
1990
- info_1 = _arg_2.fields[0].fields[0];
1991
- }
1992
- else {
1993
- matchResult_1 = 1;
1994
- glueType = _arg_2;
1995
- }
1996
- break;
1997
- }
1998
- default: {
1999
- matchResult_1 = 1;
2000
- glueType = _arg_2;
2001
- }
2002
- }
2003
- switch (matchResult_1) {
2004
- case 0:
2005
- 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))));
2006
- default:
2007
- return singleton(glueType);
2008
- }
2009
- }, filter((_arg_1) => {
2010
- if (_arg_1.tag === 2) {
2011
- return !FSharpSet__Contains(exportEqualsNames, _arg_1.fields[0].Name);
2012
- }
2013
- else {
2014
- return true;
2015
- }
2016
- }, exports)), {
2017
- Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
2018
- });
2019
- const scope = new ExportScope(context_1, isTopLevel, ofSeq(choose((_arg_4) => {
2020
- let name_2;
2021
- let matchResult_2, info_8, name_3;
2022
- if (_arg_4.tag === 25) {
2023
- switch (_arg_4.fields[0].tag) {
2024
- case 6: {
2025
- matchResult_2 = 0;
2026
- info_8 = _arg_4.fields[0].fields[0];
2027
- break;
2028
- }
2029
- case 2: {
2030
- if ((name_2 = _arg_4.fields[0].fields[0].Name, exists((_arg_5) => {
2031
- switch (_arg_5.tag) {
2032
- case 12:
2033
- return _arg_5.fields[0].Name === name_2;
2034
- case 6:
2035
- return _arg_5.fields[0].Name === name_2;
2036
- default:
2037
- return false;
2038
- }
2039
- }, sortedExports))) {
2040
- matchResult_2 = 1;
2041
- name_3 = _arg_4.fields[0].fields[0].Name;
2042
- }
2043
- else {
2044
- matchResult_2 = 2;
2045
- }
2046
- break;
2047
- }
2048
- default:
2049
- matchResult_2 = 2;
2050
- }
2051
- }
2052
- else {
2053
- matchResult_2 = 2;
2054
- }
2055
- switch (matchResult_2) {
2056
- case 0:
2057
- return info_8.Name;
2058
- case 1:
2059
- return name_3;
2060
- default:
2061
- return undefined;
2062
- }
2063
- }, exports), {
2064
- Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
2065
- }), exportEqualsNames, ofSeq(choose((_arg_6) => {
2066
- let matchResult_3, info_9, info_10, info_11;
2067
- switch (_arg_6.tag) {
2068
- case 6: {
2069
- matchResult_3 = 0;
2070
- info_9 = _arg_6.fields[0];
2071
- break;
2072
- }
2073
- case 25: {
2074
- switch (_arg_6.fields[0].tag) {
2075
- case 6: {
2076
- matchResult_3 = 0;
2077
- info_9 = _arg_6.fields[0].fields[0];
2078
- break;
2079
- }
2080
- case 12: {
2081
- matchResult_3 = 2;
2082
- info_11 = _arg_6.fields[0].fields[0];
2083
- break;
2084
- }
2085
- default:
2086
- matchResult_3 = 3;
2087
- }
2088
- break;
2089
- }
2090
- case 2: {
2091
- matchResult_3 = 1;
2092
- info_10 = _arg_6.fields[0];
1329
+ else {
1330
+ matchResult = 37;
1331
+ }
2093
1332
  break;
2094
1333
  }
2095
- case 12: {
2096
- matchResult_3 = 2;
2097
- info_11 = _arg_6.fields[0];
1334
+ case 4: {
1335
+ const activePatternResult_18 = $007CRememberedTypeLiteral$007C_$007C(context, glueType);
1336
+ if (activePatternResult_18 != null) {
1337
+ matchResult = 19;
1338
+ name_1 = activePatternResult_18;
1339
+ }
1340
+ else {
1341
+ matchResult = 37;
1342
+ }
2098
1343
  break;
2099
1344
  }
2100
1345
  default:
2101
- matchResult_3 = 3;
1346
+ matchResult = 0;
2102
1347
  }
2103
- switch (matchResult_3) {
1348
+ switch (matchResult) {
2104
1349
  case 0:
2105
- return info_9.Name;
2106
- case 1:
2107
- return info_10.Name;
1350
+ return FSharpType.Object$;
1351
+ case 1: {
1352
+ context_mut = context;
1353
+ glueType_mut = (new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(singleton(new GlueMember(/* ConstructSignature */ 7, [constructSignature])), undefined)]));
1354
+ continue transformType;
1355
+ }
2108
1356
  case 2:
2109
- return info_11.Name;
2110
- default:
2111
- return undefined;
2112
- }
2113
- }, exports), {
2114
- Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
2115
- }), new Map([]), new Set([]));
2116
- const apply_1 = (acc_mut, seenNames_mut, glueTypes_mut) => {
2117
- apply_1:
2118
- while (true) {
2119
- const acc = acc_mut, seenNames = seenNames_mut, glueTypes = glueTypes_mut;
2120
- let info_12;
2121
- let matchResult_4, name_5, tail_1, head, tail_2;
2122
- if (!isEmpty(glueTypes)) {
2123
- if (head_1(glueTypes).tag === 25) {
2124
- if (head_1(glueTypes).fields[0].tag === 2) {
2125
- if (FSharpSet__Contains(scope.DefaultExportedDeclarations, head_1(glueTypes).fields[0].fields[0].Name)) {
2126
- matchResult_4 = 1;
2127
- name_5 = head_1(glueTypes).fields[0].fields[0].Name;
2128
- tail_1 = tail_3(glueTypes);
2129
- }
2130
- else {
2131
- matchResult_4 = 2;
2132
- head = head_1(glueTypes);
2133
- tail_2 = tail_3(glueTypes);
2134
- }
2135
- }
2136
- else {
2137
- matchResult_4 = 2;
2138
- head = head_1(glueTypes);
2139
- tail_2 = tail_3(glueTypes);
2140
- }
1357
+ return new FSharpType(/* Primitive */ 8, [transformPrimitive(primitiveInfo)]);
1358
+ case 3:
1359
+ return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.String$]);
1360
+ case 4:
1361
+ return new FSharpType(/* Option */ 3, [transformType(context, glueType_21)]);
1362
+ case 5:
1363
+ return new FSharpType(/* ThisType */ 15, [new FSharpThisType(sanitizeTypeName(thisTypeInfo.Name), declaredTypeParameters_1(map((_arg) => _arg.Name, thisTypeInfo.TypeParameters)))]);
1364
+ case 6:
1365
+ return transformTupleType(context, glueTypes);
1366
+ case 7:
1367
+ return transformReadOnlyModifier(context, glueType_22);
1368
+ case 8:
1369
+ return transformUnionType(context, cases);
1370
+ case 9:
1371
+ return FSharpType.Object$;
1372
+ case 10:
1373
+ return FSharpType.Object$;
1374
+ case 11: {
1375
+ context_mut = context;
1376
+ glueType_mut = argument;
1377
+ continue transformType;
1378
+ }
1379
+ case 12:
1380
+ return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(mapTypeNameToFableCoreAwareName(context, typeReference_4), typeReference_4.FullName, typeReference_4.ModulePath, (typeReference_4.IsStandardLibrary && FSharpSet__Contains(typedArrayNames, typeReference_4.Name)) ? empty() : ((typeReference_4.IsStandardLibrary && FSharpSet__Contains(iteratorNames, typeReference_4.Name)) ? map((glueType_23) => transformType(context, glueType_23), truncate(1, typeReference_4.TypeArguments)) : map((glueType_24) => transformType(context, glueType_24), typeReference_4.TypeArguments)), FSharpType.Discard)]);
1381
+ case 13:
1382
+ return new FSharpType(/* ResizeArray */ 14, [transformType(TransformContext__PushScope_27AED5E3(context, "Item"), glueType_25)]);
1383
+ case 14:
1384
+ return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(classDeclaration.Name, classDeclaration.Name, empty(), empty(), FSharpType.Discard)]);
1385
+ case 15:
1386
+ return new FSharpType(/* TypeParameter */ 13, [name]);
1387
+ case 16:
1388
+ return transformFunctionType(context, functionTypeInfo);
1389
+ case 17: {
1390
+ const matchValue = tryTransformCallableInterface(context, interfaceInfo);
1391
+ if (matchValue == null) {
1392
+ return new FSharpType(/* Interface */ 5, [transformInterface(context, interfaceInfo)]);
2141
1393
  }
2142
1394
  else {
2143
- matchResult_4 = 2;
2144
- head = head_1(glueTypes);
2145
- tail_2 = tail_3(glueTypes);
1395
+ return matchValue;
2146
1396
  }
2147
1397
  }
2148
- else {
2149
- matchResult_4 = 0;
1398
+ case 18:
1399
+ return FSharpType.Object$;
1400
+ case 19:
1401
+ return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(name_1, TransformContext__get_FullName(context), empty(), empty(), FSharpType.Discard)]);
1402
+ case 20:
1403
+ return transformTypeLiteral(context, typeLiteralInfo);
1404
+ case 21: {
1405
+ context_mut = context;
1406
+ glueType_mut = glueType_26;
1407
+ continue transformType;
2150
1408
  }
2151
- switch (matchResult_4) {
2152
- case 0:
2153
- return acc;
2154
- case 1: {
2155
- acc_mut = acc;
2156
- seenNames_mut = seenNames;
2157
- glueTypes_mut = tail_1;
2158
- continue apply_1;
1409
+ case 22: {
1410
+ context_mut = context;
1411
+ glueType_mut = info.Type;
1412
+ continue transformType;
1413
+ }
1414
+ case 23: {
1415
+ const matchValue_1 = TypeAliasDeclaration_tryTransformKeyOf(TransformContext__get_CurrentScopeName(context), innerGlueType);
1416
+ if (matchValue_1 == null) {
1417
+ return FSharpType.Object$;
2159
1418
  }
2160
- default: {
2161
- 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({
2162
- Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
2163
- })) : 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({
2164
- Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
2165
- }))) : 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)))));
2166
- acc_mut = append(acc, added.Members);
2167
- seenNames_mut = union(seenNames, added.Names);
2168
- glueTypes_mut = append(added.Prepended, tail_2);
2169
- continue apply_1;
1419
+ else {
1420
+ TransformContext__ExposeType_Z1D58A540(context, matchValue_1);
1421
+ return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), empty(), FSharpType.Discard)]);
2170
1422
  }
2171
1423
  }
2172
- break;
1424
+ case 24: {
1425
+ context_mut = context;
1426
+ glueType_mut = namedTupleType.Type;
1427
+ continue transformType;
1428
+ }
1429
+ case 25:
1430
+ return FSharpType.Object$;
1431
+ case 26:
1432
+ switch (glueLiteral.tag) {
1433
+ case 1:
1434
+ return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.Int]);
1435
+ case 2:
1436
+ return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.Float]);
1437
+ case 3:
1438
+ return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.Bool]);
1439
+ case 4:
1440
+ return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.Null]);
1441
+ default:
1442
+ return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.String$]);
1443
+ }
1444
+ case 27:
1445
+ return FSharpType.Object$;
1446
+ case 28:
1447
+ return new FSharpType(/* Function */ 16, [new FSharpFunctionType(requiredBeforeParamArray(map((parameter) => transformParameter(context, parameter), functionDeclaration_2.Parameters)), transformType(context, functionDeclaration_2.Type))]);
1448
+ case 29:
1449
+ return transformIntersectionOfReferences(context, references, members);
1450
+ case 30:
1451
+ return transformIntersectionType(context, members_1);
1452
+ case 31:
1453
+ return UtilityType_transform(context, utilityType);
1454
+ case 32:
1455
+ return new FSharpType(/* Mapped */ 7, [new FSharpMapped(typeAliasDeclaration.Name, empty())]);
1456
+ case 33:
1457
+ return transformMappedType(context, mappedType);
1458
+ case 34:
1459
+ return FSharpType.Object$;
1460
+ case 35:
1461
+ return FSharpType.Object$;
1462
+ case 36:
1463
+ return FSharpType.Object$;
1464
+ default: {
1465
+ TransformContext__AddError_Z721C83C5(context, `Could not transform type: ${interpolate("%A%P()", [glueType])}`);
1466
+ return FSharpType.Discard;
1467
+ }
2173
1468
  }
2174
- };
2175
- return new FSharpType(/* Interface */ 5, [new FSharpInterface(ofArray([FSharpAttribute.AbstractClass, FSharpAttribute.Erase]), "Exports", empty(), "Exports", empty(), (members_2 = withoutFreeTypeParameters(apply_1(empty(), empty_2({
2176
- Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
2177
- }), sortedExports)), distinctBySignature(Aliases_get_Empty(), members_2)), empty())]);
1469
+ break;
1470
+ }
2178
1471
  }
2179
1472
 
2180
1473
  function transformParameter(context, parameter) {
@@ -2196,7 +1489,7 @@ function transformParameter(context, parameter) {
2196
1489
  case 13: {
2197
1490
  if (glueType.fields[0].Name === "ReadonlyArray") {
2198
1491
  if (!isEmpty(glueType.fields[0].TypeArguments)) {
2199
- if (isEmpty(tail_3(glueType.fields[0].TypeArguments))) {
1492
+ if (isEmpty(tail_1(glueType.fields[0].TypeArguments))) {
2200
1493
  if (glueType.fields[0].IsStandardLibrary) {
2201
1494
  matchResult = 1;
2202
1495
  elementType_1 = head_1(glueType.fields[0].TypeArguments);
@@ -2253,7 +1546,7 @@ function transformParameter(context, parameter) {
2253
1546
  const parameter_1 = new GlueParameter(parameter.Name, parameter.IsOptional, parameter.IsSpread, asArray(parameter.Type));
2254
1547
  let typ;
2255
1548
  const computedType = unwrapOptionIfAlreadyOptional(patternInput[1], parameter_1.Type, parameter_1.IsOptional);
2256
- 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_3(computedType.fields[0].TypeArguments)) ? head_1(computedType.fields[0].TypeArguments) : computedType) : computedType) : computedType) : computedType)) : computedType);
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);
2257
1550
  return new FSharpParameter(toList(delay(() => (parameter_1.IsSpread ? singleton_1(FSharpAttribute.ParamArray) : empty_1()))), patternInput[0], parameter_1.IsOptional, typ, undefined);
2258
1551
  }
2259
1552
 
@@ -2475,11 +1768,11 @@ function TransformMembers_defaultsOf(parameters, typeParameters) {
2475
1768
  }, typeParameters), {
2476
1769
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
2477
1770
  });
2478
- if (forAll_1((typeParameter_1) => FSharpMap__ContainsKey(defaults, typeParameter_1.Name), typeParameters)) {
1771
+ if (forAll((typeParameter_1) => FSharpMap__ContainsKey(defaults, typeParameter_1.Name), typeParameters)) {
2479
1772
  return map_1((_arg, default__1) => GlueSubstitution_substitute(defaults, default__1), defaults);
2480
1773
  }
2481
1774
  else {
2482
- return empty_3({
1775
+ return empty_2({
2483
1776
  Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
2484
1777
  });
2485
1778
  }
@@ -2522,7 +1815,7 @@ function TransformMembers_isAnyDictionary(glueType) {
2522
1815
  }
2523
1816
  switch (matchResult) {
2524
1817
  case 0:
2525
- return forAll_1((_arg) => {
1818
+ return forAll((_arg) => {
2526
1819
  let matchResult_1;
2527
1820
  if (_arg.tag === 5) {
2528
1821
  switch (_arg.fields[0].Type.tag) {
@@ -2563,7 +1856,7 @@ function TransformMembers_tryDictionarySignature(typeParameters, parameters) {
2563
1856
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
2564
1857
  });
2565
1858
  const hasDictionary = exists((parameter_1) => TransformMembers_isAnyDictionary(parameter_1.Type), parameters);
2566
- const allTold = forAll_1((typeParameter) => FSharpSet__Contains(told, typeParameter.Name), typeParameters);
1859
+ const allTold = forAll((typeParameter) => FSharpSet__Contains(told, typeParameter.Name), typeParameters);
2567
1860
  if (hasDictionary && allTold) {
2568
1861
  const taken = new Set(map((_arg) => _arg.Name, typeParameters));
2569
1862
  const added = [];
@@ -2594,7 +1887,7 @@ function TransformMembers_tryDictionarySignature(typeParameters, parameters) {
2594
1887
  return parameter_3;
2595
1888
  }
2596
1889
  }, parameters);
2597
- return [append(typeParameters, ofSeq_1(added)), parameters_1];
1890
+ return [append(typeParameters, ofSeq(added)), parameters_1];
2598
1891
  }
2599
1892
  else {
2600
1893
  return undefined;
@@ -2684,7 +1977,7 @@ function TransformMembers_trySpecializeStringLiteralMethod(methodName, parameter
2684
1977
  return undefined;
2685
1978
  }
2686
1979
  else {
2687
- const remainingParameters = tail_3(parameters);
1980
+ const remainingParameters = tail_1(parameters);
2688
1981
  const matchValue = head_1(parameters).Type;
2689
1982
  let matchResult, literalValue;
2690
1983
  if (matchValue.tag === 8) {
@@ -2946,7 +2239,7 @@ function TransformMembers_methodMember(context, methodInfo) {
2946
2239
  }
2947
2240
  else {
2948
2241
  const typeParameters = transformTypeParameters(context_1, TransformMembers_withoutReferenceConstraints(methodInfo.TypeParameters));
2949
- return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => patternInput[2])))), name, methodInfo.Name, typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) => TypeParameter_mapFsharpParameter(typeParameters.SealedTypes, transformParameter(context_1, arg)), parameters)), TypeParameter_mapFSharpType(typeParameters.SealedTypes, transformType(context_1, methodInfo.Type)), methodInfo.IsOptional, methodInfo.IsStatic, undefined, FSharpAccessibility.Public, xmlDocInfo.XmlDoc, FSharpMemberInfoBody.NativeOnly)]);
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)]);
2950
2243
  }
2951
2244
  }
2952
2245
 
@@ -2954,7 +2247,7 @@ function TransformMembers_callSignatureMember(context, info) {
2954
2247
  const patternInput = sanitizeNameAndPushScope("Invoke", context);
2955
2248
  const context_1 = patternInput[1];
2956
2249
  const typeParameters = transformTypeParameters(context_1, TransformMembers_withoutReferenceConstraints(info.TypeParameters));
2957
- return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(singleton(FSharpAttribute.EmitSelfInvoke), patternInput[0], "Invoke", typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) => TypeParameter_mapFsharpParameter(typeParameters.SealedTypes, transformParameter(context_1, arg)), info.Parameters)), TypeParameter_mapFSharpType(typeParameters.SealedTypes, transformType(context_1, info.Type)), false, false, undefined, FSharpAccessibility.Public, empty(), FSharpMemberInfoBody.NativeOnly)]);
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)]);
2958
2251
  }
2959
2252
 
2960
2253
  function TransformMembers_propertyMember(context, info) {
@@ -3016,7 +2309,7 @@ function TransformMembers_methodSignatureMember(context, info) {
3016
2309
  const patternInput_1 = sanitizeNameAndPushScope(patternInput[0], context);
3017
2310
  const context_1 = patternInput_1[1];
3018
2311
  const typeParameters = transformTypeParameters(context_1, TransformMembers_withoutReferenceConstraints(info.TypeParameters));
3019
- 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) => TypeParameter_mapFsharpParameter(typeParameters.SealedTypes, transformParameter(context_1, arg)), patternInput[1])), TypeParameter_mapFSharpType(typeParameters.SealedTypes, transformType(context_1, info.Type)), false, false, undefined, FSharpAccessibility.Public, xmlDocInfo.XmlDoc, FSharpMemberInfoBody.NativeOnly)]);
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)]);
3020
2313
  }
3021
2314
 
3022
2315
  function TransformMembers_constructSignatureMember(context, info) {
@@ -3195,7 +2488,7 @@ function tryParameterCombinations(parameters) {
3195
2488
  return undefined;
3196
2489
  }
3197
2490
  }, unionInfo_1.Cases);
3198
- matchValue_1 = (forAll_1((option) => (option != null), cases) ? choose((x) => x, cases) : undefined);
2491
+ matchValue_1 = (forAll((option) => (option != null), cases) ? choose((x) => x, cases) : undefined);
3199
2492
  break;
3200
2493
  }
3201
2494
  default:
@@ -3304,7 +2597,7 @@ function tryTransformCallableInterface(context, info) {
3304
2597
  if (isEmpty(matchValue)) {
3305
2598
  if (!isEmpty(matchValue_1)) {
3306
2599
  if (head_1(matchValue_1).tag === 13) {
3307
- if (isEmpty(tail_3(matchValue_1))) {
2600
+ if (isEmpty(tail_1(matchValue_1))) {
3308
2601
  if (tryCallableHeritage(TransformContext__get_TypeMemory(context), head_1(matchValue_1)) != null) {
3309
2602
  matchResult = 1;
3310
2603
  heritage_1 = head_1(matchValue_1);
@@ -3327,7 +2620,7 @@ function tryTransformCallableInterface(context, info) {
3327
2620
  }
3328
2621
  }
3329
2622
  else if (head_1(matchValue).tag === 4) {
3330
- if (isEmpty(tail_3(matchValue))) {
2623
+ if (isEmpty(tail_1(matchValue))) {
3331
2624
  if (isEmpty(matchValue_1)) {
3332
2625
  if (isDeclaredOnce) {
3333
2626
  matchResult = 0;
@@ -3599,8 +2892,8 @@ function transformInterface(context, info) {
3599
2892
  return !contains_2(_arg_2.fields[0].Name, ownNames);
3600
2893
  }
3601
2894
  }, append(membersComingFromPartial, append(membersComingFromOmit, membersComingFromCallable))))), toList(delay(() => {
3602
- let context_2;
3603
- return append_1(List_distinct(filter(isInheritableType, map((context_2 = TransformContext__PushScope_27AED5E3(context_1, "Extends"), (glueType_1) => transformType(context_2, glueType_1)), inheritance)), {
2895
+ let list_19, context_2;
2896
+ return append_1(List_distinct(filter(isInheritableType, (list_19 = withoutBasesOfBases(TransformContext__get_TypeMemory(context_1), inheritance), map((context_2 = TransformContext__PushScope_27AED5E3(context_1, "Extends"), (glueType_1) => transformType(context_2, glueType_1)), list_19))), {
3604
2897
  Equals: equals,
3605
2898
  GetHashCode: (x_2) => (safeHash(x_2) | 0),
3606
2899
  }), delay(() => {
@@ -3736,35 +3029,7 @@ function transformRecord(context, name, typeParameters, recordInfo) {
3736
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())]);
3737
3030
  }
3738
3031
 
3739
- class TypeParameter_SealedTypeInfo extends Record {
3740
- constructor(TypeParameterName, FSharpType) {
3741
- super();
3742
- this.TypeParameterName = TypeParameterName;
3743
- this.FSharpType = FSharpType;
3744
- }
3745
- }
3746
-
3747
- function TypeParameter_SealedTypeInfo_$reflection() {
3748
- return record_type("Glutinum.Converter.Transform.TypeParameter.SealedTypeInfo", [], TypeParameter_SealedTypeInfo, () => [["TypeParameterName", string_type], ["FSharpType", FSharpType_$reflection()]]);
3749
- }
3750
-
3751
- class TypeParameter_TransformResult extends Record {
3752
- constructor(FSharpTypeParameter, SealedTypeOpt) {
3753
- super();
3754
- this.FSharpTypeParameter = FSharpTypeParameter;
3755
- this.SealedTypeOpt = SealedTypeOpt;
3756
- }
3757
- }
3758
-
3759
- function TypeParameter_TransformResult_$reflection() {
3760
- return record_type("Glutinum.Converter.Transform.TypeParameter.TransformResult", [], TypeParameter_TransformResult, () => [["FSharpTypeParameter", FSharpTypeParameter_$reflection()], ["SealedTypeOpt", option_type(TypeParameter_SealedTypeInfo_$reflection())]]);
3761
- }
3762
-
3763
- function TypeParameter_TransformResult_Create_403667D8(typeParameterName, default_, constraint_, sealedType) {
3764
- return new TypeParameter_TransformResult(new FSharpTypeParameter(/* FSharpTypeParameter */ 1, [FSharpTypeParameterInfo_Create_Z6CFD3565(typeParameterName, unwrap(constraint_), unwrap(default_))]), (sealedType == null) ? undefined : (new TypeParameter_SealedTypeInfo(typeParameterName, sealedType)));
3765
- }
3766
-
3767
- function TypeParameter_transformWith(withDefault, context, typeParameter) {
3032
+ function TypeParameterTransform_transformWith(withDefault, context, typeParameter) {
3768
3033
  let default_;
3769
3034
  if (withDefault) {
3770
3035
  let mapping;
@@ -3805,18 +3070,18 @@ function TypeParameter_transformWith(withDefault, context, typeParameter) {
3805
3070
  }
3806
3071
  switch (matchResult) {
3807
3072
  case 0:
3808
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_);
3073
+ return TransformResult_Create_403667D8(typeParameter.Name, default_);
3809
3074
  case 1: {
3810
3075
  const matchValue_1 = transformType(TransformContext__PushScope_27AED5E3(context, sanitizeTypeName(typeParameter.Name)), constraintType);
3811
3076
  if (matchValue_1.tag === 11) {
3812
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, matchValue_1);
3077
+ return TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, matchValue_1);
3813
3078
  }
3814
3079
  else {
3815
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_, matchValue_1);
3080
+ return TransformResult_Create_403667D8(typeParameter.Name, default_, matchValue_1);
3816
3081
  }
3817
3082
  }
3818
3083
  case 2:
3819
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_);
3084
+ return TransformResult_Create_403667D8(typeParameter.Name, default_);
3820
3085
  default: {
3821
3086
  const matchValue_2 = transformType(TransformContext__PushScope_27AED5E3(context, sanitizeTypeName(typeParameter.Name)), constraintType_1);
3822
3087
  let matchResult_1, fsharpType_2;
@@ -3859,183 +3124,30 @@ function TypeParameter_transformWith(withDefault, context, typeParameter) {
3859
3124
  }
3860
3125
  switch (matchResult_1) {
3861
3126
  case 0:
3862
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_);
3127
+ return TransformResult_Create_403667D8(typeParameter.Name, default_);
3863
3128
  case 1:
3864
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, fsharpType_2);
3129
+ return TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, fsharpType_2);
3865
3130
  case 2:
3866
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_);
3131
+ return TransformResult_Create_403667D8(typeParameter.Name, default_);
3867
3132
  default:
3868
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_);
3869
- }
3870
- }
3871
- }
3872
- }
3873
-
3874
- function TypeParameter_transform(context, typeParameter) {
3875
- return TypeParameter_transformWith(true, context, typeParameter);
3876
- }
3877
-
3878
- function TypeParameter_mapFSharpType(seadledTypes, typ) {
3879
- let matchResult, typeParameter, info_1, info_2, innerType, typeReference, unionInfo, types, typ_7, functionInfo, alias;
3880
- switch (typ.tag) {
3881
- case 0:
3882
- case 2:
3883
- case 4:
3884
- case 5:
3885
- case 6:
3886
- case 8:
3887
- case 10:
3888
- case 15:
3889
- case 17:
3890
- case 18:
3891
- case 19:
3892
- case 20:
3893
- case 21: {
3894
- matchResult = 10;
3895
- break;
3896
- }
3897
- case 7: {
3898
- if (typ.fields[0].Name.startsWith("\'")) {
3899
- matchResult = 1;
3900
- info_1 = typ.fields[0];
3901
- }
3902
- else {
3903
- matchResult = 2;
3904
- info_2 = typ.fields[0];
3905
- }
3906
- break;
3907
- }
3908
- case 3: {
3909
- matchResult = 3;
3910
- innerType = typ.fields[0];
3911
- break;
3912
- }
3913
- case 11: {
3914
- matchResult = 4;
3915
- typeReference = typ.fields[0];
3916
- break;
3917
- }
3918
- case 1: {
3919
- matchResult = 5;
3920
- unionInfo = typ.fields[0];
3921
- break;
3922
- }
3923
- case 12: {
3924
- matchResult = 6;
3925
- types = typ.fields[0];
3926
- break;
3927
- }
3928
- case 14: {
3929
- matchResult = 7;
3930
- typ_7 = typ.fields[0];
3931
- break;
3932
- }
3933
- case 16: {
3934
- matchResult = 8;
3935
- functionInfo = typ.fields[0];
3936
- break;
3937
- }
3938
- case 9: {
3939
- matchResult = 9;
3940
- alias = typ.fields[0];
3941
- break;
3942
- }
3943
- default: {
3944
- matchResult = 0;
3945
- typeParameter = typ.fields[0];
3946
- }
3947
- }
3948
- switch (matchResult) {
3949
- case 0: {
3950
- const needMapping = tryFind((mapperInfo) => (mapperInfo.TypeParameterName === typeParameter), seadledTypes);
3951
- if (needMapping == null) {
3952
- return typ;
3953
- }
3954
- else {
3955
- return needMapping.FSharpType;
3956
- }
3957
- }
3958
- case 1: {
3959
- const matchValue = tryFind((mapperInfo_2) => (mapperInfo_2.TypeParameterName === substring(info_1.Name, 1)), seadledTypes);
3960
- if (matchValue == null) {
3961
- return typ;
3962
- }
3963
- else {
3964
- return matchValue.FSharpType;
3133
+ return TransformResult_Create_403667D8(typeParameter.Name, default_);
3965
3134
  }
3966
3135
  }
3967
- case 2:
3968
- return new FSharpType(/* Mapped */ 7, [new FSharpMapped(info_2.Name, map((_arg) => {
3969
- if (_arg.tag === 1) {
3970
- const paramInfo = _arg.fields[0];
3971
- const matchValue_1 = tryFind((mapperInfo_4) => (mapperInfo_4.TypeParameterName === paramInfo.Name), seadledTypes);
3972
- if (matchValue_1 == null) {
3973
- return new FSharpTypeParameter(/* FSharpTypeParameter */ 1, [paramInfo]);
3974
- }
3975
- else {
3976
- return new FSharpTypeParameter(/* FSharpType */ 0, [matchValue_1.FSharpType]);
3977
- }
3978
- }
3979
- else {
3980
- return new FSharpTypeParameter(/* FSharpType */ 0, [TypeParameter_mapFSharpType(seadledTypes, _arg.fields[0])]);
3981
- }
3982
- }, info_2.TypeParameters))]);
3983
- case 3:
3984
- return new FSharpType(/* Option */ 3, [TypeParameter_mapFSharpType(seadledTypes, innerType)]);
3985
- case 4:
3986
- 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)]);
3987
- case 5:
3988
- return new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, map((case$) => {
3989
- switch (case$.tag) {
3990
- case 1:
3991
- return new FSharpUnionCase(/* Typed */ 1, [TypeParameter_mapFSharpType(seadledTypes, case$.fields[0])]);
3992
- case 2:
3993
- return new FSharpUnionCase(/* Field */ 2, [case$.fields[0], TypeParameter_mapFSharpType(seadledTypes, case$.fields[1])]);
3994
- case 3:
3995
- return new FSharpUnionCase(/* NamedFields */ 3, [case$.fields[0], map((tupledArg) => [tupledArg[0], TypeParameter_mapFSharpType(seadledTypes, tupledArg[1])], case$.fields[1])]);
3996
- default:
3997
- return case$;
3998
- }
3999
- }, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants)]);
4000
- case 6:
4001
- return new FSharpType(/* Tuple */ 12, [map((typ_6) => TypeParameter_mapFSharpType(seadledTypes, typ_6), types)]);
4002
- case 7:
4003
- return new FSharpType(/* ResizeArray */ 14, [TypeParameter_mapFSharpType(seadledTypes, typ_7)]);
4004
- case 8:
4005
- return new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => TypeParameter_mapFsharpParameter(seadledTypes, parameter), functionInfo.Parameters), TypeParameter_mapFSharpType(seadledTypes, functionInfo.ReturnType))]);
4006
- case 9:
4007
- return new FSharpType(/* TypeAlias */ 9, [new FSharpTypeAlias(alias.Attributes, alias.Name, alias.XmlDoc, alias.Type, map((_arg_1) => {
4008
- if (_arg_1.tag === 0) {
4009
- return new FSharpTypeParameter(/* FSharpType */ 0, [TypeParameter_mapFSharpType(seadledTypes, _arg_1.fields[0])]);
4010
- }
4011
- else {
4012
- const matchValue_2 = tryFind((mapperInfo_6) => (mapperInfo_6.TypeParameterName === _arg_1.fields[0].Name), seadledTypes);
4013
- if (matchValue_2 == null) {
4014
- return _arg_1;
4015
- }
4016
- else {
4017
- return new FSharpTypeParameter(/* FSharpType */ 0, [matchValue_2.FSharpType]);
4018
- }
4019
- }
4020
- }, alias.TypeParameters))]);
4021
- default:
4022
- return typ;
4023
3136
  }
4024
3137
  }
4025
3138
 
4026
- function TypeParameter_mapFsharpParameter(seadledTypes, parameter) {
4027
- const typ = TypeParameter_mapFSharpType(seadledTypes, parameter.Type);
4028
- 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);
4029
3141
  }
4030
3142
 
4031
3143
  function transformTypeParameters(context, typeParameters) {
4032
- const transformedTypeParameters = map((typeParameter) => TypeParameter_transformWith(false, context, typeParameter), typeParameters);
3144
+ const transformedTypeParameters = map((typeParameter) => TypeParameterTransform_transformWith(false, context, typeParameter), typeParameters);
4033
3145
  const sealedTypes = choose((_arg) => _arg.SealedTypeOpt, transformedTypeParameters);
4034
3146
  return new TransformTypeParametersResult(map((_arg_2) => _arg_2.FSharpTypeParameter, filter((_arg_1) => (_arg_1.SealedTypeOpt == null), transformedTypeParameters)), sealedTypes);
4035
3147
  }
4036
3148
 
4037
3149
  function transformDeclarationTypeParameters(context, typeParameters) {
4038
- const transformedTypeParameters = map((typeParameter) => TypeParameter_transform(context, typeParameter), typeParameters);
3150
+ const transformedTypeParameters = map((typeParameter) => TypeParameterTransform_transform(context, typeParameter), typeParameters);
4039
3151
  return new TransformDeclarationTypeParametersResult(map((_arg) => _arg.FSharpTypeParameter, transformedTypeParameters), exists((_arg_1) => (_arg_1.SealedTypeOpt != null), transformedTypeParameters) ? map((result) => {
4040
3152
  const matchValue = result.SealedTypeOpt;
4041
3153
  if (matchValue == null) {
@@ -4148,7 +3260,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4148
3260
  return undefined;
4149
3261
  }
4150
3262
  }, aliasCases_1);
4151
- if (forAll_1((option) => (option != null), resolved)) {
3263
+ if (forAll((option) => (option != null), resolved)) {
4152
3264
  return collect(value_7, resolved);
4153
3265
  }
4154
3266
  else {
@@ -4288,7 +3400,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4288
3400
  default:
4289
3401
  return singleton(case$);
4290
3402
  }
4291
- }, cases_4) : cases_4)), forAll_1(isLiteral, withAliases) ? withAliases : flattenCasesWith(false, cases_5))));
3403
+ }, cases_4) : cases_4)), forAll(isLiteral, withAliases) ? withAliases : flattenCasesWith(false, cases_5))));
4292
3404
  const otherCases = patternInput[1];
4293
3405
  const flattenedCases = patternInput[0];
4294
3406
  const isStringEnumCompatible = (!isEmpty(flattenedCases) && exists((_arg_5) => {
@@ -4310,7 +3422,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4310
3422
  default:
4311
3423
  return false;
4312
3424
  }
4313
- }, flattenedCases)) && forAll_1((_arg_6) => {
3425
+ }, flattenedCases)) && forAll((_arg_6) => {
4314
3426
  let matchResult_6;
4315
3427
  if (_arg_6.tag === 8) {
4316
3428
  switch (_arg_6.fields[0].tag) {
@@ -4334,7 +3446,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4334
3446
  return false;
4335
3447
  }
4336
3448
  }, flattenedCases);
4337
- const isNumericOnly = !isEmpty(flattenedCases) && forAll_1((_arg_7) => {
3449
+ const isNumericOnly = !isEmpty(flattenedCases) && forAll((_arg_7) => {
4338
3450
  let matchResult_7;
4339
3451
  if (_arg_7.tag === 8) {
4340
3452
  if (_arg_7.fields[0].tag === 1) {
@@ -4439,7 +3551,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4439
3551
  else {
4440
3552
  return [caseInfo_1, add(caseInfo_1.Name, usedNames)];
4441
3553
  }
4442
- }, empty_2({
3554
+ }, empty_3({
4443
3555
  Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
4444
3556
  }), caseInfos)[0];
4445
3557
  let matchValue_3;
@@ -4453,7 +3565,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4453
3565
  return undefined;
4454
3566
  }
4455
3567
  }, _arg_10.fields[0].Members);
4456
- if (forAll_1((option_2) => (option_2 != null), properties)) {
3568
+ if (forAll((option_2) => (option_2 != null), properties)) {
4457
3569
  return choose((x_2) => x_2, properties);
4458
3570
  }
4459
3571
  else {
@@ -4464,7 +3576,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4464
3576
  return undefined;
4465
3577
  }
4466
3578
  }, otherCases);
4467
- if ((isEmpty(flattenedCases) && (length(casesProperties) >= 2)) && forAll_1((option_3) => (option_3 != null), casesProperties)) {
3579
+ if ((isEmpty(flattenedCases) && (length(casesProperties) >= 2)) && forAll((option_3) => (option_3 != null), casesProperties)) {
4468
3580
  const casesProperties_1 = choose((x_3) => x_3, casesProperties);
4469
3581
  matchValue_3 = tryPick((candidate_1) => {
4470
3582
  const tagValues = map((properties_1) => {
@@ -4523,7 +3635,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4523
3635
  return undefined;
4524
3636
  }
4525
3637
  }, casesProperties_1);
4526
- if (forAll_1((option_6) => (option_6 != null), tagValues) && (length(List_distinct(tagValues, {
3638
+ if (forAll((option_6) => (option_6 != null), tagValues) && (length(List_distinct(tagValues, {
4527
3639
  Equals: equals,
4528
3640
  GetHashCode: (x_4) => (structuralHash(x_4) | 0),
4529
3641
  })) === length(tagValues))) {
@@ -4828,7 +3940,7 @@ function aliasOfUnion(scope, cases, unionType) {
4828
3940
  let matchResult_1, single, others_3;
4829
3941
  if (!isEmpty(matchValue_1[0])) {
4830
3942
  if (!isEmpty(matchValue_1[1])) {
4831
- if (isEmpty(tail_3(matchValue_1[1]))) {
3943
+ if (isEmpty(tail_1(matchValue_1[1]))) {
4832
3944
  matchResult_1 = 0;
4833
3945
  single = head_1(matchValue_1[1]);
4834
3946
  }
@@ -4952,7 +4064,7 @@ function aliasOfTypeReference(scope, typeReference) {
4952
4064
  let matchResult, members;
4953
4065
  if (!isEmpty(matchValue)) {
4954
4066
  if (head_1(matchValue).tag === 20) {
4955
- if (isEmpty(tail_3(matchValue))) {
4067
+ if (isEmpty(tail_1(matchValue))) {
4956
4068
  matchResult = 0;
4957
4069
  members = head_1(matchValue).fields[0];
4958
4070
  }
@@ -5038,16 +4150,15 @@ function aliasOfUtilityType(scope, utilityType) {
5038
4150
 
5039
4151
  function aliasOfFunctionType(scope, functionType) {
5040
4152
  const context = scope.Context;
5041
- const declaredNames = ofSeq(map((_arg) => _arg.Name, scope.Declaration.TypeParameters), {
5042
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
5043
- });
5044
- const ownTypeParameters = transformTypeParameters(context, filter((typeParameter) => !FSharpSet__Contains(declaredNames, typeParameter.Name), functionType.TypeParameters));
4153
+ const ownDefaults = ownTypeParameterDefaults(functionType);
4154
+ const parameters = map((parameter) => GlueSubstitution_substituteParameter(ownDefaults, parameter), functionType.Parameters);
4155
+ const returnType = GlueSubstitution_substitute(ownDefaults, functionType.Type);
5045
4156
  const declaredTypeParameters = scope.TypeParameters.Value.TypeParameters;
5046
- if (isLambdaSignature(functionType.Parameters, ownTypeParameters.TypeParameters, declaredTypeParameters)) {
5047
- return aliasOf(scope, new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => transformParameter(context, parameter), functionType.Parameters), transformCallbackReturnType(TransformContext__PushScope_27AED5E3(context, "ReturnType"), functionType.Type))]));
4157
+ if (isLambdaSignature(parameters, empty(), declaredTypeParameters)) {
4158
+ return aliasOf(scope, new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter_1) => transformParameter(context, parameter_1), parameters), transformCallbackReturnType(TransformContext__PushScope_27AED5E3(context, "ReturnType"), returnType))]));
5048
4159
  }
5049
4160
  else {
5050
- return new FSharpType(/* Delegate */ 20, [new FSharpDelegate(scope.XmlDoc.XmlDoc, scope.Name, append(declaredTypeParameters, ownTypeParameters.TypeParameters), requiredBeforeParamArray(map((arg) => TypeParameter_mapFsharpParameter(ownTypeParameters.SealedTypes, transformParameter(context, arg)), functionType.Parameters)), TypeParameter_mapFSharpType(ownTypeParameters.SealedTypes, transformCallbackReturnType(TransformContext__PushScope_27AED5E3(context, "ReturnType"), functionType.Type)))]);
4161
+ return new FSharpType(/* Delegate */ 20, [new FSharpDelegate(scope.XmlDoc.XmlDoc, scope.Name, declaredTypeParameters, requiredBeforeParamArray(map((parameter_2) => transformParameter(context, parameter_2), parameters)), transformCallbackReturnType(TransformContext__PushScope_27AED5E3(context, "ReturnType"), returnType))]);
5051
4162
  }
5052
4163
  }
5053
4164
 
@@ -5063,8 +4174,8 @@ function aliasOfConstructorType(scope, constructSignature) {
5063
4174
  const context = scope.Context;
5064
4175
  const matchValue = scope.Declaration.TypeParameters;
5065
4176
  if (!isEmpty(matchValue)) {
5066
- if (isEmpty(tail_3(matchValue))) {
5067
- return new FSharpType(/* SingleErasedCaseUnion */ 2, [new FSharpSingleErasedCaseUnion(toList(delay(() => scope.XmlDoc.ObsoleteAttributes)), scope.Name, scope.XmlDoc.XmlDoc, TypeParameter_transform(context, head_1(matchValue)).FSharpTypeParameter)]);
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)]);
5068
4179
  }
5069
4180
  else {
5070
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"));
@@ -5242,9 +4353,9 @@ function ReExport_isExpressible(glueType_mut) {
5242
4353
  continue ReExport_isExpressible;
5243
4354
  }
5244
4355
  case 2:
5245
- return forAll_1(ReExport_isExpressible, glueType.fields[0].fields[0]);
4356
+ return forAll(ReExport_isExpressible, glueType.fields[0].fields[0]);
5246
4357
  case 3:
5247
- return forAll_1(ReExport_isExpressible, glueType.fields[0]);
4358
+ return forAll(ReExport_isExpressible, glueType.fields[0]);
5248
4359
  default:
5249
4360
  return false;
5250
4361
  }
@@ -5253,7 +4364,7 @@ function ReExport_isExpressible(glueType_mut) {
5253
4364
  }
5254
4365
 
5255
4366
  function ReExport_canForwardConstraints(typeParameters) {
5256
- return forAll_1((typeParameter) => {
4367
+ return forAll((typeParameter) => {
5257
4368
  const matchValue = typeParameter.Constraint;
5258
4369
  let matchResult, constraintType;
5259
4370
  if (matchValue != null) {
@@ -5404,7 +4515,7 @@ function exposeSpecializedAlias(name_mut, acc_mut, tailedTypeParameters_mut, typ
5404
4515
  return acc;
5405
4516
  }
5406
4517
  else {
5407
- const tail = tail_3(typeParameters);
4518
+ const tail = tail_1(typeParameters);
5408
4519
  const head = head_1(typeParameters);
5409
4520
  if (head.tag === 1) {
5410
4521
  const typeParameter = head.fields[0];
@@ -5414,8 +4525,8 @@ function exposeSpecializedAlias(name_mut, acc_mut, tailedTypeParameters_mut, typ
5414
4525
  const orderedTail = reverse(tail);
5415
4526
  let tailedTypeParameters_1;
5416
4527
  let substitute;
5417
- const seadledTypes = singleton(new TypeParameter_SealedTypeInfo(typeParameter.Name, defaultType));
5418
- substitute = ((typ) => TypeParameter_mapFSharpType(seadledTypes, typ));
4528
+ const seadledTypes = singleton(new SealedTypeInfo(typeParameter.Name, defaultType));
4529
+ substitute = ((typ) => mapFSharpType(seadledTypes, typ));
5419
4530
  tailedTypeParameters_1 = map((_arg) => {
5420
4531
  if (_arg.tag === 0) {
5421
4532
  return new FSharpTypeParameter(/* FSharpType */ 0, [substitute(_arg.fields[0])]);
@@ -5543,7 +4654,7 @@ function keysModuleOf(context, interfaceInfo, fsharpInterface) {
5543
4654
  }
5544
4655
 
5545
4656
  function transformToFsharp(context, glueTypes) {
5546
- TransformContext__set_SiblingTypeNames_2FCB1351(context, ofSeq(map(sanitizeTypeName, choose((_arg) => {
4657
+ TransformContext__set_SiblingTypeNames_2FCB1351(context, ofSeq_1(map(sanitizeTypeName, choose((_arg) => {
5547
4658
  switch (_arg.tag) {
5548
4659
  case 1:
5549
4660
  return _arg.fields[0].Name;
@@ -5703,7 +4814,7 @@ function transformToFsharp(context, glueTypes) {
5703
4814
  return transformModuleDeclaration(TransformContext__get_TypeMemory(context), TransformContext__get_State(context), TransformContext__get__Reporter(context), TransformContext__get_TypeLiteralsMemory(context), TransformContext__get_ImportSource(context), moduleInfo);
5704
4815
  case 5: {
5705
4816
  const name_1 = sanitizeTypeName(fileModule.Name);
5706
- TypeLiteralsMemory__EnterModule_Z721C83C5(TransformContext__get_TypeLiteralsMemory(context), name_1);
4817
+ TypeLiteralsMemory__EnterFileModule_Z721C83C5(TransformContext__get_TypeLiteralsMemory(context), name_1);
5707
4818
  const types = transform(TransformContext__get_TypeMemory(context), TransformContext__get_State(context), TransformContext__get__Reporter(context), TransformContext__get_TypeLiteralsMemory(context), fileModule.IsGlobal ? ImportSource.Global : (!fileModule.HasRuntime ? ImportSource.NoRuntime : (new ImportSource(/* Module */ 0, [fileModule.ImportSpecifier, fileModule.SymbolSpecifiers]))), true, fileModule.Types);
5708
4819
  TypeLiteralsMemory__LeaveModule(TransformContext__get_TypeLiteralsMemory(context));
5709
4820
  return singleton(new FSharpType(/* Module */ 4, [new FSharpModule(name_1, false, fileModule.ImportSpecifier, append(types, aggregatedExports(types)))]));
@@ -5760,7 +4871,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5760
4871
  default:
5761
4872
  return glueType_3;
5762
4873
  }
5763
- }, (exportEqualsNames = ofSeq(choose((_arg) => {
4874
+ }, (exportEqualsNames = ofSeq_1(choose((_arg) => {
5764
4875
  let matchResult_1, name;
5765
4876
  if (_arg.tag === 25) {
5766
4877
  if (_arg.fields[0].tag === 2) {
@@ -5793,7 +4904,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5793
4904
  default:
5794
4905
  return undefined;
5795
4906
  }
5796
- }), (declaredNames = ofSeq(choose((_arg_1) => {
4907
+ }), (declaredNames = ofSeq_1(choose((_arg_1) => {
5797
4908
  let matchResult_2, info_3, info_4, glueType_1;
5798
4909
  switch (_arg_1.tag) {
5799
4910
  case 12: {
@@ -5946,7 +5057,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5946
5057
  return true;
5947
5058
  case 11: {
5948
5059
  const info_11 = glueType_7.fields[0];
5949
- if (!info_11.IsGlobal) {
5060
+ if (!info_11.IsGlobal && info_11.IsExported) {
5950
5061
  return applyModuleDeclaration(info_11);
5951
5062
  }
5952
5063
  else {
@@ -5995,7 +5106,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5995
5106
  return undefined;
5996
5107
  }
5997
5108
  }, glueAst_2);
5998
- const defaultExported = ofSeq(choose((_arg_4) => {
5109
+ const defaultExported = ofSeq_1(choose((_arg_4) => {
5999
5110
  let matchResult_7, info_14, name_8;
6000
5111
  if (_arg_4.tag === 25) {
6001
5112
  switch (_arg_4.fields[0].tag) {
@@ -6032,7 +5143,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
6032
5143
  }, glueAst_2), {
6033
5144
  Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
6034
5145
  });
6035
- const classes_1 = ofSeq(map((_arg_5) => _arg_5.Name, filter((info_15) => {
5146
+ const classes_1 = ofSeq_1(map((_arg_5) => _arg_5.Name, filter((info_15) => {
6036
5147
  if (info_15.IsExported) {
6037
5148
  return true;
6038
5149
  }
@@ -6042,7 +5153,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
6042
5153
  }, classDeclarations)), {
6043
5154
  Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
6044
5155
  });
6045
- const constructorVariables = ofSeq(choose((_arg_6) => {
5156
+ const constructorVariables = ofSeq_1(choose((_arg_6) => {
6046
5157
  let matchResult_8, name_10, members_1, name_11;
6047
5158
  if (_arg_6.tag === 2) {
6048
5159
  switch (_arg_6.fields[0].Type.tag) {
@@ -6133,7 +5244,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
6133
5244
  exportsType_1 = undefined;
6134
5245
  }
6135
5246
  else {
6136
- 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);
6137
5248
  let matchResult_10, exportsType;
6138
5249
  if (matchValue_2.tag === 5) {
6139
5250
  if (isEmpty(matchValue_2.fields[0].Members)) {
@@ -6169,7 +5280,7 @@ export function applyWithOptions(options, typeMemory, glueAst) {
6169
5280
  const typeLiteralsMemory = TypeLiteralsMemory_$ctor();
6170
5281
  const transformed = transform(typeMemory, TransformState_Create_Z68CEF8E2(typeMemory, options.MaxOverloads), reporter, typeLiteralsMemory, options.Source, true, glueAst);
6171
5282
  const aliases = aliasesOf(transformed);
6172
- return new TransformResult(disambiguateOverloads(aliases, apply_2(apply_3(apply_4(applyWith_1(aliases, transformed))))), Reporter__get_Warnings(reporter), Reporter__get_Errors(reporter), Reporter__get_HasRegEpx(reporter), Reporter__get_HasReadonlyArray(reporter), Reporter__get_HasIterable(reporter));
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));
6173
5284
  }
6174
5285
 
6175
5286
  export function applyWithSource(source, typeMemory, glueAst) {
@@ -6177,7 +5288,7 @@ export function applyWithSource(source, typeMemory, glueAst) {
6177
5288
  }
6178
5289
 
6179
5290
  export function applyWith(importSpecifier, typeMemory, glueAst) {
6180
- return applyWithSource(new ImportSource(/* Module */ 0, [importSpecifier, empty_3({
5291
+ return applyWithSource(new ImportSource(/* Module */ 0, [importSpecifier, empty_2({
6181
5292
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
6182
5293
  })]), typeMemory, glueAst);
6183
5294
  }