@glutinum/cli 0.12.0 → 0.13.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/README.md +16 -2
- package/dist/Glutinum.Converter/FsharpAST.js +15 -10
- package/dist/Glutinum.Converter/FsharpAST.js.map +1 -1
- package/dist/Glutinum.Converter/GlueAST.js +124 -7
- package/dist/Glutinum.Converter/GlueAST.js.map +1 -1
- package/dist/Glutinum.Converter/Merge.js +1 -1
- package/dist/Glutinum.Converter/Merge.js.map +1 -1
- package/dist/Glutinum.Converter/Printer.js +34 -9
- package/dist/Glutinum.Converter/Printer.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +1 -1
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Declaration.js +2 -2
- package/dist/Glutinum.Converter/Reader/Declaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +2 -2
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +1 -1
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +1 -1
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +1 -1
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +2 -1
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Node.js +1 -1
- package/dist/Glutinum.Converter/Reader/Node.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Parameters.js +1 -1
- package/dist/Glutinum.Converter/Reader/Parameters.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeNode.js +45 -37
- package/dist/Glutinum.Converter/Reader/TypeNode.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +5 -5
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeParameters.js +1 -1
- package/dist/Glutinum.Converter/Reader/TypeParameters.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +8 -8
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +2 -2
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +1 -1
- package/dist/Glutinum.Converter/Reader/VariableStatement.js.map +1 -1
- package/dist/Glutinum.Converter/Transform.js +612 -212
- package/dist/Glutinum.Converter/Transform.js.map +1 -1
- package/dist/Glutinum.Converter/Utils/Naming.js +18 -5
- package/dist/Glutinum.Converter/Utils/Naming.js.map +1 -1
- package/dist/fable_modules/project_cracked.json +1 -1
- package/package.json +2 -2
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { bool_type, array_type, string_type, record_type, list_type, class_type } from "../fable_modules/fable-library-js.4.14.0/Reflection.js";
|
|
1
|
+
import { option_type, bool_type, array_type, string_type, union_type, record_type, list_type, class_type } from "../fable_modules/fable-library-js.4.14.0/Reflection.js";
|
|
2
2
|
import { printf, toFail, interpolate, toText, join, trimStart } from "../fable_modules/fable-library-js.4.14.0/String.js";
|
|
3
|
-
import { Record } from "../fable_modules/fable-library-js.4.14.0/Types.js";
|
|
4
|
-
import { FSharpSingleErasedCaseUnion, FSharpJSApi, FSharpTypeParameterInfo_Create_Z6CFD3565, FSharpEnum, FSharpEnumCase, FSharpUnionCaseNamed, FSharpStaticMemberInfo, FSharpAccessor, FSharpMember, FSharpMemberInfo, FSharpMemberInfoBody, FSharpClass, FSharpConstructor, FSharpAccessibility, FSharpExplicitField, FSharpParameter, FSharpTypeAlias, FSharpDelegate, FSharpFunctionType, FSharpTypeReference, FSharpThisType, FSharpUnion, FSharpUnionCase, FSharpInterface, FSharpTypeParameter, FSharpMapped, FSharpPrimitive, FSharpLiteral, FSharpCommentTypeParam, FSharpCommentParam, FSharpXmlDoc, FSharpAttribute, FSharpType, FSharpModule, FSharpType_$reflection, FSharpXmlDoc_$reflection, FSharpAttribute_$reflection } from "./FsharpAST.js";
|
|
3
|
+
import { Union, Record } from "../fable_modules/fable-library-js.4.14.0/Types.js";
|
|
4
|
+
import { FSharpSingleErasedCaseUnion, FSharpJSApi, FSharpTypeParameterInfo_Create_Z6CFD3565, FSharpEnum, FSharpEnumCase, FSharpUnionCaseNamed, FSharpStaticMemberInfo, FSharpAccessor, FSharpMember, FSharpMemberInfo, FSharpMemberInfoBody, FSharpClass, FSharpConstructor, FSharpAccessibility, FSharpTypeParameterInfo, FSharpExplicitField, FSharpParameter, FSharpTypeAlias, FSharpDelegate, FSharpFunctionType, FSharpTypeReference, FSharpThisType, FSharpUnion, FSharpUnionCase, FSharpInterface, FSharpTypeParameter, FSharpMapped, FSharpPrimitive, FSharpLiteral, FSharpCommentTypeParam, FSharpCommentParam, FSharpXmlDoc, FSharpAttribute, FSharpType, FSharpModule, FSharpTypeParameter_$reflection, FSharpType_$reflection, FSharpXmlDoc_$reflection, FSharpAttribute_$reflection } from "./FsharpAST.js";
|
|
5
|
+
import { getItemFromDict } from "../fable_modules/fable-library-js.4.14.0/MapUtil.js";
|
|
6
|
+
import { safeHash, equals, stringHash, disposeSafe, getEnumerator, comparePrimitives, int32ToString } from "../fable_modules/fable-library-js.4.14.0/Util.js";
|
|
5
7
|
import { sanitizeNameWithResult, removeSurroundingQuotes, sanitizeName } from "./Utils/Naming.js";
|
|
6
8
|
import { empty as empty_1, singleton as singleton_1, collect, append, delay, toList } from "../fable_modules/fable-library-js.4.14.0/Seq.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { GlueTypeUnion, GlueType, GlueLiteral__ToText, GlueMember, GlueProperty, GlueAccessor, GlueConstructor, GlueType__get_Name } from "./GlueAST.js";
|
|
9
|
+
import { cons, collect as collect_1, reverse, item, concat, tryFind, unzip, forAll, exists, filter, mapIndexed, partition, ofArray, length, choose, tryHead, iterate, sortBy, map, append as append_1, head as head_1, tail as tail_1, singleton, empty, isEmpty } from "../fable_modules/fable-library-js.4.14.0/List.js";
|
|
10
|
+
import { unwrap, value as value_6, map as map_1, defaultArg } from "../fable_modules/fable-library-js.4.14.0/Option.js";
|
|
11
|
+
import { GlueTypeReference, GlueTypeUnion, GlueType, GlueLiteral__ToText, GlueMember, GlueProperty, GlueAccessor, GlueConstructor, GlueMember__TryGetAccessor, GlueType__get_TypeParameters, GlueType__get_Name } from "./GlueAST.js";
|
|
11
12
|
import { List_distinct } from "../fable_modules/fable-library-js.4.14.0/Seq2.js";
|
|
12
|
-
import {
|
|
13
|
+
import { empty as empty_2, FSharpSet__Contains, ofList, singleton as singleton_2, union } from "../fable_modules/fable-library-js.4.14.0/Set.js";
|
|
14
|
+
import { apply as apply_2 } from "./Merge.js";
|
|
13
15
|
|
|
14
16
|
export class Reporter {
|
|
15
17
|
constructor() {
|
|
@@ -29,18 +31,34 @@ export function Reporter_$ctor() {
|
|
|
29
31
|
return new Reporter();
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
export class TypeLiteralsMemory {
|
|
35
|
+
constructor() {
|
|
36
|
+
this.memory = (new Map([]));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function TypeLiteralsMemory_$reflection() {
|
|
41
|
+
return class_type("Glutinum.Converter.Transform.TypeLiteralsMemory", void 0, TypeLiteralsMemory);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function TypeLiteralsMemory_$ctor() {
|
|
45
|
+
return new TypeLiteralsMemory();
|
|
46
|
+
}
|
|
47
|
+
|
|
32
48
|
export class TransformContext {
|
|
33
|
-
constructor(reporter, currentScopeName, typeMemory, parent) {
|
|
49
|
+
constructor(reporter, currentScopeName, typeMemory, typeLiteralsMemory, parent) {
|
|
34
50
|
let matchValue;
|
|
35
51
|
this.reporter = reporter;
|
|
36
52
|
this.currentScopeName = currentScopeName;
|
|
37
53
|
this.typeMemory = typeMemory;
|
|
54
|
+
this.typeLiteralsMemory = typeLiteralsMemory;
|
|
38
55
|
this.parent = parent;
|
|
39
56
|
this.types = [];
|
|
40
57
|
this.modules = [];
|
|
41
58
|
this["FullName@"] = ((matchValue = this.parent, (matchValue != null) ? trimStart((TransformContext__get_FullName(matchValue) + ".") + this.currentScopeName, ".") : ""));
|
|
42
59
|
this["CurrentScopeName@"] = this.currentScopeName;
|
|
43
60
|
this["TypeMemory@"] = this.typeMemory;
|
|
61
|
+
this["TypeLiteralsMemory@"] = this.typeLiteralsMemory;
|
|
44
62
|
this["_types@"] = this.types;
|
|
45
63
|
this["_Reporter@"] = this.reporter;
|
|
46
64
|
}
|
|
@@ -50,8 +68,8 @@ export function TransformContext_$reflection() {
|
|
|
50
68
|
return class_type("Glutinum.Converter.Transform.TransformContext", void 0, TransformContext);
|
|
51
69
|
}
|
|
52
70
|
|
|
53
|
-
export function TransformContext_$
|
|
54
|
-
return new TransformContext(reporter, currentScopeName, typeMemory, parent);
|
|
71
|
+
export function TransformContext_$ctor_1977F1E3(reporter, currentScopeName, typeMemory, typeLiteralsMemory, parent) {
|
|
72
|
+
return new TransformContext(reporter, currentScopeName, typeMemory, typeLiteralsMemory, parent);
|
|
55
73
|
}
|
|
56
74
|
|
|
57
75
|
export class TransformCommentResult extends Record {
|
|
@@ -66,6 +84,33 @@ export function TransformCommentResult_$reflection() {
|
|
|
66
84
|
return record_type("Glutinum.Converter.Transform.TransformCommentResult", [], TransformCommentResult, () => [["ObsoleteAttributes", list_type(FSharpAttribute_$reflection())], ["XmlDoc", list_type(FSharpXmlDoc_$reflection())]]);
|
|
67
85
|
}
|
|
68
86
|
|
|
87
|
+
export class TransformTypeParameterConstraintResult extends Union {
|
|
88
|
+
constructor(tag, fields) {
|
|
89
|
+
super();
|
|
90
|
+
this.tag = tag;
|
|
91
|
+
this.fields = fields;
|
|
92
|
+
}
|
|
93
|
+
cases() {
|
|
94
|
+
return ["NoConstraint", "Constraint", "DiscardConstraint", "SealedConstraint"];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function TransformTypeParameterConstraintResult_$reflection() {
|
|
99
|
+
return union_type("Glutinum.Converter.Transform.TransformTypeParameterConstraintResult", [], TransformTypeParameterConstraintResult, () => [[], [["Item", FSharpType_$reflection()]], [], [["Item", FSharpType_$reflection()]]]);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
class TransformTypeParametersResult extends Record {
|
|
103
|
+
constructor(TypeParameters, SealedTypes) {
|
|
104
|
+
super();
|
|
105
|
+
this.TypeParameters = TypeParameters;
|
|
106
|
+
this.SealedTypes = SealedTypes;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function TransformTypeParametersResult_$reflection() {
|
|
111
|
+
return record_type("Glutinum.Converter.Transform.TransformTypeParametersResult", [], TransformTypeParametersResult, () => [["TypeParameters", list_type(FSharpTypeParameter_$reflection())], ["SealedTypes", list_type(TypeParameter_SealedTypeInfo_$reflection())]]);
|
|
112
|
+
}
|
|
113
|
+
|
|
69
114
|
export class TransformResult extends Record {
|
|
70
115
|
constructor(FSharpAST, Warnings, Errors, IncludeRegExpAlias, IncludeReadonlyArrayAlias, IncludeIterableAlias) {
|
|
71
116
|
super();
|
|
@@ -114,6 +159,40 @@ export function Reporter__set_HasIterable_Z1FBCCD16(__, v) {
|
|
|
114
159
|
__["HasIterable@"] = v;
|
|
115
160
|
}
|
|
116
161
|
|
|
162
|
+
export function TypeLiteralsMemory__GetTypeName_Z384F8060(_, fullName, currentScopeName) {
|
|
163
|
+
if (_.memory.has(fullName)) {
|
|
164
|
+
_.memory.set(fullName, getItemFromDict(_.memory, fullName) + 1);
|
|
165
|
+
return (currentScopeName + "_") + int32ToString(getItemFromDict(_.memory, fullName));
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
_.memory.set(fullName, 0);
|
|
169
|
+
return currentScopeName;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function TypeLiteralsMemory__GetReference_Z384F8060(_, fullName, prefixName) {
|
|
174
|
+
if (_.memory.has(fullName)) {
|
|
175
|
+
const count = getItemFromDict(_.memory, fullName) | 0;
|
|
176
|
+
if (count === 0) {
|
|
177
|
+
return prefixName;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
return (prefixName + "_") + int32ToString(count);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
return prefixName;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function TypeLiteralsMemory__GetReferenceTypeName_Z384F8060(this$, fullName, currentScopeName) {
|
|
189
|
+
return TypeLiteralsMemory__GetReference_Z384F8060(this$, fullName, currentScopeName);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export function TypeLiteralsMemory__GetFullTypeNameReference_Z384F8060(this$, fullName, currentScopeName) {
|
|
193
|
+
return TypeLiteralsMemory__GetReference_Z384F8060(this$, fullName, fullName);
|
|
194
|
+
}
|
|
195
|
+
|
|
117
196
|
export function TransformContext__get_FullName(__) {
|
|
118
197
|
return __["FullName@"];
|
|
119
198
|
}
|
|
@@ -126,10 +205,25 @@ export function TransformContext__get_TypeMemory(__) {
|
|
|
126
205
|
return __["TypeMemory@"];
|
|
127
206
|
}
|
|
128
207
|
|
|
208
|
+
export function TransformContext__get_TypeLiteralsMemory(__) {
|
|
209
|
+
return __["TypeLiteralsMemory@"];
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* We need to expose the types for the children to be able to access
|
|
214
|
+
* push to them.
|
|
215
|
+
* This variable should not be accessed directly, but through the ExposeType method
|
|
216
|
+
* that's why we decorate it with the _ prefix
|
|
217
|
+
*/
|
|
129
218
|
export function TransformContext__get__types(__) {
|
|
130
219
|
return __["_types@"];
|
|
131
220
|
}
|
|
132
221
|
|
|
222
|
+
/**
|
|
223
|
+
* We expose an access to the reporter so we can propagate its instance
|
|
224
|
+
* when needed
|
|
225
|
+
* You should not use this directly, but instead use the AddWarning and AddError methods
|
|
226
|
+
*/
|
|
133
227
|
export function TransformContext__get__Reporter(__) {
|
|
134
228
|
return __["_Reporter@"];
|
|
135
229
|
}
|
|
@@ -158,7 +252,7 @@ export function TransformContext__ExposeType_Z1D58A540(_, typ) {
|
|
|
158
252
|
}
|
|
159
253
|
|
|
160
254
|
export function TransformContext__PushScope_Z721C83C5(this$, scopeName) {
|
|
161
|
-
const childContext = TransformContext_$
|
|
255
|
+
const childContext = TransformContext_$ctor_1977F1E3(this$.reporter, sanitizeName(scopeName), this$.typeMemory, this$.typeLiteralsMemory, this$);
|
|
162
256
|
void (this$.modules.push(childContext));
|
|
163
257
|
return childContext;
|
|
164
258
|
}
|
|
@@ -222,7 +316,7 @@ function mapTypeNameToFableCoreAwareName(context, typeReference) {
|
|
|
222
316
|
let mappedName;
|
|
223
317
|
if (typeReference.IsStandardLibrary) {
|
|
224
318
|
const matchValue = typeReference.Name;
|
|
225
|
-
mappedName = ((matchValue === "Date") ? "JS.Date" : ((matchValue === "Promise") ? "JS.Promise" : ((matchValue === "Uint8Array") ? "JS.Uint8Array" : ((matchValue === "Array") ? "ResizeArray" : ((matchValue === "Boolean") ? "bool" : ((matchValue === "Function") ? "Action" : ((matchValue === "Error") ? "Exception" : matchValue)))))));
|
|
319
|
+
mappedName = ((matchValue === "Date") ? "JS.Date" : ((matchValue === "Promise") ? "JS.Promise" : ((matchValue === "Uint8Array") ? "JS.Uint8Array" : ((matchValue === "Int8Array") ? "JS.Int8Array" : ((matchValue === "Uint8ClampedArray") ? "JS.Uint8ClampedArray" : ((matchValue === "Int16Array") ? "JS.Int16Array" : ((matchValue === "Uint16Array") ? "JS.Uint16Array" : ((matchValue === "Int32Array") ? "JS.Int32Array" : ((matchValue === "Uint32Array") ? "JS.Uint32Array" : ((matchValue === "Float32Array") ? "JS.Float32Array" : ((matchValue === "Float64Array") ? "JS.Float64Array" : ((matchValue === "Array") ? "ResizeArray" : ((matchValue === "Boolean") ? "bool" : ((matchValue === "Function") ? "Action" : ((matchValue === "Error") ? "Exception" : matchValue)))))))))))))));
|
|
226
320
|
}
|
|
227
321
|
else {
|
|
228
322
|
mappedName = typeReference.Name;
|
|
@@ -257,7 +351,7 @@ function transformComment(comment) {
|
|
|
257
351
|
while (true) {
|
|
258
352
|
const acc = acc_mut, comments = comments_mut;
|
|
259
353
|
if (!isEmpty(comments)) {
|
|
260
|
-
const rest =
|
|
354
|
+
const rest = tail_1(comments);
|
|
261
355
|
const comment_1 = head_1(comments);
|
|
262
356
|
switch (comment_1.tag) {
|
|
263
357
|
case 3: {
|
|
@@ -355,7 +449,7 @@ function transformComment(comment) {
|
|
|
355
449
|
default:
|
|
356
450
|
return 0;
|
|
357
451
|
}
|
|
358
|
-
}, toList(delay(() => append(others, delay(() => ((remarks != null) ? singleton_1(
|
|
452
|
+
}, toList(delay(() => append(others, delay(() => ((remarks != null) ? singleton_1(value_6(remarks)) : empty_1()))))), {
|
|
359
453
|
Compare: comparePrimitives,
|
|
360
454
|
}));
|
|
361
455
|
}
|
|
@@ -405,7 +499,12 @@ function transformPrimitive(gluePrimitive) {
|
|
|
405
499
|
}
|
|
406
500
|
|
|
407
501
|
function transformTupleType(context, glueTypes) {
|
|
408
|
-
|
|
502
|
+
if (isEmpty(glueTypes)) {
|
|
503
|
+
return new FSharpType(18, []);
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
return new FSharpType(12, [map((glueType) => transformType(context, glueType), glueTypes)]);
|
|
507
|
+
}
|
|
409
508
|
}
|
|
410
509
|
|
|
411
510
|
export function TypeLiteral_tryFindIterableType(context, typeLiteralInfo) {
|
|
@@ -508,9 +607,9 @@ function UtilityType_transformReadOnly(context, readonlyInfo, makeTypeAlias) {
|
|
|
508
607
|
const unionType = new FSharpType(1, [new FSharpUnion(empty(), patternInput[0], map((glueInterface) => {
|
|
509
608
|
const context_2 = TransformContext__PushScope_Z721C83C5(patternInput[1], `ReadOnly${glueInterface.Name}`);
|
|
510
609
|
const initialInterface = transformInterface(context_2, glueInterface);
|
|
511
|
-
const adaptedInterface = new FSharpInterface(initialInterface.Attributes, initialInterface.Name, initialInterface.OriginalName, initialInterface.TypeParameters, TransformMembers_forceReadonly(initialInterface.Members), initialInterface.Inheritance);
|
|
512
|
-
TransformContext__ExposeType_Z1D58A540(context_2, new FSharpType(5, [new FSharpInterface(adaptedInterface.Attributes, TransformContext__get_CurrentScopeName(context_2), adaptedInterface.OriginalName, adaptedInterface.TypeParameters, adaptedInterface.Members, adaptedInterface.Inheritance)]));
|
|
513
|
-
return new FSharpUnionCase(1, [new FSharpType(5, [new FSharpInterface(adaptedInterface.Attributes, TransformContext__get_FullName(context_2), adaptedInterface.OriginalName, adaptedInterface.TypeParameters, adaptedInterface.Members, adaptedInterface.Inheritance)])]);
|
|
610
|
+
const adaptedInterface = new FSharpInterface(initialInterface.Attributes, initialInterface.Name, initialInterface.XmlDoc, initialInterface.OriginalName, initialInterface.TypeParameters, TransformMembers_forceReadonly(initialInterface.Members), initialInterface.Inheritance);
|
|
611
|
+
TransformContext__ExposeType_Z1D58A540(context_2, new FSharpType(5, [new FSharpInterface(adaptedInterface.Attributes, TransformContext__get_CurrentScopeName(context_2), adaptedInterface.XmlDoc, adaptedInterface.OriginalName, adaptedInterface.TypeParameters, adaptedInterface.Members, adaptedInterface.Inheritance)]));
|
|
612
|
+
return new FSharpUnionCase(1, [new FSharpType(5, [new FSharpInterface(adaptedInterface.Attributes, TransformContext__get_FullName(context_2), adaptedInterface.XmlDoc, adaptedInterface.OriginalName, adaptedInterface.TypeParameters, adaptedInterface.Members, adaptedInterface.Inheritance)])]);
|
|
514
613
|
}, interfaces), false)]);
|
|
515
614
|
if (makeTypeAlias == null) {
|
|
516
615
|
return unionType;
|
|
@@ -520,7 +619,7 @@ function UtilityType_transformReadOnly(context, readonlyInfo, makeTypeAlias) {
|
|
|
520
619
|
}
|
|
521
620
|
}
|
|
522
621
|
else {
|
|
523
|
-
const interfaceTyp = new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(
|
|
622
|
+
const interfaceTyp = new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(21, [])]), TransformContext__get_CurrentScopeName(context), empty(), TransformContext__get_CurrentScopeName(context), empty(), TransformMembers_forceReadonly(TransformMembers_toFSharpMember(context, readonlyInfo.fields[0])), empty())]);
|
|
524
623
|
if (makeTypeAlias == null) {
|
|
525
624
|
TransformContext__ExposeType_Z1D58A540(context, interfaceTyp);
|
|
526
625
|
return new FSharpType(7, [new FSharpMapped(TransformContext__get_FullName(context), empty())]);
|
|
@@ -545,7 +644,7 @@ function transformType(context_mut, glueType_mut) {
|
|
|
545
644
|
return new FSharpType(3, [transformType(context, glueType.fields[0])]);
|
|
546
645
|
case 17: {
|
|
547
646
|
const thisTypeInfo = glueType.fields[0];
|
|
548
|
-
return new FSharpType(15, [new FSharpThisType(thisTypeInfo.Name, transformTypeParameters(context, thisTypeInfo.TypeParameters))]);
|
|
647
|
+
return new FSharpType(15, [new FSharpThisType(thisTypeInfo.Name, transformTypeParameters(context, thisTypeInfo.TypeParameters).TypeParameters)]);
|
|
549
648
|
}
|
|
550
649
|
case 18:
|
|
551
650
|
return transformTupleType(context, glueType.fields[0]);
|
|
@@ -591,14 +690,7 @@ function transformType(context_mut, glueType_mut) {
|
|
|
591
690
|
}
|
|
592
691
|
case 13: {
|
|
593
692
|
const typeReference = glueType.fields[0];
|
|
594
|
-
return new FSharpType(11, [new FSharpTypeReference(mapTypeNameToFableCoreAwareName(context, typeReference), typeReference.FullName, map((glueType_4) => transformType(context, glueType_4), typeReference.TypeArguments),
|
|
595
|
-
if (glueType_5.tag === 1) {
|
|
596
|
-
return glueType_5.fields[0].FullName === typeReference.FullName;
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
599
|
-
return false;
|
|
600
|
-
}
|
|
601
|
-
}, TransformContext__get_TypeMemory(context))), new FSharpType(10, [])))]);
|
|
693
|
+
return new FSharpType(11, [new FSharpTypeReference(mapTypeNameToFableCoreAwareName(context, typeReference), typeReference.FullName, map((glueType_4) => transformType(context, glueType_4), typeReference.TypeArguments), new FSharpType(10, []))]);
|
|
602
694
|
}
|
|
603
695
|
case 14:
|
|
604
696
|
return new FSharpType(14, [transformType(context, glueType.fields[0])]);
|
|
@@ -613,7 +705,7 @@ function transformType(context_mut, glueType_mut) {
|
|
|
613
705
|
const paremeters = filter((parameter) => (parameter.Name !== "this"), functionTypeInfo.Parameters);
|
|
614
706
|
let matchResult;
|
|
615
707
|
if (!isEmpty(paremeters)) {
|
|
616
|
-
if (isEmpty(
|
|
708
|
+
if (isEmpty(tail_1(paremeters))) {
|
|
617
709
|
matchResult = 0;
|
|
618
710
|
}
|
|
619
711
|
else {
|
|
@@ -627,9 +719,16 @@ function transformType(context_mut, glueType_mut) {
|
|
|
627
719
|
case 0:
|
|
628
720
|
return new FSharpType(16, [new FSharpFunctionType(map((parameter_1) => transformParameter(context, parameter_1), paremeters), transformType(context, functionTypeInfo.Type))]);
|
|
629
721
|
default: {
|
|
630
|
-
const typParameters = transformTypeParameters(context, filter((typeParameter) =>
|
|
631
|
-
|
|
632
|
-
|
|
722
|
+
const typParameters = transformTypeParameters(context, filter((typeParameter) => {
|
|
723
|
+
if (exists((parameter_2) => (typeParameter.Name === GlueType__get_Name(parameter_2.Type)), paremeters)) {
|
|
724
|
+
return true;
|
|
725
|
+
}
|
|
726
|
+
else {
|
|
727
|
+
return exists((parameterType) => (typeParameter.Name === parameterType.Name), GlueType__get_TypeParameters(functionTypeInfo.Type));
|
|
728
|
+
}
|
|
729
|
+
}, functionTypeInfo.TypeParameters));
|
|
730
|
+
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(20, [new FSharpDelegate(TransformContext__get_CurrentScopeName(context), typParameters.TypeParameters, map((arg) => TypeParameter_mapFsharpParameter(typParameters.SealedTypes, transformParameter(context, arg)), paremeters), transformType(context, functionTypeInfo.Type))]));
|
|
731
|
+
return new FSharpType(9, [new FSharpTypeAlias(empty(), TransformContext__get_FullName(context), empty(), new FSharpType(10, []), typParameters.TypeParameters)]);
|
|
633
732
|
}
|
|
634
733
|
}
|
|
635
734
|
}
|
|
@@ -637,8 +736,8 @@ function transformType(context_mut, glueType_mut) {
|
|
|
637
736
|
return new FSharpType(5, [transformInterface(context, glueType.fields[0])]);
|
|
638
737
|
case 21: {
|
|
639
738
|
const typeLiteralInfo = glueType.fields[0];
|
|
640
|
-
|
|
641
|
-
switch (
|
|
739
|
+
const hasNoIndexSignature = forAll((_arg_1) => {
|
|
740
|
+
switch (_arg_1.tag) {
|
|
642
741
|
case 6:
|
|
643
742
|
case 1:
|
|
644
743
|
case 2:
|
|
@@ -650,33 +749,82 @@ function transformType(context_mut, glueType_mut) {
|
|
|
650
749
|
default:
|
|
651
750
|
return false;
|
|
652
751
|
}
|
|
653
|
-
}, typeLiteralInfo.Members)
|
|
654
|
-
|
|
655
|
-
|
|
752
|
+
}, typeLiteralInfo.Members);
|
|
753
|
+
const typeParameterNames = List_distinct(choose((m) => {
|
|
754
|
+
let typ_3;
|
|
755
|
+
switch (m.tag) {
|
|
756
|
+
case 0: {
|
|
757
|
+
typ_3 = m.fields[0].Type;
|
|
758
|
+
break;
|
|
759
|
+
}
|
|
760
|
+
case 1: {
|
|
761
|
+
typ_3 = m.fields[0].Type;
|
|
762
|
+
break;
|
|
763
|
+
}
|
|
764
|
+
case 2: {
|
|
765
|
+
typ_3 = m.fields[0].Type;
|
|
766
|
+
break;
|
|
767
|
+
}
|
|
768
|
+
case 3: {
|
|
769
|
+
typ_3 = m.fields[0].ArgumentType;
|
|
770
|
+
break;
|
|
771
|
+
}
|
|
772
|
+
case 4: {
|
|
773
|
+
typ_3 = m.fields[0].Type;
|
|
774
|
+
break;
|
|
775
|
+
}
|
|
776
|
+
case 5: {
|
|
777
|
+
typ_3 = m.fields[0].Type;
|
|
778
|
+
break;
|
|
779
|
+
}
|
|
780
|
+
case 7: {
|
|
781
|
+
typ_3 = m.fields[0].Type;
|
|
782
|
+
break;
|
|
783
|
+
}
|
|
784
|
+
default:
|
|
785
|
+
typ_3 = m.fields[0].Type;
|
|
786
|
+
}
|
|
787
|
+
if (typ_3.tag === 16) {
|
|
788
|
+
return typ_3.fields[0];
|
|
789
|
+
}
|
|
790
|
+
else {
|
|
791
|
+
return void 0;
|
|
792
|
+
}
|
|
793
|
+
}, typeLiteralInfo.Members), {
|
|
794
|
+
Equals: (x, y) => (x === y),
|
|
795
|
+
GetHashCode: stringHash,
|
|
796
|
+
});
|
|
797
|
+
if (hasNoIndexSignature) {
|
|
798
|
+
const typeLiteralParameters = sortBy((_arg_2) => _arg_2.IsOptional, map((parameter_5) => {
|
|
799
|
+
const matchValue_1 = parameter_5.Type;
|
|
656
800
|
if (matchValue_1.tag === 3) {
|
|
657
|
-
return new FSharpParameter(
|
|
801
|
+
return new FSharpParameter(parameter_5.Attributes, parameter_5.Name, true, matchValue_1.fields[0], parameter_5.OriginalGlueMember);
|
|
658
802
|
}
|
|
659
803
|
else {
|
|
660
|
-
return
|
|
804
|
+
return parameter_5;
|
|
661
805
|
}
|
|
662
806
|
}, TransformMembers_toFSharpParameters(context, typeLiteralInfo.Members)), {
|
|
663
807
|
Compare: comparePrimitives,
|
|
664
808
|
});
|
|
665
|
-
const explicitFields = map((
|
|
666
|
-
|
|
809
|
+
const explicitFields = map((parameter_6) => {
|
|
810
|
+
let matchValue_2, matchValue_3;
|
|
811
|
+
return new FSharpExplicitField(parameter_6.Name, parameter_6.IsOptional ? (new FSharpType(3, [parameter_6.Type])) : parameter_6.Type, (matchValue_2 = parameter_6.OriginalGlueMember, (matchValue_2 == null) ? void 0 : ((matchValue_3 = GlueMember__TryGetAccessor(matchValue_2), (matchValue_3 == null) ? void 0 : transformAccessor(matchValue_3)))));
|
|
812
|
+
}, typeLiteralParameters);
|
|
813
|
+
const typeParameters_1 = map((name_3) => (new FSharpTypeParameter(1, [new FSharpTypeParameterInfo(name_3, void 0, void 0)])), typeParameterNames);
|
|
814
|
+
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(17, [new FSharpClass(ofArray([new FSharpAttribute(18, []), new FSharpAttribute(8, [])]), TypeLiteralsMemory__GetTypeName_Z384F8060(TransformContext__get_TypeLiteralsMemory(context), TransformContext__get_FullName(context), TransformContext__get_CurrentScopeName(context)), typeParameters_1, new FSharpConstructor(typeLiteralParameters, ofArray([new FSharpAttribute(19, []), new FSharpAttribute(2, [])]), new FSharpAccessibility(0, [])), empty(), explicitFields)]));
|
|
667
815
|
}
|
|
668
816
|
else {
|
|
669
|
-
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(
|
|
670
|
-
const
|
|
671
|
-
if (
|
|
817
|
+
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(21, [])]), TransformContext__get_CurrentScopeName(context), empty(), "", empty(), TransformMembers_toFSharpMember(context, typeLiteralInfo.Members), toList(delay(() => {
|
|
818
|
+
const matchValue_4 = TypeLiteral_tryFindIterableType(context, typeLiteralInfo);
|
|
819
|
+
if (matchValue_4 == null) {
|
|
672
820
|
return empty_1();
|
|
673
821
|
}
|
|
674
822
|
else {
|
|
675
|
-
return singleton_1(
|
|
823
|
+
return singleton_1(matchValue_4);
|
|
676
824
|
}
|
|
677
825
|
})))]));
|
|
678
826
|
}
|
|
679
|
-
return new FSharpType(11, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), new FSharpType(10, []))]);
|
|
827
|
+
return new FSharpType(11, [new FSharpTypeReference(TypeLiteralsMemory__GetFullTypeNameReference_Z384F8060(TransformContext__get_TypeLiteralsMemory(context), TransformContext__get_FullName(context), TransformContext__get_CurrentScopeName(context)), TransformContext__get_FullName(context), map((name_5) => (new FSharpType(7, [new FSharpMapped(`'${name_5}`, empty())])), typeParameterNames), new FSharpType(10, []))]);
|
|
680
828
|
}
|
|
681
829
|
case 24: {
|
|
682
830
|
context_mut = context;
|
|
@@ -689,12 +837,12 @@ function transformType(context_mut, glueType_mut) {
|
|
|
689
837
|
continue transformType;
|
|
690
838
|
}
|
|
691
839
|
case 9: {
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
840
|
+
const matchValue_5 = TypeAliasDeclaration_tryTransformKeyOf(TransformContext__get_CurrentScopeName(context), glueType.fields[0]);
|
|
841
|
+
if (matchValue_5 == null) {
|
|
694
842
|
return new FSharpType(18, []);
|
|
695
843
|
}
|
|
696
844
|
else {
|
|
697
|
-
TransformContext__ExposeType_Z1D58A540(context,
|
|
845
|
+
TransformContext__ExposeType_Z1D58A540(context, matchValue_5);
|
|
698
846
|
return new FSharpType(11, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), new FSharpType(10, []))]);
|
|
699
847
|
}
|
|
700
848
|
}
|
|
@@ -722,7 +870,7 @@ function transformType(context_mut, glueType_mut) {
|
|
|
722
870
|
}
|
|
723
871
|
case 6: {
|
|
724
872
|
const functionDeclaration = glueType.fields[0];
|
|
725
|
-
return new FSharpType(16, [new FSharpFunctionType(map((
|
|
873
|
+
return new FSharpType(16, [new FSharpFunctionType(map((parameter_7) => transformParameter(context, parameter_7), functionDeclaration.Parameters), transformType(context, functionDeclaration.Type))]);
|
|
726
874
|
}
|
|
727
875
|
case 20: {
|
|
728
876
|
const members_1 = glueType.fields[0];
|
|
@@ -730,47 +878,47 @@ function transformType(context_mut, glueType_mut) {
|
|
|
730
878
|
return new FSharpType(18, []);
|
|
731
879
|
}
|
|
732
880
|
else {
|
|
733
|
-
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(
|
|
881
|
+
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(21, [])]), TransformContext__get_CurrentScopeName(context), empty(), TransformContext__get_CurrentScopeName(context), empty(), TransformMembers_toFSharpMember(context, members_1), empty())]));
|
|
734
882
|
return new FSharpType(7, [new FSharpMapped(TransformContext__get_FullName(context), empty())]);
|
|
735
883
|
}
|
|
736
884
|
}
|
|
737
885
|
case 26: {
|
|
738
886
|
const utilityType = glueType.fields[0];
|
|
739
|
-
let
|
|
887
|
+
let matchResult_2, innerType;
|
|
740
888
|
switch (utilityType.tag) {
|
|
741
889
|
case 1: {
|
|
742
|
-
|
|
890
|
+
matchResult_2 = 1;
|
|
743
891
|
break;
|
|
744
892
|
}
|
|
745
893
|
case 2: {
|
|
746
|
-
|
|
894
|
+
matchResult_2 = 2;
|
|
747
895
|
innerType = utilityType.fields[0];
|
|
748
896
|
break;
|
|
749
897
|
}
|
|
750
898
|
case 3: {
|
|
751
|
-
|
|
899
|
+
matchResult_2 = 2;
|
|
752
900
|
innerType = utilityType.fields[0];
|
|
753
901
|
break;
|
|
754
902
|
}
|
|
755
903
|
case 4: {
|
|
756
|
-
|
|
904
|
+
matchResult_2 = 3;
|
|
757
905
|
break;
|
|
758
906
|
}
|
|
759
907
|
case 5: {
|
|
760
|
-
|
|
908
|
+
matchResult_2 = 4;
|
|
761
909
|
break;
|
|
762
910
|
}
|
|
763
911
|
default:
|
|
764
|
-
|
|
912
|
+
matchResult_2 = 0;
|
|
765
913
|
}
|
|
766
|
-
switch (
|
|
914
|
+
switch (matchResult_2) {
|
|
767
915
|
case 0: {
|
|
768
916
|
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(5, [(originalInterface = transformInterface(context, utilityType.fields[0]), Interface_makePartial(TransformContext__get_CurrentScopeName(context), originalInterface))]));
|
|
769
917
|
return new FSharpType(11, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), new FSharpType(10, []))]);
|
|
770
918
|
}
|
|
771
919
|
case 1: {
|
|
772
|
-
TransformContext__ExposeType_Z1D58A540(context, transformRecord(context, TransformContext__get_CurrentScopeName(context), empty(), utilityType.fields[0]));
|
|
773
|
-
return new FSharpType(7, [new FSharpMapped(TransformContext__get_FullName(context), empty())]);
|
|
920
|
+
TransformContext__ExposeType_Z1D58A540(context, transformRecord(context, TypeLiteralsMemory__GetTypeName_Z384F8060(TransformContext__get_TypeLiteralsMemory(context), TransformContext__get_FullName(context), TransformContext__get_CurrentScopeName(context)), empty(), utilityType.fields[0]));
|
|
921
|
+
return new FSharpType(7, [new FSharpMapped(TypeLiteralsMemory__GetFullTypeNameReference_Z384F8060(TransformContext__get_TypeLiteralsMemory(context), TransformContext__get_FullName(context), TransformContext__get_CurrentScopeName(context)), empty())]);
|
|
774
922
|
}
|
|
775
923
|
case 2: {
|
|
776
924
|
context_mut = context;
|
|
@@ -778,7 +926,7 @@ function transformType(context_mut, glueType_mut) {
|
|
|
778
926
|
continue transformType;
|
|
779
927
|
}
|
|
780
928
|
case 3: {
|
|
781
|
-
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(
|
|
929
|
+
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(21, [])]), TransformContext__get_CurrentScopeName(context), empty(), TransformContext__get_CurrentScopeName(context), empty(), TransformMembers_toFSharpMember(context, utilityType.fields[0]), empty())]));
|
|
782
930
|
return new FSharpType(7, [new FSharpMapped(TransformContext__get_FullName(context), empty())]);
|
|
783
931
|
}
|
|
784
932
|
default:
|
|
@@ -802,87 +950,124 @@ function transformType(context_mut, glueType_mut) {
|
|
|
802
950
|
}
|
|
803
951
|
|
|
804
952
|
function transformExports(context, isTopLevel, exports) {
|
|
953
|
+
let sortedExports, apply_1;
|
|
805
954
|
const context_1 = TransformContext__PushScope_Z721C83C5(context, "Exports");
|
|
806
|
-
return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(7, []), new FSharpAttribute(6, [])]), "Exports", "Exports", empty(),
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
955
|
+
return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(7, []), new FSharpAttribute(6, [])]), "Exports", empty(), "Exports", empty(), (sortedExports = sortBy((_arg) => {
|
|
956
|
+
if (_arg.tag === 11) {
|
|
957
|
+
return 1;
|
|
958
|
+
}
|
|
959
|
+
else {
|
|
960
|
+
return 0;
|
|
961
|
+
}
|
|
962
|
+
}, exports, {
|
|
963
|
+
Compare: comparePrimitives,
|
|
964
|
+
}), (apply_1 = ((acc, seenNames, glueTypes) => {
|
|
965
|
+
if (!isEmpty(glueTypes)) {
|
|
966
|
+
const head = head_1(glueTypes);
|
|
967
|
+
const applyHelper = (newTypes, newNames) => apply_1(append_1(acc, newTypes), union(seenNames, newNames), tail_1(glueTypes));
|
|
968
|
+
let matchResult, info, info_1, info_2, moduleDeclaration, glueType, glueType_1;
|
|
969
|
+
switch (head.tag) {
|
|
970
|
+
case 2: {
|
|
971
|
+
matchResult = 0;
|
|
972
|
+
info = head.fields[0];
|
|
973
|
+
break;
|
|
974
|
+
}
|
|
975
|
+
case 6: {
|
|
976
|
+
matchResult = 1;
|
|
977
|
+
info_1 = head.fields[0];
|
|
978
|
+
break;
|
|
979
|
+
}
|
|
980
|
+
case 12: {
|
|
827
981
|
matchResult = 2;
|
|
828
|
-
info_2 =
|
|
982
|
+
info_2 = head.fields[0];
|
|
983
|
+
break;
|
|
829
984
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
985
|
+
case 24: {
|
|
986
|
+
if (head.fields[0].tag === 12) {
|
|
987
|
+
matchResult = 2;
|
|
988
|
+
info_2 = head.fields[0].fields[0];
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
matchResult = 4;
|
|
992
|
+
glueType = head.fields[0];
|
|
993
|
+
}
|
|
994
|
+
break;
|
|
995
|
+
}
|
|
996
|
+
case 11: {
|
|
997
|
+
matchResult = 3;
|
|
998
|
+
moduleDeclaration = head.fields[0];
|
|
999
|
+
break;
|
|
1000
|
+
}
|
|
1001
|
+
default: {
|
|
1002
|
+
matchResult = 5;
|
|
1003
|
+
glueType_1 = head;
|
|
833
1004
|
}
|
|
834
|
-
break;
|
|
835
|
-
}
|
|
836
|
-
case 11: {
|
|
837
|
-
matchResult = 3;
|
|
838
|
-
moduleDeclaration = _arg.fields[0];
|
|
839
|
-
break;
|
|
840
1005
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
1006
|
+
switch (matchResult) {
|
|
1007
|
+
case 0: {
|
|
1008
|
+
const patternInput = sanitizeNameAndPushScope(info.Name, context_1);
|
|
1009
|
+
const name = patternInput[0];
|
|
1010
|
+
const xmlDocInfo = transformComment(info.Documentation);
|
|
1011
|
+
return applyHelper(singleton(new FSharpMember(1, [new FSharpMemberInfo(toList(delay(() => append(isTopLevel ? singleton_1(new FSharpAttribute(3, [info.Name, "REPLACE_ME_WITH_MODULE_NAME"])) : singleton_1(new FSharpAttribute(16, [info.Name])), delay(() => xmlDocInfo.ObsoleteAttributes)))), name, info.Name, empty(), empty(), transformType(patternInput[1], info.Type), false, isTopLevel, void 0, new FSharpAccessibility(0, []), xmlDocInfo.XmlDoc, new FSharpMemberInfoBody(0, []))])), singleton_2(name, {
|
|
1012
|
+
Compare: comparePrimitives,
|
|
1013
|
+
}));
|
|
1014
|
+
}
|
|
1015
|
+
case 1: {
|
|
1016
|
+
const patternInput_1 = sanitizeNameAndPushScope(info_1.Name, context_1);
|
|
1017
|
+
const name_1 = patternInput_1[0];
|
|
1018
|
+
const context_3 = patternInput_1[1];
|
|
1019
|
+
const xmlDocInfo_1 = transformComment(info_1.Documentation);
|
|
1020
|
+
const typeParameters = transformTypeParameters(context_3, info_1.TypeParameters);
|
|
1021
|
+
return applyHelper(singleton(new FSharpMember(0, [new FSharpMemberInfo(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)))), name_1, info_1.Name, typeParameters.TypeParameters, map((arg) => TypeParameter_mapFsharpParameter(typeParameters.SealedTypes, transformParameter(context_3, arg)), info_1.Parameters), TypeParameter_mapFSharpType(typeParameters.SealedTypes, transformType(context_3, info_1.Type)), false, isTopLevel, void 0, new FSharpAccessibility(0, []), xmlDocInfo_1.XmlDoc, new FSharpMemberInfoBody(0, []))])), singleton_2(name_1, {
|
|
1022
|
+
Compare: comparePrimitives,
|
|
1023
|
+
}));
|
|
1024
|
+
}
|
|
1025
|
+
case 2: {
|
|
1026
|
+
const patternInput_2 = sanitizeNameAndPushScope(info_2.Name, context_1);
|
|
1027
|
+
const name_2 = patternInput_2[0];
|
|
1028
|
+
const context_4 = patternInput_2[1];
|
|
1029
|
+
const patternInput_3 = unzip(map((constructorInfo) => {
|
|
1030
|
+
const xmlDocInfo_2 = transformComment(constructorInfo.Documentation);
|
|
1031
|
+
const typParameters = transformTypeParameters(context_4, info_2.TypeParameters);
|
|
1032
|
+
return [name_2, new FSharpMember(0, [new FSharpMemberInfo(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)))), name_2, info_2.Name, typParameters.TypeParameters, map((arg_1) => TypeParameter_mapFsharpParameter(typParameters.SealedTypes, transformParameter(context_4, arg_1)), constructorInfo.Parameters), new FSharpType(7, [new FSharpMapped(sanitizeName(info_2.Name), typParameters.TypeParameters)]), false, isTopLevel, void 0, new FSharpAccessibility(0, []), xmlDocInfo_2.XmlDoc, new FSharpMemberInfoBody(0, []))])];
|
|
1033
|
+
}, isEmpty(info_2.Constructors) ? singleton(new GlueConstructor(empty(), empty())) : info_2.Constructors));
|
|
1034
|
+
return applyHelper(patternInput_3[1], ofList(patternInput_3[0], {
|
|
1035
|
+
Compare: comparePrimitives,
|
|
1036
|
+
}));
|
|
1037
|
+
}
|
|
1038
|
+
case 3: {
|
|
1039
|
+
const sanitizedName = sanitizeName(moduleDeclaration.Name);
|
|
1040
|
+
const mangledName = FSharpSet__Contains(seenNames, sanitizedName) ? (`${sanitizedName}_`) : sanitizedName;
|
|
1041
|
+
const exportTypeName = isTopLevel ? (`${sanitizedName}_.Exports`) : (`${sanitizedName}.Exports`);
|
|
1042
|
+
return applyHelper(singleton(new FSharpMember(1, [new FSharpMemberInfo(toList(delay(() => (isTopLevel ? singleton_1(new FSharpAttribute(4, ["REPLACE_ME_WITH_MODULE_NAME"])) : singleton_1(new FSharpAttribute(16, [removeSurroundingQuotes(moduleDeclaration.Name)]))))), mangledName, `${moduleDeclaration.Name}.Exports`, empty(), empty(), new FSharpType(7, [new FSharpMapped(exportTypeName, empty())]), false, isTopLevel, new FSharpAccessor(0, []), new FSharpAccessibility(0, []), empty(), new FSharpMemberInfoBody(0, []))])), singleton_2(mangledName, {
|
|
1043
|
+
Compare: comparePrimitives,
|
|
1044
|
+
}));
|
|
1045
|
+
}
|
|
1046
|
+
case 4: {
|
|
1047
|
+
const patternInput_4 = sanitizeNameAndPushScope(GlueType__get_Name(glueType), context_1);
|
|
1048
|
+
const name_3 = patternInput_4[0];
|
|
1049
|
+
return applyHelper(singleton(new FSharpMember(1, [new FSharpMemberInfo(singleton(new FSharpAttribute(5, ["REPLACE_ME_WITH_MODULE_NAME"])), name_3, GlueType__get_Name(glueType), empty(), empty(), transformType(patternInput_4[1], glueType), false, true, void 0, new FSharpAccessibility(0, []), empty(), new FSharpMemberInfoBody(0, []))])), singleton_2(name_3, {
|
|
1050
|
+
Compare: comparePrimitives,
|
|
1051
|
+
}));
|
|
1052
|
+
}
|
|
1053
|
+
default:
|
|
1054
|
+
return toFail(printf("Could not generate exportMembers for: %A"))(glueType_1);
|
|
844
1055
|
}
|
|
845
1056
|
}
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
const patternInput = sanitizeNameAndPushScope(info.Name, context_1);
|
|
849
|
-
const xmlDocInfo = transformComment(info.Documentation);
|
|
850
|
-
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, []))]));
|
|
851
|
-
}
|
|
852
|
-
case 1: {
|
|
853
|
-
const patternInput_1 = sanitizeNameAndPushScope(info_1.Name, context_1);
|
|
854
|
-
const context_3 = patternInput_1[1];
|
|
855
|
-
const xmlDocInfo_1 = transformComment(info_1.Documentation);
|
|
856
|
-
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, []))))]));
|
|
857
|
-
}
|
|
858
|
-
case 2: {
|
|
859
|
-
const patternInput_2 = sanitizeNameAndPushScope(info_2.Name, context_1);
|
|
860
|
-
const context_4 = patternInput_2[1];
|
|
861
|
-
return map((constructorInfo) => {
|
|
862
|
-
let Attributes_2, Parameters_2;
|
|
863
|
-
const xmlDocInfo_2 = transformComment(constructorInfo.Documentation);
|
|
864
|
-
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(7, [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, []))))]);
|
|
865
|
-
}, isEmpty(info_2.Constructors) ? singleton(new GlueConstructor(empty(), empty())) : info_2.Constructors);
|
|
866
|
-
}
|
|
867
|
-
case 3: {
|
|
868
|
-
const sanitizedName = sanitizeName(moduleDeclaration.Name);
|
|
869
|
-
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(7, [new FSharpMapped(`${sanitizedName}.Exports`, empty())]), false, isTopLevel, new FSharpAccessor(0, []), new FSharpAccessibility(0, []), empty(), new FSharpMemberInfoBody(0, []))]));
|
|
870
|
-
}
|
|
871
|
-
case 4: {
|
|
872
|
-
const patternInput_3 = sanitizeNameAndPushScope(GlueType__get_Name(glueType), context_1);
|
|
873
|
-
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, []))]));
|
|
874
|
-
}
|
|
875
|
-
default:
|
|
876
|
-
return toFail(printf("Could not generate exportMembers for: %A"))(glueType_1);
|
|
1057
|
+
else {
|
|
1058
|
+
return acc;
|
|
877
1059
|
}
|
|
878
|
-
},
|
|
1060
|
+
}), apply_1(empty(), empty_2({
|
|
1061
|
+
Compare: comparePrimitives,
|
|
1062
|
+
}), sortedExports))), empty())]);
|
|
879
1063
|
}
|
|
880
1064
|
|
|
881
1065
|
function transformParameter(context, parameter) {
|
|
1066
|
+
const patternInput = sanitizeNameAndPushScope(parameter.Name, context);
|
|
882
1067
|
let typ;
|
|
883
|
-
const computedType = unwrapOptionIfAlreadyOptional(
|
|
1068
|
+
const computedType = unwrapOptionIfAlreadyOptional(patternInput[1], parameter.Type, parameter.IsOptional);
|
|
884
1069
|
typ = (parameter.IsSpread ? ((computedType.tag === 14) ? computedType.fields[0] : computedType) : computedType);
|
|
885
|
-
return new FSharpParameter(toList(delay(() => (parameter.IsSpread ? singleton_1(new FSharpAttribute(
|
|
1070
|
+
return new FSharpParameter(toList(delay(() => (parameter.IsSpread ? singleton_1(new FSharpAttribute(20, [])) : empty_1()))), patternInput[0], parameter.IsOptional, typ, void 0);
|
|
886
1071
|
}
|
|
887
1072
|
|
|
888
1073
|
function transformAccessor(accessor) {
|
|
@@ -908,38 +1093,38 @@ function TransformMembers_toFSharpMember(context, members) {
|
|
|
908
1093
|
case 1: {
|
|
909
1094
|
const propertyInfo = _arg_4.fields[0];
|
|
910
1095
|
const patternInput_2 = sanitizeNameAndPushScope(propertyInfo.Name, context);
|
|
911
|
-
const
|
|
1096
|
+
const xmlDocInfo_1 = transformComment(propertyInfo.Documentation);
|
|
912
1097
|
if (propertyInfo.IsPrivate && !propertyInfo.IsStatic) {
|
|
913
1098
|
return void 0;
|
|
914
1099
|
}
|
|
915
1100
|
else {
|
|
916
|
-
return new FSharpMember(1, [new FSharpMemberInfo(toList(delay(() =>
|
|
1101
|
+
return new FSharpMember(1, [new FSharpMemberInfo(toList(delay(() => xmlDocInfo_1.ObsoleteAttributes)), patternInput_2[0], propertyInfo.Name, empty(), empty(), unwrapOptionIfAlreadyOptional(patternInput_2[1], propertyInfo.Type, propertyInfo.IsOptional), propertyInfo.IsOptional, propertyInfo.IsStatic, transformAccessor(propertyInfo.Accessor), propertyInfo.IsPrivate ? (new FSharpAccessibility(1, [])) : (new FSharpAccessibility(0, [])), xmlDocInfo_1.XmlDoc, new FSharpMemberInfoBody(1, []))]);
|
|
917
1102
|
}
|
|
918
1103
|
}
|
|
919
1104
|
case 2: {
|
|
920
1105
|
const getAccessorInfo_1 = _arg_4.fields[0];
|
|
921
1106
|
const patternInput_3 = sanitizeNameAndPushScope(getAccessorInfo_1.Name, context);
|
|
922
|
-
const
|
|
923
|
-
return new FSharpMember(1, [new FSharpMemberInfo(toList(delay(() =>
|
|
1107
|
+
const xmlDocInfo_2 = transformComment(getAccessorInfo_1.Documentation);
|
|
1108
|
+
return new FSharpMember(1, [new FSharpMemberInfo(toList(delay(() => xmlDocInfo_2.ObsoleteAttributes)), patternInput_3[0], getAccessorInfo_1.Name, empty(), empty(), transformType(patternInput_3[1], getAccessorInfo_1.Type), false, getAccessorInfo_1.IsStatic, new FSharpAccessor(0, []), new FSharpAccessibility(0, []), xmlDocInfo_2.XmlDoc, new FSharpMemberInfoBody(0, []))]);
|
|
924
1109
|
}
|
|
925
1110
|
case 3: {
|
|
926
1111
|
const setAccessorInfo_1 = _arg_4.fields[0];
|
|
927
1112
|
const patternInput_4 = sanitizeNameAndPushScope(setAccessorInfo_1.Name, context);
|
|
928
|
-
const
|
|
929
|
-
return new FSharpMember(1, [new FSharpMemberInfo(toList(delay(() =>
|
|
1113
|
+
const xmlDocInfo_3 = transformComment(setAccessorInfo_1.Documentation);
|
|
1114
|
+
return new FSharpMember(1, [new FSharpMemberInfo(toList(delay(() => xmlDocInfo_3.ObsoleteAttributes)), patternInput_4[0], setAccessorInfo_1.Name, empty(), empty(), transformType(patternInput_4[1], setAccessorInfo_1.ArgumentType), false, setAccessorInfo_1.IsStatic, new FSharpAccessor(1, []), new FSharpAccessibility(0, []), xmlDocInfo_3.XmlDoc, new FSharpMemberInfoBody(0, []))]);
|
|
930
1115
|
}
|
|
931
1116
|
case 5: {
|
|
932
1117
|
const indexSignature = _arg_4.fields[0];
|
|
933
1118
|
const patternInput_5 = sanitizeNameAndPushScope("Item", context);
|
|
934
1119
|
const context_6 = patternInput_5[1];
|
|
935
|
-
return new FSharpMember(1, [new FSharpMemberInfo(singleton(new FSharpAttribute(
|
|
1120
|
+
return new FSharpMember(1, [new FSharpMemberInfo(singleton(new FSharpAttribute(17, [])), patternInput_5[0], "Item", empty(), map((parameter_3) => transformParameter(context_6, parameter_3), indexSignature.Parameters), transformType(context_6, indexSignature.Type), false, false, indexSignature.IsReadOnly ? (new FSharpAccessor(0, [])) : (new FSharpAccessor(2, [])), new FSharpAccessibility(0, []), empty(), new FSharpMemberInfoBody(0, []))]);
|
|
936
1121
|
}
|
|
937
1122
|
case 6: {
|
|
938
1123
|
const methodSignature = _arg_4.fields[0];
|
|
939
1124
|
const patternInput_6 = sanitizeNameAndPushScope(methodSignature.Name, context);
|
|
940
1125
|
const context_7 = patternInput_6[1];
|
|
941
|
-
const
|
|
942
|
-
return new FSharpMember(0, [new FSharpMemberInfo(toList(delay(() =>
|
|
1126
|
+
const xmlDocInfo_4 = transformComment(methodSignature.Documentation);
|
|
1127
|
+
return new FSharpMember(0, [new FSharpMemberInfo(toList(delay(() => xmlDocInfo_4.ObsoleteAttributes)), patternInput_6[0], methodSignature.Name, empty(), map((parameter_4) => transformParameter(context_7, parameter_4), methodSignature.Parameters), transformType(context_7, methodSignature.Type), false, false, void 0, new FSharpAccessibility(0, []), xmlDocInfo_4.XmlDoc, new FSharpMemberInfoBody(0, []))]);
|
|
943
1128
|
}
|
|
944
1129
|
case 7: {
|
|
945
1130
|
const constructSignature = _arg_4.fields[0];
|
|
@@ -952,11 +1137,12 @@ function TransformMembers_toFSharpMember(context, members) {
|
|
|
952
1137
|
const patternInput = sanitizeNameAndPushScope(methodInfo.Name, context);
|
|
953
1138
|
const name_1 = patternInput[0];
|
|
954
1139
|
const context_1 = patternInput[1];
|
|
1140
|
+
const xmlDocInfo = transformComment(methodInfo.Documentation);
|
|
955
1141
|
if (methodInfo.IsStatic) {
|
|
956
|
-
return new FSharpMember(2, [new FSharpStaticMemberInfo(
|
|
1142
|
+
return new FSharpMember(2, [new FSharpStaticMemberInfo(toList(delay(() => xmlDocInfo.ObsoleteAttributes)), name_1, methodInfo.Name, empty(), map((parameter) => transformParameter(context_1, parameter), methodInfo.Parameters), transformType(context_1, methodInfo.Type), methodInfo.IsOptional, void 0, new FSharpAccessibility(0, []), xmlDocInfo.XmlDoc)]);
|
|
957
1143
|
}
|
|
958
1144
|
else {
|
|
959
|
-
return new FSharpMember(0, [new FSharpMemberInfo(
|
|
1145
|
+
return new FSharpMember(0, [new FSharpMemberInfo(toList(delay(() => xmlDocInfo.ObsoleteAttributes)), name_1, methodInfo.Name, empty(), map((parameter_1) => transformParameter(context_1, parameter_1), methodInfo.Parameters), transformType(context_1, methodInfo.Type), methodInfo.IsOptional, methodInfo.IsStatic, void 0, new FSharpAccessibility(0, []), xmlDocInfo.XmlDoc, new FSharpMemberInfoBody(0, []))]);
|
|
960
1146
|
}
|
|
961
1147
|
}
|
|
962
1148
|
}
|
|
@@ -1052,44 +1238,44 @@ function TransformMembers_forceReadonly(members) {
|
|
|
1052
1238
|
}
|
|
1053
1239
|
|
|
1054
1240
|
function TransformMembers_toFSharpParameters(context, members) {
|
|
1055
|
-
return map((
|
|
1056
|
-
switch (
|
|
1241
|
+
return map((glueMember) => {
|
|
1242
|
+
switch (glueMember.tag) {
|
|
1057
1243
|
case 1: {
|
|
1058
|
-
const propertyInfo =
|
|
1244
|
+
const propertyInfo = glueMember.fields[0];
|
|
1059
1245
|
const patternInput_1 = sanitizeNameAndPushScope(propertyInfo.Name, context);
|
|
1060
|
-
return new FSharpParameter(empty(), patternInput_1[0], propertyInfo.IsOptional, transformType(patternInput_1[1], propertyInfo.Type));
|
|
1246
|
+
return new FSharpParameter(empty(), patternInput_1[0], propertyInfo.IsOptional, transformType(patternInput_1[1], propertyInfo.Type), glueMember);
|
|
1061
1247
|
}
|
|
1062
1248
|
case 2: {
|
|
1063
|
-
const getAccessorInfo =
|
|
1249
|
+
const getAccessorInfo = glueMember.fields[0];
|
|
1064
1250
|
const patternInput_2 = sanitizeNameAndPushScope(getAccessorInfo.Name, context);
|
|
1065
|
-
return new FSharpParameter(empty(), patternInput_2[0], false, transformType(patternInput_2[1], getAccessorInfo.Type));
|
|
1251
|
+
return new FSharpParameter(empty(), patternInput_2[0], false, transformType(patternInput_2[1], getAccessorInfo.Type), glueMember);
|
|
1066
1252
|
}
|
|
1067
1253
|
case 3: {
|
|
1068
|
-
const setAccessorInfo =
|
|
1254
|
+
const setAccessorInfo = glueMember.fields[0];
|
|
1069
1255
|
const patternInput_3 = sanitizeNameAndPushScope(setAccessorInfo.Name, context);
|
|
1070
|
-
return new FSharpParameter(empty(), patternInput_3[0], false, transformType(patternInput_3[1], setAccessorInfo.ArgumentType));
|
|
1256
|
+
return new FSharpParameter(empty(), patternInput_3[0], false, transformType(patternInput_3[1], setAccessorInfo.ArgumentType), glueMember);
|
|
1071
1257
|
}
|
|
1072
1258
|
case 5: {
|
|
1073
1259
|
const patternInput_4 = sanitizeNameAndPushScope("Item", context);
|
|
1074
|
-
return new FSharpParameter(empty(), patternInput_4[0], false, transformType(patternInput_4[1],
|
|
1260
|
+
return new FSharpParameter(empty(), patternInput_4[0], false, transformType(patternInput_4[1], glueMember.fields[0].Type), glueMember);
|
|
1075
1261
|
}
|
|
1076
1262
|
case 6: {
|
|
1077
|
-
const methodSignature =
|
|
1263
|
+
const methodSignature = glueMember.fields[0];
|
|
1078
1264
|
const patternInput_5 = sanitizeNameAndPushScope(methodSignature.Name, context);
|
|
1079
|
-
return new FSharpParameter(empty(), patternInput_5[0], false, transformType(patternInput_5[1], methodSignature.Type));
|
|
1265
|
+
return new FSharpParameter(empty(), patternInput_5[0], false, transformType(patternInput_5[1], methodSignature.Type), glueMember);
|
|
1080
1266
|
}
|
|
1081
1267
|
case 4: {
|
|
1082
1268
|
const patternInput_6 = sanitizeNameAndPushScope("Invoke", context);
|
|
1083
|
-
return new FSharpParameter(empty(), patternInput_6[0], false, transformType(patternInput_6[1],
|
|
1269
|
+
return new FSharpParameter(empty(), patternInput_6[0], false, transformType(patternInput_6[1], glueMember.fields[0].Type), glueMember);
|
|
1084
1270
|
}
|
|
1085
1271
|
case 7: {
|
|
1086
1272
|
const patternInput_7 = sanitizeNameAndPushScope("Create", context);
|
|
1087
|
-
return new FSharpParameter(empty(), patternInput_7[0], false, transformType(patternInput_7[1],
|
|
1273
|
+
return new FSharpParameter(empty(), patternInput_7[0], false, transformType(patternInput_7[1], glueMember.fields[0].Type), glueMember);
|
|
1088
1274
|
}
|
|
1089
1275
|
default: {
|
|
1090
|
-
const methodInfo =
|
|
1276
|
+
const methodInfo = glueMember.fields[0];
|
|
1091
1277
|
const patternInput = sanitizeNameAndPushScope(methodInfo.Name, context);
|
|
1092
|
-
return new FSharpParameter(empty(), patternInput[0], methodInfo.IsOptional, transformType(patternInput[1], methodInfo.Type));
|
|
1278
|
+
return new FSharpParameter(empty(), patternInput[0], methodInfo.IsOptional, transformType(patternInput[1], methodInfo.Type), glueMember);
|
|
1093
1279
|
}
|
|
1094
1280
|
}
|
|
1095
1281
|
}, members);
|
|
@@ -1097,6 +1283,7 @@ function TransformMembers_toFSharpParameters(context, members) {
|
|
|
1097
1283
|
|
|
1098
1284
|
function transformInterface(context, info) {
|
|
1099
1285
|
const patternInput = sanitizeNameAndPushScope(info.Name, context);
|
|
1286
|
+
const name = patternInput[0];
|
|
1100
1287
|
const context_1 = patternInput[1];
|
|
1101
1288
|
const membersComingFromPartial = concat(map((fullName) => concat(choose((glueType) => {
|
|
1102
1289
|
if (glueType.tag === 1) {
|
|
@@ -1146,12 +1333,15 @@ function transformInterface(context, info) {
|
|
|
1146
1333
|
return true;
|
|
1147
1334
|
}
|
|
1148
1335
|
}, map((typ_1) => TransformContext__ExposeTypeAlias_1CE4A880(context_1, typ_1), info.HeritageClauses));
|
|
1149
|
-
const
|
|
1150
|
-
|
|
1336
|
+
const typeParametersResult = transformTypeParameters(context_1, info.TypeParameters);
|
|
1337
|
+
iterate((typ_2) => {
|
|
1338
|
+
TransformContext__ExposeType_Z1D58A540(context_1, typ_2);
|
|
1339
|
+
}, exposeSpecializedAlias(name, empty(), empty(), reverse(typeParametersResult.TypeParameters)));
|
|
1340
|
+
return new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(21, [])]), name, empty(), info.Name, typeParametersResult.TypeParameters, TypeParameter_mapFsharpMembers(typeParametersResult.SealedTypes, append_1(standardMembers, membersComingFromPartial)), map((glueType_1) => transformType(context_1, glueType_1), inheritance));
|
|
1151
1341
|
}
|
|
1152
1342
|
|
|
1153
1343
|
export function Interface_makePartial(name, originalInterface) {
|
|
1154
|
-
return new FSharpInterface(originalInterface.Attributes, name, originalInterface.OriginalName, originalInterface.TypeParameters, map((m) => {
|
|
1344
|
+
return new FSharpInterface(originalInterface.Attributes, name, originalInterface.XmlDoc, originalInterface.OriginalName, originalInterface.TypeParameters, map((m) => {
|
|
1155
1345
|
if (m.tag === 1) {
|
|
1156
1346
|
const property = m.fields[0];
|
|
1157
1347
|
if (property.Type.tag === 3) {
|
|
@@ -1308,24 +1498,153 @@ function transformRecord(context, name, typeParameters, recordInfo) {
|
|
|
1308
1498
|
const context_1 = patternInput[1];
|
|
1309
1499
|
let parameters;
|
|
1310
1500
|
const patternInput_1 = sanitizeNameAndPushScope("key", context_1);
|
|
1311
|
-
parameters = singleton(new FSharpParameter(empty(), patternInput_1[0], false, transformType(patternInput_1[1], recordInfo.KeyType)));
|
|
1312
|
-
return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(
|
|
1501
|
+
parameters = singleton(new FSharpParameter(empty(), patternInput_1[0], false, transformType(patternInput_1[1], recordInfo.KeyType), void 0));
|
|
1502
|
+
return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(21, [])]), name_1, empty(), name_1, transformTypeParameters(context_1, typeParameters).TypeParameters, singleton(new FSharpMember(1, [new FSharpMemberInfo(singleton(new FSharpAttribute(17, [])), "Item", "Item", empty(), parameters, transformType(context_1, recordInfo.ValueType), false, false, new FSharpAccessor(2, []), new FSharpAccessibility(0, []), empty(), new FSharpMemberInfoBody(0, []))])), empty())]);
|
|
1313
1503
|
}
|
|
1314
1504
|
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1505
|
+
class TypeParameter_SealedTypeInfo extends Record {
|
|
1506
|
+
constructor(TypeParameterName, FSharpType) {
|
|
1507
|
+
super();
|
|
1508
|
+
this.TypeParameterName = TypeParameterName;
|
|
1509
|
+
this.FSharpType = FSharpType;
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
function TypeParameter_SealedTypeInfo_$reflection() {
|
|
1514
|
+
return record_type("Glutinum.Converter.Transform.TypeParameter.SealedTypeInfo", [], TypeParameter_SealedTypeInfo, () => [["TypeParameterName", string_type], ["FSharpType", FSharpType_$reflection()]]);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
class TypeParameter_TransformResult extends Record {
|
|
1518
|
+
constructor(FSharpTypeParameter, SealedTypeOpt) {
|
|
1519
|
+
super();
|
|
1520
|
+
this.FSharpTypeParameter = FSharpTypeParameter;
|
|
1521
|
+
this.SealedTypeOpt = SealedTypeOpt;
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
function TypeParameter_TransformResult_$reflection() {
|
|
1526
|
+
return record_type("Glutinum.Converter.Transform.TypeParameter.TransformResult", [], TypeParameter_TransformResult, () => [["FSharpTypeParameter", FSharpTypeParameter_$reflection()], ["SealedTypeOpt", option_type(TypeParameter_SealedTypeInfo_$reflection())]]);
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
function TypeParameter_TransformResult_Create_403667D8(typeParameterName, default_, constraint_, sealedType) {
|
|
1530
|
+
return new TypeParameter_TransformResult(new FSharpTypeParameter(1, [FSharpTypeParameterInfo_Create_Z6CFD3565(typeParameterName, unwrap(constraint_), unwrap(default_))]), (sealedType == null) ? void 0 : (new TypeParameter_SealedTypeInfo(typeParameterName, sealedType)));
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
function TypeParameter_transform(context, typeParameter) {
|
|
1534
|
+
const default_ = map_1((glueType) => transformType(context, glueType), typeParameter.Default);
|
|
1535
|
+
const matchValue = typeParameter.Constraint;
|
|
1536
|
+
if (matchValue != null) {
|
|
1537
|
+
const matchValue_1 = transformType(context, matchValue);
|
|
1538
|
+
let matchResult, fsharpType;
|
|
1539
|
+
switch (matchValue_1.tag) {
|
|
1540
|
+
case 16: {
|
|
1541
|
+
matchResult = 0;
|
|
1542
|
+
break;
|
|
1543
|
+
}
|
|
1544
|
+
case 8: {
|
|
1545
|
+
matchResult = 1;
|
|
1546
|
+
fsharpType = matchValue_1;
|
|
1547
|
+
break;
|
|
1548
|
+
}
|
|
1549
|
+
case 1: {
|
|
1550
|
+
matchResult = 1;
|
|
1551
|
+
fsharpType = matchValue_1;
|
|
1552
|
+
break;
|
|
1553
|
+
}
|
|
1554
|
+
default:
|
|
1555
|
+
matchResult = 2;
|
|
1320
1556
|
}
|
|
1321
|
-
|
|
1322
|
-
|
|
1557
|
+
switch (matchResult) {
|
|
1558
|
+
case 0:
|
|
1559
|
+
return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_);
|
|
1560
|
+
case 1:
|
|
1561
|
+
return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_, void 0, fsharpType);
|
|
1562
|
+
default:
|
|
1563
|
+
return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_, matchValue_1);
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
else {
|
|
1567
|
+
return TypeParameter_TransformResult_Create_403667D8(typeParameter.Name, default_);
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
function TypeParameter_mapFSharpType(seadledTypes, typ) {
|
|
1572
|
+
switch (typ.tag) {
|
|
1573
|
+
case 3:
|
|
1574
|
+
return new FSharpType(3, [TypeParameter_mapFSharpType(seadledTypes, typ.fields[0])]);
|
|
1575
|
+
case 11: {
|
|
1576
|
+
const typeReference = typ.fields[0];
|
|
1577
|
+
return new FSharpType(11, [new FSharpTypeReference(typeReference.Name, typeReference.FullName, map((typ_1) => TypeParameter_mapFSharpType(seadledTypes, typ_1), typeReference.TypeArguments), typeReference.Type)]);
|
|
1578
|
+
}
|
|
1579
|
+
case 1: {
|
|
1580
|
+
const unionInfo = typ.fields[0];
|
|
1581
|
+
return new FSharpType(1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, map((case$) => {
|
|
1582
|
+
if (case$.tag === 1) {
|
|
1583
|
+
return new FSharpUnionCase(1, [TypeParameter_mapFSharpType(seadledTypes, case$.fields[0])]);
|
|
1584
|
+
}
|
|
1585
|
+
else {
|
|
1586
|
+
return case$;
|
|
1587
|
+
}
|
|
1588
|
+
}, unionInfo.Cases), unionInfo.IsOptional)]);
|
|
1589
|
+
}
|
|
1590
|
+
case 12:
|
|
1591
|
+
return new FSharpType(12, [map((typ_3) => TypeParameter_mapFSharpType(seadledTypes, typ_3), typ.fields[0])]);
|
|
1592
|
+
case 0:
|
|
1593
|
+
case 2:
|
|
1594
|
+
case 4:
|
|
1595
|
+
case 5:
|
|
1596
|
+
case 6:
|
|
1597
|
+
case 7:
|
|
1598
|
+
case 8:
|
|
1599
|
+
case 9:
|
|
1600
|
+
case 10:
|
|
1601
|
+
case 14:
|
|
1602
|
+
case 15:
|
|
1603
|
+
case 16:
|
|
1604
|
+
case 17:
|
|
1605
|
+
case 18:
|
|
1606
|
+
case 19:
|
|
1607
|
+
case 20:
|
|
1608
|
+
return typ;
|
|
1609
|
+
default: {
|
|
1610
|
+
const needMapping = tryFind((mapperInfo) => (mapperInfo.TypeParameterName === typ.fields[0]), seadledTypes);
|
|
1611
|
+
if (needMapping == null) {
|
|
1612
|
+
return typ;
|
|
1613
|
+
}
|
|
1614
|
+
else {
|
|
1615
|
+
return needMapping.FSharpType;
|
|
1616
|
+
}
|
|
1323
1617
|
}
|
|
1324
|
-
}
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
function TypeParameter_mapFsharpParameter(seadledTypes, parameter) {
|
|
1622
|
+
return new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, TypeParameter_mapFSharpType(seadledTypes, parameter.Type), parameter.OriginalGlueMember);
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
function TypeParameter_mapFsharpMembers(seadledTypes, members) {
|
|
1626
|
+
return map((memberInfo) => {
|
|
1627
|
+
switch (memberInfo.tag) {
|
|
1628
|
+
case 1: {
|
|
1629
|
+
const propertyInfo = memberInfo.fields[0];
|
|
1630
|
+
return new FSharpMember(1, [new FSharpMemberInfo(propertyInfo.Attributes, propertyInfo.Name, propertyInfo.OriginalName, propertyInfo.TypeParameters, map((parameter_1) => TypeParameter_mapFsharpParameter(seadledTypes, parameter_1), propertyInfo.Parameters), TypeParameter_mapFSharpType(seadledTypes, propertyInfo.Type), propertyInfo.IsOptional, propertyInfo.IsStatic, propertyInfo.Accessor, propertyInfo.Accessibility, propertyInfo.XmlDoc, propertyInfo.Body)]);
|
|
1631
|
+
}
|
|
1632
|
+
case 2: {
|
|
1633
|
+
const staticMemberInfo = memberInfo.fields[0];
|
|
1634
|
+
return new FSharpMember(2, [new FSharpStaticMemberInfo(staticMemberInfo.Attributes, staticMemberInfo.Name, staticMemberInfo.OriginalName, staticMemberInfo.TypeParameters, map((parameter_2) => TypeParameter_mapFsharpParameter(seadledTypes, parameter_2), staticMemberInfo.Parameters), TypeParameter_mapFSharpType(seadledTypes, staticMemberInfo.Type), staticMemberInfo.IsOptional, staticMemberInfo.Accessor, staticMemberInfo.Accessibility, staticMemberInfo.XmlDoc)]);
|
|
1635
|
+
}
|
|
1636
|
+
default: {
|
|
1637
|
+
const methodInfo = memberInfo.fields[0];
|
|
1638
|
+
return new FSharpMember(0, [new FSharpMemberInfo(methodInfo.Attributes, methodInfo.Name, methodInfo.OriginalName, methodInfo.TypeParameters, map((parameter) => TypeParameter_mapFsharpParameter(seadledTypes, parameter), methodInfo.Parameters), TypeParameter_mapFSharpType(seadledTypes, methodInfo.Type), methodInfo.IsOptional, methodInfo.IsStatic, methodInfo.Accessor, methodInfo.Accessibility, methodInfo.XmlDoc, methodInfo.Body)]);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
}, members);
|
|
1325
1642
|
}
|
|
1326
1643
|
|
|
1327
1644
|
function transformTypeParameters(context, typeParameters) {
|
|
1328
|
-
|
|
1645
|
+
const transformedTypeParameters = map((typeParameter) => TypeParameter_transform(context, typeParameter), typeParameters);
|
|
1646
|
+
const sealedTypes = choose((_arg) => _arg.SealedTypeOpt, transformedTypeParameters);
|
|
1647
|
+
return new TransformTypeParametersResult(map((_arg_2) => _arg_2.FSharpTypeParameter, filter((_arg_1) => (_arg_1.SealedTypeOpt == null), transformedTypeParameters)), sealedTypes);
|
|
1329
1648
|
}
|
|
1330
1649
|
|
|
1331
1650
|
function tryOptimizeUnionType(context, typeName, cases) {
|
|
@@ -1459,7 +1778,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
|
|
|
1459
1778
|
return empty();
|
|
1460
1779
|
}
|
|
1461
1780
|
}, cases);
|
|
1462
|
-
return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(
|
|
1781
|
+
return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(21, [])]), typeName, empty(), TransformContext__get_CurrentScopeName(context), empty(), members, empty())]);
|
|
1463
1782
|
}
|
|
1464
1783
|
else {
|
|
1465
1784
|
return void 0;
|
|
@@ -1549,7 +1868,7 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1549
1868
|
const typeAliasName = patternInput[0];
|
|
1550
1869
|
const context_1 = patternInput[1];
|
|
1551
1870
|
const xmlDoc = transformComment(glueTypeAliasDeclaration.Documentation);
|
|
1552
|
-
const makeTypeAlias = (typ) => (new FSharpType(9, [new FSharpTypeAlias(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc, typ, transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]));
|
|
1871
|
+
const makeTypeAlias = (typ) => (new FSharpType(9, [new FSharpTypeAlias(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc, typ, transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters).TypeParameters)]));
|
|
1553
1872
|
const matchValue = glueTypeAliasDeclaration.Type;
|
|
1554
1873
|
switch (matchValue.tag) {
|
|
1555
1874
|
case 9:
|
|
@@ -1613,7 +1932,7 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1613
1932
|
const matchValue_3 = typeReference.TypeArguments;
|
|
1614
1933
|
let matchResult_1, head;
|
|
1615
1934
|
if (!isEmpty(matchValue_3)) {
|
|
1616
|
-
if (isEmpty(
|
|
1935
|
+
if (isEmpty(tail_1(matchValue_3))) {
|
|
1617
1936
|
matchResult_1 = 0;
|
|
1618
1937
|
head = head_1(matchValue_3);
|
|
1619
1938
|
}
|
|
@@ -1627,7 +1946,7 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1627
1946
|
switch (matchResult_1) {
|
|
1628
1947
|
case 0:
|
|
1629
1948
|
if (head.tag === 20) {
|
|
1630
|
-
const makeInterfaceTyp = (name) => (new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(
|
|
1949
|
+
const makeInterfaceTyp = (name) => (new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(21, [])]), name, empty(), glueTypeAliasDeclaration.Name, empty(), TransformMembers_toFSharpMember(context_2, head.fields[0]), empty()));
|
|
1631
1950
|
const exposedType = makeInterfaceTyp("ReturnType");
|
|
1632
1951
|
const typeArgument = makeInterfaceTyp(TransformContext__get_FullName(context_2) + ".ReturnType");
|
|
1633
1952
|
TransformContext__ExposeType_Z1D58A540(TransformContext__PushScope_Z721C83C5(context_2, typeReference.Name), new FSharpType(5, [exposedType]));
|
|
@@ -1651,8 +1970,10 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1651
1970
|
return makeTypeAlias(transformType(TransformContext__PushScope_Z721C83C5(context_1, "ReturnType"), utilityType.fields[0]));
|
|
1652
1971
|
case 3:
|
|
1653
1972
|
return makeTypeAlias(transformType(context_1, utilityType.fields[0]));
|
|
1654
|
-
case 4:
|
|
1655
|
-
|
|
1973
|
+
case 4: {
|
|
1974
|
+
const typParameters = transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters);
|
|
1975
|
+
return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(21, [])]), typeAliasName, empty(), glueTypeAliasDeclaration.Name, typParameters.TypeParameters, TypeParameter_mapFsharpMembers(typParameters.SealedTypes, TransformMembers_toFSharpMember(context_1, utilityType.fields[0])), empty())]);
|
|
1976
|
+
}
|
|
1656
1977
|
case 5:
|
|
1657
1978
|
return UtilityType_transformReadOnly(context_1, utilityType.fields[0], makeTypeAlias);
|
|
1658
1979
|
default:
|
|
@@ -1661,15 +1982,19 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1661
1982
|
}
|
|
1662
1983
|
case 15: {
|
|
1663
1984
|
const functionType = matchValue.fields[0];
|
|
1664
|
-
|
|
1985
|
+
const typParameters_1 = transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters);
|
|
1986
|
+
return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(21, [])]), typeAliasName, empty(), glueTypeAliasDeclaration.Name, typParameters_1.TypeParameters, singleton(new FSharpMember(0, [new FSharpMemberInfo(singleton(new FSharpAttribute(1, [])), "Invoke", "Invoke", empty(), map((arg) => TypeParameter_mapFsharpParameter(typParameters_1.SealedTypes, transformParameter(context_1, arg)), functionType.Parameters), transformType(context_1, functionType.Type), false, false, void 0, new FSharpAccessibility(0, []), empty(), new FSharpMemberInfoBody(0, []))])), empty())]);
|
|
1665
1987
|
}
|
|
1666
1988
|
case 18:
|
|
1667
1989
|
return makeTypeAlias(transformTupleType(context_1, matchValue.fields[0]));
|
|
1668
|
-
case 20:
|
|
1669
|
-
|
|
1990
|
+
case 20: {
|
|
1991
|
+
const typParameters_2 = transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters);
|
|
1992
|
+
return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(21, [])]), typeAliasName, empty(), glueTypeAliasDeclaration.Name, typParameters_2.TypeParameters, TypeParameter_mapFsharpMembers(typParameters_2.SealedTypes, TransformMembers_toFSharpMember(context_1, matchValue.fields[0])), empty())]);
|
|
1993
|
+
}
|
|
1670
1994
|
case 21: {
|
|
1671
1995
|
const typeLiteralInfo = matchValue.fields[0];
|
|
1672
|
-
|
|
1996
|
+
const typParameters_3 = transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters);
|
|
1997
|
+
return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(21, [])]), typeAliasName, empty(), glueTypeAliasDeclaration.Name, typParameters_3.TypeParameters, TypeParameter_mapFsharpMembers(typParameters_3.SealedTypes, TransformMembers_toFSharpMember(context_1, typeLiteralInfo.Members)), toList(delay(() => {
|
|
1673
1998
|
const matchValue_4 = TypeLiteral_tryFindIterableType(context_1, typeLiteralInfo);
|
|
1674
1999
|
if (matchValue_4 == null) {
|
|
1675
2000
|
return empty_1();
|
|
@@ -1683,13 +2008,15 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1683
2008
|
return makeTypeAlias(new FSharpType(18, []));
|
|
1684
2009
|
case 16:
|
|
1685
2010
|
return makeTypeAlias(new FSharpType(13, [matchValue.fields[0]]));
|
|
1686
|
-
case 27:
|
|
1687
|
-
|
|
2011
|
+
case 27: {
|
|
2012
|
+
const typParameters_4 = transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters);
|
|
2013
|
+
return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(21, [])]), typeAliasName, empty(), glueTypeAliasDeclaration.Name, typParameters_4.TypeParameters, TypeParameter_mapFsharpMembers(typParameters_4.SealedTypes, TransformMembers_toFSharpMember(context_1, transformMappedTypeMembers(context_1, matchValue.fields[0]))), empty())]);
|
|
2014
|
+
}
|
|
1688
2015
|
case 28: {
|
|
1689
2016
|
const matchValue_5 = glueTypeAliasDeclaration.TypeParameters;
|
|
1690
2017
|
if (!isEmpty(matchValue_5)) {
|
|
1691
|
-
if (isEmpty(
|
|
1692
|
-
return new FSharpType(2, [new FSharpSingleErasedCaseUnion(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc,
|
|
2018
|
+
if (isEmpty(tail_1(matchValue_5))) {
|
|
2019
|
+
return new FSharpType(2, [new FSharpSingleErasedCaseUnion(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc, TypeParameter_transform(context_1, head_1(matchValue_5)).FSharpTypeParameter)]);
|
|
1693
2020
|
}
|
|
1694
2021
|
else {
|
|
1695
2022
|
TransformContext__AddWarning_Z721C83C5(context_1, `${glueTypeAliasDeclaration.Name} contains a ConstructorType with multiple type parameters, please open an issue at https://github.com/glutinum-org/cli/issues`);
|
|
@@ -1727,26 +2054,86 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1727
2054
|
}
|
|
1728
2055
|
}
|
|
1729
2056
|
|
|
1730
|
-
function transformModuleDeclaration(typeMemory, reporter, moduleDeclaration) {
|
|
1731
|
-
|
|
2057
|
+
function transformModuleDeclaration(typeMemory, reporter, typeLiteralsMemory, moduleDeclaration) {
|
|
2058
|
+
if (isEmpty(moduleDeclaration.Types)) {
|
|
2059
|
+
return new FSharpType(10, []);
|
|
2060
|
+
}
|
|
2061
|
+
else {
|
|
2062
|
+
const moduleSuffix = moduleDeclaration.IsTopLevel ? "_" : "";
|
|
2063
|
+
return new FSharpType(4, [new FSharpModule(sanitizeName(moduleDeclaration.Name) + moduleSuffix, moduleDeclaration.IsRecursive, transform(typeMemory, reporter, typeLiteralsMemory, false, moduleDeclaration.Types))]);
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
function exposeSpecializedAlias(name_mut, acc_mut, tailedTypeParameters_mut, typeParameters_mut) {
|
|
2068
|
+
exposeSpecializedAlias:
|
|
2069
|
+
while (true) {
|
|
2070
|
+
const name = name_mut, acc = acc_mut, tailedTypeParameters = tailedTypeParameters_mut, typeParameters = typeParameters_mut;
|
|
2071
|
+
if (isEmpty(typeParameters)) {
|
|
2072
|
+
return acc;
|
|
2073
|
+
}
|
|
2074
|
+
else {
|
|
2075
|
+
const tail = tail_1(typeParameters);
|
|
2076
|
+
const head = head_1(typeParameters);
|
|
2077
|
+
if (head.tag === 1) {
|
|
2078
|
+
const matchValue = head.fields[0].Default;
|
|
2079
|
+
if (matchValue != null) {
|
|
2080
|
+
const defaultType = matchValue;
|
|
2081
|
+
const orderedTail = reverse(tail);
|
|
2082
|
+
const typeAlias = new FSharpType(9, [new FSharpTypeAlias(empty(), name, empty(), new FSharpType(7, [new FSharpMapped(name, append_1(orderedTail, cons(new FSharpTypeParameter(0, [defaultType]), tailedTypeParameters)))]), orderedTail)]);
|
|
2083
|
+
const newTailedTypeParameters = append_1(tailedTypeParameters, singleton(new FSharpTypeParameter(0, [defaultType])));
|
|
2084
|
+
name_mut = name;
|
|
2085
|
+
acc_mut = append_1(acc, singleton(typeAlias));
|
|
2086
|
+
tailedTypeParameters_mut = newTailedTypeParameters;
|
|
2087
|
+
typeParameters_mut = tail;
|
|
2088
|
+
continue exposeSpecializedAlias;
|
|
2089
|
+
}
|
|
2090
|
+
else {
|
|
2091
|
+
return acc;
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
else {
|
|
2095
|
+
return acc;
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
break;
|
|
2099
|
+
}
|
|
1732
2100
|
}
|
|
1733
2101
|
|
|
1734
2102
|
function transformClassDeclaration(context, classDeclaration) {
|
|
1735
|
-
let Members;
|
|
1736
2103
|
const patternInput = sanitizeNameAndPushScope(classDeclaration.Name, context);
|
|
2104
|
+
const name = patternInput[0];
|
|
1737
2105
|
const context_1 = patternInput[1];
|
|
1738
|
-
|
|
2106
|
+
const typeParametersResult = transformTypeParameters(context_1, classDeclaration.TypeParameters);
|
|
2107
|
+
const patternInput_1 = partition((heritageClause) => {
|
|
2108
|
+
if (heritageClause.tag === 13) {
|
|
2109
|
+
const typeReference = heritageClause.fields[0];
|
|
2110
|
+
if (typeReference.IsStandardLibrary) {
|
|
2111
|
+
return typeReference.Name === "Error";
|
|
2112
|
+
}
|
|
2113
|
+
else {
|
|
2114
|
+
return false;
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
else {
|
|
2118
|
+
return false;
|
|
2119
|
+
}
|
|
2120
|
+
}, classDeclaration.HeritageClauses);
|
|
2121
|
+
const hasErrorInheritance = !isEmpty(patternInput_1[0]);
|
|
2122
|
+
const inheritance = map((arg) => transformType(context_1, TransformContext__ExposeTypeAlias_1CE4A880(context_1, arg)), toList(delay(() => append(hasErrorInheritance ? singleton_1(new GlueType(13, [new GlueTypeReference("Exception", "System.Exception", empty(), true)])) : empty_1(), delay(() => patternInput_1[1])))));
|
|
2123
|
+
const specialiazedAlias = exposeSpecializedAlias(name, empty(), empty(), reverse(typeParametersResult.TypeParameters));
|
|
2124
|
+
const xmlDoc = transformComment(classDeclaration.Documentation);
|
|
2125
|
+
return cons(new FSharpType(5, [new FSharpInterface(toList(delay(() => append(singleton_1(new FSharpAttribute(8, [])), delay(() => append(hasErrorInheritance ? singleton_1(new FSharpAttribute(7, [])) : singleton_1(new FSharpAttribute(21, [])), delay(() => xmlDoc.ObsoleteAttributes)))))), name, xmlDoc.XmlDoc, classDeclaration.Name, typeParametersResult.TypeParameters, TypeParameter_mapFsharpMembers(typeParametersResult.SealedTypes, TransformMembers_toFSharpMember(context_1, classDeclaration.Members)), inheritance)]), specialiazedAlias);
|
|
1739
2126
|
}
|
|
1740
2127
|
|
|
1741
2128
|
function transformToFsharp(context, glueTypes) {
|
|
1742
|
-
return
|
|
2129
|
+
return collect_1((_arg) => {
|
|
1743
2130
|
switch (_arg.tag) {
|
|
1744
2131
|
case 4:
|
|
1745
|
-
return transformEnum(_arg.fields[0]);
|
|
2132
|
+
return singleton(transformEnum(_arg.fields[0]));
|
|
1746
2133
|
case 5:
|
|
1747
|
-
return transformTypeAliasDeclaration(context, _arg.fields[0]);
|
|
2134
|
+
return singleton(transformTypeAliasDeclaration(context, _arg.fields[0]));
|
|
1748
2135
|
case 11:
|
|
1749
|
-
return transformModuleDeclaration(TransformContext__get_TypeMemory(context), TransformContext__get__Reporter(context), _arg.fields[0]);
|
|
2136
|
+
return singleton(transformModuleDeclaration(TransformContext__get_TypeMemory(context), TransformContext__get__Reporter(context), TransformContext__get_TypeLiteralsMemory(context), _arg.fields[0]));
|
|
1750
2137
|
case 12:
|
|
1751
2138
|
return transformClassDeclaration(context, _arg.fields[0]);
|
|
1752
2139
|
case 24: {
|
|
@@ -1755,7 +2142,7 @@ function transformToFsharp(context, glueTypes) {
|
|
|
1755
2142
|
return transformClassDeclaration(context, exportedType.fields[0]);
|
|
1756
2143
|
}
|
|
1757
2144
|
else {
|
|
1758
|
-
return new FSharpType(10, []);
|
|
2145
|
+
return singleton(new FSharpType(10, []));
|
|
1759
2146
|
}
|
|
1760
2147
|
}
|
|
1761
2148
|
case 28:
|
|
@@ -1782,14 +2169,15 @@ function transformToFsharp(context, glueTypes) {
|
|
|
1782
2169
|
case 26:
|
|
1783
2170
|
case 29:
|
|
1784
2171
|
case 17:
|
|
1785
|
-
return new FSharpType(10, []);
|
|
2172
|
+
return singleton(new FSharpType(10, []));
|
|
1786
2173
|
default:
|
|
1787
|
-
return new FSharpType(5, [transformInterface(context, _arg.fields[0])]);
|
|
2174
|
+
return singleton(new FSharpType(5, [transformInterface(context, _arg.fields[0])]));
|
|
1788
2175
|
}
|
|
1789
2176
|
}, glueTypes);
|
|
1790
2177
|
}
|
|
1791
2178
|
|
|
1792
|
-
function transform(typeMemory, reporter, isTopLevel, glueAst) {
|
|
2179
|
+
function transform(typeMemory, reporter, typeLiteralsMemory, isTopLevel, glueAst) {
|
|
2180
|
+
let applyModuleDeclaration;
|
|
1793
2181
|
const patternInput = partition((glueType) => {
|
|
1794
2182
|
switch (glueType.tag) {
|
|
1795
2183
|
case 2:
|
|
@@ -1807,22 +2195,34 @@ function transform(typeMemory, reporter, isTopLevel, glueAst) {
|
|
|
1807
2195
|
}
|
|
1808
2196
|
}, glueAst);
|
|
1809
2197
|
const rest = patternInput[1];
|
|
1810
|
-
const exports_1 = append_1(patternInput[0],
|
|
1811
|
-
|
|
2198
|
+
const exports_1 = append_1(patternInput[0], (applyModuleDeclaration = ((info) => {
|
|
2199
|
+
if (isEmpty(info.Types)) {
|
|
2200
|
+
return false;
|
|
2201
|
+
}
|
|
2202
|
+
else {
|
|
2203
|
+
return exists((glueType_1) => {
|
|
2204
|
+
switch (glueType_1.tag) {
|
|
2205
|
+
case 12:
|
|
2206
|
+
case 2:
|
|
2207
|
+
case 6:
|
|
2208
|
+
return true;
|
|
2209
|
+
case 11:
|
|
2210
|
+
return applyModuleDeclaration(glueType_1.fields[0]);
|
|
2211
|
+
default:
|
|
2212
|
+
return false;
|
|
2213
|
+
}
|
|
2214
|
+
}, info.Types);
|
|
2215
|
+
}
|
|
2216
|
+
}), filter((glueType_2) => {
|
|
2217
|
+
switch (glueType_2.tag) {
|
|
1812
2218
|
case 12:
|
|
1813
2219
|
return true;
|
|
2220
|
+
case 2:
|
|
2221
|
+
return true;
|
|
1814
2222
|
case 11:
|
|
1815
|
-
return
|
|
1816
|
-
switch (glueType_2.tag) {
|
|
1817
|
-
case 12:
|
|
1818
|
-
case 6:
|
|
1819
|
-
return true;
|
|
1820
|
-
default:
|
|
1821
|
-
return false;
|
|
1822
|
-
}
|
|
1823
|
-
}, glueType_1.fields[0].Types);
|
|
2223
|
+
return applyModuleDeclaration(glueType_2.fields[0]);
|
|
1824
2224
|
case 24:
|
|
1825
|
-
if (
|
|
2225
|
+
if (glueType_2.fields[0].tag === 12) {
|
|
1826
2226
|
return true;
|
|
1827
2227
|
}
|
|
1828
2228
|
else {
|
|
@@ -1831,15 +2231,15 @@ function transform(typeMemory, reporter, isTopLevel, glueAst) {
|
|
|
1831
2231
|
default:
|
|
1832
2232
|
return false;
|
|
1833
2233
|
}
|
|
1834
|
-
}, rest));
|
|
1835
|
-
const rootTransformContext = TransformContext_$
|
|
2234
|
+
}, rest)));
|
|
2235
|
+
const rootTransformContext = TransformContext_$ctor_1977F1E3(reporter, "", typeMemory, typeLiteralsMemory);
|
|
1836
2236
|
const rest_1 = transformToFsharp(rootTransformContext, rest);
|
|
1837
2237
|
return toList(delay(() => append(!isEmpty(exports_1) ? singleton_1(transformExports(rootTransformContext, isTopLevel, exports_1)) : empty_1(), delay(() => append(rest_1, delay(() => TransformContext__ToList(rootTransformContext)))))));
|
|
1838
2238
|
}
|
|
1839
2239
|
|
|
1840
2240
|
export function apply(typeMemory, glueAst) {
|
|
1841
2241
|
const reporter = Reporter_$ctor();
|
|
1842
|
-
return new TransformResult(
|
|
2242
|
+
return new TransformResult(apply_2(transform(typeMemory, reporter, TypeLiteralsMemory_$ctor(), true, glueAst)), Reporter__get_Warnings(reporter), Reporter__get_Errors(reporter), Reporter__get_HasRegEpx(reporter), Reporter__get_HasReadonlyArray(reporter), Reporter__get_HasIterable(reporter));
|
|
1843
2243
|
}
|
|
1844
2244
|
|
|
1845
2245
|
//# sourceMappingURL=Transform.js.map
|