@glutinum/cli 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Glutinum.Converter/Generate.js +1 -1
- package/dist/Glutinum.Converter/Generate.js.map +1 -1
- package/dist/Glutinum.Converter/GlueAST.js +36 -17
- package/dist/Glutinum.Converter/GlueAST.js.map +1 -1
- package/dist/Glutinum.Converter/Merge.js +86 -0
- package/dist/Glutinum.Converter/Merge.js.map +1 -0
- package/dist/Glutinum.Converter/Read.js +5 -2
- package/dist/Glutinum.Converter/Read.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +1 -1
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +1 -1
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +2 -2
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/NamedTupleMember.js +1 -1
- package/dist/Glutinum.Converter/Reader/Node.js +1 -1
- package/dist/Glutinum.Converter/Reader/TypeNode.js +17 -16
- package/dist/Glutinum.Converter/Reader/TypeNode.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +8 -1
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Utils.js +13 -6
- package/dist/Glutinum.Converter/Reader/Utils.js.map +1 -1
- package/dist/Glutinum.Converter/Transform.js +183 -90
- package/dist/Glutinum.Converter/Transform.js.map +1 -1
- package/dist/fable_modules/project_cracked.json +1 -1
- package/package.json +1 -1
|
@@ -3,12 +3,13 @@ import { printf, toFail, interpolate, toText, join, trimStart } from "../fable_m
|
|
|
3
3
|
import { Record } from "../fable_modules/fable-library-js.4.14.0/Types.js";
|
|
4
4
|
import { FSharpTypeParameter_Create_Z6CFD3565, FSharpTypeAlias, FSharpEnum, FSharpEnumCase, FSharpUnionCaseNamed, FSharpStaticMemberInfo, FSharpAccessor, FSharpMember, FSharpMemberInfo, FSharpMemberInfoBody, FSharpMapped, FSharpInterface, FSharpClass, FSharpConstructor, FSharpAccessibility, FSharpExplicitField, FSharpParameter, FSharpFunctionType, FSharpTypeReference, FSharpUnion, FSharpUnionCase, FSharpPrimitive, FSharpLiteral, FSharpCommentTypeParam, FSharpCommentParam, FSharpXmlDoc, FSharpAttribute, FSharpType, FSharpModule, FSharpType_$reflection, FSharpXmlDoc_$reflection, FSharpAttribute_$reflection } from "./FsharpAST.js";
|
|
5
5
|
import { empty as empty_1, singleton as singleton_1, collect, append, delay, toList } from "../fable_modules/fable-library-js.4.14.0/Seq.js";
|
|
6
|
-
import { exists,
|
|
6
|
+
import { exists, item, concat, tryFind, choose, collect as collect_1, ofArray, forAll, filter, mapIndexed, length, partition, sortBy, map, append as append_1, head as head_1, tail, singleton, empty, isEmpty } from "../fable_modules/fable-library-js.4.14.0/List.js";
|
|
7
7
|
import { sanitizeNameWithResult, removeSurroundingQuotes, sanitizeName } from "./Utils/Naming.js";
|
|
8
8
|
import { bind, unwrap, value as value_4, map as map_1, defaultArg } from "../fable_modules/fable-library-js.4.14.0/Option.js";
|
|
9
9
|
import { int32ToString, safeHash, equals, comparePrimitives } from "../fable_modules/fable-library-js.4.14.0/Util.js";
|
|
10
10
|
import { GlueType, GlueTypeUnion, GlueMember, GlueProperty, GlueAccessor, GlueType__get_Name, GlueConstructor } from "./GlueAST.js";
|
|
11
11
|
import { List_distinct } from "../fable_modules/fable-library-js.4.14.0/Seq2.js";
|
|
12
|
+
import { apply as apply_1 } from "./Merge.js";
|
|
12
13
|
|
|
13
14
|
export class Reporter {
|
|
14
15
|
constructor() {
|
|
@@ -27,15 +28,17 @@ export function Reporter_$ctor() {
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export class TransformContext {
|
|
30
|
-
constructor(reporter, currentScopeName, parent) {
|
|
31
|
+
constructor(reporter, currentScopeName, typeMemory, parent) {
|
|
31
32
|
let matchValue;
|
|
32
33
|
this.reporter = reporter;
|
|
33
34
|
this.currentScopeName = currentScopeName;
|
|
35
|
+
this.typeMemory = typeMemory;
|
|
34
36
|
this.parent = parent;
|
|
35
37
|
this.types = [];
|
|
36
38
|
this.modules = [];
|
|
37
39
|
this["FullName@"] = ((matchValue = this.parent, (matchValue != null) ? trimStart((TransformContext__get_FullName(matchValue) + ".") + this.currentScopeName, ".") : ""));
|
|
38
40
|
this["CurrentScopeName@"] = this.currentScopeName;
|
|
41
|
+
this["TypeMemory@"] = this.typeMemory;
|
|
39
42
|
this["_types@"] = this.types;
|
|
40
43
|
this["_Reporter@"] = this.reporter;
|
|
41
44
|
}
|
|
@@ -45,8 +48,8 @@ export function TransformContext_$reflection() {
|
|
|
45
48
|
return class_type("Glutinum.Converter.Transform.TransformContext", void 0, TransformContext);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
export function TransformContext_$
|
|
49
|
-
return new TransformContext(reporter, currentScopeName, parent);
|
|
51
|
+
export function TransformContext_$ctor_Z4CBC0890(reporter, currentScopeName, typeMemory, parent) {
|
|
52
|
+
return new TransformContext(reporter, currentScopeName, typeMemory, parent);
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
export class TransformCommentResult extends Record {
|
|
@@ -99,6 +102,10 @@ export function TransformContext__get_CurrentScopeName(__) {
|
|
|
99
102
|
return __["CurrentScopeName@"];
|
|
100
103
|
}
|
|
101
104
|
|
|
105
|
+
export function TransformContext__get_TypeMemory(__) {
|
|
106
|
+
return __["TypeMemory@"];
|
|
107
|
+
}
|
|
108
|
+
|
|
102
109
|
export function TransformContext__get__types(__) {
|
|
103
110
|
return __["_types@"];
|
|
104
111
|
}
|
|
@@ -123,7 +130,7 @@ export function TransformContext__ExposeType_Z1D58A540(_, typ) {
|
|
|
123
130
|
}
|
|
124
131
|
|
|
125
132
|
export function TransformContext__PushScope_Z721C83C5(this$, scopeName) {
|
|
126
|
-
const childContext = TransformContext_$
|
|
133
|
+
const childContext = TransformContext_$ctor_Z4CBC0890(this$.reporter, scopeName, this$.typeMemory, this$);
|
|
127
134
|
void (this$.modules.push(childContext));
|
|
128
135
|
return childContext;
|
|
129
136
|
}
|
|
@@ -363,13 +370,13 @@ function transformType(context_mut, glueType_mut) {
|
|
|
363
370
|
switch (glueType.tag) {
|
|
364
371
|
case 3:
|
|
365
372
|
return new FSharpType(7, [transformPrimitive(glueType.fields[0])]);
|
|
366
|
-
case
|
|
373
|
+
case 25:
|
|
367
374
|
return new FSharpType(7, [new FSharpPrimitive(0, [])]);
|
|
368
|
-
case
|
|
375
|
+
case 22:
|
|
369
376
|
return new FSharpType(2, [transformType(context, glueType.fields[0])]);
|
|
370
|
-
case
|
|
377
|
+
case 17:
|
|
371
378
|
return new FSharpType(14, [glueType.fields[0]]);
|
|
372
|
-
case
|
|
379
|
+
case 18:
|
|
373
380
|
return transformTupleType(context, glueType.fields[0]);
|
|
374
381
|
case 7: {
|
|
375
382
|
const patternInput = partition((glueType_2) => {
|
|
@@ -413,21 +420,21 @@ function transformType(context_mut, glueType_mut) {
|
|
|
413
420
|
const typeReference = glueType.fields[0];
|
|
414
421
|
return new FSharpType(10, [new FSharpTypeReference(mapTypeNameToFableCoreAwareName(context, typeReference), typeReference.FullName, map((glueType_3) => transformType(context, glueType_3), typeReference.TypeArguments), new FSharpType(7, [new FSharpPrimitive(0, [])]))]);
|
|
415
422
|
}
|
|
416
|
-
case
|
|
423
|
+
case 14:
|
|
417
424
|
return new FSharpType(13, [transformType(context, glueType.fields[0])]);
|
|
418
425
|
case 12: {
|
|
419
426
|
const classDeclaration = glueType.fields[0];
|
|
420
427
|
return new FSharpType(10, [new FSharpTypeReference(classDeclaration.Name, classDeclaration.Name, empty(), new FSharpType(9, []))]);
|
|
421
428
|
}
|
|
422
|
-
case
|
|
429
|
+
case 16:
|
|
423
430
|
return new FSharpType(12, [glueType.fields[0]]);
|
|
424
|
-
case
|
|
431
|
+
case 15: {
|
|
425
432
|
const functionTypeInfo = glueType.fields[0];
|
|
426
|
-
return new FSharpType(15, [new FSharpFunctionType(map((
|
|
433
|
+
return new FSharpType(15, [new FSharpFunctionType(map((parameter_1) => transformParameter(context, parameter_1), filter((parameter) => (parameter.Name !== "this"), functionTypeInfo.Parameters)), transformType(context, functionTypeInfo.Type))]);
|
|
427
434
|
}
|
|
428
435
|
case 1:
|
|
429
436
|
return new FSharpType(4, [transformInterface(context, glueType.fields[0])]);
|
|
430
|
-
case
|
|
437
|
+
case 21: {
|
|
431
438
|
const typeLiteralInfo = glueType.fields[0];
|
|
432
439
|
if (forAll((_arg) => {
|
|
433
440
|
switch (_arg.tag) {
|
|
@@ -443,18 +450,18 @@ function transformType(context_mut, glueType_mut) {
|
|
|
443
450
|
return false;
|
|
444
451
|
}
|
|
445
452
|
}, typeLiteralInfo.Members)) {
|
|
446
|
-
const typeLiteralParameters = sortBy((_arg_1) => _arg_1.IsOptional, map((
|
|
447
|
-
const matchValue_1 =
|
|
453
|
+
const typeLiteralParameters = sortBy((_arg_1) => _arg_1.IsOptional, map((parameter_2) => {
|
|
454
|
+
const matchValue_1 = parameter_2.Type;
|
|
448
455
|
if (matchValue_1.tag === 2) {
|
|
449
|
-
return new FSharpParameter(
|
|
456
|
+
return new FSharpParameter(parameter_2.Attributes, parameter_2.Name, true, matchValue_1.fields[0]);
|
|
450
457
|
}
|
|
451
458
|
else {
|
|
452
|
-
return
|
|
459
|
+
return parameter_2;
|
|
453
460
|
}
|
|
454
461
|
}, TransformMembers_toFSharpParameters(context, typeLiteralInfo.Members)), {
|
|
455
462
|
Compare: comparePrimitives,
|
|
456
463
|
});
|
|
457
|
-
const explicitFields = map((
|
|
464
|
+
const explicitFields = map((parameter_3) => (new FSharpExplicitField(parameter_3.Name, parameter_3.IsOptional ? (new FSharpType(2, [parameter_3.Type])) : parameter_3.Type)), typeLiteralParameters);
|
|
458
465
|
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(16, [new FSharpClass(ofArray([new FSharpAttribute(17, []), new FSharpAttribute(8, [])]), TransformContext__get_CurrentScopeName(context), empty(), new FSharpConstructor(typeLiteralParameters, ofArray([new FSharpAttribute(18, []), new FSharpAttribute(2, [])]), new FSharpAccessibility(0, [])), empty(), explicitFields)]));
|
|
459
466
|
}
|
|
460
467
|
else {
|
|
@@ -462,7 +469,7 @@ function transformType(context_mut, glueType_mut) {
|
|
|
462
469
|
}
|
|
463
470
|
return new FSharpType(10, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), new FSharpType(9, []))]);
|
|
464
471
|
}
|
|
465
|
-
case
|
|
472
|
+
case 24: {
|
|
466
473
|
context_mut = context;
|
|
467
474
|
glueType_mut = glueType.fields[0];
|
|
468
475
|
continue transformType;
|
|
@@ -482,15 +489,11 @@ function transformType(context_mut, glueType_mut) {
|
|
|
482
489
|
return new FSharpType(10, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), new FSharpType(9, []))]);
|
|
483
490
|
}
|
|
484
491
|
}
|
|
485
|
-
case
|
|
492
|
+
case 19: {
|
|
486
493
|
context_mut = context;
|
|
487
494
|
glueType_mut = glueType.fields[0].Type;
|
|
488
495
|
continue transformType;
|
|
489
496
|
}
|
|
490
|
-
case 14: {
|
|
491
|
-
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(4, [(originalInterface = transformInterface(context, glueType.fields[0]), Interface_makePartial(TransformContext__get_CurrentScopeName(context), originalInterface))]));
|
|
492
|
-
return new FSharpType(10, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), new FSharpType(9, []))]);
|
|
493
|
-
}
|
|
494
497
|
case 0:
|
|
495
498
|
return new FSharpType(17, []);
|
|
496
499
|
case 8: {
|
|
@@ -510,9 +513,9 @@ function transformType(context_mut, glueType_mut) {
|
|
|
510
513
|
}
|
|
511
514
|
case 6: {
|
|
512
515
|
const functionDeclaration = glueType.fields[0];
|
|
513
|
-
return new FSharpType(15, [new FSharpFunctionType(map((
|
|
516
|
+
return new FSharpType(15, [new FSharpFunctionType(map((parameter_4) => transformParameter(context, parameter_4), functionDeclaration.Parameters), transformType(context, functionDeclaration.Type))]);
|
|
514
517
|
}
|
|
515
|
-
case
|
|
518
|
+
case 20: {
|
|
516
519
|
const members_1 = glueType.fields[0];
|
|
517
520
|
if (isEmpty(members_1)) {
|
|
518
521
|
return new FSharpType(17, []);
|
|
@@ -522,9 +525,16 @@ function transformType(context_mut, glueType_mut) {
|
|
|
522
525
|
return new FSharpType(6, [new FSharpMapped(TransformContext__get_FullName(context), empty())]);
|
|
523
526
|
}
|
|
524
527
|
}
|
|
525
|
-
case
|
|
526
|
-
|
|
527
|
-
|
|
528
|
+
case 26: {
|
|
529
|
+
const utilityType = glueType.fields[0];
|
|
530
|
+
if (utilityType.tag === 1) {
|
|
531
|
+
TransformContext__ExposeType_Z1D58A540(context, transformRecord(context, TransformContext__get_CurrentScopeName(context), empty(), utilityType.fields[0]));
|
|
532
|
+
return new FSharpType(6, [new FSharpMapped(TransformContext__get_FullName(context), empty())]);
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(4, [(originalInterface = transformInterface(context, utilityType.fields[0]), Interface_makePartial(TransformContext__get_CurrentScopeName(context), originalInterface))]));
|
|
536
|
+
return new FSharpType(10, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), new FSharpType(9, []))]);
|
|
537
|
+
}
|
|
528
538
|
}
|
|
529
539
|
case 5:
|
|
530
540
|
return new FSharpType(6, [new FSharpMapped(glueType.fields[0].Name, empty())]);
|
|
@@ -545,22 +555,57 @@ function transformExports(context, isTopLevel, exports) {
|
|
|
545
555
|
const context_1 = TransformContext__PushScope_Z721C83C5(context, "Exports");
|
|
546
556
|
return new FSharpType(4, [new FSharpInterface(ofArray([new FSharpAttribute(7, []), new FSharpAttribute(6, [])]), "Exports", "Exports", empty(), collect_1((_arg) => {
|
|
547
557
|
let Attributes_1, Parameters_1;
|
|
558
|
+
let matchResult, info, info_1, info_2, moduleDeclaration, glueType, glueType_1;
|
|
548
559
|
switch (_arg.tag) {
|
|
549
560
|
case 2: {
|
|
550
|
-
|
|
561
|
+
matchResult = 0;
|
|
562
|
+
info = _arg.fields[0];
|
|
563
|
+
break;
|
|
564
|
+
}
|
|
565
|
+
case 6: {
|
|
566
|
+
matchResult = 1;
|
|
567
|
+
info_1 = _arg.fields[0];
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
case 12: {
|
|
571
|
+
matchResult = 2;
|
|
572
|
+
info_2 = _arg.fields[0];
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
case 24: {
|
|
576
|
+
if (_arg.fields[0].tag === 12) {
|
|
577
|
+
matchResult = 2;
|
|
578
|
+
info_2 = _arg.fields[0].fields[0];
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
matchResult = 4;
|
|
582
|
+
glueType = _arg.fields[0];
|
|
583
|
+
}
|
|
584
|
+
break;
|
|
585
|
+
}
|
|
586
|
+
case 11: {
|
|
587
|
+
matchResult = 3;
|
|
588
|
+
moduleDeclaration = _arg.fields[0];
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
default: {
|
|
592
|
+
matchResult = 5;
|
|
593
|
+
glueType_1 = _arg;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
switch (matchResult) {
|
|
597
|
+
case 0: {
|
|
551
598
|
const patternInput = sanitizeNameAndPushScope(info.Name, context_1);
|
|
552
599
|
const xmlDocInfo = transformComment(info.Documentation);
|
|
553
600
|
return singleton(new FSharpMember(1, [new FSharpMemberInfo(toList(delay(() => append(singleton_1(new FSharpAttribute(3, [info.Name, "REPLACE_ME_WITH_MODULE_NAME"])), delay(() => xmlDocInfo.ObsoleteAttributes)))), patternInput[0], info.Name, empty(), empty(), transformType(patternInput[1], info.Type), false, true, void 0, new FSharpAccessibility(0, []), xmlDocInfo.XmlDoc, new FSharpMemberInfoBody(0, []))]));
|
|
554
601
|
}
|
|
555
|
-
case
|
|
556
|
-
const info_1 = _arg.fields[0];
|
|
602
|
+
case 1: {
|
|
557
603
|
const patternInput_1 = sanitizeNameAndPushScope(info_1.Name, context_1);
|
|
558
604
|
const context_3 = patternInput_1[1];
|
|
559
605
|
const xmlDocInfo_1 = transformComment(info_1.Documentation);
|
|
560
606
|
return singleton(new FSharpMember(0, [(Attributes_1 = toList(delay(() => append(isTopLevel ? singleton_1(new FSharpAttribute(3, [info_1.Name, "REPLACE_ME_WITH_MODULE_NAME"])) : singleton_1(new FSharpAttribute(15, [info_1.Name])), delay(() => xmlDocInfo_1.ObsoleteAttributes)))), (Parameters_1 = map((parameter) => transformParameter(context_3, parameter), info_1.Parameters), new FSharpMemberInfo(Attributes_1, patternInput_1[0], info_1.Name, transformTypeParameters(context_3, info_1.TypeParameters), Parameters_1, transformType(context_3, info_1.Type), false, isTopLevel, void 0, new FSharpAccessibility(0, []), xmlDocInfo_1.XmlDoc, new FSharpMemberInfoBody(0, []))))]));
|
|
561
607
|
}
|
|
562
|
-
case
|
|
563
|
-
const info_2 = _arg.fields[0];
|
|
608
|
+
case 2: {
|
|
564
609
|
const patternInput_2 = sanitizeNameAndPushScope(info_2.Name, context_1);
|
|
565
610
|
const context_4 = patternInput_2[1];
|
|
566
611
|
return map((constructorInfo) => {
|
|
@@ -569,18 +614,16 @@ function transformExports(context, isTopLevel, exports) {
|
|
|
569
614
|
return new FSharpMember(0, [(Attributes_2 = toList(delay(() => append(isTopLevel ? append(singleton_1(new FSharpAttribute(3, [info_2.Name, "REPLACE_ME_WITH_MODULE_NAME"])), delay(() => singleton_1(new FSharpAttribute(13, [])))) : singleton_1(new FSharpAttribute(14, [info_2.Name])), delay(() => xmlDocInfo_2.ObsoleteAttributes)))), (Parameters_2 = map((parameter_1) => transformParameter(context_4, parameter_1), constructorInfo.Parameters), new FSharpMemberInfo(Attributes_2, patternInput_2[0], info_2.Name, transformTypeParameters(context_4, info_2.TypeParameters), Parameters_2, new FSharpType(6, [new FSharpMapped(sanitizeName(info_2.Name), transformTypeParameters(context_4, info_2.TypeParameters))]), false, isTopLevel, void 0, new FSharpAccessibility(0, []), xmlDocInfo_2.XmlDoc, new FSharpMemberInfoBody(0, []))))]);
|
|
570
615
|
}, isEmpty(info_2.Constructors) ? singleton(new GlueConstructor(empty(), empty())) : info_2.Constructors);
|
|
571
616
|
}
|
|
572
|
-
case
|
|
573
|
-
const moduleDeclaration = _arg.fields[0];
|
|
617
|
+
case 3: {
|
|
574
618
|
const sanitizedName = sanitizeName(moduleDeclaration.Name);
|
|
575
619
|
return singleton(new FSharpMember(1, [new FSharpMemberInfo(ofArray([new FSharpAttribute(4, ["REPLACE_ME_WITH_MODULE_NAME"]), new FSharpAttribute(0, [`Emit("$0.${removeSurroundingQuotes(moduleDeclaration.Name)}")`])]), sanitizedName + "_", `${moduleDeclaration.Name}.Exports`, empty(), empty(), new FSharpType(6, [new FSharpMapped(`${sanitizedName}.Exports`, empty())]), false, isTopLevel, new FSharpAccessor(0, []), new FSharpAccessibility(0, []), empty(), new FSharpMemberInfoBody(0, []))]));
|
|
576
620
|
}
|
|
577
|
-
case
|
|
578
|
-
const glueType = _arg.fields[0];
|
|
621
|
+
case 4: {
|
|
579
622
|
const patternInput_3 = sanitizeNameAndPushScope(GlueType__get_Name(glueType), context_1);
|
|
580
623
|
return singleton(new FSharpMember(1, [new FSharpMemberInfo(singleton(new FSharpAttribute(5, ["REPLACE_ME_WITH_MODULE_NAME"])), patternInput_3[0], GlueType__get_Name(glueType), empty(), empty(), transformType(patternInput_3[1], glueType), false, true, void 0, new FSharpAccessibility(0, []), empty(), new FSharpMemberInfoBody(0, []))]));
|
|
581
624
|
}
|
|
582
625
|
default:
|
|
583
|
-
return toFail(printf("Could not generate exportMembers for: %A"))(
|
|
626
|
+
return toFail(printf("Could not generate exportMembers for: %A"))(glueType_1);
|
|
584
627
|
}
|
|
585
628
|
}, exports), empty())]);
|
|
586
629
|
}
|
|
@@ -765,26 +808,72 @@ function TransformMembers_toFSharpParameters(context, members) {
|
|
|
765
808
|
function transformInterface(context, info) {
|
|
766
809
|
const patternInput = sanitizeNameAndPushScope(info.Name, context);
|
|
767
810
|
const context_1 = patternInput[1];
|
|
768
|
-
const
|
|
769
|
-
|
|
811
|
+
const membersComingFromPartial = concat(map((fullName) => concat(choose((glueType) => {
|
|
812
|
+
if (glueType.tag === 1) {
|
|
813
|
+
const glueInterface = glueType.fields[0];
|
|
814
|
+
if (glueInterface.FullName === fullName) {
|
|
815
|
+
return Interface_makePartial("FakeName", transformInterface(context_1, glueInterface)).Members;
|
|
816
|
+
}
|
|
817
|
+
else {
|
|
818
|
+
return void 0;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
else {
|
|
822
|
+
return void 0;
|
|
823
|
+
}
|
|
824
|
+
}, TransformContext__get_TypeMemory(context_1))), choose((heritageClause) => {
|
|
825
|
+
if (heritageClause.tag === 13) {
|
|
826
|
+
const typeReference = heritageClause.fields[0];
|
|
827
|
+
if (typeReference.IsStandardLibrary && (typeReference.Name === "Partial")) {
|
|
828
|
+
if (length(typeReference.TypeArguments) === 1) {
|
|
829
|
+
const matchValue = item(0, typeReference.TypeArguments);
|
|
830
|
+
if (matchValue.tag === 13) {
|
|
831
|
+
return matchValue.fields[0].FullName;
|
|
832
|
+
}
|
|
833
|
+
else {
|
|
834
|
+
return void 0;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
else {
|
|
838
|
+
return void 0;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
else {
|
|
842
|
+
return void 0;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
else {
|
|
846
|
+
return void 0;
|
|
847
|
+
}
|
|
848
|
+
}, info.HeritageClauses)));
|
|
849
|
+
const standardMembers = TransformMembers_toFSharpMember(context_1, info.Members);
|
|
850
|
+
const inheritance = filter((heritageClause_1) => {
|
|
851
|
+
if (heritageClause_1.tag === 13) {
|
|
852
|
+
const typeReference_2 = heritageClause_1.fields[0];
|
|
853
|
+
return !(typeReference_2.IsStandardLibrary && (typeReference_2.Name === "Partial"));
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
return true;
|
|
857
|
+
}
|
|
858
|
+
}, info.HeritageClauses);
|
|
859
|
+
const Members = append_1(standardMembers, membersComingFromPartial);
|
|
860
|
+
return new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), patternInput[0], info.Name, transformTypeParameters(context_1, info.TypeParameters), Members, map((glueType_1) => transformType(context_1, glueType_1), inheritance));
|
|
770
861
|
}
|
|
771
862
|
|
|
772
863
|
export function Interface_makePartial(name, originalInterface) {
|
|
773
864
|
return new FSharpInterface(originalInterface.Attributes, name, originalInterface.OriginalName, originalInterface.TypeParameters, map((m) => {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
return
|
|
865
|
+
if (m.tag === 1) {
|
|
866
|
+
const property = m.fields[0];
|
|
867
|
+
if (property.Type.tag === 2) {
|
|
868
|
+
return m;
|
|
778
869
|
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
return new FSharpMember(2, [new FSharpStaticMemberInfo(staticMember.Attributes, staticMember.Name, staticMember.OriginalName, staticMember.TypeParameters, staticMember.Parameters, staticMember.Type, true, staticMember.Accessor, staticMember.Accessibility)]);
|
|
782
|
-
}
|
|
783
|
-
default: {
|
|
784
|
-
const method = m.fields[0];
|
|
785
|
-
return new FSharpMember(0, [new FSharpMemberInfo(method.Attributes, method.Name, method.OriginalName, method.TypeParameters, method.Parameters, method.Type, true, method.IsStatic, method.Accessor, method.Accessibility, method.XmlDoc, method.Body)]);
|
|
870
|
+
else {
|
|
871
|
+
return new FSharpMember(1, [new FSharpMemberInfo(property.Attributes, property.Name, property.OriginalName, property.TypeParameters, property.Parameters, property.Type, true, property.IsStatic, property.Accessor, property.Accessibility, property.XmlDoc, property.Body)]);
|
|
786
872
|
}
|
|
787
873
|
}
|
|
874
|
+
else {
|
|
875
|
+
return m;
|
|
876
|
+
}
|
|
788
877
|
}, originalInterface.Members), originalInterface.Inheritance);
|
|
789
878
|
}
|
|
790
879
|
|
|
@@ -1061,7 +1150,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
|
|
|
1061
1150
|
}))]);
|
|
1062
1151
|
}
|
|
1063
1152
|
else if (forAll((_arg_3) => {
|
|
1064
|
-
if (_arg_3.tag ===
|
|
1153
|
+
if (_arg_3.tag === 21) {
|
|
1065
1154
|
return true;
|
|
1066
1155
|
}
|
|
1067
1156
|
else {
|
|
@@ -1069,7 +1158,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
|
|
|
1069
1158
|
}
|
|
1070
1159
|
}, cases)) {
|
|
1071
1160
|
const members = collect_1((_arg_4) => {
|
|
1072
|
-
if (_arg_4.tag ===
|
|
1161
|
+
if (_arg_4.tag === 21) {
|
|
1073
1162
|
return TransformMembers_toFSharpMember(context, _arg_4.fields[0].Members);
|
|
1074
1163
|
}
|
|
1075
1164
|
else {
|
|
@@ -1151,7 +1240,7 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1151
1240
|
return TypeAliasDeclaration_transformLiteral(xmlDoc, typeAliasName, matchValue.fields[0]);
|
|
1152
1241
|
case 3:
|
|
1153
1242
|
return new FSharpType(8, [new FSharpTypeAlias(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc, new FSharpType(7, [transformPrimitive(matchValue.fields[0])]), transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]);
|
|
1154
|
-
case
|
|
1243
|
+
case 25:
|
|
1155
1244
|
return new FSharpType(8, [new FSharpTypeAlias(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc, new FSharpType(7, [new FSharpPrimitive(0, [])]), transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]);
|
|
1156
1245
|
case 13: {
|
|
1157
1246
|
const typeReference = matchValue.fields[0];
|
|
@@ -1174,7 +1263,7 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1174
1263
|
}
|
|
1175
1264
|
switch (matchResult_1) {
|
|
1176
1265
|
case 0:
|
|
1177
|
-
if (head.tag ===
|
|
1266
|
+
if (head.tag === 20) {
|
|
1178
1267
|
const makeInterfaceTyp = (name) => (new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), name, glueTypeAliasDeclaration.Name, empty(), TransformMembers_toFSharpMember(context_2, head.fields[0]), empty()));
|
|
1179
1268
|
const exposedType = makeInterfaceTyp("ReturnType");
|
|
1180
1269
|
const typeArgument = makeInterfaceTyp(TransformContext__get_FullName(context_2) + ".ReturnType");
|
|
@@ -1188,25 +1277,30 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1188
1277
|
return handleDefaultCase();
|
|
1189
1278
|
}
|
|
1190
1279
|
}
|
|
1191
|
-
case 16:
|
|
1192
|
-
return new FSharpType(8, [new FSharpTypeAlias(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc, transformType(context_1, new GlueType(16, [matchValue.fields[0]])), transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]);
|
|
1193
1280
|
case 14:
|
|
1194
|
-
return new FSharpType(
|
|
1195
|
-
case
|
|
1196
|
-
|
|
1197
|
-
|
|
1281
|
+
return new FSharpType(8, [new FSharpTypeAlias(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc, transformType(context_1, new GlueType(14, [matchValue.fields[0]])), transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]);
|
|
1282
|
+
case 26: {
|
|
1283
|
+
const utilityType = matchValue.fields[0];
|
|
1284
|
+
if (utilityType.tag === 1) {
|
|
1285
|
+
return transformRecord(context_1, typeAliasName, glueTypeAliasDeclaration.TypeParameters, utilityType.fields[0]);
|
|
1286
|
+
}
|
|
1287
|
+
else {
|
|
1288
|
+
return new FSharpType(4, [Interface_makePartial(typeAliasName, transformInterface(context_1, utilityType.fields[0]))]);
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
case 15: {
|
|
1198
1292
|
const functionType = matchValue.fields[0];
|
|
1199
1293
|
return new FSharpType(4, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), typeAliasName, glueTypeAliasDeclaration.Name, transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters), singleton(new FSharpMember(0, [new FSharpMemberInfo(singleton(new FSharpAttribute(1, [])), "Invoke", "Invoke", empty(), map((parameter) => transformParameter(context_1, parameter), functionType.Parameters), transformType(context_1, functionType.Type), false, false, void 0, new FSharpAccessibility(0, []), empty(), new FSharpMemberInfoBody(0, []))])), empty())]);
|
|
1200
1294
|
}
|
|
1201
|
-
case
|
|
1295
|
+
case 18:
|
|
1202
1296
|
return new FSharpType(8, [new FSharpTypeAlias(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc, transformTupleType(context_1, matchValue.fields[0]), transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]);
|
|
1203
|
-
case
|
|
1297
|
+
case 20:
|
|
1204
1298
|
return new FSharpType(4, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), typeAliasName, glueTypeAliasDeclaration.Name, transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters), TransformMembers_toFSharpMember(context_1, matchValue.fields[0]), empty())]);
|
|
1205
|
-
case
|
|
1299
|
+
case 21:
|
|
1206
1300
|
return new FSharpType(4, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), typeAliasName, glueTypeAliasDeclaration.Name, transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters), TransformMembers_toFSharpMember(context_1, matchValue.fields[0].Members), empty())]);
|
|
1207
|
-
case
|
|
1301
|
+
case 23:
|
|
1208
1302
|
return new FSharpType(8, [new FSharpTypeAlias(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc, new FSharpType(17, []), transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]);
|
|
1209
|
-
case
|
|
1303
|
+
case 16:
|
|
1210
1304
|
return new FSharpType(8, [new FSharpTypeAlias(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc, new FSharpType(12, [matchValue.fields[0]]), transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]);
|
|
1211
1305
|
case 12:
|
|
1212
1306
|
case 4:
|
|
@@ -1215,11 +1309,11 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1215
1309
|
case 5:
|
|
1216
1310
|
case 0:
|
|
1217
1311
|
case 6:
|
|
1218
|
-
case
|
|
1312
|
+
case 17:
|
|
1219
1313
|
case 2:
|
|
1220
|
-
case 26:
|
|
1221
|
-
case 21:
|
|
1222
1314
|
case 24:
|
|
1315
|
+
case 19:
|
|
1316
|
+
case 22:
|
|
1223
1317
|
return new FSharpType(9, []);
|
|
1224
1318
|
default: {
|
|
1225
1319
|
const matchValue_1 = tryOptimizeUnionType(context_1, typeAliasName, matchValue.fields[0].fields[0]);
|
|
@@ -1233,8 +1327,8 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1233
1327
|
}
|
|
1234
1328
|
}
|
|
1235
1329
|
|
|
1236
|
-
function transformModuleDeclaration(reporter, moduleDeclaration) {
|
|
1237
|
-
return new FSharpType(3, [new FSharpModule(sanitizeName(moduleDeclaration.Name), moduleDeclaration.IsRecursive, transform(reporter, false, moduleDeclaration.Types))]);
|
|
1330
|
+
function transformModuleDeclaration(typeMemory, reporter, moduleDeclaration) {
|
|
1331
|
+
return new FSharpType(3, [new FSharpModule(sanitizeName(moduleDeclaration.Name), moduleDeclaration.IsRecursive, transform(typeMemory, reporter, false, moduleDeclaration.Types))]);
|
|
1238
1332
|
}
|
|
1239
1333
|
|
|
1240
1334
|
function transformClassDeclaration(context, classDeclaration) {
|
|
@@ -1252,10 +1346,10 @@ function transformToFsharp(context, glueTypes) {
|
|
|
1252
1346
|
case 5:
|
|
1253
1347
|
return transformTypeAliasDeclaration(context, _arg.fields[0]);
|
|
1254
1348
|
case 11:
|
|
1255
|
-
return transformModuleDeclaration(TransformContext__get__Reporter(context), _arg.fields[0]);
|
|
1349
|
+
return transformModuleDeclaration(TransformContext__get_TypeMemory(context), TransformContext__get__Reporter(context), _arg.fields[0]);
|
|
1256
1350
|
case 12:
|
|
1257
1351
|
return transformClassDeclaration(context, _arg.fields[0]);
|
|
1258
|
-
case
|
|
1352
|
+
case 24: {
|
|
1259
1353
|
const exportedType = _arg.fields[0];
|
|
1260
1354
|
if (exportedType.tag === 12) {
|
|
1261
1355
|
return transformClassDeclaration(context, exportedType.fields[0]);
|
|
@@ -1264,10 +1358,9 @@ function transformToFsharp(context, glueTypes) {
|
|
|
1264
1358
|
return new FSharpType(9, []);
|
|
1265
1359
|
}
|
|
1266
1360
|
}
|
|
1267
|
-
case
|
|
1268
|
-
case 18:
|
|
1269
|
-
case 14:
|
|
1361
|
+
case 15:
|
|
1270
1362
|
case 16:
|
|
1363
|
+
case 14:
|
|
1271
1364
|
case 13:
|
|
1272
1365
|
case 6:
|
|
1273
1366
|
case 10:
|
|
@@ -1275,17 +1368,17 @@ function transformToFsharp(context, glueTypes) {
|
|
|
1275
1368
|
case 8:
|
|
1276
1369
|
case 2:
|
|
1277
1370
|
case 3:
|
|
1278
|
-
case
|
|
1371
|
+
case 23:
|
|
1279
1372
|
case 9:
|
|
1280
1373
|
case 0:
|
|
1374
|
+
case 18:
|
|
1281
1375
|
case 20:
|
|
1282
|
-
case 22:
|
|
1283
|
-
case 23:
|
|
1284
|
-
case 15:
|
|
1285
|
-
case 24:
|
|
1286
1376
|
case 21:
|
|
1287
|
-
case
|
|
1377
|
+
case 22:
|
|
1288
1378
|
case 19:
|
|
1379
|
+
case 25:
|
|
1380
|
+
case 26:
|
|
1381
|
+
case 17:
|
|
1289
1382
|
return new FSharpType(9, []);
|
|
1290
1383
|
default:
|
|
1291
1384
|
return new FSharpType(4, [transformInterface(context, _arg.fields[0])]);
|
|
@@ -1293,13 +1386,13 @@ function transformToFsharp(context, glueTypes) {
|
|
|
1293
1386
|
}, glueTypes);
|
|
1294
1387
|
}
|
|
1295
1388
|
|
|
1296
|
-
function transform(reporter, isTopLevel, glueAst) {
|
|
1389
|
+
function transform(typeMemory, reporter, isTopLevel, glueAst) {
|
|
1297
1390
|
const patternInput = partition((glueType) => {
|
|
1298
1391
|
switch (glueType.tag) {
|
|
1299
1392
|
case 2:
|
|
1300
1393
|
case 6:
|
|
1301
1394
|
return true;
|
|
1302
|
-
case
|
|
1395
|
+
case 24:
|
|
1303
1396
|
if (glueType.fields[0].tag === 2) {
|
|
1304
1397
|
return true;
|
|
1305
1398
|
}
|
|
@@ -1325,7 +1418,7 @@ function transform(reporter, isTopLevel, glueAst) {
|
|
|
1325
1418
|
return false;
|
|
1326
1419
|
}
|
|
1327
1420
|
}, glueType_1.fields[0].Types);
|
|
1328
|
-
case
|
|
1421
|
+
case 24:
|
|
1329
1422
|
if (glueType_1.fields[0].tag === 12) {
|
|
1330
1423
|
return true;
|
|
1331
1424
|
}
|
|
@@ -1336,14 +1429,14 @@ function transform(reporter, isTopLevel, glueAst) {
|
|
|
1336
1429
|
return false;
|
|
1337
1430
|
}
|
|
1338
1431
|
}, rest));
|
|
1339
|
-
const rootTransformContext = TransformContext_$
|
|
1432
|
+
const rootTransformContext = TransformContext_$ctor_Z4CBC0890(reporter, "", typeMemory);
|
|
1340
1433
|
const rest_1 = transformToFsharp(rootTransformContext, rest);
|
|
1341
1434
|
return toList(delay(() => append(!isEmpty(exports_1) ? singleton_1(transformExports(rootTransformContext, isTopLevel, exports_1)) : empty_1(), delay(() => append(rest_1, delay(() => TransformContext__ToList(rootTransformContext)))))));
|
|
1342
1435
|
}
|
|
1343
1436
|
|
|
1344
|
-
export function apply(glueAst) {
|
|
1437
|
+
export function apply(typeMemory, glueAst) {
|
|
1345
1438
|
const reporter = Reporter_$ctor();
|
|
1346
|
-
return new TransformResult(transform(reporter, true, glueAst), Reporter__get_Warnings(reporter), Reporter__get_Errors(reporter), Reporter__get_HasRegEpx(reporter));
|
|
1439
|
+
return new TransformResult(apply_1(transform(typeMemory, reporter, true, glueAst)), Reporter__get_Warnings(reporter), Reporter__get_Errors(reporter), Reporter__get_HasRegEpx(reporter));
|
|
1347
1440
|
}
|
|
1348
1441
|
|
|
1349
1442
|
//# sourceMappingURL=Transform.js.map
|