@glutinum/cli 1.0.0-beta.7 → 1.0.0-beta.9

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, TypeLiteralsMemory__EnterFileModule_Z721C83C5, 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, GlueTypeReference, GlueClassDeclaration, GlueLiteral__ToText, GlueIndexSignature, GlueLiteral, GlueMember__TryGetAccessor, GlueMember__get_Documentation, GluePrimitive, GlueProperty, GlueAccessor, GlueMethod, GlueMethodSignature, GlueSubstitution_mentionedTypeParameters, GlueFunctionType, GlueParameter, GlueTypeUnion, GlueFunctionDeclaration, GlueVariable, GlueType__get_Name, GlueConstructor, GlueType, GlueTypeLiteral, GlueMember, GlueTypeParameter, GlueSubstitution_substitute, GlueSubstitution_substituteParameter, GlueInterface, GlueTypeAliasDeclaration_$reflection, GlueType_$reflection } from "./GlueAST.js";
2
+ import { Record } from "../fable_modules/fable-library-js.5.17.2/Types.js";
3
+ import { int32_type, bool_type, array_type, list_type, record_type, class_type, string_type } from "../fable_modules/fable-library-js.5.17.2/Reflection.js";
4
+ import { Reporter__get_HasIterable, Reporter__get_HasReadonlyArray, Reporter__get_HasRegEpx, Reporter__get_Errors, Reporter__get_Warnings, TransformState_Create_Z68CEF8E2, TypeLiteralsMemory_$ctor, Reporter_$ctor, TransformContext__ToList, importDefaultAttribute, TransformContext_$ctor_Z1635F75A, TypeLiteralsMemory__EnterFileModule_Z721C83C5, TransformContext__get__Reporter, TransformContext__set_SiblingTypeNames_2FCB1351, importAttribute, TypeLiteralsMemory__LeaveModule, TypeLiteralsMemory__EnterModule_Z721C83C5, TransformContext__ExposeTypeAlias_1CE4A880, TransformContext__AddWarning_Z721C83C5, sanitizeTypeNameAndPushScope, ImportSource, TransformContext__get_ImportSource, TransformContext__get_TypeMemory, sanitizeMemberNameAndPushScope, TransformContext__AddError_Z721C83C5, TypeLiteralsMemory__Remember_74C8CBB, TransformContext__get_TypeLiteralsMemory, TransformContext__get_Root, TypeLiteralsMemory__TryReference_433E080, TransformContext__get_State, TransformContext__get_FullName, TransformContext__ExposeType_Z1D58A540, TransformContext__PushScope_27AED5E3, sanitizeNameAndPushScope, TransformContext__NewTypeName, TransformContext__get_CurrentScopeName, TransformContext__ExposeIterable, TransformContext__ReferenceName_Z721C83C5, TransformContext__get_OriginalScopeName, TransformContext__ExposeTypeAlias_Z721C83C5, TransformContext__ExposeReadonlyArray, ImportSource_$reflection, TransformContext_$reflection } from "./Transformer/Context.js";
5
+ import { GlueReExport, GlueVariable, GlueTypeReference, GlueClassDeclaration, GlueLiteral__ToText, GlueIndexSignature, GlueLiteral, GlueTypeUnion, GlueMember__TryGetAccessor, GlueMember__get_Documentation, GluePrimitive, GlueProperty, GlueAccessor, GlueFunctionDeclaration, GlueMethod, GlueMethodSignature, GlueSubstitution_mentionedTypeParameters, GlueFunctionType, GlueParameter, 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 { empty as empty_3, add, contains as contains_2, ofSeq as ofSeq_1, 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, 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, isNullish, tryCases, 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
+ import { contains as contains_1 } from "../fable_modules/fable-library-js.5.17.2/Array.js";
28
29
  import { inheritsIterable, asMethods, tryCallableHeritage } from "./Transformer/CallableProperties.js";
29
30
  import { withoutBaseClassProperties, withoutBasesOfBases, isInheritableType, isSelfHeritage, isArrayHeritage, isErrorHeritage, withoutRedeclaredBases } from "./Transformer/Heritage.js";
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 {
@@ -796,10 +743,11 @@ function transformUnionType(context, cases) {
796
743
  const others = patternInput[1];
797
744
  const optionalTypes = patternInput[0];
798
745
  const isOptional = !isEmpty(optionalTypes);
799
- if (isOptional && (length(others) === 1)) {
800
- return new FSharpType(/* Option */ 3, [transformType(context, head_1(others))]);
746
+ const others_1 = (length(others) > 1) ? map(arrayAsInput, others) : others;
747
+ if (isOptional && (length(others_1) === 1)) {
748
+ return new FSharpType(/* Option */ 3, [transformType(context, head_1(others_1))]);
801
749
  }
802
- else if (isEmpty(others)) {
750
+ else if (isEmpty(others_1)) {
803
751
  if (!isEmpty(optionalTypes)) {
804
752
  return transformType(context, head_1(optionalTypes));
805
753
  }
@@ -807,22 +755,22 @@ function transformUnionType(context, cases) {
807
755
  return FSharpType.Object$;
808
756
  }
809
757
  }
810
- else if (length(others) === 1) {
811
- return transformType(context, head_1(others));
758
+ else if (length(others_1) === 1) {
759
+ return transformType(context, head_1(others_1));
812
760
  }
813
761
  else {
814
- const matchValue = tryOptimizeUnionType(context, TransformContext__get_CurrentScopeName(context), others);
762
+ const matchValue = tryOptimizeUnionType(context, TransformContext__get_CurrentScopeName(context), others_1);
815
763
  if (matchValue == null) {
816
- const isLarge = length(others) > 9;
817
- const name_1 = isLarge ? TransformContext__NewTypeName(context) : (`U${length(others)}`);
764
+ const isLarge = length(others_1) > 9;
765
+ const name_1 = isLarge ? TransformContext__NewTypeName(context) : (`U${length(others_1)}`);
818
766
  const caseContext = isLarge ? context : sanitizeNameAndPushScope(name_1, context)[1];
819
- const caseTypes = List_distinct(mapIndexed((index, caseType) => transformType(TransformContext__PushScope_27AED5E3(caseContext, `Case${index + 1}`), caseType), others), {
767
+ const caseTypes = List_distinct(mapIndexed((index, caseType) => transformType(TransformContext__PushScope_27AED5E3(caseContext, `Case${index + 1}`), caseType), others_1), {
820
768
  Equals: equals,
821
769
  GetHashCode: (x_1) => (safeHash(x_1) | 0),
822
770
  });
823
771
  let matchResult, single;
824
772
  if (!isEmpty(caseTypes)) {
825
- if (isEmpty(tail_3(caseTypes))) {
773
+ if (isEmpty(tail_1(caseTypes))) {
826
774
  matchResult = 0;
827
775
  single = head_1(caseTypes);
828
776
  }
@@ -843,7 +791,7 @@ function transformUnionType(context, cases) {
843
791
  case 0:
844
792
  return single;
845
793
  case 1: {
846
- const typeParameterNames_1 = List_distinct(collect(typeParameterNames_2, others), {
794
+ const typeParameterNames_1 = List_distinct(collect(typeParameterNames_2, others_1), {
847
795
  Equals: (x_2, y_2) => (x_2 === y_2),
848
796
  GetHashCode: (x_2) => (stringHash(x_2) | 0),
849
797
  });
@@ -864,12 +812,12 @@ function transformUnionType(context, cases) {
864
812
  }
865
813
  else {
866
814
  const name = TransformContext__NewTypeName(context);
867
- const typeParameterNames = List_distinct(collect(typeParameterNames_2, others), {
815
+ const typeParameterNames = List_distinct(collect(typeParameterNames_2, others_1), {
868
816
  Equals: (x, y) => (x === y),
869
817
  GetHashCode: (x) => (stringHash(x) | 0),
870
818
  });
871
819
  let option_3;
872
- const option_1 = tryOptimizeUnionType(context, name, others);
820
+ const option_1 = tryOptimizeUnionType(context, name, others_1);
873
821
  option_3 = ((option_1 != null) ? ((typ = option_1, (typ.tag === 1) ? ((unionInfo = typ.fields[0], new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, unionInfo.Cases, unionInfo.IsOptional, declaredTypeParameters_1(typeParameterNames), unionInfo.Constants)]))) : typ)) : undefined);
874
822
  if (option_3 != null) {
875
823
  TransformContext__ExposeType_Z1D58A540(context, option_3);
@@ -912,7 +860,7 @@ function transformFunctionType(context, functionTypeInfo) {
912
860
  const paremeters = filter((parameter) => (parameter.Name !== "this"), functionTypeInfo.Parameters);
913
861
  let matchResult;
914
862
  if (!isEmpty(paremeters)) {
915
- if (isEmpty(tail_3(paremeters))) {
863
+ if (isEmpty(tail_1(paremeters))) {
916
864
  matchResult = 0;
917
865
  }
918
866
  else {
@@ -953,7 +901,7 @@ function transformFunctionType(context, functionTypeInfo) {
953
901
  }
954
902
  }, append(functionTypeInfo.TypeParameters, map(unconstrained, filter((name) => !FSharpSet__Contains(declared, name), functionTypeInfo.OwnTypeParameterNames))))));
955
903
  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)))]));
904
+ 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
905
  const ownDefaults_1 = map_1((_arg_1, glueType) => transformType(context, glueType), ownTypeParameterDefaults(functionTypeInfo));
958
906
  return new FSharpType(/* TypeAlias */ 9, [new FSharpTypeAlias(empty(), TransformContext__ReferenceName_Z721C83C5(context, name_2), empty(), FSharpType.Discard, map((typeParameter_2) => {
959
907
  let matchResult_1, info_1;
@@ -1113,7 +1061,7 @@ function transformType(context_mut, glueType_mut) {
1113
1061
  }
1114
1062
  else if (glueType.fields[0].Name === "Readonly") {
1115
1063
  if (!isEmpty(glueType.fields[0].TypeArguments)) {
1116
- if (isEmpty(tail_3(glueType.fields[0].TypeArguments))) {
1064
+ if (isEmpty(tail_1(glueType.fields[0].TypeArguments))) {
1117
1065
  if (glueType.fields[0].IsStandardLibrary) {
1118
1066
  matchResult = 11;
1119
1067
  argument = head_1(glueType.fields[0].TypeArguments);
@@ -1523,858 +1471,143 @@ function transformType(context_mut, glueType_mut) {
1523
1471
  }
1524
1472
  }
1525
1473
 
1526
- function withoutFreeTypeParameters(members) {
1527
- const erase = (declared, typ) => {
1528
- const declaredNames = ofList(choose((_arg) => {
1529
- if (_arg.tag === 0) {
1530
- return undefined;
1531
- }
1532
- else {
1533
- return _arg.fields[0].Name;
1534
- }
1535
- }, declared), {
1536
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1537
- });
1538
- const free = map((name_1) => (new TypeParameter_SealedTypeInfo(name_1, FSharpType.Object$)), filter((name) => !FSharpSet__Contains(declaredNames, name), List_distinct(namedTypeParameters(typ), {
1539
- Equals: (x_1, y_1) => (x_1 === y_1),
1540
- GetHashCode: (x_1) => (stringHash(x_1) | 0),
1541
- })));
1542
- if (isEmpty(free)) {
1543
- return typ;
1544
- }
1545
- else {
1546
- return TypeParameter_mapFSharpType(free, typ);
1547
- }
1548
- };
1549
- const eraseInfo = (info_1) => {
1550
- const Type = erase(info_1.TypeParameters, info_1.Type);
1551
- return new FSharpMemberInfo(info_1.Attributes, info_1.Name, info_1.OriginalName, info_1.TypeParameters, map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, erase(info_1.TypeParameters, parameter.Type), parameter.OriginalGlueMember)), info_1.Parameters), Type, info_1.IsOptional, info_1.IsStatic, info_1.Accessor, info_1.Accessibility, info_1.XmlDoc, info_1.Body);
1552
- };
1553
- return map((_arg_1) => {
1554
- switch (_arg_1.tag) {
1555
- case 1:
1556
- return new FSharpMember(/* Property */ 1, [eraseInfo(_arg_1.fields[0])]);
1557
- case 2:
1558
- return new FSharpMember(/* StaticMember */ 2, [_arg_1.fields[0]]);
1559
- default:
1560
- return new FSharpMember(/* Method */ 0, [eraseInfo(_arg_1.fields[0])]);
1561
- }
1562
- }, members);
1474
+ function transformParameter(context, parameter) {
1475
+ const patternInput = sanitizeNameAndPushScope(parameter.Name, context);
1476
+ const parameter_1 = new GlueParameter(parameter.Name, parameter.IsOptional, parameter.IsSpread, arrayAsInput(parameter.Type));
1477
+ let typ;
1478
+ const computedType = unwrapOptionIfAlreadyOptional(patternInput[1], parameter_1.Type, parameter_1.IsOptional);
1479
+ 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);
1480
+ return new FSharpParameter(toList(delay(() => (parameter_1.IsSpread ? singleton_1(FSharpAttribute.ParamArray) : empty_1()))), patternInput[0], parameter_1.IsOptional, typ, undefined);
1481
+ }
1482
+
1483
+ function transformAccessor(accessor) {
1484
+ switch (accessor.tag) {
1485
+ case 1:
1486
+ return FSharpAccessor.WriteOnly;
1487
+ case 2:
1488
+ return FSharpAccessor.ReadWrite;
1489
+ default:
1490
+ return FSharpAccessor.ReadOnly;
1491
+ }
1563
1492
  }
1564
1493
 
1565
- function exportMembers(members, names) {
1566
- return new ExportMembers(members, names, empty());
1494
+ function methodGlueFunctionType(documentation, typeParameters, parameters, returnType) {
1495
+ return new GlueType(/* FunctionType */ 15, [new GlueFunctionType(documentation, returnType, typeParameters, map((_arg) => _arg.Name, typeParameters), parameters)]);
1567
1496
  }
1568
1497
 
1569
- function throughDefault(scope, memberName, emit) {
1570
- let matchValue;
1571
- let outArg = defaultOf();
1572
- matchValue = [tryGetValue(scope.ExportEqualsMembers, memberName, new FSharpRef(() => outArg, (v) => {
1573
- outArg = v;
1574
- })), outArg];
1575
- let matchResult;
1576
- if (matchValue[0]) {
1577
- if (scope.IsTopLevel) {
1498
+ function methodFunctionType(context, documentation, typeParameters, parameters, returnType) {
1499
+ return transformType(context, methodGlueFunctionType(documentation, typeParameters, parameters, returnType));
1500
+ }
1501
+
1502
+ function TransformMembers_withoutReferenceConstraints(typeParameters) {
1503
+ return map((typeParameter) => {
1504
+ const matchValue = typeParameter.Constraint;
1505
+ let matchResult;
1506
+ if (matchValue == null) {
1507
+ matchResult = 0;
1508
+ }
1509
+ else if (matchValue.tag === 9) {
1578
1510
  matchResult = 0;
1579
1511
  }
1580
1512
  else {
1581
1513
  matchResult = 1;
1582
1514
  }
1583
- }
1584
- else {
1585
- matchResult = 1;
1586
- }
1587
- switch (matchResult) {
1588
- case 0: {
1589
- const emit_1 = scope.ExportEqualsCalls.has(memberName) ? "$0($1...)" : emit;
1590
- return toList(delay(() => append_1(importDefaultAttribute(matchValue[1], TransformContext__get_ImportSource(scope.Context)), delay(() => singleton_1(new FSharpAttribute(/* Text */ 0, [concat("Emit(\"", emit_1, "\")")]))))));
1515
+ switch (matchResult) {
1516
+ case 0:
1517
+ return typeParameter;
1518
+ default:
1519
+ return new GlueTypeParameter(typeParameter.Name, undefined, typeParameter.Default);
1591
1520
  }
1521
+ }, typeParameters);
1522
+ }
1523
+
1524
+ function TransformMembers_disposalMemberName(name) {
1525
+ switch (name) {
1526
+ case "[Symbol.dispose]":
1527
+ return "dispose";
1528
+ case "[Symbol.asyncDispose]":
1529
+ return "asyncDispose";
1592
1530
  default:
1593
1531
  return undefined;
1594
1532
  }
1595
1533
  }
1596
1534
 
1597
- function exportProperty(scope) {
1598
- return new FSharpMemberInfo(empty(), "", "", empty(), empty(), FSharpType.Discard, false, scope.IsTopLevel, undefined, FSharpAccessibility.Public, empty(), FSharpMemberInfoBody.NativeOnly);
1599
- }
1600
-
1601
- function moduleNames(seenNames, moduleDeclaration) {
1602
- const sanitizedName = sanitizeTypeName(moduleDeclaration.Name);
1603
- const withSuffix = sanitizeTypeName(removeSurroundingQuotes(moduleDeclaration.Name) + "_");
1604
- return [sanitizedName, withSuffix, FSharpSet__Contains(seenNames, sanitizedName) ? withSuffix : sanitizedName];
1605
- }
1606
-
1607
- function exportVariable(scope, info) {
1608
- let bind$0040;
1609
- const patternInput = sanitizeMemberNameAndPushScope(scope.IsTopLevel, info.Name, scope.Context);
1610
- const name = patternInput[0];
1611
- const context_1 = TransformContext__PushScope_27AED5E3(patternInput[1], "Type");
1612
- const xmlDocInfo = transformComment(info.Documentation);
1613
- return exportMembers(singleton(new FSharpMember(/* Property */ 1, [(bind$0040 = exportProperty(scope), new FSharpMemberInfo(toList(delay(() => {
1614
- let matchValue;
1615
- return append_1((matchValue = throughDefault(scope, info.Name, concat("$0.", info.Name)), (matchValue == null) ? (scope.IsTopLevel ? importAttribute(info.Name, TransformContext__get_ImportSource(context_1)) : singleton_1(new FSharpAttribute(/* EmitMacroProperty */ 19, [info.Name]))) : matchValue), delay(() => xmlDocInfo.ObsoleteAttributes));
1616
- })), name, info.Name, bind$0040.TypeParameters, bind$0040.Parameters, transformType(context_1, info.Type), bind$0040.IsOptional, bind$0040.IsStatic, bind$0040.Accessor, bind$0040.Accessibility, xmlDocInfo.XmlDoc, bind$0040.Body))])), singleton_2(name, {
1617
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1618
- }));
1619
- }
1620
-
1621
- function exportFunction(scope, seenNames, exports, info) {
1622
- let specifier;
1623
- const patternInput = sanitizeMemberNameAndPushScope(scope.IsTopLevel, info.Name, scope.Context);
1624
- const name = patternInput[0];
1625
- const context = patternInput[1];
1626
- const xmlDocInfo = transformComment(info.Documentation);
1627
- const typeParameters = transformTypeParameters(context, info.TypeParameters);
1628
- const method = new FSharpMemberInfo(toList(delay(() => {
1629
- let matchValue;
1630
- return append_1((matchValue = throughDefault(scope, info.Name, concat("$0.", info.Name, "($1...)")), (matchValue == null) ? (scope.IsTopLevel ? (FSharpSet__Contains(scope.DefaultExportedDeclarations, info.Name) ? importDefaultAttribute(info.Name, TransformContext__get_ImportSource(context)) : importAttribute(info.Name, TransformContext__get_ImportSource(context))) : singleton_1(new FSharpAttribute(/* EmitMacroInvoke */ 18, [info.Name]))) : matchValue), delay(() => xmlDocInfo.ObsoleteAttributes));
1631
- })), name, info.Name, typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) => TypeParameter_mapFsharpParameter(typeParameters.SealedTypes, transformParameter(context, arg)), info.Parameters)), TypeParameter_mapFSharpType(typeParameters.SealedTypes, transformType(context, info.Type)), false, scope.IsTopLevel, undefined, FSharpAccessibility.Public, xmlDocInfo.XmlDoc, FSharpMemberInfoBody.NativeOnly);
1632
- let runtimeName;
1633
- const matchValue_1 = TransformContext__get_ImportSource(context);
1634
- let matchResult, specifier_1;
1635
- if (matchValue_1.tag === 0) {
1636
- if ((specifier = matchValue_1.fields[0], ((((((scope.IsTopLevel && FSharpSet__Contains(scope.DefaultExportedDeclarations, info.Name)) && (specifier !== "REPLACE_ME_WITH_MODULE_NAME")) && !(specifier.indexOf("/") >= 0)) && forAll((c) => {
1637
- if (isLetterOrDigit(c)) {
1638
- return true;
1639
- }
1640
- else {
1641
- return c === "_";
1642
- }
1643
- }, specifier.split(""))) && (specifier !== name)) && !FSharpSet__Contains(seenNames, specifier)) && !exists((_arg) => {
1644
- let matchResult_1, other, other_1;
1645
- switch (_arg.tag) {
1646
- case 6: {
1647
- matchResult_1 = 0;
1648
- other = _arg.fields[0];
1649
- break;
1650
- }
1651
- case 25: {
1652
- if (_arg.fields[0].tag === 6) {
1653
- matchResult_1 = 0;
1654
- other = _arg.fields[0].fields[0];
1655
- }
1656
- else {
1657
- matchResult_1 = 2;
1658
- }
1659
- break;
1660
- }
1661
- case 2: {
1662
- matchResult_1 = 1;
1663
- other_1 = _arg.fields[0];
1664
- break;
1665
- }
1666
- default:
1667
- matchResult_1 = 2;
1668
- }
1669
- switch (matchResult_1) {
1670
- case 0:
1671
- return other.Name === specifier;
1672
- case 1:
1673
- return other_1.Name === specifier;
1674
- default:
1675
- return false;
1676
- }
1677
- }, exports))) {
1678
- matchResult = 0;
1679
- specifier_1 = matchValue_1.fields[0];
1680
- }
1681
- else {
1535
+ function TransformMembers_hasComputedName(glueMember) {
1536
+ let matchResult, name;
1537
+ switch (glueMember.tag) {
1538
+ case 4:
1539
+ case 7:
1540
+ case 5: {
1682
1541
  matchResult = 1;
1542
+ break;
1683
1543
  }
1684
- }
1685
- else {
1686
- matchResult = 1;
1687
- }
1688
- switch (matchResult) {
1689
1544
  case 0: {
1690
- runtimeName = specifier_1;
1545
+ matchResult = 0;
1546
+ name = glueMember.fields[0].Name;
1691
1547
  break;
1692
1548
  }
1693
- default:
1694
- runtimeName = undefined;
1695
- }
1696
- return exportMembers(toList(delay(() => append_1(singleton_1(new FSharpMember(/* Method */ 0, [method])), delay(() => {
1697
- const matchValue_2 = runtimeName;
1698
- if (matchValue_2 == null) {
1699
- return empty_1();
1549
+ case 6: {
1550
+ matchResult = 0;
1551
+ name = glueMember.fields[0].Name;
1552
+ break;
1700
1553
  }
1701
- else {
1702
- return singleton_1(new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(method.Attributes, matchValue_2, method.OriginalName, method.TypeParameters, method.Parameters, method.Type, method.IsOptional, method.IsStatic, method.Accessor, method.Accessibility, method.XmlDoc, method.Body)]));
1554
+ case 2: {
1555
+ matchResult = 0;
1556
+ name = glueMember.fields[0].Name;
1557
+ break;
1703
1558
  }
1704
- })))), ofList(toList(delay(() => append_1(singleton_1(name), delay(() => ofArray(toArray(runtimeName)))))), {
1705
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1706
- }));
1559
+ case 3: {
1560
+ matchResult = 0;
1561
+ name = glueMember.fields[0].Name;
1562
+ break;
1563
+ }
1564
+ default: {
1565
+ matchResult = 0;
1566
+ name = glueMember.fields[0].Name;
1567
+ }
1568
+ }
1569
+ switch (matchResult) {
1570
+ case 0:
1571
+ if (name.startsWith("[")) {
1572
+ return TransformMembers_disposalMemberName(name) == null;
1573
+ }
1574
+ else {
1575
+ return false;
1576
+ }
1577
+ default:
1578
+ return false;
1579
+ }
1707
1580
  }
1708
1581
 
1709
- function exportClass(scope, isDefaultExport, info) {
1710
- const patternInput = sanitizeNameAndPushScope(info.Name, scope.Context);
1711
- const name = patternInput[0];
1712
- const context = patternInput[1];
1713
- return exportMembers(map((constructorInfo_1) => {
1714
- const xmlDocInfo = transformComment(constructorInfo_1.Documentation);
1715
- const typParameters = transformTypeParameters(context, info.TypeParameters);
1716
- return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(toList(delay(() => append_1(scope.IsTopLevel ? append_1(isDefaultExport ? importDefaultAttribute(info.Name, TransformContext__get_ImportSource(context)) : importAttribute(info.Name, TransformContext__get_ImportSource(context)), delay(() => singleton_1(FSharpAttribute.EmitConstructor))) : singleton_1(new FSharpAttribute(/* EmitMacroConstructor */ 17, [info.Name])), delay(() => xmlDocInfo.ObsoleteAttributes)))), name, info.Name, typParameters.TypeParameters, requiredBeforeParamArray(map((arg) => TypeParameter_mapFsharpParameter(typParameters.SealedTypes, transformParameter(context, arg)), constructorInfo_1.Parameters)), new FSharpType(/* Mapped */ 7, [new FSharpMapped(sanitizeTypeName(info.Name), typParameters.TypeParameters)]), false, scope.IsTopLevel, undefined, FSharpAccessibility.Public, xmlDocInfo.XmlDoc, FSharpMemberInfoBody.NativeOnly)]);
1717
- }, isEmpty(info.Constructors) ? singleton(new GlueConstructor(empty(), empty())) : collect((constructorInfo) => map((parameters) => (new GlueConstructor(constructorInfo.Documentation, parameters)), expandParameters(TransformContext__get_State(context).MaxOverloads, TransformContext__get_TypeMemory(context), constructorInfo.Parameters)), info.Constructors)), singleton_2(name, {
1718
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1719
- }));
1582
+ function TransformMembers_withoutComputedNames(members) {
1583
+ return filter((arg) => !TransformMembers_hasComputedName(arg), members);
1720
1584
  }
1721
1585
 
1722
- function exportModule(scope, seenNames, moduleDeclaration) {
1723
- let bind$0040, typ_2;
1724
- const context = scope.Context;
1725
- const patternInput = moduleNames(seenNames, moduleDeclaration);
1726
- const mangledName = patternInput[2];
1727
- const exportTypeName = moduleDeclaration.IsTopLevel ? concat(patternInput[1], ".Exports") : concat(patternInput[0], ".Exports");
1728
- const isAmbientModule = moduleDeclaration.Name.startsWith("\"") ? true : moduleDeclaration.Name.startsWith("\'");
1729
- const exportEqualsType = tryPick((_arg) => {
1730
- let matchResult, name_1, typ_1;
1731
- if (_arg.tag === 25) {
1732
- if (_arg.fields[0].tag === 2) {
1733
- if (_arg.fields[0].fields[0].Name.startsWith("export=")) {
1734
- matchResult = 0;
1735
- name_1 = _arg.fields[0].fields[0].Name;
1736
- typ_1 = _arg.fields[0].fields[0].Type;
1737
- }
1738
- else {
1739
- matchResult = 1;
1740
- }
1741
- }
1742
- else {
1586
+ function TransformMembers_withoutStaticMembers(members) {
1587
+ return filter((_arg) => {
1588
+ let matchResult, isStatic;
1589
+ switch (_arg.tag) {
1590
+ case 4:
1591
+ case 7:
1592
+ case 5:
1593
+ case 6: {
1743
1594
  matchResult = 1;
1595
+ break;
1744
1596
  }
1745
- }
1746
- else {
1747
- matchResult = 1;
1748
- }
1749
- switch (matchResult) {
1750
- case 0:
1751
- return typ_1;
1752
- default:
1753
- return undefined;
1754
- }
1755
- }, moduleDeclaration.Types);
1756
- const xmlDocInfo = transformComment(moduleDeclaration.Documentation);
1757
- const namespaceValues = (scope.IsTopLevel && (FSharpSet__Contains(scope.ExportEqualsNames, moduleDeclaration.Name) ? true : FSharpSet__Contains(scope.DefaultExportedDeclarations, moduleDeclaration.Name))) ? choose((_arg_1) => {
1758
- let info, info_1;
1759
- let matchResult_1, info_2, info_3;
1760
- switch (_arg_1.tag) {
1761
- case 6: {
1762
- if ((info = _arg_1.fields[0], !FSharpSet__Contains(scope.DeclaredValueNames, info.Name) && !FSharpSet__Contains(seenNames, info.Name))) {
1763
- matchResult_1 = 0;
1764
- info_2 = _arg_1.fields[0];
1765
- }
1766
- else {
1767
- matchResult_1 = 2;
1768
- }
1597
+ case 1: {
1598
+ matchResult = 0;
1599
+ isStatic = _arg.fields[0].IsStatic;
1769
1600
  break;
1770
1601
  }
1771
1602
  case 2: {
1772
- if ((info_1 = _arg_1.fields[0], !FSharpSet__Contains(scope.DeclaredValueNames, info_1.Name) && !FSharpSet__Contains(seenNames, info_1.Name))) {
1773
- matchResult_1 = 1;
1774
- info_3 = _arg_1.fields[0];
1775
- }
1776
- else {
1777
- matchResult_1 = 2;
1778
- }
1603
+ matchResult = 0;
1604
+ isStatic = _arg.fields[0].IsStatic;
1779
1605
  break;
1780
1606
  }
1781
- default:
1782
- matchResult_1 = 2;
1783
- }
1784
- switch (matchResult_1) {
1785
- case 0: {
1786
- scope.ExportEqualsMembers.set(info_2.Name, moduleDeclaration.Name);
1787
- return new GlueType(/* FunctionDeclaration */ 6, [info_2]);
1788
- }
1789
- case 1: {
1790
- scope.ExportEqualsMembers.set(info_3.Name, moduleDeclaration.Name);
1791
- return new GlueType(/* Variable */ 2, [info_3]);
1792
- }
1793
- default:
1794
- return undefined;
1795
- }
1796
- }, moduleDeclaration.Types) : empty();
1797
- return new ExportMembers(singleton(new FSharpMember(/* Property */ 1, [(bind$0040 = exportProperty(scope), new FSharpMemberInfo(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => (isAmbientModule ? singleton_1(new FSharpAttribute(/* ImportAll */ 4, [removeSurroundingQuotes(moduleDeclaration.Name)])) : (scope.IsTopLevel ? importAllAttribute(removeSurroundingQuotes(moduleDeclaration.Name), TransformContext__get_ImportSource(context)) : singleton_1(new FSharpAttribute(/* EmitMacroProperty */ 19, [removeSurroundingQuotes(moduleDeclaration.Name)])))))))), mangledName, concat(moduleDeclaration.Name, ".Exports"), bind$0040.TypeParameters, bind$0040.Parameters, (exportEqualsType == null) ? (new FSharpType(/* Mapped */ 7, [new FSharpMapped(exportTypeName, empty())])) : ((typ_2 = exportEqualsType, transformType(TransformContext__PushScope_27AED5E3(context, mangledName), typ_2))), bind$0040.IsOptional, scope.IsTopLevel ? true : isAmbientModule, FSharpAccessor.ReadOnly, bind$0040.Accessibility, xmlDocInfo.XmlDoc, bind$0040.Body))])), singleton_2(mangledName, {
1798
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1799
- }), namespaceValues);
1800
- }
1801
-
1802
- function exportEqualsVariable(scope, name, typ) {
1803
- const patternInput = sanitizeMemberNameAndPushScope(true, substring(name, "export=".length), scope.Context);
1804
- const name_1 = patternInput[0];
1805
- const context = patternInput[1];
1806
- let property;
1807
- const bind$0040 = exportProperty(scope);
1808
- property = (new FSharpMemberInfo(importDefaultAttribute(name_1, TransformContext__get_ImportSource(context)), name_1, name_1, bind$0040.TypeParameters, bind$0040.Parameters, transformType(context, typ), bind$0040.IsOptional, true, bind$0040.Accessor, bind$0040.Accessibility, bind$0040.XmlDoc, bind$0040.Body));
1809
- const withoutThis = (memberType) => {
1810
- if (memberType.tag === 17) {
1811
- return typ;
1812
- }
1813
- else {
1814
- return memberType;
1815
- }
1816
- };
1817
- const objectMembers = (typ.tag === 13) ? defaultArg(tryPick((_arg) => {
1818
- let matchResult, info_1;
1819
- if (_arg.tag === 1) {
1820
- if (_arg.fields[0].FullName === typ.fields[0].FullName) {
1821
- matchResult = 0;
1822
- info_1 = _arg.fields[0];
1823
- }
1824
- else {
1825
- matchResult = 1;
1826
- }
1827
- }
1828
- else {
1829
- matchResult = 1;
1830
- }
1831
- switch (matchResult) {
1832
- case 0:
1833
- return info_1.Members;
1834
- default:
1835
- return undefined;
1836
- }
1837
- }, TransformContext__get_TypeMemory(context)), empty()) : ((typ.tag === 22) ? typ.fields[0].Members : empty());
1838
- const memberExports = filter((glueType) => (GlueType__get_Name(glueType) !== name_1), choose((_arg_1) => {
1839
- let matchResult_1, info_5, info_6, info_7;
1840
- switch (_arg_1.tag) {
1841
- case 1: {
1842
- if (!_arg_1.fields[0].IsStatic) {
1843
- matchResult_1 = 0;
1844
- info_5 = _arg_1.fields[0];
1845
- }
1846
- else {
1847
- matchResult_1 = 3;
1848
- }
1849
- break;
1850
- }
1851
- case 6: {
1852
- matchResult_1 = 1;
1853
- info_6 = _arg_1.fields[0];
1854
- break;
1855
- }
1856
- case 0: {
1857
- if (!_arg_1.fields[0].IsStatic) {
1858
- matchResult_1 = 2;
1859
- info_7 = _arg_1.fields[0];
1860
- }
1861
- else {
1862
- matchResult_1 = 3;
1863
- }
1864
- break;
1865
- }
1866
- default:
1867
- matchResult_1 = 3;
1868
- }
1869
- switch (matchResult_1) {
1870
- case 0:
1871
- return new GlueType(/* Variable */ 2, [new GlueVariable(info_5.Documentation, info_5.Name, info_5.Type)]);
1872
- case 1:
1873
- return new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(info_6.Documentation, true, info_6.Name, withoutThis(info_6.Type), info_6.Parameters, empty())]);
1874
- case 2:
1875
- return new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(info_7.Documentation, true, info_7.Name, withoutThis(info_7.Type), info_7.Parameters, empty())]);
1876
- default:
1877
- return undefined;
1878
- }
1879
- }, objectMembers));
1880
- const calls = collect((_arg_2) => {
1881
- if (_arg_2.tag === 4) {
1882
- const info_8 = _arg_2.fields[0];
1883
- return map((parameters) => (new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(empty(), true, name_1, withoutThis(info_8.Type), parameters, info_8.TypeParameters)])), expandParameters(TransformContext__get_State(context).MaxOverloads, TransformContext__get_TypeMemory(context), info_8.Parameters));
1884
- }
1885
- else {
1886
- return empty();
1887
- }
1888
- }, objectMembers);
1889
- const enumerator = getEnumerator(memberExports);
1890
- try {
1891
- while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
1892
- const memberExport = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
1893
- scope.ExportEqualsMembers.set(GlueType__get_Name(memberExport), name_1);
1894
- }
1895
- }
1896
- finally {
1897
- disposeSafe(enumerator);
1898
- }
1899
- if (!isEmpty(calls)) {
1900
- scope.ExportEqualsMembers.set(name_1, name_1);
1901
- addToSet(name_1, scope.ExportEqualsCalls);
1902
- }
1903
- return new ExportMembers(isEmpty(calls) ? singleton(new FSharpMember(/* Property */ 1, [property])) : empty(), singleton_2(name_1, {
1904
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1905
- }), append(calls, memberExports));
1906
- }
1907
-
1908
- function exportDefaultModule(scope, seenNames, moduleDeclaration) {
1909
- let bind$0040;
1910
- const patternInput = moduleNames(seenNames, moduleDeclaration);
1911
- const name = patternInput[2];
1912
- const xmlDocInfo = transformComment(moduleDeclaration.Documentation);
1913
- return exportMembers(singleton(new FSharpMember(/* Property */ 1, [(bind$0040 = exportProperty(scope), new FSharpMemberInfo(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => importDefaultAttribute(moduleDeclaration.Name, TransformContext__get_ImportSource(scope.Context)))))), name, concat(moduleDeclaration.Name, ".Exports"), bind$0040.TypeParameters, bind$0040.Parameters, new FSharpType(/* Mapped */ 7, [new FSharpMapped(concat(patternInput[1], ".Exports"), empty())]), bind$0040.IsOptional, true, FSharpAccessor.ReadOnly, bind$0040.Accessibility, xmlDocInfo.XmlDoc, bind$0040.Body))])), singleton_2(name, {
1914
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1915
- }));
1916
- }
1917
-
1918
- function exportDefault(scope, seenNames, glueType) {
1919
- let bind$0040;
1920
- const patternInput = sanitizeMemberNameAndPushScope(true, GlueType__get_Name(glueType), scope.Context);
1921
- const name = patternInput[0];
1922
- const context = patternInput[1];
1923
- const name_1 = FSharpSet__Contains(seenNames, name) ? concat(name, "_") : name;
1924
- const context_1 = (glueType.tag === 2) ? TransformContext__PushScope_27AED5E3(context, "Type") : context;
1925
- return exportMembers(singleton(new FSharpMember(/* Property */ 1, [(bind$0040 = exportProperty(scope), new FSharpMemberInfo(importDefaultAttribute(GlueType__get_Name(glueType), TransformContext__get_ImportSource(context_1)), name_1, GlueType__get_Name(glueType), bind$0040.TypeParameters, bind$0040.Parameters, transformType(context_1, glueType), bind$0040.IsOptional, true, bind$0040.Accessor, bind$0040.Accessibility, bind$0040.XmlDoc, bind$0040.Body))])), singleton_2(name_1, {
1926
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1927
- }));
1928
- }
1929
-
1930
- function transformExports(context, isTopLevel, exports) {
1931
- let members_2;
1932
- const context_1 = TransformContext__PushScope_27AED5E3(context, "Exports");
1933
- const exportEqualsNames = ofSeq(choose((_arg) => {
1934
- let matchResult, name_1;
1935
- if (_arg.tag === 25) {
1936
- if (_arg.fields[0].tag === 2) {
1937
- if (_arg.fields[0].fields[0].Name.startsWith("export=")) {
1938
- matchResult = 0;
1939
- name_1 = _arg.fields[0].fields[0].Name;
1940
- }
1941
- else {
1942
- matchResult = 1;
1943
- }
1944
- }
1945
- else {
1946
- matchResult = 1;
1947
- }
1948
- }
1949
- else {
1950
- matchResult = 1;
1951
- }
1952
- switch (matchResult) {
1953
- case 0:
1954
- return substring(name_1, "export=".length);
1955
- default:
1956
- return undefined;
1957
- }
1958
- }, exports), {
1959
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
1960
- });
1961
- const sortedExports = sortBy((_arg_3) => {
1962
- if (_arg_3.tag === 11) {
1963
- return 1;
1964
- }
1965
- else {
1966
- return 0;
1967
- }
1968
- }, collect((_arg_2) => {
1969
- let info_2;
1970
- let matchResult_1, info_1, glueType;
1971
- switch (_arg_2.tag) {
1972
- case 6: {
1973
- matchResult_1 = 0;
1974
- info_1 = _arg_2.fields[0];
1975
- break;
1976
- }
1977
- case 25: {
1978
- if (_arg_2.fields[0].tag === 6) {
1979
- matchResult_1 = 0;
1980
- info_1 = _arg_2.fields[0].fields[0];
1981
- }
1982
- else {
1983
- matchResult_1 = 1;
1984
- glueType = _arg_2;
1985
- }
1986
- break;
1987
- }
1988
- default: {
1989
- matchResult_1 = 1;
1990
- glueType = _arg_2;
1991
- }
1992
- }
1993
- switch (matchResult_1) {
1994
- case 0:
1995
- return collect((info_4) => map((Item) => (new GlueType(/* FunctionDeclaration */ 6, [Item])), collect(TransformMembers_withDictionaryParameterOverloadsOfFunction, map((parameters) => (new GlueFunctionDeclaration(info_4.Documentation, info_4.IsDeclared, info_4.Name, info_4.Type, parameters, info_4.TypeParameters)), expandParameters(TransformContext__get_State(context_1).MaxOverloads, TransformContext__get_TypeMemory(context_1), info_4.Parameters)))), collect(TransformMembers_withDefaultedTypeParameterOverloadsOfFunction, (info_2 = expandFunction(TransformContext__get_State(context_1).KeyOfMaps, info_1), resolveFunction(TransformContext__get_State(context_1).Conditionals, info_2))));
1996
- default:
1997
- return singleton(glueType);
1998
- }
1999
- }, filter((_arg_1) => {
2000
- if (_arg_1.tag === 2) {
2001
- return !FSharpSet__Contains(exportEqualsNames, _arg_1.fields[0].Name);
2002
- }
2003
- else {
2004
- return true;
2005
- }
2006
- }, exports)), {
2007
- Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
2008
- });
2009
- const scope = new ExportScope(context_1, isTopLevel, ofSeq(choose((_arg_4) => {
2010
- let name_2;
2011
- let matchResult_2, info_8, name_3;
2012
- if (_arg_4.tag === 25) {
2013
- switch (_arg_4.fields[0].tag) {
2014
- case 6: {
2015
- matchResult_2 = 0;
2016
- info_8 = _arg_4.fields[0].fields[0];
2017
- break;
2018
- }
2019
- case 2: {
2020
- if ((name_2 = _arg_4.fields[0].fields[0].Name, exists((_arg_5) => {
2021
- switch (_arg_5.tag) {
2022
- case 12:
2023
- return _arg_5.fields[0].Name === name_2;
2024
- case 6:
2025
- return _arg_5.fields[0].Name === name_2;
2026
- default:
2027
- return false;
2028
- }
2029
- }, sortedExports))) {
2030
- matchResult_2 = 1;
2031
- name_3 = _arg_4.fields[0].fields[0].Name;
2032
- }
2033
- else {
2034
- matchResult_2 = 2;
2035
- }
2036
- break;
2037
- }
2038
- default:
2039
- matchResult_2 = 2;
2040
- }
2041
- }
2042
- else {
2043
- matchResult_2 = 2;
2044
- }
2045
- switch (matchResult_2) {
2046
- case 0:
2047
- return info_8.Name;
2048
- case 1:
2049
- return name_3;
2050
- default:
2051
- return undefined;
2052
- }
2053
- }, exports), {
2054
- Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
2055
- }), exportEqualsNames, ofSeq(choose((_arg_6) => {
2056
- let matchResult_3, info_9, info_10, info_11;
2057
- switch (_arg_6.tag) {
2058
- case 6: {
2059
- matchResult_3 = 0;
2060
- info_9 = _arg_6.fields[0];
2061
- break;
2062
- }
2063
- case 25: {
2064
- switch (_arg_6.fields[0].tag) {
2065
- case 6: {
2066
- matchResult_3 = 0;
2067
- info_9 = _arg_6.fields[0].fields[0];
2068
- break;
2069
- }
2070
- case 12: {
2071
- matchResult_3 = 2;
2072
- info_11 = _arg_6.fields[0].fields[0];
2073
- break;
2074
- }
2075
- default:
2076
- matchResult_3 = 3;
2077
- }
2078
- break;
2079
- }
2080
- case 2: {
2081
- matchResult_3 = 1;
2082
- info_10 = _arg_6.fields[0];
2083
- break;
2084
- }
2085
- case 12: {
2086
- matchResult_3 = 2;
2087
- info_11 = _arg_6.fields[0];
2088
- break;
2089
- }
2090
- default:
2091
- matchResult_3 = 3;
2092
- }
2093
- switch (matchResult_3) {
2094
- case 0:
2095
- return info_9.Name;
2096
- case 1:
2097
- return info_10.Name;
2098
- case 2:
2099
- return info_11.Name;
2100
- default:
2101
- return undefined;
2102
- }
2103
- }, exports), {
2104
- Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
2105
- }), new Map([]), new Set([]));
2106
- const apply_1 = (acc_mut, seenNames_mut, glueTypes_mut) => {
2107
- apply_1:
2108
- while (true) {
2109
- const acc = acc_mut, seenNames = seenNames_mut, glueTypes = glueTypes_mut;
2110
- let info_12;
2111
- let matchResult_4, name_5, tail_1, head, tail_2;
2112
- if (!isEmpty(glueTypes)) {
2113
- if (head_1(glueTypes).tag === 25) {
2114
- if (head_1(glueTypes).fields[0].tag === 2) {
2115
- if (FSharpSet__Contains(scope.DefaultExportedDeclarations, head_1(glueTypes).fields[0].fields[0].Name)) {
2116
- matchResult_4 = 1;
2117
- name_5 = head_1(glueTypes).fields[0].fields[0].Name;
2118
- tail_1 = tail_3(glueTypes);
2119
- }
2120
- else {
2121
- matchResult_4 = 2;
2122
- head = head_1(glueTypes);
2123
- tail_2 = tail_3(glueTypes);
2124
- }
2125
- }
2126
- else {
2127
- matchResult_4 = 2;
2128
- head = head_1(glueTypes);
2129
- tail_2 = tail_3(glueTypes);
2130
- }
2131
- }
2132
- else {
2133
- matchResult_4 = 2;
2134
- head = head_1(glueTypes);
2135
- tail_2 = tail_3(glueTypes);
2136
- }
2137
- }
2138
- else {
2139
- matchResult_4 = 0;
2140
- }
2141
- switch (matchResult_4) {
2142
- case 0:
2143
- return acc;
2144
- case 1: {
2145
- acc_mut = acc;
2146
- seenNames_mut = seenNames;
2147
- glueTypes_mut = tail_1;
2148
- continue apply_1;
2149
- }
2150
- default: {
2151
- const added = (head.tag === 2) ? exportVariable(scope, head.fields[0]) : ((head.tag === 6) ? exportFunction(scope, seenNames, glueTypes, head.fields[0]) : ((head.tag === 12) ? (((info_12 = head.fields[0], !info_12.IsExported && !FSharpSet__Contains(scope.DefaultExportedDeclarations, info_12.Name))) ? exportMembers(empty(), empty_2({
2152
- Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
2153
- })) : exportClass(scope, FSharpSet__Contains(scope.DefaultExportedDeclarations, head.fields[0].Name), head.fields[0])) : ((head.tag === 25) ? ((head.fields[0].tag === 12) ? exportClass(scope, true, head.fields[0].fields[0]) : ((head.fields[0].tag === 2) ? (head.fields[0].fields[0].Name.startsWith("export=") ? (isTopLevel ? exportEqualsVariable(scope, head.fields[0].fields[0].Name, head.fields[0].fields[0].Type) : exportMembers(empty(), empty_2({
2154
- Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
2155
- }))) : exportDefault(scope, seenNames, head.fields[0])) : ((head.fields[0].tag === 11) ? exportDefaultModule(scope, seenNames, head.fields[0].fields[0]) : exportDefault(scope, seenNames, head.fields[0])))) : ((head.tag === 11) ? exportModule(scope, seenNames, head.fields[0]) : toFail(printf("Could not generate exportMembers for: %A"))(head)))));
2156
- acc_mut = append(acc, added.Members);
2157
- seenNames_mut = union(seenNames, added.Names);
2158
- glueTypes_mut = append(added.Prepended, tail_2);
2159
- continue apply_1;
2160
- }
2161
- }
2162
- break;
2163
- }
2164
- };
2165
- return new FSharpType(/* Interface */ 5, [new FSharpInterface(ofArray([FSharpAttribute.AbstractClass, FSharpAttribute.Erase]), "Exports", empty(), "Exports", empty(), (members_2 = withoutFreeTypeParameters(apply_1(empty(), empty_2({
2166
- Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
2167
- }), sortedExports)), distinctBySignature(Aliases_get_Empty(), members_2)), empty())]);
2168
- }
2169
-
2170
- function transformParameter(context, parameter) {
2171
- const patternInput = sanitizeNameAndPushScope(parameter.Name, context);
2172
- const asArray = (glueType) => {
2173
- let matchResult, elementType, elementType_1, cases, glueType_1, glueType_2;
2174
- switch (glueType.tag) {
2175
- case 30: {
2176
- if (glueType.fields[0].tag === 14) {
2177
- matchResult = 0;
2178
- elementType = glueType.fields[0].fields[0];
2179
- }
2180
- else {
2181
- matchResult = 4;
2182
- glueType_2 = glueType;
2183
- }
2184
- break;
2185
- }
2186
- case 13: {
2187
- if (glueType.fields[0].Name === "ReadonlyArray") {
2188
- if (!isEmpty(glueType.fields[0].TypeArguments)) {
2189
- if (isEmpty(tail_3(glueType.fields[0].TypeArguments))) {
2190
- if (glueType.fields[0].IsStandardLibrary) {
2191
- matchResult = 1;
2192
- elementType_1 = head_1(glueType.fields[0].TypeArguments);
2193
- }
2194
- else {
2195
- matchResult = 4;
2196
- glueType_2 = glueType;
2197
- }
2198
- }
2199
- else {
2200
- matchResult = 4;
2201
- glueType_2 = glueType;
2202
- }
2203
- }
2204
- else {
2205
- matchResult = 4;
2206
- glueType_2 = glueType;
2207
- }
2208
- }
2209
- else {
2210
- matchResult = 4;
2211
- glueType_2 = glueType;
2212
- }
2213
- break;
2214
- }
2215
- case 7: {
2216
- matchResult = 2;
2217
- cases = glueType.fields[0].fields[0];
2218
- break;
2219
- }
2220
- case 23: {
2221
- matchResult = 3;
2222
- glueType_1 = glueType.fields[0];
2223
- break;
2224
- }
2225
- default: {
2226
- matchResult = 4;
2227
- glueType_2 = glueType;
2228
- }
2229
- }
2230
- switch (matchResult) {
2231
- case 0:
2232
- return new GlueType(/* Array */ 14, [elementType]);
2233
- case 1:
2234
- return new GlueType(/* Array */ 14, [elementType_1]);
2235
- case 2:
2236
- return new GlueType(/* Union */ 7, [new GlueTypeUnion(map(asArray, cases))]);
2237
- case 3:
2238
- return new GlueType(/* OptionalType */ 23, [asArray(glueType_1)]);
2239
- default:
2240
- return glueType_2;
2241
- }
2242
- };
2243
- const parameter_1 = new GlueParameter(parameter.Name, parameter.IsOptional, parameter.IsSpread, asArray(parameter.Type));
2244
- let typ;
2245
- const computedType = unwrapOptionIfAlreadyOptional(patternInput[1], parameter_1.Type, parameter_1.IsOptional);
2246
- typ = (parameter_1.IsSpread ? ((computedType.tag === 14) ? computedType.fields[0] : ((computedType.tag === 11) ? ((computedType.fields[0].Name === "ResizeArray") ? (!isEmpty(computedType.fields[0].TypeArguments) ? (isEmpty(tail_3(computedType.fields[0].TypeArguments)) ? head_1(computedType.fields[0].TypeArguments) : computedType) : computedType) : computedType) : computedType)) : computedType);
2247
- return new FSharpParameter(toList(delay(() => (parameter_1.IsSpread ? singleton_1(FSharpAttribute.ParamArray) : empty_1()))), patternInput[0], parameter_1.IsOptional, typ, undefined);
2248
- }
2249
-
2250
- function transformAccessor(accessor) {
2251
- switch (accessor.tag) {
2252
- case 1:
2253
- return FSharpAccessor.WriteOnly;
2254
- case 2:
2255
- return FSharpAccessor.ReadWrite;
2256
- default:
2257
- return FSharpAccessor.ReadOnly;
2258
- }
2259
- }
2260
-
2261
- function methodGlueFunctionType(documentation, typeParameters, parameters, returnType) {
2262
- return new GlueType(/* FunctionType */ 15, [new GlueFunctionType(documentation, returnType, typeParameters, map((_arg) => _arg.Name, typeParameters), parameters)]);
2263
- }
2264
-
2265
- function methodFunctionType(context, documentation, typeParameters, parameters, returnType) {
2266
- return transformType(context, methodGlueFunctionType(documentation, typeParameters, parameters, returnType));
2267
- }
2268
-
2269
- function TransformMembers_withoutReferenceConstraints(typeParameters) {
2270
- return map((typeParameter) => {
2271
- const matchValue = typeParameter.Constraint;
2272
- let matchResult;
2273
- if (matchValue == null) {
2274
- matchResult = 0;
2275
- }
2276
- else if (matchValue.tag === 9) {
2277
- matchResult = 0;
2278
- }
2279
- else {
2280
- matchResult = 1;
2281
- }
2282
- switch (matchResult) {
2283
- case 0:
2284
- return typeParameter;
2285
- default:
2286
- return new GlueTypeParameter(typeParameter.Name, undefined, typeParameter.Default);
2287
- }
2288
- }, typeParameters);
2289
- }
2290
-
2291
- function TransformMembers_disposalMemberName(name) {
2292
- switch (name) {
2293
- case "[Symbol.dispose]":
2294
- return "dispose";
2295
- case "[Symbol.asyncDispose]":
2296
- return "asyncDispose";
2297
- default:
2298
- return undefined;
2299
- }
2300
- }
2301
-
2302
- function TransformMembers_hasComputedName(glueMember) {
2303
- let matchResult, name;
2304
- switch (glueMember.tag) {
2305
- case 4:
2306
- case 7:
2307
- case 5: {
2308
- matchResult = 1;
2309
- break;
2310
- }
2311
- case 0: {
2312
- matchResult = 0;
2313
- name = glueMember.fields[0].Name;
2314
- break;
2315
- }
2316
- case 6: {
2317
- matchResult = 0;
2318
- name = glueMember.fields[0].Name;
2319
- break;
2320
- }
2321
- case 2: {
2322
- matchResult = 0;
2323
- name = glueMember.fields[0].Name;
2324
- break;
2325
- }
2326
- case 3: {
2327
- matchResult = 0;
2328
- name = glueMember.fields[0].Name;
2329
- break;
2330
- }
2331
- default: {
2332
- matchResult = 0;
2333
- name = glueMember.fields[0].Name;
2334
- }
2335
- }
2336
- switch (matchResult) {
2337
- case 0:
2338
- if (name.startsWith("[")) {
2339
- return TransformMembers_disposalMemberName(name) == null;
2340
- }
2341
- else {
2342
- return false;
2343
- }
2344
- default:
2345
- return false;
2346
- }
2347
- }
2348
-
2349
- function TransformMembers_withoutComputedNames(members) {
2350
- return filter((arg) => !TransformMembers_hasComputedName(arg), members);
2351
- }
2352
-
2353
- function TransformMembers_withoutStaticMembers(members) {
2354
- return filter((_arg) => {
2355
- let matchResult, isStatic;
2356
- switch (_arg.tag) {
2357
- case 4:
2358
- case 7:
2359
- case 5:
2360
- case 6: {
2361
- matchResult = 1;
2362
- break;
2363
- }
2364
- case 1: {
2365
- matchResult = 0;
2366
- isStatic = _arg.fields[0].IsStatic;
2367
- break;
2368
- }
2369
- case 2: {
2370
- matchResult = 0;
2371
- isStatic = _arg.fields[0].IsStatic;
2372
- break;
2373
- }
2374
- case 3: {
2375
- matchResult = 0;
2376
- isStatic = _arg.fields[0].IsStatic;
2377
- break;
1607
+ case 3: {
1608
+ matchResult = 0;
1609
+ isStatic = _arg.fields[0].IsStatic;
1610
+ break;
2378
1611
  }
2379
1612
  default: {
2380
1613
  matchResult = 0;
@@ -2465,11 +1698,11 @@ function TransformMembers_defaultsOf(parameters, typeParameters) {
2465
1698
  }, typeParameters), {
2466
1699
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
2467
1700
  });
2468
- if (forAll_1((typeParameter_1) => FSharpMap__ContainsKey(defaults, typeParameter_1.Name), typeParameters)) {
1701
+ if (forAll((typeParameter_1) => FSharpMap__ContainsKey(defaults, typeParameter_1.Name), typeParameters)) {
2469
1702
  return map_1((_arg, default__1) => GlueSubstitution_substitute(defaults, default__1), defaults);
2470
1703
  }
2471
1704
  else {
2472
- return empty_3({
1705
+ return empty_2({
2473
1706
  Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
2474
1707
  });
2475
1708
  }
@@ -2512,7 +1745,7 @@ function TransformMembers_isAnyDictionary(glueType) {
2512
1745
  }
2513
1746
  switch (matchResult) {
2514
1747
  case 0:
2515
- return forAll_1((_arg) => {
1748
+ return forAll((_arg) => {
2516
1749
  let matchResult_1;
2517
1750
  if (_arg.tag === 5) {
2518
1751
  switch (_arg.fields[0].Type.tag) {
@@ -2553,7 +1786,7 @@ function TransformMembers_tryDictionarySignature(typeParameters, parameters) {
2553
1786
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
2554
1787
  });
2555
1788
  const hasDictionary = exists((parameter_1) => TransformMembers_isAnyDictionary(parameter_1.Type), parameters);
2556
- const allTold = forAll_1((typeParameter) => FSharpSet__Contains(told, typeParameter.Name), typeParameters);
1789
+ const allTold = forAll((typeParameter) => FSharpSet__Contains(told, typeParameter.Name), typeParameters);
2557
1790
  if (hasDictionary && allTold) {
2558
1791
  const taken = new Set(map((_arg) => _arg.Name, typeParameters));
2559
1792
  const added = [];
@@ -2584,7 +1817,7 @@ function TransformMembers_tryDictionarySignature(typeParameters, parameters) {
2584
1817
  return parameter_3;
2585
1818
  }
2586
1819
  }, parameters);
2587
- return [append(typeParameters, ofSeq_1(added)), parameters_1];
1820
+ return [append(typeParameters, ofSeq(added)), parameters_1];
2588
1821
  }
2589
1822
  else {
2590
1823
  return undefined;
@@ -2674,7 +1907,7 @@ function TransformMembers_trySpecializeStringLiteralMethod(methodName, parameter
2674
1907
  return undefined;
2675
1908
  }
2676
1909
  else {
2677
- const remainingParameters = tail_3(parameters);
1910
+ const remainingParameters = tail_1(parameters);
2678
1911
  const matchValue = head_1(parameters).Type;
2679
1912
  let matchResult, literalValue;
2680
1913
  if (matchValue.tag === 8) {
@@ -2936,7 +2169,7 @@ function TransformMembers_methodMember(context, methodInfo) {
2936
2169
  }
2937
2170
  else {
2938
2171
  const typeParameters = transformTypeParameters(context_1, TransformMembers_withoutReferenceConstraints(methodInfo.TypeParameters));
2939
- return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => patternInput[2])))), name, methodInfo.Name, typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) => 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)]);
2172
+ return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => patternInput[2])))), name, methodInfo.Name, typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) => mapFsharpParameter(typeParameters.SealedTypes, transformParameter(context_1, arg)), parameters)), mapFSharpType(typeParameters.SealedTypes, transformType(context_1, methodInfo.Type)), methodInfo.IsOptional, methodInfo.IsStatic, undefined, FSharpAccessibility.Public, xmlDocInfo.XmlDoc, FSharpMemberInfoBody.NativeOnly)]);
2940
2173
  }
2941
2174
  }
2942
2175
 
@@ -2944,7 +2177,7 @@ function TransformMembers_callSignatureMember(context, info) {
2944
2177
  const patternInput = sanitizeNameAndPushScope("Invoke", context);
2945
2178
  const context_1 = patternInput[1];
2946
2179
  const typeParameters = transformTypeParameters(context_1, TransformMembers_withoutReferenceConstraints(info.TypeParameters));
2947
- return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(singleton(FSharpAttribute.EmitSelfInvoke), patternInput[0], "Invoke", typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) => 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)]);
2180
+ return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(singleton(FSharpAttribute.EmitSelfInvoke), patternInput[0], "Invoke", typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) => mapFsharpParameter(typeParameters.SealedTypes, transformParameter(context_1, arg)), info.Parameters)), mapFSharpType(typeParameters.SealedTypes, transformType(context_1, info.Type)), false, false, undefined, FSharpAccessibility.Public, empty(), FSharpMemberInfoBody.NativeOnly)]);
2948
2181
  }
