@glutinum/cli 1.0.0-beta.15 → 1.0.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Glutinum.Converter/Merge.js +12 -3
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +28 -23
- package/dist/Glutinum.Converter/Reader/TypeNode.js +64 -17
- package/dist/Glutinum.Converter/Reader/UtilityType.js +69 -7
- package/dist/Glutinum.Converter/Transform.js +26 -24
- package/dist/Glutinum.Converter/Transformer/Heritage.js +176 -2
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { FSharpUnion, FSharpClass, FSharpModule, FSharpInterface, FSharpStaticMe
|
|
|
5
5
|
import { ofList, FSharpMap__TryFind, tryFind, ofSeq, empty } from "../fable_modules/fable-library-js.5.21.0/Map.js";
|
|
6
6
|
import { Exception, safeHash, equals, stringHash, compareArrays, arrayHash, equalArrays, defaultOf, int32ToString, disposeSafe, getEnumerator, comparePrimitives } from "../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
7
7
|
import { mapIndexed, tryFindIndex, ofSeq as ofSeq_2, maxBy, tryFind as tryFind_1, toArray, ofArray, indexed, sortBy, exists, forAll, filter, collect, head, tail, zip, empty as empty_1, length, choose, singleton, append, isEmpty as isEmpty_1, map } from "../fable_modules/fable-library-js.5.21.0/List.js";
|
|
8
|
-
import { concat, join } from "../fable_modules/fable-library-js.5.21.0/String.js";
|
|
8
|
+
import { concat, substring, join } from "../fable_modules/fable-library-js.5.21.0/String.js";
|
|
9
9
|
import { exists as exists_1, forAll as forAll_1, filter as filter_1, truncate, length as length_1, map as map_1 } from "../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
10
10
|
import { isSubset, singleton as singleton_1, FSharpSet__get_IsEmpty, ofSeq as ofSeq_1, empty as empty_2, FSharpSet__Contains } from "../fable_modules/fable-library-js.5.21.0/Set.js";
|
|
11
11
|
import { addToDict, addToSet, getItemFromDict, tryGetValue } from "../fable_modules/fable-library-js.5.21.0/MapUtil.js";
|
|
@@ -695,6 +695,15 @@ function withoutSubsumedOverloads(aliases, members) {
|
|
|
695
695
|
}, zip(members, signatures)));
|
|
696
696
|
}
|
|
697
697
|
|
|
698
|
+
function withUnderscoreSuffix(name) {
|
|
699
|
+
if (name.startsWith("``") && name.endsWith("``")) {
|
|
700
|
+
return substring(name, 0, name.length - 2) + "_``";
|
|
701
|
+
}
|
|
702
|
+
else {
|
|
703
|
+
return name + "_";
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
698
707
|
export function distinctBySignature(aliases, members) {
|
|
699
708
|
const members_2 = withParameterlessOverloads(withoutSubsumedOverloads(aliases, members));
|
|
700
709
|
const methodNames = ofSeq_1(choose((_arg) => {
|
|
@@ -937,9 +946,9 @@ export function distinctBySignature(aliases, members) {
|
|
|
937
946
|
}
|
|
938
947
|
switch (matchResult_4) {
|
|
939
948
|
case 0:
|
|
940
|
-
return new FSharpMember(/* StaticMember */ 2, [new FSharpStaticMemberInfo(info_7.Attributes, info_7.Name
|
|
949
|
+
return new FSharpMember(/* StaticMember */ 2, [new FSharpStaticMemberInfo(info_7.Attributes, withUnderscoreSuffix(info_7.Name), info_7.OriginalName, info_7.TypeParameters, info_7.Parameters, info_7.Type, info_7.IsOptional, info_7.Accessor, info_7.Accessibility, info_7.XmlDoc)]);
|
|
941
950
|
case 1:
|
|
942
|
-
return new FSharpMember(/* Property */ 1, [new FSharpMemberInfo(info_8.Attributes, info_8.Name
|
|
951
|
+
return new FSharpMember(/* Property */ 1, [new FSharpMemberInfo(info_8.Attributes, withUnderscoreSuffix(info_8.Name), info_8.OriginalName, info_8.TypeParameters, info_8.Parameters, info_8.Type, info_8.IsOptional, info_8.IsStatic, info_8.Accessor, info_8.Accessibility, info_8.XmlDoc, info_8.Body)]);
|
|
943
952
|
default:
|
|
944
953
|
return fsharpMember;
|
|
945
954
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { tryItem, tryPick, mapIndexed, forAll, length, fold, isEmpty, exists, filter, cons, map, append, collect, empty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
3
3
|
import { readHeritageClauses, getFullNameOrEmpty, readModuleHeritageMembers, otherFileInterfaceDeclarations, mainDeclaration } from "./Utils.js";
|
|
4
4
|
import { toList } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
5
5
|
import { defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
|
|
@@ -9,7 +9,7 @@ import { safeHash, equals } from "../../fable_modules/fable-library-js.5.21.0/Ut
|
|
|
9
9
|
import { PackageContext__TryFindExternalModulePath_Z721C83C5 } from "./Types.js";
|
|
10
10
|
|
|
11
11
|
export function readInterfaceDeclaration(reader, declaration) {
|
|
12
|
-
let option_1;
|
|
12
|
+
let option_3, option_1, symbol_1;
|
|
13
13
|
const symbolOpt = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(declaration.name);
|
|
14
14
|
let otherDeclarations;
|
|
15
15
|
if (symbolOpt == null) {
|
|
@@ -43,35 +43,40 @@ export function readInterfaceDeclaration(reader, declaration) {
|
|
|
43
43
|
const members = collect((declaration_1) => append(readModuleHeritageMembers(reader, declaration_1.heritageClauses), map((declaration_2) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_2), toList(declaration_1.members))), cons(declaration, otherDeclarations));
|
|
44
44
|
let typeParameters;
|
|
45
45
|
const own = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"](declaration.typeParameters);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
let othersDefaults;
|
|
51
|
-
const matchValue_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(declaration.name);
|
|
52
|
-
if (matchValue_1 == null) {
|
|
53
|
-
othersDefaults = empty();
|
|
46
|
+
const declarations = defaultArg((option_3 = ((option_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(declaration.name), (option_1 != null) ? ((symbol_1 = option_1, symbol_1.declarations)) : undefined)), (option_3 != null) ? toList(option_3) : undefined), empty());
|
|
47
|
+
const others = () => map((other_1) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"](other_1.typeParameters), filter((other) => {
|
|
48
|
+
if (other.kind === 265) {
|
|
49
|
+
return !(other === declaration);
|
|
54
50
|
}
|
|
55
51
|
else {
|
|
56
|
-
|
|
57
|
-
othersDefaults = map((other_1) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"](other_1.typeParameters), filter((other) => {
|
|
58
|
-
if (other.kind === 265) {
|
|
59
|
-
return !(other === declaration);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
}, defaultArg((option_1 = symbol_1.declarations, (option_1 != null) ? toList(option_1) : undefined), empty())));
|
|
52
|
+
return false;
|
|
65
53
|
}
|
|
54
|
+
}, declarations));
|
|
55
|
+
const mergesWithClass = exists((other_2) => (other_2.kind === 264), declarations);
|
|
56
|
+
if (isEmpty(own) && !mergesWithClass) {
|
|
57
|
+
typeParameters = fold((longest, other_3) => {
|
|
58
|
+
if (length(other_3) > length(longest)) {
|
|
59
|
+
return other_3;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return longest;
|
|
63
|
+
}
|
|
64
|
+
}, empty(), others());
|
|
65
|
+
}
|
|
66
|
+
else if (forAll((typeParameter) => (typeParameter.Default != null), own)) {
|
|
67
|
+
typeParameters = own;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
const othersDefaults = others();
|
|
66
71
|
typeParameters = mapIndexed((index, typeParameter_1) => {
|
|
67
72
|
if (typeParameter_1.Default != null) {
|
|
68
73
|
return typeParameter_1;
|
|
69
74
|
}
|
|
70
75
|
else {
|
|
71
|
-
return new GlueTypeParameter(typeParameter_1.Name, typeParameter_1.Constraint, tryPick((
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
return
|
|
76
|
+
return new GlueTypeParameter(typeParameter_1.Name, typeParameter_1.Constraint, tryPick((others_1) => {
|
|
77
|
+
const option_6 = tryItem(index, others_1);
|
|
78
|
+
if (option_6 != null) {
|
|
79
|
+
return option_6.Default;
|
|
75
80
|
}
|
|
76
81
|
else {
|
|
77
82
|
return undefined;
|
|
@@ -4,7 +4,7 @@ import { tryReadLiteral, typeLiteralId, declaredName, isFromEsLib, Type_StringLi
|
|
|
4
4
|
import { filter, choose, sortByDescending, tryHead, map as map_1, toList, exists, forAll, tryPick } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
5
5
|
import { exists as exists_1, collect, head, tail, isEmpty, map, append, fold, singleton, empty, length, mapIndexed } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
6
6
|
import { GlueTypeLiteral, GlueConstructSignature, GlueThisType, GlueFunctionType, GlueTypeUnion, GlueLiteral, GlueTypeReference, GluePrimitive, GlueType } from "../GlueAST.js";
|
|
7
|
-
import { readReadonly, readPick, readOmit, readThisParameterType, readReturnType, readRecord, readPartial, readExclude, tryExpandAnonymousObjectApplication } from "./UtilityType.js";
|
|
7
|
+
import { tryReadInstanceType, readReadonly, readPick, readOmit, readThisParameterType, readReturnType, readRecord, readPartial, readExclude, tryExpandAnonymousObjectApplication } from "./UtilityType.js";
|
|
8
8
|
import { contains, item as item_1 } from "../../fable_modules/fable-library-js.5.21.0/Array.js";
|
|
9
9
|
import { isGlobalThisQuery, truncateToDeclaredArity, tryResolveDeferred, isDeferredConditional } from "./Deferred.js";
|
|
10
10
|
import { FSharpSet__Contains } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
|
|
@@ -280,17 +280,26 @@ function readTypeReference(reader, typeNode) {
|
|
|
280
280
|
matchResult_2 = 8;
|
|
281
281
|
break;
|
|
282
282
|
}
|
|
283
|
-
case "
|
|
283
|
+
case "InstanceType": {
|
|
284
284
|
if (typeReferenceNode.typeArguments != null) {
|
|
285
285
|
matchResult_2 = 9;
|
|
286
286
|
}
|
|
287
287
|
else {
|
|
288
|
+
matchResult_2 = 11;
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
case "Awaited": {
|
|
293
|
+
if (typeReferenceNode.typeArguments != null) {
|
|
288
294
|
matchResult_2 = 10;
|
|
289
295
|
}
|
|
296
|
+
else {
|
|
297
|
+
matchResult_2 = 11;
|
|
298
|
+
}
|
|
290
299
|
break;
|
|
291
300
|
}
|
|
292
301
|
default:
|
|
293
|
-
matchResult_2 =
|
|
302
|
+
matchResult_2 = 11;
|
|
294
303
|
}
|
|
295
304
|
switch (matchResult_2) {
|
|
296
305
|
case 0:
|
|
@@ -398,32 +407,70 @@ function readTypeReference(reader, typeNode) {
|
|
|
398
407
|
case 8:
|
|
399
408
|
return readReadonly(reader, typeReferenceNode);
|
|
400
409
|
case 9: {
|
|
410
|
+
const matchValue_11 = readTypeReference_1(true);
|
|
411
|
+
let matchResult_5, unresolved, resolved;
|
|
412
|
+
switch (matchValue_11.tag) {
|
|
413
|
+
case 13: {
|
|
414
|
+
if (matchValue_11.fields[0].Name === "InstanceType") {
|
|
415
|
+
matchResult_5 = 0;
|
|
416
|
+
unresolved = matchValue_11;
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
matchResult_5 = 1;
|
|
420
|
+
resolved = matchValue_11;
|
|
421
|
+
}
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
case 3: {
|
|
425
|
+
if (matchValue_11.fields[0].tag === 6) {
|
|
426
|
+
matchResult_5 = 0;
|
|
427
|
+
unresolved = matchValue_11;
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
matchResult_5 = 1;
|
|
431
|
+
resolved = matchValue_11;
|
|
432
|
+
}
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
default: {
|
|
436
|
+
matchResult_5 = 1;
|
|
437
|
+
resolved = matchValue_11;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
switch (matchResult_5) {
|
|
441
|
+
case 0:
|
|
442
|
+
return defaultArg(tryReadInstanceType(reader, typeReferenceNode), unresolved);
|
|
443
|
+
default:
|
|
444
|
+
return resolved;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
case 10: {
|
|
401
448
|
const awaited = (glueType_1_mut) => {
|
|
402
449
|
awaited:
|
|
403
450
|
while (true) {
|
|
404
451
|
const glueType_1 = glueType_1_mut;
|
|
405
|
-
let
|
|
452
|
+
let matchResult_6, result, glueType_2;
|
|
406
453
|
if (glueType_1.tag === 13) {
|
|
407
454
|
switch (glueType_1.fields[0].Name) {
|
|
408
455
|
case "Promise": {
|
|
409
456
|
if (!isEmpty(glueType_1.fields[0].TypeArguments)) {
|
|
410
457
|
if (isEmpty(tail(glueType_1.fields[0].TypeArguments))) {
|
|
411
458
|
if (glueType_1.fields[0].IsStandardLibrary) {
|
|
412
|
-
|
|
459
|
+
matchResult_6 = 0;
|
|
413
460
|
result = head(glueType_1.fields[0].TypeArguments);
|
|
414
461
|
}
|
|
415
462
|
else {
|
|
416
|
-
|
|
463
|
+
matchResult_6 = 1;
|
|
417
464
|
glueType_2 = glueType_1;
|
|
418
465
|
}
|
|
419
466
|
}
|
|
420
467
|
else {
|
|
421
|
-
|
|
468
|
+
matchResult_6 = 1;
|
|
422
469
|
glueType_2 = glueType_1;
|
|
423
470
|
}
|
|
424
471
|
}
|
|
425
472
|
else {
|
|
426
|
-
|
|
473
|
+
matchResult_6 = 1;
|
|
427
474
|
glueType_2 = glueType_1;
|
|
428
475
|
}
|
|
429
476
|
break;
|
|
@@ -432,36 +479,36 @@ function readTypeReference(reader, typeNode) {
|
|
|
432
479
|
if (!isEmpty(glueType_1.fields[0].TypeArguments)) {
|
|
433
480
|
if (isEmpty(tail(glueType_1.fields[0].TypeArguments))) {
|
|
434
481
|
if (glueType_1.fields[0].IsStandardLibrary) {
|
|
435
|
-
|
|
482
|
+
matchResult_6 = 0;
|
|
436
483
|
result = head(glueType_1.fields[0].TypeArguments);
|
|
437
484
|
}
|
|
438
485
|
else {
|
|
439
|
-
|
|
486
|
+
matchResult_6 = 1;
|
|
440
487
|
glueType_2 = glueType_1;
|
|
441
488
|
}
|
|
442
489
|
}
|
|
443
490
|
else {
|
|
444
|
-
|
|
491
|
+
matchResult_6 = 1;
|
|
445
492
|
glueType_2 = glueType_1;
|
|
446
493
|
}
|
|
447
494
|
}
|
|
448
495
|
else {
|
|
449
|
-
|
|
496
|
+
matchResult_6 = 1;
|
|
450
497
|
glueType_2 = glueType_1;
|
|
451
498
|
}
|
|
452
499
|
break;
|
|
453
500
|
}
|
|
454
501
|
default: {
|
|
455
|
-
|
|
502
|
+
matchResult_6 = 1;
|
|
456
503
|
glueType_2 = glueType_1;
|
|
457
504
|
}
|
|
458
505
|
}
|
|
459
506
|
}
|
|
460
507
|
else {
|
|
461
|
-
|
|
508
|
+
matchResult_6 = 1;
|
|
462
509
|
glueType_2 = glueType_1;
|
|
463
510
|
}
|
|
464
|
-
switch (
|
|
511
|
+
switch (matchResult_6) {
|
|
465
512
|
case 0: {
|
|
466
513
|
glueType_1_mut = result;
|
|
467
514
|
continue awaited;
|
|
@@ -831,7 +878,7 @@ export function readTypeNode(reader, typeNode) {
|
|
|
831
878
|
const literalTypeNode = typeNode;
|
|
832
879
|
const matchValue_2 = tryReadLiteral(checker, literalTypeNode.literal);
|
|
833
880
|
if (matchValue_2 == null) {
|
|
834
|
-
throw new Exception(Report_readerError_Z19516DCE("type node - literal type", "Could not read literal type", typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs",
|
|
881
|
+
throw new Exception(Report_readerError_Z19516DCE("type node - literal type", "Could not read literal type", typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 538));
|
|
835
882
|
}
|
|
836
883
|
else {
|
|
837
884
|
return new GlueType(/* Literal */ 8, [matchValue_2]);
|
|
@@ -846,7 +893,7 @@ export function readTypeNode(reader, typeNode) {
|
|
|
846
893
|
case 234:
|
|
847
894
|
return readExpressionWithTypeArguments(reader, typeNode);
|
|
848
895
|
default: {
|
|
849
|
-
const item = Report_readerError_Z19516DCE("type node", concat("Unsupported kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(typeNode.kind)), typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs",
|
|
896
|
+
const item = Report_readerError_Z19516DCE("type node", concat("Unsupported kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(typeNode.kind)), typeNode, "/_//src/Glutinum.Converter/Reader/TypeNode.fs", 682);
|
|
850
897
|
const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
851
898
|
void (objectArg.push(item));
|
|
852
899
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
@@ -3,7 +3,7 @@ import { isFromEsLib, typeLiteralId, readTypeArguments, getFullNameOrEmpty, defa
|
|
|
3
3
|
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
4
4
|
import { item as item_4, contains, filter as filter_1, append, collect, map, ofArray, isEmpty, choose, singleton, empty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
5
5
|
import { GlueReadonly, GlueRecord, GlueUtilityType, GlueInterface, GlueSubstitution_substituteMember, GlueSubstitution_mentionedTypeParameters, GlueTypeLiteral, GluePrimitive, GlueTypeUnion, GlueType, GlueLiteral } from "../GlueAST.js";
|
|
6
|
-
import { contains as contains_1, singleton as singleton_1, choose as choose_1, ofList as ofList_1, empty as empty_1, exists, map as map_1, filter, forAll, toList } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
6
|
+
import { contains as contains_1, singleton as singleton_1, choose as choose_1, ofList as ofList_1, empty as empty_1, tryHead, exists, map as map_1, filter, forAll, toList } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
7
7
|
import { toArray, defaultArg, value as value_6 } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
|
|
8
8
|
import { readInstantiatedMember, readPropertyWithoutDeclaration } from "./MemberTypes.js";
|
|
9
9
|
import { List_distinct } from "../../fable_modules/fable-library-js.5.21.0/Seq2.js";
|
|
@@ -691,6 +691,65 @@ export function readThisParameterType(reader, typeReferenceNode) {
|
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
|
|
694
|
+
export function tryReadInstanceType(reader, typeReferenceNode) {
|
|
695
|
+
let constraintNode, typNode, signature, typNode_1;
|
|
696
|
+
const argument = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(value_6(typeReferenceNode.typeArguments)[0]);
|
|
697
|
+
if (typeReferenceNode.pos < 0) {
|
|
698
|
+
return undefined;
|
|
699
|
+
}
|
|
700
|
+
else {
|
|
701
|
+
const matchValue = argument.flags;
|
|
702
|
+
if ($007CHasTypeFlags$007C_$007C(524288, matchValue) != null) {
|
|
703
|
+
let option_9;
|
|
704
|
+
let option_7;
|
|
705
|
+
let option_5;
|
|
706
|
+
let option_3;
|
|
707
|
+
const option_1 = argument.getSymbol();
|
|
708
|
+
if (option_1 != null) {
|
|
709
|
+
const symbol = option_1;
|
|
710
|
+
option_3 = symbol.declarations;
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
option_3 = undefined;
|
|
714
|
+
}
|
|
715
|
+
option_5 = ((option_3 != null) ? tryHead(option_3) : undefined);
|
|
716
|
+
if (option_5 != null) {
|
|
717
|
+
const declaration = option_5;
|
|
718
|
+
option_7 = declaration.constraint;
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
option_7 = undefined;
|
|
722
|
+
}
|
|
723
|
+
option_9 = ((option_7 != null) ? (((constraintNode = option_7, constraintNode.kind === 187)) ? option_7 : undefined) : undefined);
|
|
724
|
+
if (option_9 != null) {
|
|
725
|
+
return (typNode = option_9, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode));
|
|
726
|
+
}
|
|
727
|
+
else {
|
|
728
|
+
return undefined;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
else {
|
|
732
|
+
let option_15;
|
|
733
|
+
let option_13;
|
|
734
|
+
const option_11 = tryHead(argument.getConstructSignatures());
|
|
735
|
+
option_13 = ((option_11 != null) ? ((signature = option_11, signature.getReturnType())) : undefined);
|
|
736
|
+
if (option_13 != null) {
|
|
737
|
+
const instance = option_13;
|
|
738
|
+
option_15 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(instance, undefined, typeNodeBuilderFlags);
|
|
739
|
+
}
|
|
740
|
+
else {
|
|
741
|
+
option_15 = undefined;
|
|
742
|
+
}
|
|
743
|
+
if (option_15 != null) {
|
|
744
|
+
return (typNode_1 = option_15, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode_1));
|
|
745
|
+
}
|
|
746
|
+
else {
|
|
747
|
+
return undefined;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
694
753
|
export function readOmitOrPick(reader, typeReferenceNode, keepListedKeys) {
|
|
695
754
|
let option_1, matchValue_4, item_1, objectArg_2, objectArg_3;
|
|
696
755
|
let keysToOmitType;
|
|
@@ -709,6 +768,9 @@ export function readOmitOrPick(reader, typeReferenceNode, keepListedKeys) {
|
|
|
709
768
|
else if ($007CHasTypeFlags$007C_$007C(33554432, matchValue) != null) {
|
|
710
769
|
matchResult = 0;
|
|
711
770
|
}
|
|
771
|
+
else if ($007CHasTypeFlags$007C_$007C(67108864, matchValue) != null) {
|
|
772
|
+
matchResult = 0;
|
|
773
|
+
}
|
|
712
774
|
else {
|
|
713
775
|
matchResult = 1;
|
|
714
776
|
}
|
|
@@ -721,15 +783,15 @@ export function readOmitOrPick(reader, typeReferenceNode, keepListedKeys) {
|
|
|
721
783
|
hasUnboundKeys = false;
|
|
722
784
|
}
|
|
723
785
|
const tryReadValueOfKeys = (typ) => {
|
|
724
|
-
const
|
|
725
|
-
if (
|
|
726
|
-
const item = Report_readerError_Z19516DCE("keysToOmit", "Expected a string literal", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/UtilityType.fs",
|
|
786
|
+
const activePatternResult_4 = Type_StringLiteral_$007CString$007COther$007C(typ);
|
|
787
|
+
if (activePatternResult_4.tag === 1) {
|
|
788
|
+
const item = Report_readerError_Z19516DCE("keysToOmit", "Expected a string literal", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/UtilityType.fs", 650);
|
|
727
789
|
const objectArg_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
728
790
|
void (objectArg_1.push(item));
|
|
729
791
|
return undefined;
|
|
730
792
|
}
|
|
731
793
|
else {
|
|
732
|
-
return
|
|
794
|
+
return activePatternResult_4.fields[0];
|
|
733
795
|
}
|
|
734
796
|
};
|
|
735
797
|
let keysToOmit;
|
|
@@ -788,7 +850,7 @@ export function readOmitOrPick(reader, typeReferenceNode, keepListedKeys) {
|
|
|
788
850
|
const filteredProperties = toList(filter((prop) => (keepListedKeys === contains_1(prop.name, keysToOmit, {
|
|
789
851
|
Equals: (x, y) => (x === y),
|
|
790
852
|
GetHashCode: (x) => (stringHash(x) | 0),
|
|
791
|
-
})), (matchValue_4 = baseType.flags, ($007CHasTypeFlags$007C_$007C(1, matchValue_4) != null) ? ((literalMembers != null) ? [] : (($007CHasTypeFlags$007C_$007C(1, matchValue_4) != null) ? (((item_1 = Report_readerError_Z19516DCE("omit base type", "Was not able to resolve the base type, and defaulting to any. If the base type is defined, in another file, please make sure to include it in the input files", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/UtilityType.fs",
|
|
853
|
+
})), (matchValue_4 = baseType.flags, ($007CHasTypeFlags$007C_$007C(1, matchValue_4) != null) ? ((literalMembers != null) ? [] : (($007CHasTypeFlags$007C_$007C(1, matchValue_4) != null) ? (((item_1 = Report_readerError_Z19516DCE("omit base type", "Was not able to resolve the base type, and defaulting to any. If the base type is defined, in another file, please make sure to include it in the input files", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/UtilityType.fs", 685), (objectArg_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"](), void (objectArg_2.push(item_1)))), [])) : ((objectArg_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), objectArg_3.getPropertiesOfType(baseType))))) : (($007CHasTypeFlags$007C_$007C(1, matchValue_4) != null) ? (((item_1 = Report_readerError_Z19516DCE("omit base type", "Was not able to resolve the base type, and defaulting to any. If the base type is defined, in another file, please make sure to include it in the input files", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/UtilityType.fs", 685), (objectArg_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"](), void (objectArg_2.push(item_1)))), [])) : ((objectArg_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), objectArg_3.getPropertiesOfType(baseType)))))));
|
|
792
854
|
const isInProgress = exists((inProgress) => (inProgress === baseType), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Expansions);
|
|
793
855
|
const members_1 = isInProgress ? empty() : withInProgress(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Expansions, baseType, () => collect((property) => readPropertyMembers(reader, typeReferenceNode, property), filteredProperties));
|
|
794
856
|
const defaults = defaultTypeArguments(reader, value_6(typeReferenceNode.typeArguments)[0]);
|
|
@@ -910,7 +972,7 @@ export function readReadonly(reader, typeReferenceNode) {
|
|
|
910
972
|
}, unionType.types))])])]);
|
|
911
973
|
}
|
|
912
974
|
catch (matchValue_2) {
|
|
913
|
-
const item = Report_readerError_Z19516DCE("Readonly", "Unable to read the members of the union type", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/UtilityType.fs",
|
|
975
|
+
const item = Report_readerError_Z19516DCE("Readonly", "Unable to read the members of the union type", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/UtilityType.fs", 821);
|
|
914
976
|
const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
915
977
|
void (objectArg.push(item));
|
|
916
978
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
@@ -28,7 +28,7 @@ import { applyWith as applyWith_1, disambiguateOverloads, aliasesOf, parametersS
|
|
|
28
28
|
import { isCandidate, tryResolveMembers, methodAsProperty } from "./Transformer/ParamObjectCandidate.js";
|
|
29
29
|
import { max, min } from "../fable_modules/fable-library-js.5.21.0/Double.js";
|
|
30
30
|
import { inheritsIterable, asMethods, tryCallableHeritage } from "./Transformer/CallableProperties.js";
|
|
31
|
-
import { withoutBaseClassProperties, tryAllProperties, withoutBasesOfBases, isInheritableType, isSelfHeritage, isArrayHeritage, isErrorHeritage, thisMembersOfBases, withoutRedeclaredBases } from "./Transformer/Heritage.js";
|
|
31
|
+
import { withoutBaseClassProperties, tryAllProperties, withoutBasesOfBases, isInheritableType, isSelfHeritage, isArrayHeritage, isErrorHeritage, thisMembersOfBases, withoutConflictingInstantiations, withoutRedeclaredBases } from "./Transformer/Heritage.js";
|
|
32
32
|
import { op_UnaryNegation_Int32 } from "../fable_modules/fable-library-js.5.21.0/Int32.js";
|
|
33
33
|
import { transformEnum } from "./Transformer/Enum.js";
|
|
34
34
|
import { Transforms, transformExports } from "./Transformer/Exports.js";
|
|
@@ -3225,17 +3225,18 @@ function tryTransformCallableInterface(context, info) {
|
|
|
3225
3225
|
}
|
|
3226
3226
|
|
|
3227
3227
|
function transformInterface(context, info) {
|
|
3228
|
-
let
|
|
3228
|
+
let members_4, typeMemory_1, ownNames;
|
|
3229
3229
|
let info_1;
|
|
3230
3230
|
const thisType = new GlueThisType(info.Name, info.TypeParameters);
|
|
3231
3231
|
const patternInput = withoutRedeclaredBases(TransformContext__get_TypeMemory(context), thisType, info.Members, info.HeritageClauses);
|
|
3232
|
-
const
|
|
3233
|
-
const
|
|
3234
|
-
const
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
const
|
|
3238
|
-
const
|
|
3232
|
+
const patternInput_1 = withoutConflictingInstantiations(TransformContext__get_TypeMemory(context), thisType, patternInput[1], patternInput[0]);
|
|
3233
|
+
const members_1 = patternInput_1[1];
|
|
3234
|
+
const heritageClauses_1 = patternInput_1[0];
|
|
3235
|
+
const members_2 = append(members_1, thisMembersOfBases(TransformContext__get_TypeMemory(context), thisType, members_1, heritageClauses_1));
|
|
3236
|
+
info_1 = (new GlueInterface(info.Documentation, info.FullName, info.Name, (members_4 = asMethods(TransformContext__get_TypeMemory(context), members_2), resolveMembers(TransformContext__get_State(context).Conditionals, members_4)), info.TypeParameters, heritageClauses_1));
|
|
3237
|
+
const patternInput_2 = sanitizeTypeNameAndPushScope(info_1.Name, context);
|
|
3238
|
+
const name = patternInput_2[0];
|
|
3239
|
+
const context_1 = patternInput_2[1];
|
|
3239
3240
|
const xmlDocInfo = transformComment(info_1.Documentation);
|
|
3240
3241
|
const membersComingFromPartial = concat_1(map((fullName) => {
|
|
3241
3242
|
if (contains_1(fullName, TransformContext__get_State(context_1).PartialHeritageBeingExpanded, {
|
|
@@ -3293,17 +3294,17 @@ function transformInterface(context, info) {
|
|
|
3293
3294
|
}
|
|
3294
3295
|
}, map((typ) => TransformContext__ExposeTypeAlias_1CE4A880(context_1, typ), info_1.HeritageClauses))));
|
|
3295
3296
|
const membersComingFromOmit = collect((heritageClause_1) => {
|
|
3296
|
-
let matchResult,
|
|
3297
|
+
let matchResult, members_5;
|
|
3297
3298
|
if (heritageClause_1.tag === 27) {
|
|
3298
3299
|
switch (heritageClause_1.fields[0].tag) {
|
|
3299
3300
|
case 4: {
|
|
3300
3301
|
matchResult = 0;
|
|
3301
|
-
|
|
3302
|
+
members_5 = heritageClause_1.fields[0].fields[0];
|
|
3302
3303
|
break;
|
|
3303
3304
|
}
|
|
3304
3305
|
case 5: {
|
|
3305
3306
|
matchResult = 0;
|
|
3306
|
-
|
|
3307
|
+
members_5 = heritageClause_1.fields[0].fields[0];
|
|
3307
3308
|
break;
|
|
3308
3309
|
}
|
|
3309
3310
|
default:
|
|
@@ -3315,7 +3316,7 @@ function transformInterface(context, info) {
|
|
|
3315
3316
|
}
|
|
3316
3317
|
switch (matchResult) {
|
|
3317
3318
|
case 0:
|
|
3318
|
-
return TransformMembers_toFSharpMember(context_1,
|
|
3319
|
+
return TransformMembers_toFSharpMember(context_1, members_5);
|
|
3319
3320
|
default:
|
|
3320
3321
|
return empty();
|
|
3321
3322
|
}
|
|
@@ -3451,7 +3452,7 @@ function transformInterface(context, info) {
|
|
|
3451
3452
|
Equals: equals,
|
|
3452
3453
|
GetHashCode: (x_2) => (safeHash(x_2) | 0),
|
|
3453
3454
|
}), delay(() => {
|
|
3454
|
-
let
|
|
3455
|
+
let heritageClauses_2;
|
|
3455
3456
|
const merged = collect((_arg_3) => {
|
|
3456
3457
|
let matchResult_5, candidate_1;
|
|
3457
3458
|
if (_arg_3.tag === 1) {
|
|
@@ -3473,8 +3474,8 @@ function transformInterface(context, info) {
|
|
|
3473
3474
|
return empty();
|
|
3474
3475
|
}
|
|
3475
3476
|
}, TransformContext__get_TypeMemory(context_1));
|
|
3476
|
-
|
|
3477
|
-
if (!inheritsIterable(TransformContext__get_TypeMemory(context_1),
|
|
3477
|
+
heritageClauses_2 = (isEmpty(merged) ? info_1.HeritageClauses : merged);
|
|
3478
|
+
if (!inheritsIterable(TransformContext__get_TypeMemory(context_1), heritageClauses_2)) {
|
|
3478
3479
|
const matchValue_2 = TypeLiteral_tryFindIterableType(context_1, info_1.Members);
|
|
3479
3480
|
if (matchValue_2 == null) {
|
|
3480
3481
|
return empty_1();
|
|
@@ -5410,7 +5411,7 @@ function exposeSpecializedAlias(name_mut, acc_mut, tailedTypeParameters_mut, typ
|
|
|
5410
5411
|
}
|
|
5411
5412
|
|
|
5412
5413
|
function transformClassDeclaration(context, classDeclaration) {
|
|
5413
|
-
let list_7, f2_1, context_2,
|
|
5414
|
+
let list_7, f2_1, context_2, members_4, members_3;
|
|
5414
5415
|
const patternInput = sanitizeTypeNameAndPushScope(classDeclaration.Name, context);
|
|
5415
5416
|
const name = patternInput[0];
|
|
5416
5417
|
const context_1 = patternInput[1];
|
|
@@ -5420,13 +5421,14 @@ function transformClassDeclaration(context, classDeclaration) {
|
|
|
5420
5421
|
let classDeclaration_1;
|
|
5421
5422
|
const thisType = new GlueThisType(classDeclaration.Name, classDeclaration.TypeParameters);
|
|
5422
5423
|
const patternInput_1 = withoutRedeclaredBases(TransformContext__get_TypeMemory(context_1), thisType, classDeclaration.Members, classDeclaration.HeritageClauses);
|
|
5423
|
-
const
|
|
5424
|
-
const
|
|
5425
|
-
|
|
5424
|
+
const patternInput_2 = withoutConflictingInstantiations(TransformContext__get_TypeMemory(context_1), thisType, patternInput_1[1], patternInput_1[0]);
|
|
5425
|
+
const members_1 = patternInput_2[1];
|
|
5426
|
+
const heritageClauses_1 = patternInput_2[0];
|
|
5427
|
+
classDeclaration_1 = (new GlueClassDeclaration(classDeclaration.Documentation, classDeclaration.FullName, classDeclaration.Name, classDeclaration.Constructors, append(members_1, thisMembersOfBases(TransformContext__get_TypeMemory(context_1), thisType, members_1, heritageClauses_1)), classDeclaration.TypeParameters, heritageClauses_1, classDeclaration.IsExported));
|
|
5426
5428
|
const typeParametersResult = transformDeclarationTypeParameters(context_1, classDeclaration_1.TypeParameters);
|
|
5427
|
-
const
|
|
5428
|
-
const otherInheritance =
|
|
5429
|
-
const errorInheritance =
|
|
5429
|
+
const patternInput_3 = partition(isErrorHeritage, filter((arg) => !isSelfHeritage(classDeclaration_1.FullName, arg), classDeclaration_1.HeritageClauses));
|
|
5430
|
+
const otherInheritance = patternInput_3[1];
|
|
5431
|
+
const errorInheritance = patternInput_3[0];
|
|
5430
5432
|
const isErrorDerived = (visited, heritageClause_2) => {
|
|
5431
5433
|
if (heritageClause_2.tag === 13) {
|
|
5432
5434
|
const typeReference = heritageClause_2.fields[0];
|
|
@@ -5483,7 +5485,7 @@ function transformClassDeclaration(context, classDeclaration) {
|
|
|
5483
5485
|
const defaultAliases = exposeSpecializedAlias(name, empty(), empty(), reverse(typeParametersResult.TypeParameters));
|
|
5484
5486
|
specialiazedAlias = append(defaultAliases, ofArray(toArray(makeSealedTypeAlias(name, aliasArities(typeParametersResult.TypeParameters, defaultAliases), typeParametersResult))));
|
|
5485
5487
|
const xmlDoc = transformComment(classDeclaration_1.Documentation);
|
|
5486
|
-
return cons(new FSharpType(/* Interface */ 5, [new FSharpInterface(toList(delay(() => append_1(singleton_1(FSharpAttribute.AllowNullLiteral), delay(() => append_1(hasErrorInheritance ? append_1(singleton_1(FSharpAttribute.AbstractClass), delay(() => importAttribute(classDeclaration_1.Name, TransformContext__get_ImportSource(context_1)))) : singleton_1(FSharpAttribute.Interface), delay(() => xmlDoc.ObsoleteAttributes)))))), name, xmlDoc.XmlDoc, classDeclaration_1.Name, typeParametersResult.TypeParameters, TransformMembers_toFSharpMember(context_1, (
|
|
5488
|
+
return cons(new FSharpType(/* Interface */ 5, [new FSharpInterface(toList(delay(() => append_1(singleton_1(FSharpAttribute.AllowNullLiteral), delay(() => append_1(hasErrorInheritance ? append_1(singleton_1(FSharpAttribute.AbstractClass), delay(() => importAttribute(classDeclaration_1.Name, TransformContext__get_ImportSource(context_1)))) : singleton_1(FSharpAttribute.Interface), delay(() => xmlDoc.ObsoleteAttributes)))))), name, xmlDoc.XmlDoc, classDeclaration_1.Name, typeParametersResult.TypeParameters, TransformMembers_toFSharpMember(context_1, (members_4 = ((members_3 = withoutBaseClassProperties(TransformContext__get_TypeMemory(context_1), classDeclaration_1.HeritageClauses, classDeclaration_1.Members), asMethods(TransformContext__get_TypeMemory(context_1), members_3))), resolveMembers(TransformContext__get_State(context_1).Conditionals, members_4))), inheritance)]), specialiazedAlias);
|
|
5487
5489
|
}
|
|
5488
5490
|
|
|
5489
5491
|
function keysMemberTransform(scope, memberName) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
import { ofList, add, empty as empty_1, FSharpSet__Add, FSharpSet__Contains, ofSeq } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
|
|
3
3
|
import { equals, stringHash, comparePrimitives } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
4
|
-
import { exists, take, forAll2, length, indexed as indexed_1, fold, forAll, head, tail, map, singleton, filter, empty, choose, append, collect as collect_1, tryPick, ofArray, contains, isEmpty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
4
|
+
import { cons, exists, take, forAll2, length, indexed as indexed_1, fold, forAll, head, tail, map, singleton, filter, empty, choose, append, collect as collect_1, tryPick, ofArray, contains, isEmpty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
5
5
|
import { value as value_1, defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
|
|
6
6
|
import { Record } from "../../fable_modules/fable-library-js.5.21.0/Types.js";
|
|
7
7
|
import { GlueSubstitution_substitute, GlueSubstitution_substituteMember, GlueSubstitution_ofTypeArguments, GlueSubstitution_substituteParameter, GluePrimitive, GlueTypeReference, GlueTypeUnion, GlueType, GlueFunctionType, GlueParameter, GlueType_$reflection, GlueMember_$reflection, GlueTypeParameter_$reflection } from "../GlueAST.js";
|
|
8
8
|
import { record_type, list_type } from "../../fable_modules/fable-library-js.5.21.0/Reflection.js";
|
|
9
9
|
import { List_distinctBy } from "../../fable_modules/fable-library-js.5.21.0/Seq2.js";
|
|
10
|
-
import { add as add_1, ofList as ofList_1 } from "../../fable_modules/fable-library-js.5.21.0/Map.js";
|
|
10
|
+
import { FSharpMap__get_Item, add as add_1, ofList as ofList_1 } from "../../fable_modules/fable-library-js.5.21.0/Map.js";
|
|
11
11
|
import { max } from "../../fable_modules/fable-library-js.5.21.0/Double.js";
|
|
12
12
|
|
|
13
13
|
const primitiveNames = ofSeq(["string", "float", "int", "bool", "obj", "unit", "bigint"], {
|
|
@@ -546,6 +546,180 @@ export function withoutRedeclaredBases(typeMemory, thisType, members, heritageCl
|
|
|
546
546
|
return [patternInput_1[1], patternInput_1[0]];
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
+
function keyOf(typeReference) {
|
|
550
|
+
if (typeReference.FullName !== "") {
|
|
551
|
+
return typeReference.FullName;
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
return typeReference.Name;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function instantiations(typeMemory, visited, heritageClause) {
|
|
559
|
+
let f2, visited_1;
|
|
560
|
+
let matchResult, typeReference_1;
|
|
561
|
+
if (heritageClause.tag === 13) {
|
|
562
|
+
if (!FSharpSet__Contains(visited, keyOf(heritageClause.fields[0]))) {
|
|
563
|
+
matchResult = 0;
|
|
564
|
+
typeReference_1 = heritageClause.fields[0];
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
matchResult = 1;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
matchResult = 1;
|
|
572
|
+
}
|
|
573
|
+
switch (matchResult) {
|
|
574
|
+
case 0: {
|
|
575
|
+
const key = keyOf(typeReference_1);
|
|
576
|
+
const matchValue = tryFindBase(typeMemory, typeReference_1);
|
|
577
|
+
if (matchValue == null) {
|
|
578
|
+
return singleton([key, map(comparable, typeReference_1.TypeArguments)]);
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
const declaration = matchValue;
|
|
582
|
+
const substitutions = GlueSubstitution_ofTypeArguments(declaration.TypeParameters, typeReference_1.TypeArguments);
|
|
583
|
+
return cons([key, map((typeParameter) => comparable(FSharpMap__get_Item(substitutions, typeParameter.Name)), declaration.TypeParameters)], collect_1((f2 = ((visited_1 = FSharpSet__Add(visited, key), (heritageClause_1) => instantiations(typeMemory, visited_1, heritageClause_1))), (arg) => f2(GlueSubstitution_substitute(substitutions, arg))), declaration.HeritageClauses));
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
default:
|
|
587
|
+
return empty();
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
function mentionsTypeParameter(glueType_mut) {
|
|
592
|
+
mentionsTypeParameter:
|
|
593
|
+
while (true) {
|
|
594
|
+
const glueType = glueType_mut;
|
|
595
|
+
let matchResult, elementType;
|
|
596
|
+
switch (glueType.tag) {
|
|
597
|
+
case 16: {
|
|
598
|
+
matchResult = 0;
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
case 13: {
|
|
602
|
+
matchResult = 1;
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
605
|
+
case 14: {
|
|
606
|
+
matchResult = 2;
|
|
607
|
+
elementType = glueType.fields[0];
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
case 31: {
|
|
611
|
+
matchResult = 2;
|
|
612
|
+
elementType = glueType.fields[0];
|
|
613
|
+
break;
|
|
614
|
+
}
|
|
615
|
+
case 23: {
|
|
616
|
+
matchResult = 2;
|
|
617
|
+
elementType = glueType.fields[0];
|
|
618
|
+
break;
|
|
619
|
+
}
|
|
620
|
+
case 7: {
|
|
621
|
+
matchResult = 3;
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
case 18: {
|
|
625
|
+
matchResult = 4;
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
default:
|
|
629
|
+
matchResult = 5;
|
|
630
|
+
}
|
|
631
|
+
switch (matchResult) {
|
|
632
|
+
case 0:
|
|
633
|
+
return true;
|
|
634
|
+
case 1:
|
|
635
|
+
return exists(mentionsTypeParameter, glueType.fields[0].TypeArguments);
|
|
636
|
+
case 2: {
|
|
637
|
+
glueType_mut = elementType;
|
|
638
|
+
continue mentionsTypeParameter;
|
|
639
|
+
}
|
|
640
|
+
case 3:
|
|
641
|
+
return exists(mentionsTypeParameter, glueType.fields[0].fields[0]);
|
|
642
|
+
case 4:
|
|
643
|
+
return exists(mentionsTypeParameter, glueType.fields[0]);
|
|
644
|
+
default:
|
|
645
|
+
return false;
|
|
646
|
+
}
|
|
647
|
+
break;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* F# rejects an interface reached with two instantiations that may unify (FS3360)
|
|
653
|
+
*/
|
|
654
|
+
export function withoutConflictingInstantiations(typeMemory, thisType, members, heritageClauses) {
|
|
655
|
+
const resolve = (tupledArg_2, heritageClauses_1) => fold((tupledArg_3, heritageClause) => {
|
|
656
|
+
let substitutions_1;
|
|
657
|
+
const members_2 = tupledArg_3[0];
|
|
658
|
+
const kept_1 = tupledArg_3[1];
|
|
659
|
+
const inherited_2 = tupledArg_3[2];
|
|
660
|
+
const candidate_1 = instantiations(typeMemory, empty_1({
|
|
661
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
662
|
+
}), heritageClause);
|
|
663
|
+
if (!exists((tupledArg) => {
|
|
664
|
+
const arguments$ = tupledArg[1];
|
|
665
|
+
return exists((tupledArg_1) => {
|
|
666
|
+
const inheritedArguments = tupledArg_1[1];
|
|
667
|
+
if ((tupledArg_1[0] === tupledArg[0]) && !equals(inheritedArguments, arguments$)) {
|
|
668
|
+
return exists(mentionsTypeParameter, append(inheritedArguments, arguments$));
|
|
669
|
+
}
|
|
670
|
+
else {
|
|
671
|
+
return false;
|
|
672
|
+
}
|
|
673
|
+
}, inherited_2);
|
|
674
|
+
}, candidate_1)) {
|
|
675
|
+
return [members_2, append(kept_1, singleton(heritageClause)), append(inherited_2, candidate_1)];
|
|
676
|
+
}
|
|
677
|
+
else {
|
|
678
|
+
let matchResult, typeReference_1;
|
|
679
|
+
if (heritageClause.tag === 13) {
|
|
680
|
+
if (!exists((tupledArg_4) => (tupledArg_4[0] === keyOf(heritageClause.fields[0])), inherited_2)) {
|
|
681
|
+
matchResult = 0;
|
|
682
|
+
typeReference_1 = heritageClause.fields[0];
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
matchResult = 1;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
else {
|
|
689
|
+
matchResult = 1;
|
|
690
|
+
}
|
|
691
|
+
switch (matchResult) {
|
|
692
|
+
case 0: {
|
|
693
|
+
const matchValue = tryFindBase(typeMemory, typeReference_1);
|
|
694
|
+
if (matchValue == null) {
|
|
695
|
+
return [members_2, kept_1, inherited_2];
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
const baseDeclaration = matchValue;
|
|
699
|
+
const substitutions = GlueSubstitution_ofTypeArguments(baseDeclaration.TypeParameters, typeReference_1.TypeArguments);
|
|
700
|
+
const names = ofList(choose(memberName, members_2), {
|
|
701
|
+
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
702
|
+
});
|
|
703
|
+
return resolve([append(members_2, filter((baseMember) => {
|
|
704
|
+
const matchValue_1 = memberName(baseMember);
|
|
705
|
+
if (matchValue_1 == null) {
|
|
706
|
+
return !exists((b) => isSameKind(baseMember, b), members_2);
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
return !FSharpSet__Contains(names, matchValue_1);
|
|
710
|
+
}
|
|
711
|
+
}, map((substitutions_1 = add_1("this", new GlueType(/* ThisType */ 17, [thisType]), substitutions), (glueMember_1) => GlueSubstitution_substituteMember(substitutions_1, glueMember_1)), baseDeclaration.Members))), kept_1, inherited_2], map((glueType_1) => GlueSubstitution_substitute(substitutions, glueType_1), baseDeclaration.HeritageClauses));
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
default:
|
|
715
|
+
return [members_2, kept_1, inherited_2];
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}, [tupledArg_2[0], tupledArg_2[1], tupledArg_2[2]], heritageClauses_1);
|
|
719
|
+
const patternInput = resolve([members, empty(), empty()], heritageClauses);
|
|
720
|
+
return [patternInput[1], patternInput[0]];
|
|
721
|
+
}
|
|
722
|
+
|
|
549
723
|
function mentionsThis(glueType_mut) {
|
|
550
724
|
mentionsThis:
|
|
551
725
|
while (true) {
|