@glutinum/cli 0.11.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 +64 -2
- package/dist/Glutinum.Converter/FsharpAST.js +34 -14
- package/dist/Glutinum.Converter/FsharpAST.js.map +1 -1
- package/dist/Glutinum.Converter/Generate.js.map +1 -1
- package/dist/Glutinum.Converter/GlueAST.js +144 -9
- 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 +104 -62
- package/dist/Glutinum.Converter/Printer.js.map +1 -1
- package/dist/Glutinum.Converter/Read.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/Documentation.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/ExportAssignment.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/InterfaceDeclaration.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/NamedTupleMember.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/Report.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeNode.js +192 -73
- 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/TypeScriptReader.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/Utils.js +34 -2
- package/dist/Glutinum.Converter/Reader/Utils.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 +886 -256
- package/dist/Glutinum.Converter/Transform.js.map +1 -1
- package/dist/Glutinum.Converter/TypeScript.Extensions.js +10 -0
- package/dist/Glutinum.Converter/TypeScript.Extensions.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,
|
|
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() {
|
|
@@ -17,6 +19,7 @@ export class Reporter {
|
|
|
17
19
|
this["Errors@"] = [];
|
|
18
20
|
this["HasRegEpx@"] = false;
|
|
19
21
|
this["HasReadonlyArray@"] = false;
|
|
22
|
+
this["HasIterable@"] = false;
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
|
|
@@ -28,18 +31,34 @@ export function Reporter_$ctor() {
|
|
|
28
31
|
return new Reporter();
|
|
29
32
|
}
|
|
30
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
|
+
|
|
31
48
|
export class TransformContext {
|
|
32
|
-
constructor(reporter, currentScopeName, typeMemory, parent) {
|
|
49
|
+
constructor(reporter, currentScopeName, typeMemory, typeLiteralsMemory, parent) {
|
|
33
50
|
let matchValue;
|
|
34
51
|
this.reporter = reporter;
|
|
35
52
|
this.currentScopeName = currentScopeName;
|
|
36
53
|
this.typeMemory = typeMemory;
|
|
54
|
+
this.typeLiteralsMemory = typeLiteralsMemory;
|
|
37
55
|
this.parent = parent;
|
|
38
56
|
this.types = [];
|
|
39
57
|
this.modules = [];
|
|
40
58
|
this["FullName@"] = ((matchValue = this.parent, (matchValue != null) ? trimStart((TransformContext__get_FullName(matchValue) + ".") + this.currentScopeName, ".") : ""));
|
|
41
59
|
this["CurrentScopeName@"] = this.currentScopeName;
|
|
42
60
|
this["TypeMemory@"] = this.typeMemory;
|
|
61
|
+
this["TypeLiteralsMemory@"] = this.typeLiteralsMemory;
|
|
43
62
|
this["_types@"] = this.types;
|
|
44
63
|
this["_Reporter@"] = this.reporter;
|
|
45
64
|
}
|
|
@@ -49,8 +68,8 @@ export function TransformContext_$reflection() {
|
|
|
49
68
|
return class_type("Glutinum.Converter.Transform.TransformContext", void 0, TransformContext);
|
|
50
69
|
}
|
|
51
70
|
|
|
52
|
-
export function TransformContext_$
|
|
53
|
-
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);
|
|
54
73
|
}
|
|
55
74
|
|
|
56
75
|
export class TransformCommentResult extends Record {
|
|
@@ -65,19 +84,47 @@ export function TransformCommentResult_$reflection() {
|
|
|
65
84
|
return record_type("Glutinum.Converter.Transform.TransformCommentResult", [], TransformCommentResult, () => [["ObsoleteAttributes", list_type(FSharpAttribute_$reflection())], ["XmlDoc", list_type(FSharpXmlDoc_$reflection())]]);
|
|
66
85
|
}
|
|
67
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
|
+
|
|
68
114
|
export class TransformResult extends Record {
|
|
69
|
-
constructor(FSharpAST, Warnings, Errors, IncludeRegExpAlias, IncludeReadonlyArrayAlias) {
|
|
115
|
+
constructor(FSharpAST, Warnings, Errors, IncludeRegExpAlias, IncludeReadonlyArrayAlias, IncludeIterableAlias) {
|
|
70
116
|
super();
|
|
71
117
|
this.FSharpAST = FSharpAST;
|
|
72
118
|
this.Warnings = Warnings;
|
|
73
119
|
this.Errors = Errors;
|
|
74
120
|
this.IncludeRegExpAlias = IncludeRegExpAlias;
|
|
75
121
|
this.IncludeReadonlyArrayAlias = IncludeReadonlyArrayAlias;
|
|
122
|
+
this.IncludeIterableAlias = IncludeIterableAlias;
|
|
76
123
|
}
|
|
77
124
|
}
|
|
78
125
|
|
|
79
126
|
export function TransformResult_$reflection() {
|
|
80
|
-
return record_type("Glutinum.Converter.Transform.TransformResult", [], TransformResult, () => [["FSharpAST", list_type(FSharpType_$reflection())], ["Warnings", array_type(string_type)], ["Errors", array_type(string_type)], ["IncludeRegExpAlias", bool_type], ["IncludeReadonlyArrayAlias", bool_type]]);
|
|
127
|
+
return record_type("Glutinum.Converter.Transform.TransformResult", [], TransformResult, () => [["FSharpAST", list_type(FSharpType_$reflection())], ["Warnings", array_type(string_type)], ["Errors", array_type(string_type)], ["IncludeRegExpAlias", bool_type], ["IncludeReadonlyArrayAlias", bool_type], ["IncludeIterableAlias", bool_type]]);
|
|
81
128
|
}
|
|
82
129
|
|
|
83
130
|
export function Reporter__get_Warnings(__) {
|
|
@@ -104,6 +151,48 @@ export function Reporter__set_HasReadonlyArray_Z1FBCCD16(__, v) {
|
|
|
104
151
|
__["HasReadonlyArray@"] = v;
|
|
105
152
|
}
|
|
106
153
|
|
|
154
|
+
export function Reporter__get_HasIterable(__) {
|
|
155
|
+
return __["HasIterable@"];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function Reporter__set_HasIterable_Z1FBCCD16(__, v) {
|
|
159
|
+
__["HasIterable@"] = v;
|
|
160
|
+
}
|
|
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
|
+
|
|
107
196
|
export function TransformContext__get_FullName(__) {
|
|
108
197
|
return __["FullName@"];
|
|
109
198
|
}
|
|
@@ -116,10 +205,25 @@ export function TransformContext__get_TypeMemory(__) {
|
|
|
116
205
|
return __["TypeMemory@"];
|
|
117
206
|
}
|
|
118
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
|
+
*/
|
|
119
218
|
export function TransformContext__get__types(__) {
|
|
120
219
|
return __["_types@"];
|
|
121
220
|
}
|
|
122
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
|
+
*/
|
|
123
227
|
export function TransformContext__get__Reporter(__) {
|
|
124
228
|
return __["_Reporter@"];
|
|
125
229
|
}
|
|
@@ -132,6 +236,10 @@ export function TransformContext__ExposeReadonlyArray(_) {
|
|
|
132
236
|
Reporter__set_HasReadonlyArray_Z1FBCCD16(_.reporter, true);
|
|
133
237
|
}
|
|
134
238
|
|
|
239
|
+
export function TransformContext__ExposeIterable(_) {
|
|
240
|
+
Reporter__set_HasIterable_Z1FBCCD16(_.reporter, true);
|
|
241
|
+
}
|
|
242
|
+
|
|
135
243
|
export function TransformContext__ExposeType_Z1D58A540(_, typ) {
|
|
136
244
|
const matchValue = _.parent;
|
|
137
245
|
if (matchValue != null) {
|
|
@@ -144,7 +252,7 @@ export function TransformContext__ExposeType_Z1D58A540(_, typ) {
|
|
|
144
252
|
}
|
|
145
253
|
|
|
146
254
|
export function TransformContext__PushScope_Z721C83C5(this$, scopeName) {
|
|
147
|
-
const childContext = TransformContext_$
|
|
255
|
+
const childContext = TransformContext_$ctor_1977F1E3(this$.reporter, sanitizeName(scopeName), this$.typeMemory, this$.typeLiteralsMemory, this$);
|
|
148
256
|
void (this$.modules.push(childContext));
|
|
149
257
|
return childContext;
|
|
150
258
|
}
|
|
@@ -172,39 +280,49 @@ export function TransformContext__AddError_Z721C83C5(_, error) {
|
|
|
172
280
|
void (Reporter__get_Errors(_.reporter).push(error));
|
|
173
281
|
}
|
|
174
282
|
|
|
283
|
+
export function TransformContext__ExposeTypeAlias_Z721C83C5(this$, name) {
|
|
284
|
+
switch (name) {
|
|
285
|
+
case "RegExp": {
|
|
286
|
+
TransformContext__ExposeRegExp(this$);
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
case "ReadonlyArray": {
|
|
290
|
+
TransformContext__ExposeReadonlyArray(this$);
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
case "Iterable": {
|
|
294
|
+
TransformContext__ExposeIterable(this$);
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
default:
|
|
298
|
+
0;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export function TransformContext__ExposeTypeAlias_1CE4A880(this$, typ) {
|
|
303
|
+
if (typ.tag === 13) {
|
|
304
|
+
const typeReference = typ.fields[0];
|
|
305
|
+
if (typeReference.IsStandardLibrary) {
|
|
306
|
+
TransformContext__ExposeTypeAlias_Z721C83C5(this$, typeReference.Name);
|
|
307
|
+
}
|
|
308
|
+
return typ;
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
return typ;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
175
315
|
function mapTypeNameToFableCoreAwareName(context, typeReference) {
|
|
316
|
+
let mappedName;
|
|
176
317
|
if (typeReference.IsStandardLibrary) {
|
|
177
318
|
const matchValue = typeReference.Name;
|
|
178
|
-
|
|
179
|
-
case "Date":
|
|
180
|
-
return "JS.Date";
|
|
181
|
-
case "Promise":
|
|
182
|
-
return "JS.Promise";
|
|
183
|
-
case "Uint8Array":
|
|
184
|
-
return "JS.Uint8Array";
|
|
185
|
-
case "ReadonlyArray": {
|
|
186
|
-
TransformContext__ExposeReadonlyArray(context);
|
|
187
|
-
return "ReadonlyArray";
|
|
188
|
-
}
|
|
189
|
-
case "Array":
|
|
190
|
-
return "ResizeArray";
|
|
191
|
-
case "Boolean":
|
|
192
|
-
return "bool";
|
|
193
|
-
case "Function":
|
|
194
|
-
return "Action";
|
|
195
|
-
case "RegExp": {
|
|
196
|
-
TransformContext__ExposeRegExp(context);
|
|
197
|
-
return "RegExp";
|
|
198
|
-
}
|
|
199
|
-
case "Error":
|
|
200
|
-
return "Exception";
|
|
201
|
-
default:
|
|
202
|
-
return matchValue;
|
|
203
|
-
}
|
|
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)))))))))))))));
|
|
204
320
|
}
|
|
205
321
|
else {
|
|
206
|
-
|
|
322
|
+
mappedName = typeReference.Name;
|
|
207
323
|
}
|
|
324
|
+
TransformContext__ExposeTypeAlias_Z721C83C5(context, mappedName);
|
|
325
|
+
return mappedName;
|
|
208
326
|
}
|
|
209
327
|
|
|
210
328
|
function unwrapOptionIfAlreadyOptional(context, typ, isOptional) {
|
|
@@ -233,7 +351,7 @@ function transformComment(comment) {
|
|
|
233
351
|
while (true) {
|
|
234
352
|
const acc = acc_mut, comments = comments_mut;
|
|
235
353
|
if (!isEmpty(comments)) {
|
|
236
|
-
const rest =
|
|
354
|
+
const rest = tail_1(comments);
|
|
237
355
|
const comment_1 = head_1(comments);
|
|
238
356
|
switch (comment_1.tag) {
|
|
239
357
|
case 3: {
|
|
@@ -331,7 +449,7 @@ function transformComment(comment) {
|
|
|
331
449
|
default:
|
|
332
450
|
return 0;
|
|
333
451
|
}
|
|
334
|
-
}, toList(delay(() => append(others, delay(() => ((remarks != null) ? singleton_1(
|
|
452
|
+
}, toList(delay(() => append(others, delay(() => ((remarks != null) ? singleton_1(value_6(remarks)) : empty_1()))))), {
|
|
335
453
|
Compare: comparePrimitives,
|
|
336
454
|
}));
|
|
337
455
|
}
|
|
@@ -381,7 +499,135 @@ function transformPrimitive(gluePrimitive) {
|
|
|
381
499
|
}
|
|
382
500
|
|
|
383
501
|
function transformTupleType(context, glueTypes) {
|
|
384
|
-
|
|
502
|
+
if (isEmpty(glueTypes)) {
|
|
503
|
+
return new FSharpType(18, []);
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
return new FSharpType(12, [map((glueType) => transformType(context, glueType), glueTypes)]);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
export function TypeLiteral_tryFindIterableType(context, typeLiteralInfo) {
|
|
511
|
+
const makeIterable = (typeParameter) => (new FSharpType(7, [new FSharpMapped("Iterable", singleton(typeParameter))]));
|
|
512
|
+
const makeIterableObj = () => makeIterable(new FSharpTypeParameter(0, [new FSharpType(18, [])]));
|
|
513
|
+
return map_1((methodSignature_1) => {
|
|
514
|
+
const matchValue = methodSignature_1.Type;
|
|
515
|
+
switch (matchValue.tag) {
|
|
516
|
+
case 13: {
|
|
517
|
+
const typeReference = matchValue.fields[0];
|
|
518
|
+
if (typeReference.Name === "IterableIterator") {
|
|
519
|
+
return makeIterable(new FSharpTypeParameter(0, [transformType(context, head_1(typeReference.TypeArguments))]));
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
return makeIterableObj();
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
case 21: {
|
|
526
|
+
let returnType = new FSharpTypeParameter(0, [new FSharpType(18, [])]);
|
|
527
|
+
const enumerator = getEnumerator(matchValue.fields[0].Members);
|
|
528
|
+
try {
|
|
529
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
530
|
+
const m = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
531
|
+
let matchResult, nextMethodSignature_1;
|
|
532
|
+
if (m.tag === 6) {
|
|
533
|
+
if (m.fields[0].Name === "next") {
|
|
534
|
+
matchResult = 0;
|
|
535
|
+
nextMethodSignature_1 = m.fields[0];
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
matchResult = 1;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
matchResult = 1;
|
|
543
|
+
}
|
|
544
|
+
switch (matchResult) {
|
|
545
|
+
case 0: {
|
|
546
|
+
const matchValue_1 = nextMethodSignature_1.Type;
|
|
547
|
+
if (matchValue_1.tag === 21) {
|
|
548
|
+
iterate((_arg_1) => {
|
|
549
|
+
let matchResult_1, property_1;
|
|
550
|
+
if (_arg_1.tag === 1) {
|
|
551
|
+
if (_arg_1.fields[0].Name === "value") {
|
|
552
|
+
matchResult_1 = 0;
|
|
553
|
+
property_1 = _arg_1.fields[0];
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
matchResult_1 = 1;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
matchResult_1 = 1;
|
|
561
|
+
}
|
|
562
|
+
switch (matchResult_1) {
|
|
563
|
+
case 0: {
|
|
564
|
+
returnType = (new FSharpTypeParameter(0, [transformType(context, property_1.Type)]));
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
case 1: {
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}, matchValue_1.fields[0].Members);
|
|
572
|
+
}
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
finally {
|
|
579
|
+
disposeSafe(enumerator);
|
|
580
|
+
}
|
|
581
|
+
return makeIterable(returnType);
|
|
582
|
+
}
|
|
583
|
+
default:
|
|
584
|
+
return makeIterableObj();
|
|
585
|
+
}
|
|
586
|
+
}, tryHead(choose((_arg) => {
|
|
587
|
+
if (_arg.tag === 6) {
|
|
588
|
+
const methodSignature = _arg.fields[0];
|
|
589
|
+
if (methodSignature.Name === "[Symbol.iterator]") {
|
|
590
|
+
TransformContext__ExposeIterable(context);
|
|
591
|
+
return methodSignature;
|
|
592
|
+
}
|
|
593
|
+
else {
|
|
594
|
+
return void 0;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
return void 0;
|
|
599
|
+
}
|
|
600
|
+
}, typeLiteralInfo.Members)));
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
function UtilityType_transformReadOnly(context, readonlyInfo, makeTypeAlias) {
|
|
604
|
+
if (readonlyInfo.tag === 1) {
|
|
605
|
+
const interfaces = readonlyInfo.fields[0];
|
|
606
|
+
const patternInput = sanitizeNameAndPushScope(`U${length(interfaces)}`, context);
|
|
607
|
+
const unionType = new FSharpType(1, [new FSharpUnion(empty(), patternInput[0], map((glueInterface) => {
|
|
608
|
+
const context_2 = TransformContext__PushScope_Z721C83C5(patternInput[1], `ReadOnly${glueInterface.Name}`);
|
|
609
|
+
const initialInterface = transformInterface(context_2, glueInterface);
|
|
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)])]);
|
|
613
|
+
}, interfaces), false)]);
|
|
614
|
+
if (makeTypeAlias == null) {
|
|
615
|
+
return unionType;
|
|
616
|
+
}
|
|
617
|
+
else {
|
|
618
|
+
return makeTypeAlias(unionType);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
else {
|
|
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())]);
|
|
623
|
+
if (makeTypeAlias == null) {
|
|
624
|
+
TransformContext__ExposeType_Z1D58A540(context, interfaceTyp);
|
|
625
|
+
return new FSharpType(7, [new FSharpMapped(TransformContext__get_FullName(context), empty())]);
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
return interfaceTyp;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
385
631
|
}
|
|
386
632
|
|
|
387
633
|
function transformType(context_mut, glueType_mut) {
|
|
@@ -398,7 +644,7 @@ function transformType(context_mut, glueType_mut) {
|
|
|
398
644
|
return new FSharpType(3, [transformType(context, glueType.fields[0])]);
|
|
399
645
|
case 17: {
|
|
400
646
|
const thisTypeInfo = glueType.fields[0];
|
|
401
|
-
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)]);
|
|
402
648
|
}
|
|
403
649
|
case 18:
|
|
404
650
|
return transformTupleType(context, glueType.fields[0]);
|
|
@@ -444,7 +690,7 @@ function transformType(context_mut, glueType_mut) {
|
|
|
444
690
|
}
|
|
445
691
|
case 13: {
|
|
446
692
|
const typeReference = glueType.fields[0];
|
|
447
|
-
return new FSharpType(11, [new FSharpTypeReference(mapTypeNameToFableCoreAwareName(context, typeReference), typeReference.FullName, map((glueType_4) => transformType(context, glueType_4), typeReference.TypeArguments), new FSharpType(
|
|
693
|
+
return new FSharpType(11, [new FSharpTypeReference(mapTypeNameToFableCoreAwareName(context, typeReference), typeReference.FullName, map((glueType_4) => transformType(context, glueType_4), typeReference.TypeArguments), new FSharpType(10, []))]);
|
|
448
694
|
}
|
|
449
695
|
case 14:
|
|
450
696
|
return new FSharpType(14, [transformType(context, glueType.fields[0])]);
|
|
@@ -459,7 +705,7 @@ function transformType(context_mut, glueType_mut) {
|
|
|
459
705
|
const paremeters = filter((parameter) => (parameter.Name !== "this"), functionTypeInfo.Parameters);
|
|
460
706
|
let matchResult;
|
|
461
707
|
if (!isEmpty(paremeters)) {
|
|
462
|
-
if (isEmpty(
|
|
708
|
+
if (isEmpty(tail_1(paremeters))) {
|
|
463
709
|
matchResult = 0;
|
|
464
710
|
}
|
|
465
711
|
else {
|
|
@@ -473,9 +719,16 @@ function transformType(context_mut, glueType_mut) {
|
|
|
473
719
|
case 0:
|
|
474
720
|
return new FSharpType(16, [new FSharpFunctionType(map((parameter_1) => transformParameter(context, parameter_1), paremeters), transformType(context, functionTypeInfo.Type))]);
|
|
475
721
|
default: {
|
|
476
|
-
const typParameters = transformTypeParameters(context, filter((typeParameter) =>
|
|
477
|
-
|
|
478
|
-
|
|
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)]);
|
|
479
732
|
}
|
|
480
733
|
}
|
|
481
734
|
}
|
|
@@ -483,8 +736,8 @@ function transformType(context_mut, glueType_mut) {
|
|
|
483
736
|
return new FSharpType(5, [transformInterface(context, glueType.fields[0])]);
|
|
484
737
|
case 21: {
|
|
485
738
|
const typeLiteralInfo = glueType.fields[0];
|
|
486
|
-
|
|
487
|
-
switch (
|
|
739
|
+
const hasNoIndexSignature = forAll((_arg_1) => {
|
|
740
|
+
switch (_arg_1.tag) {
|
|
488
741
|
case 6:
|
|
489
742
|
case 1:
|
|
490
743
|
case 2:
|
|
@@ -496,25 +749,82 @@ function transformType(context_mut, glueType_mut) {
|
|
|
496
749
|
default:
|
|
497
750
|
return false;
|
|
498
751
|
}
|
|
499
|
-
}, typeLiteralInfo.Members)
|
|
500
|
-
|
|
501
|
-
|
|
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;
|
|
502
800
|
if (matchValue_1.tag === 3) {
|
|
503
|
-
return new FSharpParameter(
|
|
801
|
+
return new FSharpParameter(parameter_5.Attributes, parameter_5.Name, true, matchValue_1.fields[0], parameter_5.OriginalGlueMember);
|
|
504
802
|
}
|
|
505
803
|
else {
|
|
506
|
-
return
|
|
804
|
+
return parameter_5;
|
|
507
805
|
}
|
|
508
806
|
}, TransformMembers_toFSharpParameters(context, typeLiteralInfo.Members)), {
|
|
509
807
|
Compare: comparePrimitives,
|
|
510
808
|
});
|
|
511
|
-
const explicitFields = map((
|
|
512
|
-
|
|
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)]));
|
|
513
815
|
}
|
|
514
816
|
else {
|
|
515
|
-
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(
|
|
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) {
|
|
820
|
+
return empty_1();
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
return singleton_1(matchValue_4);
|
|
824
|
+
}
|
|
825
|
+
})))]));
|
|
516
826
|
}
|
|
517
|
-
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, []))]);
|
|
518
828
|
}
|
|
519
829
|
case 24: {
|
|
520
830
|
context_mut = context;
|
|
@@ -527,12 +837,12 @@ function transformType(context_mut, glueType_mut) {
|
|
|
527
837
|
continue transformType;
|
|
528
838
|
}
|
|
529
839
|
case 9: {
|
|
530
|
-
const
|
|
531
|
-
if (
|
|
840
|
+
const matchValue_5 = TypeAliasDeclaration_tryTransformKeyOf(TransformContext__get_CurrentScopeName(context), glueType.fields[0]);
|
|
841
|
+
if (matchValue_5 == null) {
|
|
532
842
|
return new FSharpType(18, []);
|
|
533
843
|
}
|
|
534
844
|
else {
|
|
535
|
-
TransformContext__ExposeType_Z1D58A540(context,
|
|
845
|
+
TransformContext__ExposeType_Z1D58A540(context, matchValue_5);
|
|
536
846
|
return new FSharpType(11, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), new FSharpType(10, []))]);
|
|
537
847
|
}
|
|
538
848
|
}
|
|
@@ -560,7 +870,7 @@ function transformType(context_mut, glueType_mut) {
|
|
|
560
870
|
}
|
|
561
871
|
case 6: {
|
|
562
872
|
const functionDeclaration = glueType.fields[0];
|
|
563
|
-
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))]);
|
|
564
874
|
}
|
|
565
875
|
case 20: {
|
|
566
876
|
const members_1 = glueType.fields[0];
|
|
@@ -568,45 +878,59 @@ function transformType(context_mut, glueType_mut) {
|
|
|
568
878
|
return new FSharpType(18, []);
|
|
569
879
|
}
|
|
570
880
|
else {
|
|
571
|
-
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())]));
|
|
572
882
|
return new FSharpType(7, [new FSharpMapped(TransformContext__get_FullName(context), empty())]);
|
|
573
883
|
}
|
|
574
884
|
}
|
|
575
885
|
case 26: {
|
|
576
886
|
const utilityType = glueType.fields[0];
|
|
577
|
-
let
|
|
887
|
+
let matchResult_2, innerType;
|
|
578
888
|
switch (utilityType.tag) {
|
|
579
889
|
case 1: {
|
|
580
|
-
|
|
890
|
+
matchResult_2 = 1;
|
|
581
891
|
break;
|
|
582
892
|
}
|
|
583
893
|
case 2: {
|
|
584
|
-
|
|
894
|
+
matchResult_2 = 2;
|
|
585
895
|
innerType = utilityType.fields[0];
|
|
586
896
|
break;
|
|
587
897
|
}
|
|
588
898
|
case 3: {
|
|
589
|
-
|
|
899
|
+
matchResult_2 = 2;
|
|
590
900
|
innerType = utilityType.fields[0];
|
|
591
901
|
break;
|
|
592
902
|
}
|
|
903
|
+
case 4: {
|
|
904
|
+
matchResult_2 = 3;
|
|
905
|
+
break;
|
|
906
|
+
}
|
|
907
|
+
case 5: {
|
|
908
|
+
matchResult_2 = 4;
|
|
909
|
+
break;
|
|
910
|
+
}
|
|
593
911
|
default:
|
|
594
|
-
|
|
912
|
+
matchResult_2 = 0;
|
|
595
913
|
}
|
|
596
|
-
switch (
|
|
914
|
+
switch (matchResult_2) {
|
|
597
915
|
case 0: {
|
|
598
916
|
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(5, [(originalInterface = transformInterface(context, utilityType.fields[0]), Interface_makePartial(TransformContext__get_CurrentScopeName(context), originalInterface))]));
|
|
599
917
|
return new FSharpType(11, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), new FSharpType(10, []))]);
|
|
600
918
|
}
|
|
601
919
|
case 1: {
|
|
602
|
-
TransformContext__ExposeType_Z1D58A540(context, transformRecord(context, TransformContext__get_CurrentScopeName(context), empty(), utilityType.fields[0]));
|
|
603
|
-
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())]);
|
|
604
922
|
}
|
|
605
|
-
|
|
923
|
+
case 2: {
|
|
606
924
|
context_mut = context;
|
|
607
925
|
glueType_mut = innerType;
|
|
608
926
|
continue transformType;
|
|
609
927
|
}
|
|
928
|
+
case 3: {
|
|
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())]));
|
|
930
|
+
return new FSharpType(7, [new FSharpMapped(TransformContext__get_FullName(context), empty())]);
|
|
931
|
+
}
|
|
932
|
+
default:
|
|
933
|
+
return UtilityType_transformReadOnly(context, utilityType.fields[0], void 0);
|
|
610
934
|
}
|
|
611
935
|
}
|
|
612
936
|
case 5:
|
|
@@ -626,87 +950,124 @@ function transformType(context_mut, glueType_mut) {
|
|
|
626
950
|
}
|
|
627
951
|
|
|
628
952
|
function transformExports(context, isTopLevel, exports) {
|
|
953
|
+
let sortedExports, apply_1;
|
|
629
954
|
const context_1 = TransformContext__PushScope_Z721C83C5(context, "Exports");
|
|
630
|
-
return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(7, []), new FSharpAttribute(6, [])]), "Exports", "Exports", empty(),
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
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: {
|
|
651
981
|
matchResult = 2;
|
|
652
|
-
info_2 =
|
|
982
|
+
info_2 = head.fields[0];
|
|
983
|
+
break;
|
|
653
984
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
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;
|
|
657
1004
|
}
|
|
658
|
-
break;
|
|
659
|
-
}
|
|
660
|
-
case 11: {
|
|
661
|
-
matchResult = 3;
|
|
662
|
-
moduleDeclaration = _arg.fields[0];
|
|
663
|
-
break;
|
|
664
1005
|
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
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);
|
|
668
1055
|
}
|
|
669
1056
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
const patternInput = sanitizeNameAndPushScope(info.Name, context_1);
|
|
673
|
-
const xmlDocInfo = transformComment(info.Documentation);
|
|
674
|
-
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, []))]));
|
|
675
|
-
}
|
|
676
|
-
case 1: {
|
|
677
|
-
const patternInput_1 = sanitizeNameAndPushScope(info_1.Name, context_1);
|
|
678
|
-
const context_3 = patternInput_1[1];
|
|
679
|
-
const xmlDocInfo_1 = transformComment(info_1.Documentation);
|
|
680
|
-
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, []))))]));
|
|
681
|
-
}
|
|
682
|
-
case 2: {
|
|
683
|
-
const patternInput_2 = sanitizeNameAndPushScope(info_2.Name, context_1);
|
|
684
|
-
const context_4 = patternInput_2[1];
|
|
685
|
-
return map((constructorInfo) => {
|
|
686
|
-
let Attributes_2, Parameters_2;
|
|
687
|
-
const xmlDocInfo_2 = transformComment(constructorInfo.Documentation);
|
|
688
|
-
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, []))))]);
|
|
689
|
-
}, isEmpty(info_2.Constructors) ? singleton(new GlueConstructor(empty(), empty())) : info_2.Constructors);
|
|
690
|
-
}
|
|
691
|
-
case 3: {
|
|
692
|
-
const sanitizedName = sanitizeName(moduleDeclaration.Name);
|
|
693
|
-
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, []))]));
|
|
694
|
-
}
|
|
695
|
-
case 4: {
|
|
696
|
-
const patternInput_3 = sanitizeNameAndPushScope(GlueType__get_Name(glueType), context_1);
|
|
697
|
-
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, []))]));
|
|
698
|
-
}
|
|
699
|
-
default:
|
|
700
|
-
return toFail(printf("Could not generate exportMembers for: %A"))(glueType_1);
|
|
1057
|
+
else {
|
|
1058
|
+
return acc;
|
|
701
1059
|
}
|
|
702
|
-
},
|
|
1060
|
+
}), apply_1(empty(), empty_2({
|
|
1061
|
+
Compare: comparePrimitives,
|
|
1062
|
+
}), sortedExports))), empty())]);
|
|
703
1063
|
}
|
|
704
1064
|
|
|
705
1065
|
function transformParameter(context, parameter) {
|
|
1066
|
+
const patternInput = sanitizeNameAndPushScope(parameter.Name, context);
|
|
706
1067
|
let typ;
|
|
707
|
-
const computedType = unwrapOptionIfAlreadyOptional(
|
|
1068
|
+
const computedType = unwrapOptionIfAlreadyOptional(patternInput[1], parameter.Type, parameter.IsOptional);
|
|
708
1069
|
typ = (parameter.IsSpread ? ((computedType.tag === 14) ? computedType.fields[0] : computedType) : computedType);
|
|
709
|
-
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);
|
|
710
1071
|
}
|
|
711
1072
|
|
|
712
1073
|
function transformAccessor(accessor) {
|
|
@@ -721,159 +1082,200 @@ function transformAccessor(accessor) {
|
|
|
721
1082
|
}
|
|
722
1083
|
|
|
723
1084
|
function TransformMembers_toFSharpMember(context, members) {
|
|
724
|
-
return choose((
|
|
725
|
-
switch (
|
|
1085
|
+
return choose((_arg_4) => {
|
|
1086
|
+
switch (_arg_4.tag) {
|
|
726
1087
|
case 4: {
|
|
727
|
-
const callSignatureInfo =
|
|
1088
|
+
const callSignatureInfo = _arg_4.fields[0];
|
|
728
1089
|
const patternInput_1 = sanitizeNameAndPushScope("Invoke", context);
|
|
729
1090
|
const context_2 = patternInput_1[1];
|
|
730
1091
|
return new FSharpMember(0, [new FSharpMemberInfo(singleton(new FSharpAttribute(1, [])), patternInput_1[0], "Invoke", empty(), map((parameter_2) => transformParameter(context_2, parameter_2), callSignatureInfo.Parameters), transformType(context_2, callSignatureInfo.Type), false, false, void 0, new FSharpAccessibility(0, []), empty(), new FSharpMemberInfoBody(0, []))]);
|
|
731
1092
|
}
|
|
732
1093
|
case 1: {
|
|
733
|
-
const propertyInfo =
|
|
1094
|
+
const propertyInfo = _arg_4.fields[0];
|
|
734
1095
|
const patternInput_2 = sanitizeNameAndPushScope(propertyInfo.Name, context);
|
|
735
|
-
const
|
|
1096
|
+
const xmlDocInfo_1 = transformComment(propertyInfo.Documentation);
|
|
736
1097
|
if (propertyInfo.IsPrivate && !propertyInfo.IsStatic) {
|
|
737
1098
|
return void 0;
|
|
738
1099
|
}
|
|
739
1100
|
else {
|
|
740
|
-
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, []))]);
|
|
741
1102
|
}
|
|
742
1103
|
}
|
|
743
1104
|
case 2: {
|
|
744
|
-
const getAccessorInfo_1 =
|
|
1105
|
+
const getAccessorInfo_1 = _arg_4.fields[0];
|
|
745
1106
|
const patternInput_3 = sanitizeNameAndPushScope(getAccessorInfo_1.Name, context);
|
|
746
|
-
const
|
|
747
|
-
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, []))]);
|
|
748
1109
|
}
|
|
749
1110
|
case 3: {
|
|
750
|
-
const setAccessorInfo_1 =
|
|
1111
|
+
const setAccessorInfo_1 = _arg_4.fields[0];
|
|
751
1112
|
const patternInput_4 = sanitizeNameAndPushScope(setAccessorInfo_1.Name, context);
|
|
752
|
-
const
|
|
753
|
-
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, []))]);
|
|
754
1115
|
}
|
|
755
1116
|
case 5: {
|
|
756
|
-
const indexSignature =
|
|
1117
|
+
const indexSignature = _arg_4.fields[0];
|
|
757
1118
|
const patternInput_5 = sanitizeNameAndPushScope("Item", context);
|
|
758
1119
|
const context_6 = patternInput_5[1];
|
|
759
|
-
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, []))]);
|
|
760
1121
|
}
|
|
761
1122
|
case 6: {
|
|
762
|
-
const methodSignature =
|
|
1123
|
+
const methodSignature = _arg_4.fields[0];
|
|
763
1124
|
const patternInput_6 = sanitizeNameAndPushScope(methodSignature.Name, context);
|
|
764
1125
|
const context_7 = patternInput_6[1];
|
|
765
|
-
const
|
|
766
|
-
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, []))]);
|
|
767
1128
|
}
|
|
768
1129
|
case 7: {
|
|
769
|
-
const constructSignature =
|
|
1130
|
+
const constructSignature = _arg_4.fields[0];
|
|
770
1131
|
const patternInput_7 = sanitizeNameAndPushScope("Create", context);
|
|
771
1132
|
const context_8 = patternInput_7[1];
|
|
772
1133
|
return new FSharpMember(0, [new FSharpMemberInfo(singleton(new FSharpAttribute(13, [])), patternInput_7[0], "Create", empty(), map((parameter_5) => transformParameter(context_8, parameter_5), constructSignature.Parameters), transformType(context_8, constructSignature.Type), false, false, void 0, new FSharpAccessibility(0, []), empty(), new FSharpMemberInfoBody(0, []))]);
|
|
773
1134
|
}
|
|
774
1135
|
default: {
|
|
775
|
-
const methodInfo =
|
|
1136
|
+
const methodInfo = _arg_4.fields[0];
|
|
776
1137
|
const patternInput = sanitizeNameAndPushScope(methodInfo.Name, context);
|
|
777
|
-
const
|
|
1138
|
+
const name_1 = patternInput[0];
|
|
778
1139
|
const context_1 = patternInput[1];
|
|
1140
|
+
const xmlDocInfo = transformComment(methodInfo.Documentation);
|
|
779
1141
|
if (methodInfo.IsStatic) {
|
|
780
|
-
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)]);
|
|
781
1143
|
}
|
|
782
1144
|
else {
|
|
783
|
-
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, []))]);
|
|
784
1146
|
}
|
|
785
1147
|
}
|
|
786
1148
|
}
|
|
787
|
-
}, choose((
|
|
788
|
-
switch (
|
|
1149
|
+
}, choose((_arg_1) => {
|
|
1150
|
+
switch (_arg_1.tag) {
|
|
789
1151
|
case 3: {
|
|
790
|
-
const associatedGetAccessor = tryFind((
|
|
791
|
-
if (
|
|
792
|
-
return
|
|
1152
|
+
const associatedGetAccessor = tryFind((_arg_3) => {
|
|
1153
|
+
if (_arg_3.tag === 2) {
|
|
1154
|
+
return _arg_1.fields[0].Name === _arg_3.fields[0].Name;
|
|
793
1155
|
}
|
|
794
1156
|
else {
|
|
795
1157
|
return false;
|
|
796
1158
|
}
|
|
797
1159
|
}, members);
|
|
798
1160
|
if (associatedGetAccessor == null) {
|
|
799
|
-
return
|
|
1161
|
+
return _arg_1;
|
|
800
1162
|
}
|
|
801
1163
|
else {
|
|
802
1164
|
return void 0;
|
|
803
1165
|
}
|
|
804
1166
|
}
|
|
805
1167
|
case 4:
|
|
806
|
-
return
|
|
1168
|
+
return _arg_1;
|
|
807
1169
|
case 0:
|
|
808
|
-
return
|
|
1170
|
+
return _arg_1;
|
|
809
1171
|
case 1:
|
|
810
|
-
return
|
|
1172
|
+
return _arg_1;
|
|
811
1173
|
case 5:
|
|
812
|
-
return
|
|
1174
|
+
return _arg_1;
|
|
813
1175
|
case 6:
|
|
814
|
-
return
|
|
1176
|
+
return _arg_1;
|
|
815
1177
|
case 7:
|
|
816
|
-
return
|
|
1178
|
+
return _arg_1;
|
|
817
1179
|
default: {
|
|
818
|
-
const getAccessorInfo =
|
|
819
|
-
const associatedSetAccessor = tryFind((
|
|
820
|
-
if (
|
|
821
|
-
return getAccessorInfo.Name ===
|
|
1180
|
+
const getAccessorInfo = _arg_1.fields[0];
|
|
1181
|
+
const associatedSetAccessor = tryFind((_arg_2) => {
|
|
1182
|
+
if (_arg_2.tag === 3) {
|
|
1183
|
+
return getAccessorInfo.Name === _arg_2.fields[0].Name;
|
|
822
1184
|
}
|
|
823
1185
|
else {
|
|
824
1186
|
return false;
|
|
825
1187
|
}
|
|
826
1188
|
}, members);
|
|
827
1189
|
if (associatedSetAccessor == null) {
|
|
828
|
-
return
|
|
1190
|
+
return _arg_1;
|
|
829
1191
|
}
|
|
830
1192
|
else {
|
|
831
1193
|
return new GlueMember(1, [new GlueProperty(getAccessorInfo.Name, getAccessorInfo.Documentation, getAccessorInfo.Type, getAccessorInfo.IsStatic, false, new GlueAccessor(2, []), getAccessorInfo.IsPrivate)]);
|
|
832
1194
|
}
|
|
833
1195
|
}
|
|
834
1196
|
}
|
|
835
|
-
},
|
|
1197
|
+
}, filter((_arg) => {
|
|
1198
|
+
let matchResult, name;
|
|
1199
|
+
switch (_arg.tag) {
|
|
1200
|
+
case 2:
|
|
1201
|
+
case 3:
|
|
1202
|
+
case 1:
|
|
1203
|
+
case 4:
|
|
1204
|
+
case 7:
|
|
1205
|
+
case 5: {
|
|
1206
|
+
matchResult = 1;
|
|
1207
|
+
break;
|
|
1208
|
+
}
|
|
1209
|
+
case 6: {
|
|
1210
|
+
matchResult = 0;
|
|
1211
|
+
name = _arg.fields[0].Name;
|
|
1212
|
+
break;
|
|
1213
|
+
}
|
|
1214
|
+
default: {
|
|
1215
|
+
matchResult = 0;
|
|
1216
|
+
name = _arg.fields[0].Name;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
switch (matchResult) {
|
|
1220
|
+
case 0:
|
|
1221
|
+
return name !== "[Symbol.iterator]";
|
|
1222
|
+
default:
|
|
1223
|
+
return true;
|
|
1224
|
+
}
|
|
1225
|
+
}, members)));
|
|
836
1226
|
}
|
|
837
1227
|
|
|
838
|
-
function
|
|
1228
|
+
function TransformMembers_forceReadonly(members) {
|
|
839
1229
|
return map((_arg) => {
|
|
840
|
-
|
|
1230
|
+
if (_arg.tag === 1) {
|
|
1231
|
+
const property = _arg.fields[0];
|
|
1232
|
+
return new FSharpMember(1, [new FSharpMemberInfo(property.Attributes, property.Name, property.OriginalName, property.TypeParameters, property.Parameters, property.Type, property.IsOptional, property.IsStatic, new FSharpAccessor(0, []), property.Accessibility, property.XmlDoc, property.Body)]);
|
|
1233
|
+
}
|
|
1234
|
+
else {
|
|
1235
|
+
return _arg;
|
|
1236
|
+
}
|
|
1237
|
+
}, members);
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
function TransformMembers_toFSharpParameters(context, members) {
|
|
1241
|
+
return map((glueMember) => {
|
|
1242
|
+
switch (glueMember.tag) {
|
|
841
1243
|
case 1: {
|
|
842
|
-
const propertyInfo =
|
|
1244
|
+
const propertyInfo = glueMember.fields[0];
|
|
843
1245
|
const patternInput_1 = sanitizeNameAndPushScope(propertyInfo.Name, context);
|
|
844
|
-
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);
|
|
845
1247
|
}
|
|
846
1248
|
case 2: {
|
|
847
|
-
const getAccessorInfo =
|
|
1249
|
+
const getAccessorInfo = glueMember.fields[0];
|
|
848
1250
|
const patternInput_2 = sanitizeNameAndPushScope(getAccessorInfo.Name, context);
|
|
849
|
-
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);
|
|
850
1252
|
}
|
|
851
1253
|
case 3: {
|
|
852
|
-
const setAccessorInfo =
|
|
1254
|
+
const setAccessorInfo = glueMember.fields[0];
|
|
853
1255
|
const patternInput_3 = sanitizeNameAndPushScope(setAccessorInfo.Name, context);
|
|
854
|
-
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);
|
|
855
1257
|
}
|
|
856
1258
|
case 5: {
|
|
857
1259
|
const patternInput_4 = sanitizeNameAndPushScope("Item", context);
|
|
858
|
-
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);
|
|
859
1261
|
}
|
|
860
1262
|
case 6: {
|
|
861
|
-
const methodSignature =
|
|
1263
|
+
const methodSignature = glueMember.fields[0];
|
|
862
1264
|
const patternInput_5 = sanitizeNameAndPushScope(methodSignature.Name, context);
|
|
863
|
-
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);
|
|
864
1266
|
}
|
|
865
1267
|
case 4: {
|
|
866
1268
|
const patternInput_6 = sanitizeNameAndPushScope("Invoke", context);
|
|
867
|
-
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);
|
|
868
1270
|
}
|
|
869
1271
|
case 7: {
|
|
870
1272
|
const patternInput_7 = sanitizeNameAndPushScope("Create", context);
|
|
871
|
-
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);
|
|
872
1274
|
}
|
|
873
1275
|
default: {
|
|
874
|
-
const methodInfo =
|
|
1276
|
+
const methodInfo = glueMember.fields[0];
|
|
875
1277
|
const patternInput = sanitizeNameAndPushScope(methodInfo.Name, context);
|
|
876
|
-
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);
|
|
877
1279
|
}
|
|
878
1280
|
}
|
|
879
1281
|
}, members);
|
|
@@ -881,6 +1283,7 @@ function TransformMembers_toFSharpParameters(context, members) {
|
|
|
881
1283
|
|
|
882
1284
|
function transformInterface(context, info) {
|
|
883
1285
|
const patternInput = sanitizeNameAndPushScope(info.Name, context);
|
|
1286
|
+
const name = patternInput[0];
|
|
884
1287
|
const context_1 = patternInput[1];
|
|
885
1288
|
const membersComingFromPartial = concat(map((fullName) => concat(choose((glueType) => {
|
|
886
1289
|
if (glueType.tag === 1) {
|
|
@@ -919,7 +1322,7 @@ function transformInterface(context, info) {
|
|
|
919
1322
|
else {
|
|
920
1323
|
return void 0;
|
|
921
1324
|
}
|
|
922
|
-
}, info.HeritageClauses)));
|
|
1325
|
+
}, map((typ) => TransformContext__ExposeTypeAlias_1CE4A880(context_1, typ), info.HeritageClauses))));
|
|
923
1326
|
const standardMembers = TransformMembers_toFSharpMember(context_1, info.Members);
|
|
924
1327
|
const inheritance = filter((heritageClause_1) => {
|
|
925
1328
|
if (heritageClause_1.tag === 13) {
|
|
@@ -929,13 +1332,16 @@ function transformInterface(context, info) {
|
|
|
929
1332
|
else {
|
|
930
1333
|
return true;
|
|
931
1334
|
}
|
|
932
|
-
}, info.HeritageClauses);
|
|
933
|
-
const
|
|
934
|
-
|
|
1335
|
+
}, map((typ_1) => TransformContext__ExposeTypeAlias_1CE4A880(context_1, typ_1), info.HeritageClauses));
|
|
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));
|
|
935
1341
|
}
|
|
936
1342
|
|
|
937
1343
|
export function Interface_makePartial(name, originalInterface) {
|
|
938
|
-
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) => {
|
|
939
1345
|
if (m.tag === 1) {
|
|
940
1346
|
const property = m.fields[0];
|
|
941
1347
|
if (property.Type.tag === 3) {
|
|
@@ -1092,24 +1498,153 @@ function transformRecord(context, name, typeParameters, recordInfo) {
|
|
|
1092
1498
|
const context_1 = patternInput[1];
|
|
1093
1499
|
let parameters;
|
|
1094
1500
|
const patternInput_1 = sanitizeNameAndPushScope("key", context_1);
|
|
1095
|
-
parameters = singleton(new FSharpParameter(empty(), patternInput_1[0], false, transformType(patternInput_1[1], recordInfo.KeyType)));
|
|
1096
|
-
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())]);
|
|
1097
1503
|
}
|
|
1098
1504
|
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
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;
|
|
1104
1556
|
}
|
|
1105
|
-
|
|
1106
|
-
|
|
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);
|
|
1107
1564
|
}
|
|
1108
|
-
}
|
|
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
|
+
}
|
|
1617
|
+
}
|
|
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);
|
|
1109
1642
|
}
|
|
1110
1643
|
|
|
1111
1644
|
function transformTypeParameters(context, typeParameters) {
|
|
1112
|
-
|
|
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);
|
|
1113
1648
|
}
|
|
1114
1649
|
|
|
1115
1650
|
function tryOptimizeUnionType(context, typeName, cases) {
|
|
@@ -1243,7 +1778,7 @@ function tryOptimizeUnionType(context, typeName, cases) {
|
|
|
1243
1778
|
return empty();
|
|
1244
1779
|
}
|
|
1245
1780
|
}, cases);
|
|
1246
|
-
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())]);
|
|
1247
1782
|
}
|
|
1248
1783
|
else {
|
|
1249
1784
|
return void 0;
|
|
@@ -1333,7 +1868,7 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1333
1868
|
const typeAliasName = patternInput[0];
|
|
1334
1869
|
const context_1 = patternInput[1];
|
|
1335
1870
|
const xmlDoc = transformComment(glueTypeAliasDeclaration.Documentation);
|
|
1336
|
-
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)]));
|
|
1337
1872
|
const matchValue = glueTypeAliasDeclaration.Type;
|
|
1338
1873
|
switch (matchValue.tag) {
|
|
1339
1874
|
case 9:
|
|
@@ -1397,7 +1932,7 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1397
1932
|
const matchValue_3 = typeReference.TypeArguments;
|
|
1398
1933
|
let matchResult_1, head;
|
|
1399
1934
|
if (!isEmpty(matchValue_3)) {
|
|
1400
|
-
if (isEmpty(
|
|
1935
|
+
if (isEmpty(tail_1(matchValue_3))) {
|
|
1401
1936
|
matchResult_1 = 0;
|
|
1402
1937
|
head = head_1(matchValue_3);
|
|
1403
1938
|
}
|
|
@@ -1411,7 +1946,7 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1411
1946
|
switch (matchResult_1) {
|
|
1412
1947
|
case 0:
|
|
1413
1948
|
if (head.tag === 20) {
|
|
1414
|
-
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()));
|
|
1415
1950
|
const exposedType = makeInterfaceTyp("ReturnType");
|
|
1416
1951
|
const typeArgument = makeInterfaceTyp(TransformContext__get_FullName(context_2) + ".ReturnType");
|
|
1417
1952
|
TransformContext__ExposeType_Z1D58A540(TransformContext__PushScope_Z721C83C5(context_2, typeReference.Name), new FSharpType(5, [exposedType]));
|
|
@@ -1435,31 +1970,53 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1435
1970
|
return makeTypeAlias(transformType(TransformContext__PushScope_Z721C83C5(context_1, "ReturnType"), utilityType.fields[0]));
|
|
1436
1971
|
case 3:
|
|
1437
1972
|
return makeTypeAlias(transformType(context_1, utilityType.fields[0]));
|
|
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
|
+
}
|
|
1977
|
+
case 5:
|
|
1978
|
+
return UtilityType_transformReadOnly(context_1, utilityType.fields[0], makeTypeAlias);
|
|
1438
1979
|
default:
|
|
1439
1980
|
return new FSharpType(5, [Interface_makePartial(typeAliasName, transformInterface(context_1, utilityType.fields[0]))]);
|
|
1440
1981
|
}
|
|
1441
1982
|
}
|
|
1442
1983
|
case 15: {
|
|
1443
1984
|
const functionType = matchValue.fields[0];
|
|
1444
|
-
|
|
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())]);
|
|
1445
1987
|
}
|
|
1446
1988
|
case 18:
|
|
1447
1989
|
return makeTypeAlias(transformTupleType(context_1, matchValue.fields[0]));
|
|
1448
|
-
case 20:
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
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
|
+
}
|
|
1994
|
+
case 21: {
|
|
1995
|
+
const typeLiteralInfo = matchValue.fields[0];
|
|
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(() => {
|
|
1998
|
+
const matchValue_4 = TypeLiteral_tryFindIterableType(context_1, typeLiteralInfo);
|
|
1999
|
+
if (matchValue_4 == null) {
|
|
2000
|
+
return empty_1();
|
|
2001
|
+
}
|
|
2002
|
+
else {
|
|
2003
|
+
return singleton_1(matchValue_4);
|
|
2004
|
+
}
|
|
2005
|
+
})))]);
|
|
2006
|
+
}
|
|
1452
2007
|
case 23:
|
|
1453
2008
|
return makeTypeAlias(new FSharpType(18, []));
|
|
1454
2009
|
case 16:
|
|
1455
2010
|
return makeTypeAlias(new FSharpType(13, [matchValue.fields[0]]));
|
|
1456
|
-
case 27:
|
|
1457
|
-
|
|
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
|
+
}
|
|
1458
2015
|
case 28: {
|
|
1459
|
-
const
|
|
1460
|
-
if (!isEmpty(
|
|
1461
|
-
if (isEmpty(
|
|
1462
|
-
return new FSharpType(2, [new FSharpSingleErasedCaseUnion(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc,
|
|
2016
|
+
const matchValue_5 = glueTypeAliasDeclaration.TypeParameters;
|
|
2017
|
+
if (!isEmpty(matchValue_5)) {
|
|
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)]);
|
|
1463
2020
|
}
|
|
1464
2021
|
else {
|
|
1465
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`);
|
|
@@ -1497,26 +2054,86 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
|
1497
2054
|
}
|
|
1498
2055
|
}
|
|
1499
2056
|
|
|
1500
|
-
function transformModuleDeclaration(typeMemory, reporter, moduleDeclaration) {
|
|
1501
|
-
|
|
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
|
+
}
|
|
1502
2100
|
}
|
|
1503
2101
|
|
|
1504
2102
|
function transformClassDeclaration(context, classDeclaration) {
|
|
1505
|
-
let Members;
|
|
1506
2103
|
const patternInput = sanitizeNameAndPushScope(classDeclaration.Name, context);
|
|
2104
|
+
const name = patternInput[0];
|
|
1507
2105
|
const context_1 = patternInput[1];
|
|
1508
|
-
|
|
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);
|
|
1509
2126
|
}
|
|
1510
2127
|
|
|
1511
2128
|
function transformToFsharp(context, glueTypes) {
|
|
1512
|
-
return
|
|
2129
|
+
return collect_1((_arg) => {
|
|
1513
2130
|
switch (_arg.tag) {
|
|
1514
2131
|
case 4:
|
|
1515
|
-
return transformEnum(_arg.fields[0]);
|
|
2132
|
+
return singleton(transformEnum(_arg.fields[0]));
|
|
1516
2133
|
case 5:
|
|
1517
|
-
return transformTypeAliasDeclaration(context, _arg.fields[0]);
|
|
2134
|
+
return singleton(transformTypeAliasDeclaration(context, _arg.fields[0]));
|
|
1518
2135
|
case 11:
|
|
1519
|
-
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]));
|
|
1520
2137
|
case 12:
|
|
1521
2138
|
return transformClassDeclaration(context, _arg.fields[0]);
|
|
1522
2139
|
case 24: {
|
|
@@ -1525,7 +2142,7 @@ function transformToFsharp(context, glueTypes) {
|
|
|
1525
2142
|
return transformClassDeclaration(context, exportedType.fields[0]);
|
|
1526
2143
|
}
|
|
1527
2144
|
else {
|
|
1528
|
-
return new FSharpType(10, []);
|
|
2145
|
+
return singleton(new FSharpType(10, []));
|
|
1529
2146
|
}
|
|
1530
2147
|
}
|
|
1531
2148
|
case 28:
|
|
@@ -1552,14 +2169,15 @@ function transformToFsharp(context, glueTypes) {
|
|
|
1552
2169
|
case 26:
|
|
1553
2170
|
case 29:
|
|
1554
2171
|
case 17:
|
|
1555
|
-
return new FSharpType(10, []);
|
|
2172
|
+
return singleton(new FSharpType(10, []));
|
|
1556
2173
|
default:
|
|
1557
|
-
return new FSharpType(5, [transformInterface(context, _arg.fields[0])]);
|
|
2174
|
+
return singleton(new FSharpType(5, [transformInterface(context, _arg.fields[0])]));
|
|
1558
2175
|
}
|
|
1559
2176
|
}, glueTypes);
|
|
1560
2177
|
}
|
|
1561
2178
|
|
|
1562
|
-
function transform(typeMemory, reporter, isTopLevel, glueAst) {
|
|
2179
|
+
function transform(typeMemory, reporter, typeLiteralsMemory, isTopLevel, glueAst) {
|
|
2180
|
+
let applyModuleDeclaration;
|
|
1563
2181
|
const patternInput = partition((glueType) => {
|
|
1564
2182
|
switch (glueType.tag) {
|
|
1565
2183
|
case 2:
|
|
@@ -1577,22 +2195,34 @@ function transform(typeMemory, reporter, isTopLevel, glueAst) {
|
|
|
1577
2195
|
}
|
|
1578
2196
|
}, glueAst);
|
|
1579
2197
|
const rest = patternInput[1];
|
|
1580
|
-
const exports_1 = append_1(patternInput[0],
|
|
1581
|
-
|
|
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) {
|
|
1582
2218
|
case 12:
|
|
1583
2219
|
return true;
|
|
2220
|
+
case 2:
|
|
2221
|
+
return true;
|
|
1584
2222
|
case 11:
|
|
1585
|
-
return
|
|
1586
|
-
switch (glueType_2.tag) {
|
|
1587
|
-
case 12:
|
|
1588
|
-
case 6:
|
|
1589
|
-
return true;
|
|
1590
|
-
default:
|
|
1591
|
-
return false;
|
|
1592
|
-
}
|
|
1593
|
-
}, glueType_1.fields[0].Types);
|
|
2223
|
+
return applyModuleDeclaration(glueType_2.fields[0]);
|
|
1594
2224
|
case 24:
|
|
1595
|
-
if (
|
|
2225
|
+
if (glueType_2.fields[0].tag === 12) {
|
|
1596
2226
|
return true;
|
|
1597
2227
|
}
|
|
1598
2228
|
else {
|
|
@@ -1601,15 +2231,15 @@ function transform(typeMemory, reporter, isTopLevel, glueAst) {
|
|
|
1601
2231
|
default:
|
|
1602
2232
|
return false;
|
|
1603
2233
|
}
|
|
1604
|
-
}, rest));
|
|
1605
|
-
const rootTransformContext = TransformContext_$
|
|
2234
|
+
}, rest)));
|
|
2235
|
+
const rootTransformContext = TransformContext_$ctor_1977F1E3(reporter, "", typeMemory, typeLiteralsMemory);
|
|
1606
2236
|
const rest_1 = transformToFsharp(rootTransformContext, rest);
|
|
1607
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)))))));
|
|
1608
2238
|
}
|
|
1609
2239
|
|
|
1610
2240
|
export function apply(typeMemory, glueAst) {
|
|
1611
2241
|
const reporter = Reporter_$ctor();
|
|
1612
|
-
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));
|
|
1613
2243
|
}
|
|
1614
2244
|
|
|
1615
2245
|
//# sourceMappingURL=Transform.js.map
|