2949
2182
 
2950
2183
  function TransformMembers_propertyMember(context, info) {
@@ -3006,7 +2239,7 @@ function TransformMembers_methodSignatureMember(context, info) {
3006
2239
  const patternInput_1 = sanitizeNameAndPushScope(patternInput[0], context);
3007
2240
  const context_1 = patternInput_1[1];
3008
2241
  const typeParameters = transformTypeParameters(context_1, TransformMembers_withoutReferenceConstraints(info.TypeParameters));
3009
- return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => patternInput[2])))), patternInput_1[0], info.Name, typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) => 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)]);
2242
+ return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => patternInput[2])))), patternInput_1[0], info.Name, typeParameters.TypeParameters, requiredBeforeParamArray(map((arg) => mapFsharpParameter(typeParameters.SealedTypes, transformParameter(context_1, arg)), patternInput[1])), mapFSharpType(typeParameters.SealedTypes, transformType(context_1, info.Type)), false, false, undefined, FSharpAccessibility.Public, xmlDocInfo.XmlDoc, FSharpMemberInfoBody.NativeOnly)]);
3010
2243
  }
3011
2244
 
3012
2245
  function TransformMembers_constructSignatureMember(context, info) {
@@ -3157,99 +2390,263 @@ function paramObjectParameters(context, members) {
3157
2390
  });
3158
2391
  }
3159
2392
 
3160
- function tryParameterCombinations(parameters) {
3161
- let signatures, aliases;
3162
- const variants = map((parameter_1) => {
3163
- let matchValue_1;
3164
- const matchValue = parameter_1.Type;
3165
- let matchResult, unionInfo_1;
3166
- if (matchValue.tag === 1) {
3167
- if (length(matchValue.fields[0].Cases) > 1) {
3168
- matchResult = 0;
3169
- unionInfo_1 = matchValue.fields[0];
2393
+ function tryErasedUnionCases(parameter) {
2394
+ const matchValue = parameter.Type;
2395
+ let matchResult, unionInfo_1;
2396
+ if (matchValue.tag === 1) {
2397
+ if (length(matchValue.fields[0].Cases) > 1) {
2398
+ matchResult = 0;
2399
+ unionInfo_1 = matchValue.fields[0];
2400
+ }
2401
+ else {
2402
+ matchResult = 1;
2403
+ }
2404
+ }
2405
+ else {
2406
+ matchResult = 1;
2407
+ }
2408
+ switch (matchResult) {
2409
+ case 0: {
2410
+ const cases = map((_arg) => {
2411
+ if (_arg.tag === 1) {
2412
+ return _arg.fields[0];
2413
+ }
2414
+ else {
2415
+ return undefined;
2416
+ }
2417
+ }, unionInfo_1.Cases);
2418
+ if (forAll((option) => (option != null), cases)) {
2419
+ return choose((x) => x, cases);
3170
2420
  }
3171
2421
  else {
2422
+ return undefined;
2423
+ }
2424
+ }
2425
+ default:
2426
+ return undefined;
2427
+ }
2428
+ }
2429
+
2430
+ function tryParameterCombinations(maxOverloads, parameters) {
2431
+ let signatures, aliases;
2432
+ const variants = map((parameter) => {
2433
+ const matchValue = tryErasedUnionCases(parameter);
2434
+ if (matchValue == null) {
2435
+ return singleton(parameter);
2436
+ }
2437
+ else {
2438
+ const cases = matchValue;
2439
+ return toList(delay(() => append_1(parameter.IsOptional ? singleton_1(undefined) : empty_1(), delay(() => map_2((case$) => (new FSharpParameter(parameter.Attributes, parameter.Name, false, case$, parameter.OriginalGlueMember)), cases)))));
2440
+ }
2441
+ }, parameters);
2442
+ const combinationsCount = fold((count, parameterVariants) => (min(count * length(parameterVariants), maxOverloads + 1) | 0), 1, variants) | 0;
2443
+ if ((combinationsCount === 1) ? true : (combinationsCount > maxOverloads)) {
2444
+ return undefined;
2445
+ }
2446
+ else {
2447
+ const combinations = map((arg) => sortBy((_arg) => _arg.IsOptional, choose((x) => x, arg), {
2448
+ Compare: (x_1, y) => (comparePrimitives(x_1, y) | 0),
2449
+ }), foldBack((parameterVariants_1, acc) => collect((variant) => map((tail) => cons(variant, tail), acc), parameterVariants_1), variants, singleton(empty())));
2450
+ if ((signatures = map((aliases = Aliases_get_Empty(), (parameters_1) => parametersSignature(aliases, parameters_1)), combinations), length(List_distinct(signatures, {
2451
+ Equals: equals,
2452
+ GetHashCode: (x_2) => (safeHash(x_2) | 0),
2453
+ })) !== length(signatures))) {
2454
+ return undefined;
2455
+ }
2456
+ else {
2457
+ return combinations;
2458
+ }
2459
+ }
2460
+ }
2461
+
2462
+ function paramObjectParameterSets(context, members) {
2463
+ let option_3;
2464
+ const parameters = paramObjectParameters(context, members);
2465
+ const expandable = map((parameter) => {
2466
+ let tupledArg;
2467
+ let aliasCases;
2468
+ const matchValue_1 = parameter.OriginalGlueMember;
2469
+ let matchResult, property;
2470
+ if (parameter.Type.tag === 1) {
2471
+ matchResult = 0;
2472
+ }
2473
+ else if (matchValue_1 != null) {
2474
+ if (matchValue_1.tag === 1) {
3172
2475
  matchResult = 1;
2476
+ property = matchValue_1.fields[0];
2477
+ }
2478
+ else {
2479
+ matchResult = 2;
3173
2480
  }
3174
2481
  }
3175
2482
  else {
3176
- matchResult = 1;
2483
+ matchResult = 2;
3177
2484
  }
3178
2485
  switch (matchResult) {
3179
2486
  case 0: {
3180
- const cases = map((_arg) => {
3181
- if (_arg.tag === 1) {
3182
- return _arg.fields[0];
2487
+ aliasCases = undefined;
2488
+ break;
2489
+ }
2490
+ case 1: {
2491
+ let propertyType;
2492
+ const matchValue_3 = property.Type;
2493
+ propertyType = ((matchValue_3.tag === 23) ? matchValue_3.fields[0] : matchValue_3);
2494
+ let matchResult_1, fullName_1;
2495
+ if (propertyType.tag === 13) {
2496
+ if (isEmpty(propertyType.fields[0].TypeArguments)) {
2497
+ if (!contains_1(propertyType.fields[0].FullName, TransformContext__get_State(context).UnionAliasesBeingExpanded, {
2498
+ Equals: (x, y) => (x === y),
2499
+ GetHashCode: (x) => (stringHash(x) | 0),
2500
+ })) {
2501
+ matchResult_1 = 0;
2502
+ fullName_1 = propertyType.fields[0].FullName;
2503
+ }
2504
+ else {
2505
+ matchResult_1 = 1;
2506
+ }
3183
2507
  }
3184
2508
  else {
3185
- return undefined;
2509
+ matchResult_1 = 1;
2510
+ }
2511
+ }
2512
+ else {
2513
+ matchResult_1 = 1;
2514
+ }
2515
+ switch (matchResult_1) {
2516
+ case 0: {
2517
+ const option_1 = tryCases(TransformContext__get_TypeMemory(context), propertyType);
2518
+ aliasCases = ((option_1 != null) ? ((tupledArg = option_1, [fullName_1, tupledArg[0], tupledArg[1]])) : undefined);
2519
+ break;
3186
2520
  }
3187
- }, unionInfo_1.Cases);
3188
- matchValue_1 = (forAll_1((option) => (option != null), cases) ? choose((x) => x, cases) : undefined);
2521
+ default:
2522
+ aliasCases = undefined;
2523
+ }
3189
2524
  break;
3190
2525
  }
3191
2526
  default:
3192
- matchValue_1 = undefined;
2527
+ aliasCases = undefined;
3193
2528
  }
3194
- if (matchValue_1 == null) {
3195
- return singleton(parameter_1);
2529
+ if (aliasCases == null) {
2530
+ return parameter;
3196
2531
  }
3197
2532
  else {
3198
- const cases_1 = matchValue_1;
3199
- return toList(delay(() => append_1(parameter_1.IsOptional ? singleton_1(undefined) : empty_1(), delay(() => map_2((case$) => (new FSharpParameter(parameter_1.Attributes, parameter_1.Name, false, case$, parameter_1.OriginalGlueMember)), cases_1)))));
2533
+ const nullable_1 = aliasCases[2];
2534
+ const fullName_2 = aliasCases[0];
2535
+ const cases_1 = aliasCases[1];
2536
+ const context_1 = sanitizeNameAndPushScope(parameter.Name, context)[1];
2537
+ void (TransformContext__get_State(context_1).UnionAliasesBeingExpanded.push(fullName_2));
2538
+ try {
2539
+ return new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional ? true : nullable_1, new FSharpType(/* Union */ 1, [new FSharpUnion(empty(), "", map((arg_1) => (new FSharpUnionCase(/* Typed */ 1, [transformType(context_1, arrayAsInput(arg_1))])), cases_1), false, empty(), empty())]), parameter.OriginalGlueMember);
2540
+ }
2541
+ finally {
2542
+ TransformContext__get_State(context_1).UnionAliasesBeingExpanded.splice(TransformContext__get_State(context_1).UnionAliasesBeingExpanded.length - 1, 1);
2543
+ }
3200
2544
  }
3201
2545
  }, parameters);
3202
- const combinationsCount = fold((count, parameterVariants) => (min(count * length(parameterVariants), 13) | 0), 1, variants) | 0;
3203
- if ((combinationsCount === 1) ? true : (combinationsCount > 12)) {
3204
- return undefined;
2546
+ const expandedNames = ofSeq_1(map((_arg) => _arg.Name, filter((parameter_1) => (tryErasedUnionCases(parameter_1) != null), expandable)), {
2547
+ Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
2548
+ });
2549
+ return defaultArg((option_3 = tryParameterCombinations(TransformContext__get_State(context).MaxOverloads, expandable), (option_3 != null) ? append(filter((list_4) => exists((parameter_2) => FSharpSet__Contains(expandedNames, parameter_2.Name), list_4), option_3), singleton(parameters)) : undefined), singleton(parameters));
2550
+ }
2551
+
2552
+ function paramObjectCreateMembers(context, returnType, members) {
2553
+ return map((parameters) => (new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(ofArray([FSharpAttribute.ParamObject, FSharpAttribute.EmitSelf]), "Create", "Create", empty(), requiredBeforeParamArray(parameters), returnType, false, true, undefined, FSharpAccessibility.Public, empty(), FSharpMemberInfoBody.NativeOnly)])), paramObjectParameterSets(context, members));
2554
+ }
2555
+
2556
+ function transformParamObjectClass(context, name, documentation, members) {
2557
+ const xmlDocInfo = transformComment(documentation);
2558
+ const typeParameterNames = List_distinct(collect(memberTypeParameterNames, members), {
2559
+ Equals: (x, y) => (x === y),
2560
+ GetHashCode: (x) => (stringHash(x) | 0),
2561
+ });
2562
+ const typeLiteralParameters = paramObjectParameters(context, members);
2563
+ const explicitFields = map((parameter) => {
2564
+ let matchValue, option_3, option_1;
2565
+ return new FSharpExplicitField(parameter.Name, (matchValue = parameter.OriginalGlueMember, (matchValue == null) ? empty() : transformComment(GlueMember__get_Documentation(matchValue)).XmlDoc), parameter.IsOptional ? (new FSharpType(/* Option */ 3, [parameter.Type])) : parameter.Type, (option_3 = ((option_1 = parameter.OriginalGlueMember, (option_1 != null) ? GlueMember__TryGetAccessor(option_1) : undefined)), (option_3 != null) ? transformAccessor(option_3) : undefined));
2566
+ }, typeLiteralParameters);
2567
+ let patternInput_1;
2568
+ const paramObjectConstructor = (parameters) => (new FSharpConstructor(parameters, ofArray([FSharpAttribute.ParamObject, FSharpAttribute.EmitSelf]), FSharpAccessibility.Public));
2569
+ const matchValue_1 = tryParameterCombinations(TransformContext__get_State(context).MaxOverloads, typeLiteralParameters);
2570
+ if (matchValue_1 != null) {
2571
+ const patternInput = partition(isEmpty, matchValue_1);
2572
+ patternInput_1 = [isEmpty(patternInput[0]) ? (new FSharpConstructor(empty(), empty(), FSharpAccessibility.Private)) : paramObjectConstructor(empty()), map(paramObjectConstructor, patternInput[1])];
3205
2573
  }
3206
2574
  else {
3207
- const combinations = map((arg) => sortBy((_arg_1) => _arg_1.IsOptional, choose((x_1) => x_1, arg), {
3208
- Compare: (x_2, y) => (comparePrimitives(x_2, y) | 0),
3209
- }), foldBack((parameterVariants_1, acc) => collect((variant) => map((tail) => cons(variant, tail), acc), parameterVariants_1), variants, singleton(empty())));
3210
- if ((signatures = map((aliases = Aliases_get_Empty(), (parameters_1) => parametersSignature(aliases, parameters_1)), combinations), length(List_distinct(signatures, {
3211
- Equals: equals,
3212
- GetHashCode: (x_3) => (safeHash(x_3) | 0),
3213
- })) !== length(signatures))) {
3214
- return undefined;
2575
+ patternInput_1 = [paramObjectConstructor(typeLiteralParameters), empty()];
2576
+ }
2577
+ return new FSharpClass(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => append_1(singleton_1(new FSharpAttribute(/* Global */ 21, [undefined])), delay(() => singleton_1(FSharpAttribute.AllowNullLiteral))))))), xmlDocInfo.XmlDoc, name, declaredTypeParameters_1(typeParameterNames), patternInput_1[0], patternInput_1[1], explicitFields);
2578
+ }
2579
+
2580
+ function arrayAsInput(glueType) {
2581
+ let matchResult, elementType, elementType_1, cases, glueType_2, glueType_3;
2582
+ switch (glueType.tag) {
2583
+ case 30: {
2584
+ if (glueType.fields[0].tag === 14) {
2585
+ matchResult = 0;
2586
+ elementType = glueType.fields[0].fields[0];
2587
+ }
2588
+ else {
2589
+ matchResult = 4;
2590
+ glueType_3 = glueType;
2591
+ }
2592
+ break;
2593
+ }
2594
+ case 13: {
2595
+ if (glueType.fields[0].Name === "ReadonlyArray") {
2596
+ if (!isEmpty(glueType.fields[0].TypeArguments)) {
2597
+ if (isEmpty(tail_1(glueType.fields[0].TypeArguments))) {
2598
+ if (glueType.fields[0].IsStandardLibrary) {
2599
+ matchResult = 1;
2600
+ elementType_1 = head_1(glueType.fields[0].TypeArguments);
2601
+ }
2602
+ else {
2603
+ matchResult = 4;
2604
+ glueType_3 = glueType;
2605
+ }
2606
+ }
2607
+ else {
2608
+ matchResult = 4;
2609
+ glueType_3 = glueType;
2610
+ }
2611
+ }
2612
+ else {
2613
+ matchResult = 4;
2614
+ glueType_3 = glueType;
2615
+ }
2616
+ }
2617
+ else {
2618
+ matchResult = 4;
2619
+ glueType_3 = glueType;
2620
+ }
2621
+ break;
2622
+ }
2623
+ case 7: {
2624
+ matchResult = 2;
2625
+ cases = glueType.fields[0].fields[0];
2626
+ break;
3215
2627
  }
3216
- else {
3217
- return combinations;
2628
+ case 23: {
2629
+ matchResult = 3;
2630
+ glueType_2 = glueType.fields[0];
2631
+ break;
2632
+ }
2633
+ default: {
2634
+ matchResult = 4;
2635
+ glueType_3 = glueType;
3218
2636
  }
3219
2637
  }
3220
- }
3221
-
3222
- function paramObjectParameterSets(context, members) {
3223
- const parameters = paramObjectParameters(context, members);
3224
- return defaultArg(tryParameterCombinations(parameters), singleton(parameters));
3225
- }
3226
-
3227
- function paramObjectCreateMembers(context, returnType, members) {
3228
- return map((parameters) => (new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(ofArray([FSharpAttribute.ParamObject, FSharpAttribute.EmitSelf]), "Create", "Create", empty(), requiredBeforeParamArray(parameters), returnType, false, true, undefined, FSharpAccessibility.Public, empty(), FSharpMemberInfoBody.NativeOnly)])), paramObjectParameterSets(context, members));
3229
- }
3230
-
3231
- function transformParamObjectClass(context, name, documentation, members) {
3232
- const xmlDocInfo = transformComment(documentation);
3233
- const typeParameterNames = List_distinct(collect(memberTypeParameterNames, members), {
3234
- Equals: (x, y) => (x === y),
3235
- GetHashCode: (x) => (stringHash(x) | 0),
3236
- });
3237
- const typeLiteralParameters = paramObjectParameters(context, members);
3238
- const explicitFields = map((parameter) => {
3239
- let matchValue, option_3, option_1;
3240
- return new FSharpExplicitField(parameter.Name, (matchValue = parameter.OriginalGlueMember, (matchValue == null) ? empty() : transformComment(GlueMember__get_Documentation(matchValue)).XmlDoc), parameter.IsOptional ? (new FSharpType(/* Option */ 3, [parameter.Type])) : parameter.Type, (option_3 = ((option_1 = parameter.OriginalGlueMember, (option_1 != null) ? GlueMember__TryGetAccessor(option_1) : undefined)), (option_3 != null) ? transformAccessor(option_3) : undefined));
3241
- }, typeLiteralParameters);
3242
- let patternInput_1;
3243
- const paramObjectConstructor = (parameters) => (new FSharpConstructor(parameters, ofArray([FSharpAttribute.ParamObject, FSharpAttribute.EmitSelf]), FSharpAccessibility.Public));
3244
- const matchValue_1 = tryParameterCombinations(typeLiteralParameters);
3245
- if (matchValue_1 != null) {
3246
- const patternInput = partition(isEmpty, matchValue_1);
3247
- patternInput_1 = [isEmpty(patternInput[0]) ? (new FSharpConstructor(empty(), empty(), FSharpAccessibility.Private)) : paramObjectConstructor(empty()), map(paramObjectConstructor, patternInput[1])];
3248
- }
3249
- else {
3250
- patternInput_1 = [paramObjectConstructor(typeLiteralParameters), empty()];
2638
+ switch (matchResult) {
2639
+ case 0:
2640
+ return new GlueType(/* Array */ 14, [elementType]);
2641
+ case 1:
2642
+ return new GlueType(/* Array */ 14, [elementType_1]);
2643
+ case 2:
2644
+ return new GlueType(/* Union */ 7, [new GlueTypeUnion(map(arrayAsInput, cases))]);
2645
+ case 3:
2646
+ return new GlueType(/* OptionalType */ 23, [arrayAsInput(glueType_2)]);
2647
+ default:
2648
+ return glueType_3;
3251
2649
  }
3252
- return new FSharpClass(toList(delay(() => append_1(xmlDocInfo.ObsoleteAttributes, delay(() => append_1(singleton_1(new FSharpAttribute(/* Global */ 21, [undefined])), delay(() => singleton_1(FSharpAttribute.AllowNullLiteral))))))), xmlDocInfo.XmlDoc, name, declaredTypeParameters_1(typeParameterNames), patternInput_1[0], patternInput_1[1], explicitFields);
3253
2650
  }
3254
2651
 
3255
2652
  function transformCallbackReturnType(context, returnType) {
@@ -3275,7 +2672,7 @@ function transformCallbackReturnType(context, returnType) {
3275
2672
  case 0:
3276
2673
  return new FSharpType(/* Primitive */ 8, [FSharpPrimitive.Unit]);
3277
2674
  default:
3278
- return transformType(context, returnType);
2675
+ return transformType(context, arrayAsInput(returnType));
3279
2676
  }
3280
2677
  }
3281
2678
 
@@ -3294,7 +2691,7 @@ function tryTransformCallableInterface(context, info) {
3294
2691
  if (isEmpty(matchValue)) {
3295
2692
  if (!isEmpty(matchValue_1)) {
3296
2693
  if (head_1(matchValue_1).tag === 13) {
3297
- if (isEmpty(tail_3(matchValue_1))) {
2694
+ if (isEmpty(tail_1(matchValue_1))) {
3298
2695
  if (tryCallableHeritage(TransformContext__get_TypeMemory(context), head_1(matchValue_1)) != null) {
3299
2696
  matchResult = 1;
3300
2697
  heritage_1 = head_1(matchValue_1);
@@ -3317,7 +2714,7 @@ function tryTransformCallableInterface(context, info) {
3317
2714
  }
3318
2715
  }
3319
2716
  else if (head_1(matchValue).tag === 4) {
3320
- if (isEmpty(tail_3(matchValue))) {
2717
+ if (isEmpty(tail_1(matchValue))) {
3321
2718
  if (isEmpty(matchValue_1)) {
3322
2719
  if (isDeclaredOnce) {
3323
2720
  matchResult = 0;
@@ -3726,35 +3123,7 @@ function transformRecord(context, name, typeParameters, recordInfo) {
3726
3123
  return new FSharpType(/* Interface */ 5, [new FSharpInterface(ofArray([FSharpAttribute.AllowNullLiteral, FSharpAttribute.Interface]), patternInput[0], empty(), "", transformDeclarationTypeParameters(context_1, typeParameters).TypeParameters, singleton(new FSharpMember(/* Property */ 1, [new FSharpMemberInfo(singleton(FSharpAttribute.EmitIndexer), "Item", "Item", empty(), parameters, transformType(context_1, recordInfo.ValueType), false, false, FSharpAccessor.ReadWrite, FSharpAccessibility.Public, empty(), FSharpMemberInfoBody.NativeOnly)])), empty())]);
3727
3124
  }
3728
3125
 
3729
- class TypeParameter_SealedTypeInfo extends Record {
3730
- constructor(TypeParameterName, FSharpType) {
3731
- super();
3732
- this.TypeParameterName = TypeParameterName;
3733
- this.FSharpType = FSharpType;
3734
- }
3735
- }
3736
-
3737
- function TypeParameter_SealedTypeInfo_$reflection() {
3738
- return record_type("Glutinum.Converter.Transform.TypeParameter.SealedTypeInfo", [], TypeParameter_SealedTypeInfo, () => [["TypeParameterName", string_type], ["FSharpType", FSharpType_$reflection()]]);
3739
- }
3740
-
3741
- class TypeParameter_TransformResult extends Record {
3742
- constructor(FSharpTypeParameter, SealedTypeOpt) {
3743
- super();
3744
- this.FSharpTypeParameter = FSharpTypeParameter;
3745
- this.SealedTypeOpt = SealedTypeOpt;
3746
- }
3747
- }
3748
-
3749
- function TypeParameter_TransformResult_$reflection() {
3750
- return record_type("Glutinum.Converter.Transform.TypeParameter.TransformResult", [], TypeParameter_TransformResult, () => [["FSharpTypeParameter", FSharpTypeParameter_$reflection()], ["SealedTypeOpt", option_type(TypeParameter_SealedTypeInfo_$reflection())]]);
3751
- }
3752
-
3753
- function TypeParameter_TransformResult_Create_403667D8(typeParameterName, default_, constraint_, sealedType) {
3754
- return new TypeParameter_TransformResult(new FSharpTypeParameter(/* FSharpTypeParameter */ 1, [FSharpTypeParameterInfo_Create_Z6CFD3565(typeParameterName, unwrap(constraint_), unwrap(default_))]), (sealedType == null) ? undefined : (new TypeParameter_SealedTypeInfo(typeParameterName, sealedType)));
3755
- }
3756
-
3757
- function TypeParameter_transformWith(withDefault, context, typeParameter) {
3126
+ function TypeParameterTransform_transformWith(withDefault, context, typeParameter) {
3758
3127
  let default_;
3759
3128
  if (withDefault) {
3760
3129
  let mapping;
@@ -3795,18 +3164,18 @@ function TypeParameter_transformWith(withDefault, context, typeParameter) {
3795
3164
  }
3796
3165
  switch (matchResult) {
3797
3166
  case 0:
3798
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_);
3167
+ return TransformResult_Create_403667D8(typeParameter.Name, default_);
3799
3168
  case 1: {
3800
3169
  const matchValue_1 = transformType(TransformContext__PushScope_27AED5E3(context, sanitizeTypeName(typeParameter.Name)), constraintType);
3801
3170
  if (matchValue_1.tag === 11) {
3802
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, matchValue_1);
3171
+ return TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, matchValue_1);
3803
3172
  }
3804
3173
  else {
3805
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_, matchValue_1);
3174
+ return TransformResult_Create_403667D8(typeParameter.Name, default_, matchValue_1);
3806
3175
  }
3807
3176
  }
3808
3177
  case 2:
3809
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_);
3178
+ return TransformResult_Create_403667D8(typeParameter.Name, default_);
3810
3179
  default: {
3811
3180
  const matchValue_2 = transformType(TransformContext__PushScope_27AED5E3(context, sanitizeTypeName(typeParameter.Name)), constraintType_1);
3812
3181
  let matchResult_1, fsharpType_2;
@@ -3849,183 +3218,30 @@ function TypeParameter_transformWith(withDefault, context, typeParameter) {
3849
3218
  }
3850
3219
  switch (matchResult_1) {
3851
3220
  case 0:
3852
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_);
3221
+ return TransformResult_Create_403667D8(typeParameter.Name, default_);
3853
3222
  case 1:
3854
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, fsharpType_2);
3223
+ return TransformResult_Create_403667D8(typeParameter.Name, default_, undefined, fsharpType_2);
3855
3224
  case 2:
3856
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_);
3225
+ return TransformResult_Create_403667D8(typeParameter.Name, default_);
3857
3226
  default:
3858
- return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_);
3859
- }
3860
- }
3861
- }
3862
- }
3863
-
3864
- function TypeParameter_transform(context, typeParameter) {
3865
- return TypeParameter_transformWith(true, context, typeParameter);
3866
- }
3867
-
3868
- function TypeParameter_mapFSharpType(seadledTypes, typ) {
3869
- let matchResult, typeParameter, info_1, info_2, innerType, typeReference, unionInfo, types, typ_7, functionInfo, alias;
3870
- switch (typ.tag) {
3871
- case 0:
3872
- case 2:
3873
- case 4:
3874
- case 5:
3875
- case 6:
3876
- case 8:
3877
- case 10:
3878
- case 15:
3879
- case 17:
3880
- case 18:
3881
- case 19:
3882
- case 20:
3883
- case 21: {
3884
- matchResult = 10;
3885
- break;
3886
- }
3887
- case 7: {
3888
- if (typ.fields[0].Name.startsWith("\'")) {
3889
- matchResult = 1;
3890
- info_1 = typ.fields[0];
3891
- }
3892
- else {
3893
- matchResult = 2;
3894
- info_2 = typ.fields[0];
3895
- }
3896
- break;
3897
- }
3898
- case 3: {
3899
- matchResult = 3;
3900
- innerType = typ.fields[0];
3901
- break;
3902
- }
3903
- case 11: {
3904
- matchResult = 4;
3905
- typeReference = typ.fields[0];
3906
- break;
3907
- }
3908
- case 1: {
3909
- matchResult = 5;
3910
- unionInfo = typ.fields[0];
3911
- break;
3912
- }
3913
- case 12: {
3914
- matchResult = 6;
3915
- types = typ.fields[0];
3916
- break;
3917
- }
3918
- case 14: {
3919
- matchResult = 7;
3920
- typ_7 = typ.fields[0];
3921
- break;
3922
- }
3923
- case 16: {
3924
- matchResult = 8;
3925
- functionInfo = typ.fields[0];
3926
- break;
3927
- }
3928
- case 9: {
3929
- matchResult = 9;
3930
- alias = typ.fields[0];
3931
- break;
3932
- }
3933
- default: {
3934
- matchResult = 0;
3935
- typeParameter = typ.fields[0];
3936
- }
3937
- }
3938
- switch (matchResult) {
3939
- case 0: {
3940
- const needMapping = tryFind((mapperInfo) => (mapperInfo.TypeParameterName === typeParameter), seadledTypes);
3941
- if (needMapping == null) {
3942
- return typ;
3943
- }
3944
- else {
3945
- return needMapping.FSharpType;
3946
- }
3947
- }
3948
- case 1: {
3949
- const matchValue = tryFind((mapperInfo_2) => (mapperInfo_2.TypeParameterName === substring(info_1.Name, 1)), seadledTypes);
3950
- if (matchValue == null) {
3951
- return typ;
3952
- }
3953
- else {
3954
- return matchValue.FSharpType;
3227
+ return TransformResult_Create_403667D8(typeParameter.Name, default_);
3955
3228
  }
3956
3229
  }
3957
- case 2:
3958
- return new FSharpType(/* Mapped */ 7, [new FSharpMapped(info_2.Name, map((_arg) => {
3959
- if (_arg.tag === 1) {
3960
- const paramInfo = _arg.fields[0];
3961
- const matchValue_1 = tryFind((mapperInfo_4) => (mapperInfo_4.TypeParameterName === paramInfo.Name), seadledTypes);
3962
- if (matchValue_1 == null) {
3963
- return new FSharpTypeParameter(/* FSharpTypeParameter */ 1, [paramInfo]);
3964
- }
3965
- else {
3966
- return new FSharpTypeParameter(/* FSharpType */ 0, [matchValue_1.FSharpType]);
3967
- }
3968
- }
3969
- else {
3970
- return new FSharpTypeParameter(/* FSharpType */ 0, [TypeParameter_mapFSharpType(seadledTypes, _arg.fields[0])]);
3971
- }
3972
- }, info_2.TypeParameters))]);
3973
- case 3:
3974
- return new FSharpType(/* Option */ 3, [TypeParameter_mapFSharpType(seadledTypes, innerType)]);
3975
- case 4:
3976
- return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(typeReference.Name, typeReference.FullName, typeReference.ModulePath, map((typ_2) => TypeParameter_mapFSharpType(seadledTypes, typ_2), typeReference.TypeArguments), typeReference.Type)]);
3977
- case 5:
3978
- return new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, map((case$) => {
3979
- switch (case$.tag) {
3980
- case 1:
3981
- return new FSharpUnionCase(/* Typed */ 1, [TypeParameter_mapFSharpType(seadledTypes, case$.fields[0])]);
3982
- case 2:
3983
- return new FSharpUnionCase(/* Field */ 2, [case$.fields[0], TypeParameter_mapFSharpType(seadledTypes, case$.fields[1])]);
3984
- case 3:
3985
- return new FSharpUnionCase(/* NamedFields */ 3, [case$.fields[0], map((tupledArg) => [tupledArg[0], TypeParameter_mapFSharpType(seadledTypes, tupledArg[1])], case$.fields[1])]);
3986
- default:
3987
- return case$;
3988
- }
3989
- }, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants)]);
3990
- case 6:
3991
- return new FSharpType(/* Tuple */ 12, [map((typ_6) => TypeParameter_mapFSharpType(seadledTypes, typ_6), types)]);
3992
- case 7:
3993
- return new FSharpType(/* ResizeArray */ 14, [TypeParameter_mapFSharpType(seadledTypes, typ_7)]);
3994
- case 8:
3995
- return new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => TypeParameter_mapFsharpParameter(seadledTypes, parameter), functionInfo.Parameters), TypeParameter_mapFSharpType(seadledTypes, functionInfo.ReturnType))]);
3996
- case 9:
3997
- return new FSharpType(/* TypeAlias */ 9, [new FSharpTypeAlias(alias.Attributes, alias.Name, alias.XmlDoc, alias.Type, map((_arg_1) => {
3998
- if (_arg_1.tag === 0) {
3999
- return new FSharpTypeParameter(/* FSharpType */ 0, [TypeParameter_mapFSharpType(seadledTypes, _arg_1.fields[0])]);
4000
- }
4001
- else {
4002
- const matchValue_2 = tryFind((mapperInfo_6) => (mapperInfo_6.TypeParameterName === _arg_1.fields[0].Name), seadledTypes);
4003
- if (matchValue_2 == null) {
4004
- return _arg_1;
4005
- }
4006
- else {
4007
- return new FSharpTypeParameter(/* FSharpType */ 0, [matchValue_2.FSharpType]);
4008
- }
4009
- }
4010
- }, alias.TypeParameters))]);
4011
- default:
4012
- return typ;
4013
3230
  }
4014
3231
  }
4015
3232
 
4016
- function TypeParameter_mapFsharpParameter(seadledTypes, parameter) {
4017
- const typ = TypeParameter_mapFSharpType(seadledTypes, parameter.Type);
4018
- return new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, parameter.IsOptional ? defaultArg(tryUnwrapOption(typ), typ) : typ, parameter.OriginalGlueMember);
3233
+ function TypeParameterTransform_transform(context, typeParameter) {
3234
+ return TypeParameterTransform_transformWith(true, context, typeParameter);
4019
3235
  }
4020
3236
 
4021
3237
  function transformTypeParameters(context, typeParameters) {
4022
- const transformedTypeParameters = map((typeParameter) => TypeParameter_transformWith(false, context, typeParameter), typeParameters);
3238
+ const transformedTypeParameters = map((typeParameter) => TypeParameterTransform_transformWith(false, context, typeParameter), typeParameters);
4023
3239
  const sealedTypes = choose((_arg) => _arg.SealedTypeOpt, transformedTypeParameters);
4024
3240
  return new TransformTypeParametersResult(map((_arg_2) => _arg_2.FSharpTypeParameter, filter((_arg_1) => (_arg_1.SealedTypeOpt == null), transformedTypeParameters)), sealedTypes);
4025
3241
  }
4026
3242
 
4027
3243
  function transformDeclarationTypeParameters(context, typeParameters) {
4028
- const transformedTypeParameters = map((typeParameter) => TypeParameter_transform(context, typeParameter), typeParameters);
3244
+ const transformedTypeParameters = map((typeParameter) => TypeParameterTransform_transform(context, typeParameter), typeParameters);
4029
3245
  return new TransformDeclarationTypeParametersResult(map((_arg) => _arg.FSharpTypeParameter, transformedTypeParameters), exists((_arg_1) => (_arg_1.SealedTypeOpt != null), transformedTypeParameters) ? map((result) => {
4030
3246
  const matchValue = result.SealedTypeOpt;
4031
3247
  if (matchValue == null) {
@@ -4138,7 +3354,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4138
3354
  return undefined;
4139
3355
  }
4140
3356
  }, aliasCases_1);
4141
- if (forAll_1((option) => (option != null), resolved)) {
3357
+ if (forAll((option) => (option != null), resolved)) {
4142
3358
  return collect(value_7, resolved);
4143
3359
  }
4144
3360
  else {
@@ -4278,7 +3494,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4278
3494
  default:
4279
3495
  return singleton(case$);
4280
3496
  }
4281
- }, cases_4) : cases_4)), forAll_1(isLiteral, withAliases) ? withAliases : flattenCasesWith(false, cases_5))));
3497
+ }, cases_4) : cases_4)), forAll(isLiteral, withAliases) ? withAliases : flattenCasesWith(false, cases_5))));
4282
3498
  const otherCases = patternInput[1];
4283
3499
  const flattenedCases = patternInput[0];
4284
3500
  const isStringEnumCompatible = (!isEmpty(flattenedCases) && exists((_arg_5) => {
@@ -4300,7 +3516,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4300
3516
  default:
4301
3517
  return false;
4302
3518
  }
4303
- }, flattenedCases)) && forAll_1((_arg_6) => {
3519
+ }, flattenedCases)) && forAll((_arg_6) => {
4304
3520
  let matchResult_6;
4305
3521
  if (_arg_6.tag === 8) {
4306
3522
  switch (_arg_6.fields[0].tag) {
@@ -4324,7 +3540,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4324
3540
  return false;
4325
3541
  }
4326
3542
  }, flattenedCases);
4327
- const isNumericOnly = !isEmpty(flattenedCases) && forAll_1((_arg_7) => {
3543
+ const isNumericOnly = !isEmpty(flattenedCases) && forAll((_arg_7) => {
4328
3544
  let matchResult_7;
4329
3545
  if (_arg_7.tag === 8) {
4330
3546
  if (_arg_7.fields[0].tag === 1) {
@@ -4429,7 +3645,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4429
3645
  else {
4430
3646
  return [caseInfo_1, add(caseInfo_1.Name, usedNames)];
4431
3647
  }
4432
- }, empty_2({
3648
+ }, empty_3({
4433
3649
  Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
4434
3650
  }), caseInfos)[0];
4435
3651
  let matchValue_3;
@@ -4443,7 +3659,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4443
3659
  return undefined;
4444
3660
  }
4445
3661
  }, _arg_10.fields[0].Members);
4446
- if (forAll_1((option_2) => (option_2 != null), properties)) {
3662
+ if (forAll((option_2) => (option_2 != null), properties)) {
4447
3663
  return choose((x_2) => x_2, properties);
4448
3664
  }
4449
3665
  else {
@@ -4454,7 +3670,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4454
3670
  return undefined;
4455
3671
  }
4456
3672
  }, otherCases);
4457
- if ((isEmpty(flattenedCases) && (length(casesProperties) >= 2)) && forAll_1((option_3) => (option_3 != null), casesProperties)) {
3673
+ if ((isEmpty(flattenedCases) && (length(casesProperties) >= 2)) && forAll((option_3) => (option_3 != null), casesProperties)) {
4458
3674
  const casesProperties_1 = choose((x_3) => x_3, casesProperties);
4459
3675
  matchValue_3 = tryPick((candidate_1) => {
4460
3676
  const tagValues = map((properties_1) => {
@@ -4513,7 +3729,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
4513
3729
  return undefined;
4514
3730
  }
4515
3731
  }, casesProperties_1);
4516
- if (forAll_1((option_6) => (option_6 != null), tagValues) && (length(List_distinct(tagValues, {
3732
+ if (forAll((option_6) => (option_6 != null), tagValues) && (length(List_distinct(tagValues, {
4517
3733
  Equals: equals,
4518
3734
  GetHashCode: (x_4) => (structuralHash(x_4) | 0),
4519
3735
  })) === length(tagValues))) {
@@ -4788,84 +4004,113 @@ function aliasInterfaceOf(scope, typeParameters, members, inheritance) {
4788
4004
  return new FSharpType(/* Interface */ 5, [new FSharpInterface(ofArray([FSharpAttribute.AllowNullLiteral, FSharpAttribute.Interface]), scope.Name, empty(), scope.Declaration.Name, typeParameters, members, inheritance)]);
4789
4005
  }
4790
4006
 
4791
- function aliasOfUnion(scope, cases, unionType) {
4792
- const context = scope.Context;
4793
- const matchValue = tryOptimizeUnionType(context, scope.Name, cases);
4794
- if (matchValue == null) {
4795
- const matchValue_1 = partition((_arg) => {
4796
- let matchResult;
4797
- if (_arg.tag === 3) {
4798
- switch (_arg.fields[0].tag) {
4799
- case 7:
4800
- case 8: {
4801
- matchResult = 0;
4802
- break;
4803
- }
4804
- default:
4805
- matchResult = 1;
4806
- }
4007
+ function isSelfReferencingUnion(name, cases) {
4008
+ if (exists((case$) => !equals(replaceSelfReference(name, case$), case$), cases)) {
4009
+ return !exists((_arg) => {
4010
+ if (_arg.tag === 8) {
4011
+ return true;
4807
4012
  }
4808
4013
  else {
4809
- matchResult = 1;
4014
+ return false;
4810
4015
  }
4811
- switch (matchResult) {
4812
- case 0:
4813
- return true;
4016
+ }, cases);
4017
+ }
4018
+ else {
4019
+ return false;
4020
+ }
4021
+ }
4022
+
4023
+ function aliasOfUnion(scope, cases, unionType) {
4024
+ let unionInfo, typ;
4025
+ const context = scope.Context;
4026
+ const cases_1 = (length(filter((arg) => !isNullish(arg), cases)) > 1) ? map(arrayAsInput, cases) : cases;
4027
+ const isNullable = (_arg) => {
4028
+ let matchResult;
4029
+ if (_arg.tag === 3) {
4030
+ switch (_arg.fields[0].tag) {
4031
+ case 7:
4032
+ case 8: {
4033
+ matchResult = 0;
4034
+ break;
4035
+ }
4814
4036
  default:
4815
- return false;
4037
+ matchResult = 1;
4816
4038
  }
4817
- }, cases);
4818
- let matchResult_1, single, others_3;
4819
- if (!isEmpty(matchValue_1[0])) {
4820
- if (!isEmpty(matchValue_1[1])) {
4821
- if (isEmpty(tail_3(matchValue_1[1]))) {
4822
- matchResult_1 = 0;
4823
- single = head_1(matchValue_1[1]);
4039
+ }
4040
+ else {
4041
+ matchResult = 1;
4042
+ }
4043
+ switch (matchResult) {
4044
+ case 0:
4045
+ return true;
4046
+ default:
4047
+ return false;
4048
+ }
4049
+ };
4050
+ const isSelfReferencing = isSelfReferencingUnion(scope.Declaration.Name, cases_1);
4051
+ const erasedUnionOf = (others) => {
4052
+ const casesContext = TransformContext__PushScope_27AED5E3(context, "Cases");
4053
+ const caseTypes = List_distinct(mapIndexed((index, caseType) => transformType(TransformContext__PushScope_27AED5E3(casesContext, `Case${index + 1}`), caseType), others), {
4054
+ Equals: equals,
4055
+ GetHashCode: (x) => (safeHash(x) | 0),
4056
+ });
4057
+ return new FSharpType(/* Union */ 1, [erasedUnion(scope.Name, scope.TypeParameters.Value.TypeParameters, caseTypes)]);
4058
+ };
4059
+ void (TransformContext__get_State(context).UnionAliasesBeingExpanded.push(scope.Declaration.FullName));
4060
+ try {
4061
+ if (isSelfReferencing) {
4062
+ return erasedUnionOf(filter((arg_1) => !isNullable(arg_1), cases_1));
4063
+ }
4064
+ else {
4065
+ const matchValue = tryOptimizeUnionType(context, scope.Name, cases_1);
4066
+ if (matchValue == null) {
4067
+ const matchValue_1 = partition(isNullable, cases_1);
4068
+ let matchResult_1, single, others_4;
4069
+ if (!isEmpty(matchValue_1[0])) {
4070
+ if (!isEmpty(matchValue_1[1])) {
4071
+ if (isEmpty(tail_1(matchValue_1[1]))) {
4072
+ matchResult_1 = 0;
4073
+ single = head_1(matchValue_1[1]);
4074
+ }
4075
+ else if (length(matchValue_1[1]) > 9) {
4076
+ matchResult_1 = 1;
4077
+ others_4 = matchValue_1[1];
4078
+ }
4079
+ else {
4080
+ matchResult_1 = 2;
4081
+ }
4082
+ }
4083
+ else if (length(matchValue_1[1]) > 9) {
4084
+ matchResult_1 = 1;
4085
+ others_4 = matchValue_1[1];
4086
+ }
4087
+ else {
4088
+ matchResult_1 = 2;
4089
+ }
4824
4090
  }
4825
4091
  else if (length(matchValue_1[1]) > 9) {
4826
4092
  matchResult_1 = 1;
4827
- others_3 = matchValue_1[1];
4093
+ others_4 = matchValue_1[1];
4828
4094
  }
4829
4095
  else {
4830
4096
  matchResult_1 = 2;
4831
4097
  }
4832
- }
4833
- else if (length(matchValue_1[1]) > 9) {
4834
- matchResult_1 = 1;
4835
- others_3 = matchValue_1[1];
4098
+ switch (matchResult_1) {
4099
+ case 0:
4100
+ return aliasOf(scope, new FSharpType(/* Option */ 3, [transformType(TransformContext__PushScope_27AED5E3(context, "Value"), single)]));
4101
+ case 1:
4102
+ return erasedUnionOf(others_4);
4103
+ default:
4104
+ return aliasOf(scope, transformType(context, unionType));
4105
+ }
4836
4106
  }
4837
4107
  else {
4838
- matchResult_1 = 2;
4839
- }
4840
- }
4841
- else if (length(matchValue_1[1]) > 9) {
4842
- matchResult_1 = 1;
4843
- others_3 = matchValue_1[1];
4844
- }
4845
- else {
4846
- matchResult_1 = 2;
4847
- }
4848
- switch (matchResult_1) {
4849
- case 0:
4850
- return aliasOf(scope, new FSharpType(/* Option */ 3, [transformType(TransformContext__PushScope_27AED5E3(context, "Value"), single)]));
4851
- case 1: {
4852
- const caseTypes = List_distinct(mapIndexed((index, caseType) => transformType(TransformContext__PushScope_27AED5E3(context, `Case${index + 1}`), caseType), others_3), {
4853
- Equals: equals,
4854
- GetHashCode: (x) => (safeHash(x) | 0),
4855
- });
4856
- return new FSharpType(/* Union */ 1, [erasedUnion(scope.Name, scope.TypeParameters.Value.TypeParameters, caseTypes)]);
4108
+ return (matchValue.tag === 1) ? ((unionInfo = matchValue.fields[0], new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, unionInfo.Cases, unionInfo.IsOptional, scope.TypeParameters.Value.TypeParameters, unionInfo.Constants)]))) : ((typ = matchValue, typ));
4857
4109
  }
4858
- default:
4859
- return aliasOf(scope, transformType(context, unionType));
4860
4110
  }
4861
4111
  }
4862
- else if (matchValue.tag === 1) {
4863
- const unionInfo = matchValue.fields[0];
4864
- return new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, unionInfo.Cases, unionInfo.IsOptional, scope.TypeParameters.Value.TypeParameters, unionInfo.Constants)]);
4865
- }
4866
- else {
4867
- const typ = matchValue;
4868
- return typ;
4112
+ finally {
4113
+ TransformContext__get_State(context).UnionAliasesBeingExpanded.splice(TransformContext__get_State(context).UnionAliasesBeingExpanded.length - 1, 1);
4869
4114
  }
4870
4115
  }
4871
4116
 
@@ -4942,7 +4187,7 @@ function aliasOfTypeReference(scope, typeReference) {
4942
4187
  let matchResult, members;
4943
4188
  if (!isEmpty(matchValue)) {
4944
4189
  if (head_1(matchValue).tag === 20) {
4945
- if (isEmpty(tail_3(matchValue))) {
4190
+ if (isEmpty(tail_1(matchValue))) {
4946
4191
  matchResult = 0;
4947
4192
  members = head_1(matchValue).fields[0];
4948
4193
  }
@@ -5052,8 +4297,8 @@ function aliasOfConstructorType(scope, constructSignature) {
5052
4297
  const context = scope.Context;
5053
4298
  const matchValue = scope.Declaration.TypeParameters;
5054
4299
  if (!isEmpty(matchValue)) {
5055
- if (isEmpty(tail_3(matchValue))) {
5056
- return new FSharpType(/* SingleErasedCaseUnion */ 2, [new FSharpSingleErasedCaseUnion(toList(delay(() => scope.XmlDoc.ObsoleteAttributes)), scope.Name, scope.XmlDoc.XmlDoc, TypeParameter_transform(context, head_1(matchValue)).FSharpTypeParameter)]);
4300
+ if (isEmpty(tail_1(matchValue))) {
4301
+ return new FSharpType(/* SingleErasedCaseUnion */ 2, [new FSharpSingleErasedCaseUnion(toList(delay(() => scope.XmlDoc.ObsoleteAttributes)), scope.Name, scope.XmlDoc.XmlDoc, TypeParameterTransform_transform(context, head_1(matchValue)).FSharpTypeParameter)]);
5057
4302
  }
5058
4303
  else {
5059
4304
  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"));
@@ -5071,24 +4316,48 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
5071
4316
  const context_1 = patternInput[1];
5072
4317
  const scope = new AliasScope(typeAliasName, context_1, glueTypeAliasDeclaration, transformComment(glueTypeAliasDeclaration.Documentation), new Lazy(() => transformDeclarationTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters)));
5073
4318
  const aliasInterface = (members, inheritance) => aliasInterfaceOf(scope, scope.TypeParameters.Value.TypeParameters, members, inheritance);
4319
+ let aliasType;
4320
+ const matchValue = glueTypeAliasDeclaration.Type;
4321
+ let matchResult, cases_1, glueType;
4322
+ if (matchValue.tag === 7) {
4323
+ if (isSelfReferencingUnion(glueTypeAliasDeclaration.Name, matchValue.fields[0].fields[0])) {
4324
+ matchResult = 0;
4325
+ cases_1 = matchValue.fields[0].fields[0];
4326
+ }
4327
+ else {
4328
+ matchResult = 1;
4329
+ glueType = matchValue;
4330
+ }
4331
+ }
4332
+ else {
4333
+ matchResult = 1;
4334
+ glueType = matchValue;
4335
+ }
4336
+ switch (matchResult) {
4337
+ case 0: {
4338
+ aliasType = glueTypeAliasDeclaration.Type;
4339
+ break;
4340
+ }
4341
+ default:
4342
+ aliasType = replaceSelfReference(glueTypeAliasDeclaration.Name, glueType);
4343
+ }
5074
4344
  let fsharpType;
5075
- const matchValue = replaceSelfReference(glueTypeAliasDeclaration.Name, glueTypeAliasDeclaration.Type);
5076
- switch (matchValue.tag) {
4345
+ switch (aliasType.tag) {
5077
4346
  case 9: {
5078
- const matchValue_1 = TypeAliasDeclaration_transformKeyOf(context_1, glueTypeAliasDeclaration.Name, matchValue.fields[0]);
4347
+ const matchValue_1 = TypeAliasDeclaration_transformKeyOf(context_1, glueTypeAliasDeclaration.Name, aliasType.fields[0]);
5079
4348
  fsharpType = ((matchValue_1.tag === 10) ? aliasOf(scope, FSharpType.Object$) : matchValue_1);
5080
4349
  break;
5081
4350
  }
5082
4351
  case 10: {
5083
- fsharpType = aliasOfIndexedAccessType(scope, matchValue.fields[0]);
4352
+ fsharpType = aliasOfIndexedAccessType(scope, aliasType.fields[0]);
5084
4353
  break;
5085
4354
  }
5086
4355
  case 8: {
5087
- fsharpType = TypeAliasDeclaration_transformLiteral(scope.XmlDoc, typeAliasName, matchValue.fields[0]);
4356
+ fsharpType = TypeAliasDeclaration_transformLiteral(scope.XmlDoc, typeAliasName, aliasType.fields[0]);
5088
4357
  break;
5089
4358
  }
5090
4359
  case 3: {
5091
- fsharpType = aliasOf(scope, new FSharpType(/* Primitive */ 8, [transformPrimitive(matchValue.fields[0])]));
4360
+ fsharpType = aliasOf(scope, new FSharpType(/* Primitive */ 8, [transformPrimitive(aliasType.fields[0])]));
5092
4361
  break;
5093
4362
  }
5094
4363
  case 26: {
@@ -5096,36 +4365,36 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
5096
4365
  break;
5097
4366
  }
5098
4367
  case 13: {
5099
- fsharpType = aliasOfTypeReference(scope, matchValue.fields[0]);
4368
+ fsharpType = aliasOfTypeReference(scope, aliasType.fields[0]);
5100
4369
  break;
5101
4370
  }
5102
4371
  case 14: {
5103
- fsharpType = aliasOf(scope, transformType(context_1, new GlueType(/* Array */ 14, [matchValue.fields[0]])));
4372
+ fsharpType = aliasOf(scope, transformType(context_1, new GlueType(/* Array */ 14, [aliasType.fields[0]])));
5104
4373
  break;
5105
4374
  }
5106
4375
  case 27: {
5107
- fsharpType = aliasOfUtilityType(scope, matchValue.fields[0]);
4376
+ fsharpType = aliasOfUtilityType(scope, aliasType.fields[0]);
5108
4377
  break;
5109
4378
  }
5110
4379
  case 15: {
5111
- fsharpType = aliasOfFunctionType(scope, matchValue.fields[0]);
4380
+ fsharpType = aliasOfFunctionType(scope, aliasType.fields[0]);
5112
4381
  break;
5113
4382
  }
5114
4383
  case 18: {
5115
- fsharpType = aliasOf(scope, transformTupleType(TransformContext__PushScope_27AED5E3(context_1, "Item"), matchValue.fields[0]));
4384
+ fsharpType = aliasOf(scope, transformTupleType(TransformContext__PushScope_27AED5E3(context_1, "Item"), aliasType.fields[0]));
5116
4385
  break;
5117
4386
  }
5118
4387
  case 20: {
5119
- fsharpType = aliasInterface(TransformMembers_toFSharpMember(context_1, matchValue.fields[0]), empty());
4388
+ fsharpType = aliasInterface(TransformMembers_toFSharpMember(context_1, aliasType.fields[0]), empty());
5120
4389
  break;
5121
4390
  }
5122
4391
  case 21: {
5123
- const matchValue_2 = inheritableBases(context_1, matchValue.fields[0]);
5124
- fsharpType = (isEmpty(matchValue_2) ? aliasOf(scope, FSharpType.Object$) : aliasInterface(TransformMembers_toFSharpMember(context_1, matchValue.fields[1]), map((glueType_3) => transformType(context_1, glueType_3), matchValue_2)));
4392
+ const matchValue_2 = inheritableBases(context_1, aliasType.fields[0]);
4393
+ fsharpType = (isEmpty(matchValue_2) ? aliasOf(scope, FSharpType.Object$) : aliasInterface(TransformMembers_toFSharpMember(context_1, aliasType.fields[1]), map((glueType_4) => transformType(context_1, glueType_4), matchValue_2)));
5125
4394
  break;
5126
4395
  }
5127
4396
  case 22: {
5128
- fsharpType = aliasOfTypeLiteral(scope, matchValue.fields[0]);
4397
+ fsharpType = aliasOfTypeLiteral(scope, aliasType.fields[0]);
5129
4398
  break;
5130
4399
  }
5131
4400
  case 24: {
@@ -5133,19 +4402,19 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
5133
4402
  break;
5134
4403
  }
5135
4404
  case 16: {
5136
- fsharpType = aliasOf(scope, new FSharpType(/* TypeParameter */ 13, [matchValue.fields[0]]));
4405
+ fsharpType = aliasOf(scope, new FSharpType(/* TypeParameter */ 13, [aliasType.fields[0]]));
5137
4406
  break;
5138
4407
  }
5139
4408
  case 28: {
5140
- fsharpType = aliasInterface(TransformMembers_toFSharpMember(context_1, transformMappedTypeMembers(context_1, matchValue.fields[0])), empty());
4409
+ fsharpType = aliasInterface(TransformMembers_toFSharpMember(context_1, transformMappedTypeMembers(context_1, aliasType.fields[0])), empty());
5141
4410
  break;
5142
4411
  }
5143
4412
  case 29: {
5144
- fsharpType = aliasOfConstructorType(scope, matchValue.fields[0]);
4413
+ fsharpType = aliasOfConstructorType(scope, aliasType.fields[0]);
5145
4414
  break;
5146
4415
  }
5147
4416
  case 30: {
5148
- fsharpType = aliasOf(scope, transformReadOnlyModifier(TransformContext__PushScope_27AED5E3(context_1, "Item"), matchValue.fields[0]));
4417
+ fsharpType = aliasOf(scope, transformReadOnlyModifier(TransformContext__PushScope_27AED5E3(context_1, "Item"), aliasType.fields[0]));
5149
4418
  break;
5150
4419
  }
5151
4420
  case 12:
@@ -5167,7 +4436,7 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
5167
4436
  break;
5168
4437
  }
5169
4438
  default:
5170
- fsharpType = aliasOfUnion(scope, matchValue.fields[0].fields[0], matchValue);
4439
+ fsharpType = aliasOfUnion(scope, aliasType.fields[0].fields[0], aliasType);
5171
4440
  }
5172
4441
  if (scope.TypeParameters.IsValueCreated) {
5173
4442
  const typeParameters = scope.TypeParameters.Value.TypeParameters;
@@ -5231,9 +4500,9 @@ function ReExport_isExpressible(glueType_mut) {
5231
4500
  continue ReExport_isExpressible;
5232
4501
  }
5233
4502
  case 2:
5234
- return forAll_1(ReExport_isExpressible, glueType.fields[0].fields[0]);
4503
+ return forAll(ReExport_isExpressible, glueType.fields[0].fields[0]);
5235
4504
  case 3:
5236
- return forAll_1(ReExport_isExpressible, glueType.fields[0]);
4505
+ return forAll(ReExport_isExpressible, glueType.fields[0]);
5237
4506
  default:
5238
4507
  return false;
5239
4508
  }
@@ -5242,7 +4511,7 @@ function ReExport_isExpressible(glueType_mut) {
5242
4511
  }
5243
4512
 
5244
4513
  function ReExport_canForwardConstraints(typeParameters) {
5245
- return forAll_1((typeParameter) => {
4514
+ return forAll((typeParameter) => {
5246
4515
  const matchValue = typeParameter.Constraint;
5247
4516
  let matchResult, constraintType;
5248
4517
  if (matchValue != null) {
@@ -5393,7 +4662,7 @@ function exposeSpecializedAlias(name_mut, acc_mut, tailedTypeParameters_mut, typ
5393
4662
  return acc;
5394
4663
  }
5395
4664
  else {
5396
- const tail = tail_3(typeParameters);
4665
+ const tail = tail_1(typeParameters);
5397
4666
  const head = head_1(typeParameters);
5398
4667
  if (head.tag === 1) {
5399
4668
  const typeParameter = head.fields[0];
@@ -5403,8 +4672,8 @@ function exposeSpecializedAlias(name_mut, acc_mut, tailedTypeParameters_mut, typ
5403
4672
  const orderedTail = reverse(tail);
5404
4673
  let tailedTypeParameters_1;
5405
4674
  let substitute;
5406
- const seadledTypes = singleton(new TypeParameter_SealedTypeInfo(typeParameter.Name, defaultType));
5407
- substitute = ((typ) => TypeParameter_mapFSharpType(seadledTypes, typ));
4675
+ const seadledTypes = singleton(new SealedTypeInfo(typeParameter.Name, defaultType));
4676
+ substitute = ((typ) => mapFSharpType(seadledTypes, typ));
5408
4677
  tailedTypeParameters_1 = map((_arg) => {
5409
4678
  if (_arg.tag === 0) {
5410
4679
  return new FSharpTypeParameter(/* FSharpType */ 0, [substitute(_arg.fields[0])]);
@@ -5532,7 +4801,7 @@ function keysModuleOf(context, interfaceInfo, fsharpInterface) {
5532
4801
  }
5533
4802
 
5534
4803
  function transformToFsharp(context, glueTypes) {
5535
- TransformContext__set_SiblingTypeNames_2FCB1351(context, ofSeq(map(sanitizeTypeName, choose((_arg) => {
4804
+ TransformContext__set_SiblingTypeNames_2FCB1351(context, ofSeq_1(map(sanitizeTypeName, choose((_arg) => {
5536
4805
  switch (_arg.tag) {
5537
4806
  case 1:
5538
4807
  return _arg.fields[0].Name;
@@ -5749,7 +5018,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5749
5018
  default:
5750
5019
  return glueType_3;
5751
5020
  }
5752
- }, (exportEqualsNames = ofSeq(choose((_arg) => {
5021
+ }, (exportEqualsNames = ofSeq_1(choose((_arg) => {
5753
5022
  let matchResult_1, name;
5754
5023
  if (_arg.tag === 25) {
5755
5024
  if (_arg.fields[0].tag === 2) {
@@ -5782,7 +5051,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5782
5051
  default:
5783
5052
  return undefined;
5784
5053
  }
5785
- }), (declaredNames = ofSeq(choose((_arg_1) => {
5054
+ }), (declaredNames = ofSeq_1(choose((_arg_1) => {
5786
5055
  let matchResult_2, info_3, info_4, glueType_1;
5787
5056
  switch (_arg_1.tag) {
5788
5057
  case 12: {
@@ -5984,7 +5253,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
5984
5253
  return undefined;
5985
5254
  }
5986
5255
  }, glueAst_2);
5987
- const defaultExported = ofSeq(choose((_arg_4) => {
5256
+ const defaultExported = ofSeq_1(choose((_arg_4) => {
5988
5257
  let matchResult_7, info_14, name_8;
5989
5258
  if (_arg_4.tag === 25) {
5990
5259
  switch (_arg_4.fields[0].tag) {
@@ -6021,7 +5290,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
6021
5290
  }, glueAst_2), {
6022
5291
  Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
6023
5292
  });
6024
- const classes_1 = ofSeq(map((_arg_5) => _arg_5.Name, filter((info_15) => {
5293
+ const classes_1 = ofSeq_1(map((_arg_5) => _arg_5.Name, filter((info_15) => {
6025
5294
  if (info_15.IsExported) {
6026
5295
  return true;
6027
5296
  }
@@ -6031,7 +5300,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
6031
5300
  }, classDeclarations)), {
6032
5301
  Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
6033
5302
  });
6034
- const constructorVariables = ofSeq(choose((_arg_6) => {
5303
+ const constructorVariables = ofSeq_1(choose((_arg_6) => {
6035
5304
  let matchResult_8, name_10, members_1, name_11;
6036
5305
  if (_arg_6.tag === 2) {
6037
5306
  switch (_arg_6.fields[0].Type.tag) {
@@ -6122,7 +5391,7 @@ function transform(typeMemory, state, reporter, typeLiteralsMemory, importSource
6122
5391
  exportsType_1 = undefined;
6123
5392
  }
6124
5393
  else {
6125
- const matchValue_2 = transformExports(rootTransformContext, isTopLevel, exports_1);
5394
+ const matchValue_2 = transformExports(new Transforms(transformType, transformParameter, transformTypeParameters, TransformMembers_withDefaultedTypeParameterOverloadsOfFunction, TransformMembers_withDictionaryParameterOverloadsOfFunction), rootTransformContext, isTopLevel, exports_1);
6126
5395
  let matchResult_10, exportsType;
6127
5396
  if (matchValue_2.tag === 5) {
6128
5397
  if (isEmpty(matchValue_2.fields[0].Members)) {
@@ -6158,7 +5427,7 @@ export function applyWithOptions(options, typeMemory, glueAst) {
6158
5427
  const typeLiteralsMemory = TypeLiteralsMemory_$ctor();
6159
5428
  const transformed = transform(typeMemory, TransformState_Create_Z68CEF8E2(typeMemory, options.MaxOverloads), reporter, typeLiteralsMemory, options.Source, true, glueAst);
6160
5429
  const aliases = aliasesOf(transformed);
6161
- 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));
5430
+ return new TransformResult(disambiguateOverloads(aliases, apply_1(apply_2(apply_3(applyWith_1(aliases, transformed))))), Reporter__get_Warnings(reporter), Reporter__get_Errors(reporter), Reporter__get_HasRegEpx(reporter), Reporter__get_HasReadonlyArray(reporter), Reporter__get_HasIterable(reporter));
6162
5431
  }
6163
5432
 
6164
5433
  export function applyWithSource(source, typeMemory, glueAst) {
@@ -6166,7 +5435,7 @@ export function applyWithSource(source, typeMemory, glueAst) {
6166
5435
  }
6167
5436
 
6168
5437
  export function applyWith(importSpecifier, typeMemory, glueAst) {
6169
- return applyWithSource(new ImportSource(/* Module */ 0, [importSpecifier, empty_3({
5438
+ return applyWithSource(new ImportSource(/* Module */ 0, [importSpecifier, empty_2({
6170
5439
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
6171
5440
  })]), typeMemory, glueAst);
6172
5441
  }