@glutinum/cli 0.3.1 → 0.5.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 +169 -1
- package/dist/Glutinum.Converter/FsharpAST.js +152 -20
- package/dist/Glutinum.Converter/FsharpAST.js.map +1 -1
- package/dist/Glutinum.Converter/Generate.js +17 -5
- package/dist/Glutinum.Converter/Generate.js.map +1 -1
- package/dist/Glutinum.Converter/GlueAST.js +97 -17
- package/dist/Glutinum.Converter/GlueAST.js.map +1 -1
- package/dist/Glutinum.Converter/Log.js +9 -5
- package/dist/Glutinum.Converter/Log.js.map +1 -1
- package/dist/Glutinum.Converter/Printer.js +486 -132
- package/dist/Glutinum.Converter/Printer.js.map +1 -1
- package/dist/Glutinum.Converter/Read.js +8 -5
- package/dist/Glutinum.Converter/Read.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +14 -6
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Declaration.js +50 -0
- package/dist/Glutinum.Converter/Reader/Declaration.js.map +1 -0
- package/dist/Glutinum.Converter/Reader/Documentation.js +119 -0
- package/dist/Glutinum.Converter/Reader/Documentation.js.map +1 -0
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +13 -11
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +42 -0
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js.map +1 -0
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +15 -5
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +4 -2
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +3 -3
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +3 -3
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Node.js +24 -10
- package/dist/Glutinum.Converter/Reader/Node.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Parameters.js +3 -3
- package/dist/Glutinum.Converter/Reader/Parameters.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +5 -5
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeNode.js +151 -18
- package/dist/Glutinum.Converter/Reader/TypeNode.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +29 -20
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/TypeParameters.js +2 -2
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +102 -77
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +17 -11
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/Utils.js +80 -5
- package/dist/Glutinum.Converter/Reader/Utils.js.map +1 -1
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +14 -7
- package/dist/Glutinum.Converter/Reader/VariableStatement.js.map +1 -1
- package/dist/Glutinum.Converter/Transform.js +559 -193
- package/dist/Glutinum.Converter/Transform.js.map +1 -1
- package/dist/Glutinum.Converter/TypeScript.js +1 -1
- package/dist/Glutinum.Converter/Utils/Keywords.js +3 -3
- package/dist/Glutinum.Converter/Utils/List.js +62 -0
- package/dist/Glutinum.Converter/Utils/List.js.map +1 -0
- package/dist/Glutinum.Converter/Utils/Naming.js +73 -6
- package/dist/Glutinum.Converter/Utils/Naming.js.map +1 -1
- package/dist/Glutinum.Converter/Utils/String.js +6 -1
- package/dist/Glutinum.Converter/Utils/String.js.map +1 -1
- package/dist/Program.js +9 -10
- package/dist/Program.js.map +1 -1
- package/package.json +22 -3
- package/dist/Glutinum.Converter/Reader/NamedDeclaration.js +0 -34
- package/dist/Glutinum.Converter/Reader/NamedDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Types.js +0 -16
- package/dist/Glutinum.Converter/Reader/Types.js.map +0 -1
- package/dist/fable_modules/fable-library.4.5.0/Array.d.ts +0 -120
- package/dist/fable_modules/fable-library.4.5.0/Array.js +0 -1204
- package/dist/fable_modules/fable-library.4.5.0/Async.d.ts +0 -32
- package/dist/fable_modules/fable-library.4.5.0/Async.js +0 -158
- package/dist/fable_modules/fable-library.4.5.0/AsyncBuilder.d.ts +0 -59
- package/dist/fable_modules/fable-library.4.5.0/AsyncBuilder.js +0 -183
- package/dist/fable_modules/fable-library.4.5.0/BigInt.d.ts +0 -115
- package/dist/fable_modules/fable-library.4.5.0/BigInt.js +0 -282
- package/dist/fable_modules/fable-library.4.5.0/BitConverter.d.ts +0 -27
- package/dist/fable_modules/fable-library.4.5.0/BitConverter.js +0 -138
- package/dist/fable_modules/fable-library.4.5.0/Boolean.d.ts +0 -3
- package/dist/fable_modules/fable-library.4.5.0/Boolean.js +0 -21
- package/dist/fable_modules/fable-library.4.5.0/CHANGELOG.md +0 -11
- package/dist/fable_modules/fable-library.4.5.0/Char.d.ts +0 -65
- package/dist/fable_modules/fable-library.4.5.0/Char.js +0 -169
- package/dist/fable_modules/fable-library.4.5.0/Choice.d.ts +0 -138
- package/dist/fable_modules/fable-library.4.5.0/Choice.js +0 -227
- package/dist/fable_modules/fable-library.4.5.0/Date.d.ts +0 -70
- package/dist/fable_modules/fable-library.4.5.0/Date.js +0 -451
- package/dist/fable_modules/fable-library.4.5.0/DateOffset.d.ts +0 -63
- package/dist/fable_modules/fable-library.4.5.0/DateOffset.js +0 -268
- package/dist/fable_modules/fable-library.4.5.0/DateOnly.d.ts +0 -18
- package/dist/fable_modules/fable-library.4.5.0/DateOnly.js +0 -124
- package/dist/fable_modules/fable-library.4.5.0/Decimal.d.ts +0 -45
- package/dist/fable_modules/fable-library.4.5.0/Decimal.js +0 -212
- package/dist/fable_modules/fable-library.4.5.0/Double.d.ts +0 -11
- package/dist/fable_modules/fable-library.4.5.0/Double.js +0 -46
- package/dist/fable_modules/fable-library.4.5.0/Encoding.d.ts +0 -12
- package/dist/fable_modules/fable-library.4.5.0/Encoding.js +0 -173
- package/dist/fable_modules/fable-library.4.5.0/Event.d.ts +0 -31
- package/dist/fable_modules/fable-library.4.5.0/Event.js +0 -93
- package/dist/fable_modules/fable-library.4.5.0/FSharp.Collections.d.ts +0 -7
- package/dist/fable_modules/fable-library.4.5.0/FSharp.Collections.js +0 -27
- package/dist/fable_modules/fable-library.4.5.0/FSharp.Core.d.ts +0 -17
- package/dist/fable_modules/fable-library.4.5.0/FSharp.Core.js +0 -69
- package/dist/fable_modules/fable-library.4.5.0/Global.d.ts +0 -24
- package/dist/fable_modules/fable-library.4.5.0/Global.js +0 -8
- package/dist/fable_modules/fable-library.4.5.0/Guid.d.ts +0 -10
- package/dist/fable_modules/fable-library.4.5.0/Guid.js +0 -142
- package/dist/fable_modules/fable-library.4.5.0/Int32.d.ts +0 -28
- package/dist/fable_modules/fable-library.4.5.0/Int32.js +0 -135
- package/dist/fable_modules/fable-library.4.5.0/List.d.ts +0 -143
- package/dist/fable_modules/fable-library.4.5.0/List.js +0 -1273
- package/dist/fable_modules/fable-library.4.5.0/Long.d.ts +0 -3
- package/dist/fable_modules/fable-library.4.5.0/Long.js +0 -46
- package/dist/fable_modules/fable-library.4.5.0/MailboxProcessor.d.ts +0 -25
- package/dist/fable_modules/fable-library.4.5.0/MailboxProcessor.js +0 -93
- package/dist/fable_modules/fable-library.4.5.0/Map.d.ts +0 -178
- package/dist/fable_modules/fable-library.4.5.0/Map.js +0 -1396
- package/dist/fable_modules/fable-library.4.5.0/MapUtil.d.ts +0 -10
- package/dist/fable_modules/fable-library.4.5.0/MapUtil.js +0 -112
- package/dist/fable_modules/fable-library.4.5.0/MutableMap.d.ts +0 -52
- package/dist/fable_modules/fable-library.4.5.0/MutableMap.js +0 -326
- package/dist/fable_modules/fable-library.4.5.0/MutableSet.d.ts +0 -39
- package/dist/fable_modules/fable-library.4.5.0/MutableSet.js +0 -232
- package/dist/fable_modules/fable-library.4.5.0/Native.d.ts +0 -2
- package/dist/fable_modules/fable-library.4.5.0/Native.js +0 -8
- package/dist/fable_modules/fable-library.4.5.0/Numeric.d.ts +0 -19
- package/dist/fable_modules/fable-library.4.5.0/Numeric.js +0 -71
- package/dist/fable_modules/fable-library.4.5.0/Observable.d.ts +0 -32
- package/dist/fable_modules/fable-library.4.5.0/Observable.js +0 -113
- package/dist/fable_modules/fable-library.4.5.0/Option.d.ts +0 -28
- package/dist/fable_modules/fable-library.4.5.0/Option.js +0 -96
- package/dist/fable_modules/fable-library.4.5.0/README.md +0 -3
- package/dist/fable_modules/fable-library.4.5.0/Random.d.ts +0 -37
- package/dist/fable_modules/fable-library.4.5.0/Random.js +0 -170
- package/dist/fable_modules/fable-library.4.5.0/Range.d.ts +0 -12
- package/dist/fable_modules/fable-library.4.5.0/Range.js +0 -45
- package/dist/fable_modules/fable-library.4.5.0/Reflection.d.ts +0 -119
- package/dist/fable_modules/fable-library.4.5.0/Reflection.js +0 -461
- package/dist/fable_modules/fable-library.4.5.0/RegExp.d.ts +0 -10
- package/dist/fable_modules/fable-library.4.5.0/RegExp.js +0 -132
- package/dist/fable_modules/fable-library.4.5.0/Seq.d.ts +0 -165
- package/dist/fable_modules/fable-library.4.5.0/Seq.js +0 -1379
- package/dist/fable_modules/fable-library.4.5.0/Seq2.d.ts +0 -18
- package/dist/fable_modules/fable-library.4.5.0/Seq2.js +0 -111
- package/dist/fable_modules/fable-library.4.5.0/Set.d.ts +0 -190
- package/dist/fable_modules/fable-library.4.5.0/Set.js +0 -1789
- package/dist/fable_modules/fable-library.4.5.0/String.d.ts +0 -49
- package/dist/fable_modules/fable-library.4.5.0/String.js +0 -540
- package/dist/fable_modules/fable-library.4.5.0/System.Collections.Generic.d.ts +0 -71
- package/dist/fable_modules/fable-library.4.5.0/System.Collections.Generic.js +0 -307
- package/dist/fable_modules/fable-library.4.5.0/System.Text.d.ts +0 -30
- package/dist/fable_modules/fable-library.4.5.0/System.Text.js +0 -110
- package/dist/fable_modules/fable-library.4.5.0/SystemException.d.ts +0 -5
- package/dist/fable_modules/fable-library.4.5.0/SystemException.js +0 -5
- package/dist/fable_modules/fable-library.4.5.0/TimeOnly.d.ts +0 -15
- package/dist/fable_modules/fable-library.4.5.0/TimeOnly.js +0 -122
- package/dist/fable_modules/fable-library.4.5.0/TimeSpan.d.ts +0 -34
- package/dist/fable_modules/fable-library.4.5.0/TimeSpan.js +0 -177
- package/dist/fable_modules/fable-library.4.5.0/Timer.d.ts +0 -19
- package/dist/fable_modules/fable-library.4.5.0/Timer.js +0 -67
- package/dist/fable_modules/fable-library.4.5.0/Types.d.ts +0 -58
- package/dist/fable_modules/fable-library.4.5.0/Types.js +0 -208
- package/dist/fable_modules/fable-library.4.5.0/Unicode.13.0.0.d.ts +0 -2
- package/dist/fable_modules/fable-library.4.5.0/Unicode.13.0.0.js +0 -4
- package/dist/fable_modules/fable-library.4.5.0/Uri.d.ts +0 -29
- package/dist/fable_modules/fable-library.4.5.0/Uri.js +0 -142
- package/dist/fable_modules/fable-library.4.5.0/Util.d.ts +0 -207
- package/dist/fable_modules/fable-library.4.5.0/Util.js +0 -781
- package/dist/fable_modules/fable-library.4.5.0/lib/big.d.ts +0 -5
- package/dist/fable_modules/fable-library.4.5.0/lib/big.js +0 -826
- package/dist/fable_modules/fable-library.4.5.0/package.json +0 -23
- package/dist/fable_modules/project_cracked.json +0 -1
|
@@ -1,13 +1,126 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { printf, toFail, interpolate, toText, trimStart } from "../fable_modules/fable-library-js.4.14.0/String.js";
|
|
2
|
+
import { class_type } from "../fable_modules/fable-library-js.4.14.0/Reflection.js";
|
|
3
|
+
import { empty as empty_1, singleton as singleton_1, collect, append, delay, toList } from "../fable_modules/fable-library-js.4.14.0/Seq.js";
|
|
4
|
+
import { exists, append as append_1, forAll, tail, filter, choose, collect as collect_1, ofArray, sortBy, head as head_1, length, map, partition, singleton, empty, isEmpty } from "../fable_modules/fable-library-js.4.14.0/List.js";
|
|
5
|
+
import { FSharpTypeParameter_Create_Z6CFD3565, FSharpTypeAlias, FSharpEnum, FSharpEnumCase, FSharpStaticMemberInfo, FSharpInterface, FSharpAccessor, FSharpMapped, FSharpMember, FSharpMemberInfo, FSharpClass, FSharpConstructor, FSharpAccessibility, FSharpExplicitField, FSharpParameter, FSharpFunctionType, FSharpTypeReference, FSharpUnion, FSharpUnionCase, FSharpPrimitive, FSharpLiteral, FSharpCommentParam, FSharpXmlDoc, FSharpAttribute, FSharpType, FSharpModule } from "./FsharpAST.js";
|
|
6
|
+
import { removeSurroundingQuotes, nameNotEqualsDefaultFableValue, mapTypeNameToFableCoreAwareName, sanitizeName } from "./Utils/Naming.js";
|
|
7
|
+
import { unwrap, map as map_1, defaultArg } from "../fable_modules/fable-library-js.4.14.0/Option.js";
|
|
4
8
|
import { GlueType, GlueTypeUnion, GlueType__get_Name } from "./GlueAST.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { List_distinct } from "../fable_modules/fable-library.4.
|
|
8
|
-
import { int32ToString, safeHash, equals } from "../fable_modules/fable-library.4.5.0/Util.js";
|
|
9
|
+
import { int32ToString, safeHash, equals, comparePrimitives } from "../fable_modules/fable-library-js.4.14.0/Util.js";
|
|
10
|
+
import { error } from "./Log.js";
|
|
11
|
+
import { List_distinct } from "../fable_modules/fable-library-js.4.14.0/Seq2.js";
|
|
9
12
|
import { removeSingleQuote, removeDoubleQuote } from "./Utils/String.js";
|
|
10
|
-
|
|
13
|
+
|
|
14
|
+
export class TransformContext {
|
|
15
|
+
constructor(currentScopeName, parent) {
|
|
16
|
+
let matchValue;
|
|
17
|
+
this.currentScopeName = currentScopeName;
|
|
18
|
+
this.parent = parent;
|
|
19
|
+
this.types = [];
|
|
20
|
+
this.modules = [];
|
|
21
|
+
this["FullName@"] = ((matchValue = this.parent, (matchValue != null) ? trimStart((TransformContext__get_FullName(matchValue) + ".") + this.currentScopeName, ".") : ""));
|
|
22
|
+
this["CurrentScopeName@"] = this.currentScopeName;
|
|
23
|
+
this["_types@"] = this.types;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function TransformContext_$reflection() {
|
|
28
|
+
return class_type("Glutinum.Converter.Transform.TransformContext", void 0, TransformContext);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function TransformContext_$ctor_Z535BF207(currentScopeName, parent) {
|
|
32
|
+
return new TransformContext(currentScopeName, parent);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function TransformContext__get_FullName(__) {
|
|
36
|
+
return __["FullName@"];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function TransformContext__get_CurrentScopeName(__) {
|
|
40
|
+
return __["CurrentScopeName@"];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function TransformContext__get__types(__) {
|
|
44
|
+
return __["_types@"];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function TransformContext__ExposeType_Z1D58A540(_, typ) {
|
|
48
|
+
const matchValue = _.parent;
|
|
49
|
+
if (matchValue != null) {
|
|
50
|
+
const parent = matchValue;
|
|
51
|
+
void (TransformContext__get__types(parent).push(typ));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
void (_.types.push(typ));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function TransformContext__PushScope_Z721C83C5(this$, scopeName) {
|
|
59
|
+
const childContext = TransformContext_$ctor_Z535BF207(scopeName, this$);
|
|
60
|
+
void (this$.modules.push(childContext));
|
|
61
|
+
return childContext;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function TransformContext__ToList(_) {
|
|
65
|
+
if (_.parent != null) {
|
|
66
|
+
const types = toList(delay(() => append(toList(_.types), delay(() => collect(TransformContext__ToList, _.modules)))));
|
|
67
|
+
if (isEmpty(types)) {
|
|
68
|
+
return empty();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return singleton(new FSharpType(3, [new FSharpModule(_.currentScopeName, false, types)]));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return toList(delay(() => append(toList(_.types), delay(() => collect(TransformContext__ToList, _.modules)))));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function sanitizeNameAndPushScope(name, context) {
|
|
80
|
+
const name_1 = sanitizeName(name);
|
|
81
|
+
return [name_1, TransformContext__PushScope_Z721C83C5(context, name_1)];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function transformComment(comment) {
|
|
85
|
+
const patternInput = partition((_arg) => {
|
|
86
|
+
if (_arg.tag === 3) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}, comment);
|
|
93
|
+
return {
|
|
94
|
+
ObsoleteAttributes: map((_arg_1) => {
|
|
95
|
+
if (_arg_1.tag === 3) {
|
|
96
|
+
return new FSharpAttribute(8, [_arg_1.fields[0]]);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
throw new Error("Should not happen");
|
|
100
|
+
}
|
|
101
|
+
}, patternInput[0]),
|
|
102
|
+
Others: map((comment_1) => {
|
|
103
|
+
switch (comment_1.tag) {
|
|
104
|
+
case 0:
|
|
105
|
+
return new FSharpXmlDoc(0, [comment_1.fields[0]]);
|
|
106
|
+
case 1:
|
|
107
|
+
return new FSharpXmlDoc(2, [comment_1.fields[0]]);
|
|
108
|
+
case 2: {
|
|
109
|
+
const param = comment_1.fields[0];
|
|
110
|
+
return new FSharpXmlDoc(1, [new FSharpCommentParam(param.Name, defaultArg(map_1((content_1) => trimStart(trimStart(trimStart(content_1), "-")), param.Content), ""))]);
|
|
111
|
+
}
|
|
112
|
+
case 4:
|
|
113
|
+
return new FSharpXmlDoc(3, [comment_1.fields[0]]);
|
|
114
|
+
case 5:
|
|
115
|
+
return new FSharpXmlDoc(4, [comment_1.fields[0]]);
|
|
116
|
+
case 6:
|
|
117
|
+
return new FSharpXmlDoc(5, [comment_1.fields[0]]);
|
|
118
|
+
default:
|
|
119
|
+
throw new Error("Should not happen");
|
|
120
|
+
}
|
|
121
|
+
}, patternInput[1]),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
11
124
|
|
|
12
125
|
function transformLiteral(glueLiteral) {
|
|
13
126
|
switch (glueLiteral.tag) {
|
|
@@ -17,6 +130,8 @@ function transformLiteral(glueLiteral) {
|
|
|
17
130
|
return new FSharpLiteral(2, [glueLiteral.fields[0]]);
|
|
18
131
|
case 3:
|
|
19
132
|
return new FSharpLiteral(3, [glueLiteral.fields[0]]);
|
|
133
|
+
case 4:
|
|
134
|
+
return new FSharpLiteral(4, []);
|
|
20
135
|
default:
|
|
21
136
|
return new FSharpLiteral(0, [glueLiteral.fields[0]]);
|
|
22
137
|
}
|
|
@@ -40,108 +155,177 @@ function transformPrimitive(gluePrimitive) {
|
|
|
40
155
|
return new FSharpPrimitive(6, []);
|
|
41
156
|
case 8:
|
|
42
157
|
return new FSharpPrimitive(6, []);
|
|
158
|
+
case 9:
|
|
159
|
+
return new FSharpPrimitive(6, []);
|
|
43
160
|
default:
|
|
44
161
|
return new FSharpPrimitive(0, []);
|
|
45
162
|
}
|
|
46
163
|
}
|
|
47
164
|
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
165
|
+
function transformTupleType(context, glueTypes) {
|
|
166
|
+
return new FSharpType(11, [map((glueType) => transformType(context, glueType), glueTypes)]);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function transformType(context_mut, glueType_mut) {
|
|
170
|
+
transformType:
|
|
171
|
+
while (true) {
|
|
172
|
+
const context = context_mut, glueType = glueType_mut;
|
|
173
|
+
switch (glueType.tag) {
|
|
174
|
+
case 3:
|
|
175
|
+
return new FSharpType(7, [transformPrimitive(glueType.fields[0])]);
|
|
176
|
+
case 22:
|
|
177
|
+
return new FSharpType(2, [transformType(context, glueType.fields[0])]);
|
|
178
|
+
case 18:
|
|
179
|
+
return new FSharpType(14, [glueType.fields[0]]);
|
|
180
|
+
case 19:
|
|
181
|
+
return transformTupleType(context, glueType.fields[0]);
|
|
182
|
+
case 7: {
|
|
183
|
+
const patternInput = partition((glueType_2) => {
|
|
184
|
+
if (glueType_2.tag === 3) {
|
|
185
|
+
const primitiveInfo_1 = glueType_2.fields[0];
|
|
186
|
+
switch (primitiveInfo_1.tag) {
|
|
187
|
+
case 7:
|
|
188
|
+
case 8:
|
|
189
|
+
return true;
|
|
190
|
+
default:
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
return false;
|
|
60
196
|
}
|
|
197
|
+
}, glueType.fields[0].fields[0]);
|
|
198
|
+
const others = patternInput[1];
|
|
199
|
+
const isOptional = !isEmpty(patternInput[0]);
|
|
200
|
+
if (isOptional && (length(others) === 1)) {
|
|
201
|
+
return new FSharpType(2, [transformType(context, head_1(others))]);
|
|
202
|
+
}
|
|
203
|
+
else if (length(others) === 1) {
|
|
204
|
+
context_mut = context;
|
|
205
|
+
glueType_mut = head_1(others);
|
|
206
|
+
continue transformType;
|
|
61
207
|
}
|
|
62
208
|
else {
|
|
63
|
-
return
|
|
209
|
+
return new FSharpType(1, [new FSharpUnion(empty(), `U${length(others)}`, map((caseType) => (new FSharpUnionCase(empty(), mapTypeNameToFableCoreAwareName(GlueType__get_Name(caseType)))), others), isOptional)]);
|
|
64
210
|
}
|
|
65
|
-
}, glueType.fields[0].fields[0]);
|
|
66
|
-
const others = patternInput[1];
|
|
67
|
-
const isOptional = !isEmpty(patternInput[0]);
|
|
68
|
-
if (isOptional && (length(others) === 1)) {
|
|
69
|
-
return new FSharpType(2, [transformType(head(others))]);
|
|
70
211
|
}
|
|
71
|
-
|
|
72
|
-
|
|
212
|
+
case 13: {
|
|
213
|
+
const typeReference = glueType.fields[0];
|
|
214
|
+
return new FSharpType(10, [new FSharpTypeReference(mapTypeNameToFableCoreAwareName(typeReference.Name), typeReference.FullName, map((glueType_3) => transformType(context, glueType_3), typeReference.TypeArguments), new FSharpType(7, [new FSharpPrimitive(0, [])]))]);
|
|
73
215
|
}
|
|
216
|
+
case 15:
|
|
217
|
+
return new FSharpType(13, [transformType(context, glueType.fields[0])]);
|
|
218
|
+
case 12: {
|
|
219
|
+
const classDeclaration = glueType.fields[0];
|
|
220
|
+
return new FSharpType(10, [new FSharpTypeReference(classDeclaration.Name, classDeclaration.Name, empty(), new FSharpType(9, []))]);
|
|
221
|
+
}
|
|
222
|
+
case 17:
|
|
223
|
+
return new FSharpType(12, [glueType.fields[0]]);
|
|
224
|
+
case 16: {
|
|
225
|
+
const functionTypeInfo = glueType.fields[0];
|
|
226
|
+
return new FSharpType(15, [new FSharpFunctionType(map((parameter) => transformParameter(context, parameter), functionTypeInfo.Parameters), empty(), transformType(context, functionTypeInfo.Type))]);
|
|
227
|
+
}
|
|
228
|
+
case 1:
|
|
229
|
+
return new FSharpType(4, [transformInterface(context, glueType.fields[0])]);
|
|
230
|
+
case 21: {
|
|
231
|
+
const typeLiteralParameters = sortBy((_arg) => _arg.IsOptional, map((parameter_1) => {
|
|
232
|
+
const matchValue = parameter_1.Type;
|
|
233
|
+
if (matchValue.tag === 2) {
|
|
234
|
+
return new FSharpParameter(parameter_1.Attributes, parameter_1.Name, true, matchValue.fields[0]);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
return parameter_1;
|
|
238
|
+
}
|
|
239
|
+
}, TransformMembers_toFSharpParameters(context, glueType.fields[0].Members)), {
|
|
240
|
+
Compare: comparePrimitives,
|
|
241
|
+
});
|
|
242
|
+
const explicitFields = map((parameter_2) => (new FSharpExplicitField(parameter_2.Name, parameter_2.IsOptional ? (new FSharpType(2, [parameter_2.Type])) : parameter_2.Type)), typeLiteralParameters);
|
|
243
|
+
TransformContext__ExposeType_Z1D58A540(context, new FSharpType(16, [new FSharpClass(ofArray([new FSharpAttribute(15, []), new FSharpAttribute(7, [])]), TransformContext__get_CurrentScopeName(context), empty(), new FSharpConstructor(typeLiteralParameters, ofArray([new FSharpAttribute(16, []), new FSharpAttribute(2, [])]), new FSharpAccessibility(0, [])), empty(), explicitFields)]));
|
|
244
|
+
return new FSharpType(10, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), new FSharpType(9, []))]);
|
|
245
|
+
}
|
|
246
|
+
case 24: {
|
|
247
|
+
context_mut = context;
|
|
248
|
+
glueType_mut = glueType.fields[0];
|
|
249
|
+
continue transformType;
|
|
250
|
+
}
|
|
251
|
+
case 2: {
|
|
252
|
+
context_mut = context;
|
|
253
|
+
glueType_mut = glueType.fields[0].Type;
|
|
254
|
+
continue transformType;
|
|
255
|
+
}
|
|
256
|
+
case 11:
|
|
257
|
+
case 10:
|
|
258
|
+
case 8:
|
|
259
|
+
case 4:
|
|
260
|
+
case 5:
|
|
261
|
+
case 9:
|
|
262
|
+
case 0:
|
|
263
|
+
case 14:
|
|
264
|
+
case 20:
|
|
265
|
+
case 6: {
|
|
266
|
+
error(toText(interpolate("Could not transform type: %A%P()", [glueType])));
|
|
267
|
+
return new FSharpType(9, []);
|
|
268
|
+
}
|
|
269
|
+
default:
|
|
270
|
+
return new FSharpType(17, []);
|
|
74
271
|
}
|
|
75
|
-
|
|
76
|
-
const typeReference = glueType.fields[0];
|
|
77
|
-
return new FSharpType(10, [new FSharpTypeReference(mapDateToDateTime(typeReference.Name), typeReference.FullName, map(transformType, typeReference.TypeArguments))]);
|
|
78
|
-
}
|
|
79
|
-
case 15:
|
|
80
|
-
return new FSharpType(12, [transformType(glueType.fields[0])]);
|
|
81
|
-
case 12: {
|
|
82
|
-
const classDeclaration = glueType.fields[0];
|
|
83
|
-
return new FSharpType(10, [new FSharpTypeReference(classDeclaration.Name, classDeclaration.Name, empty())]);
|
|
84
|
-
}
|
|
85
|
-
case 17:
|
|
86
|
-
return new FSharpType(11, [glueType.fields[0]]);
|
|
87
|
-
case 11:
|
|
88
|
-
case 10:
|
|
89
|
-
case 8:
|
|
90
|
-
case 1:
|
|
91
|
-
case 4:
|
|
92
|
-
case 5:
|
|
93
|
-
case 2:
|
|
94
|
-
case 9:
|
|
95
|
-
case 0:
|
|
96
|
-
case 16:
|
|
97
|
-
case 14:
|
|
98
|
-
case 6: {
|
|
99
|
-
toConsole(printf("Could not transform type: %A"))(glueType);
|
|
100
|
-
return new FSharpType(9, []);
|
|
101
|
-
}
|
|
102
|
-
default:
|
|
103
|
-
return new FSharpType(7, [transformPrimitive(glueType.fields[0])]);
|
|
272
|
+
break;
|
|
104
273
|
}
|
|
105
274
|
}
|
|
106
275
|
|
|
107
|
-
function transformExports(isTopLevel, exports) {
|
|
108
|
-
|
|
109
|
-
|
|
276
|
+
function transformExports(context, isTopLevel, exports) {
|
|
277
|
+
const context_1 = TransformContext__PushScope_Z721C83C5(context, "Exports");
|
|
278
|
+
return new FSharpType(4, [new FSharpInterface(singleton(new FSharpAttribute(6, [])), "Exports", "Exports", empty(), collect_1((_arg) => {
|
|
279
|
+
let Attributes_1, Parameters_1;
|
|
110
280
|
switch (_arg.tag) {
|
|
111
281
|
case 2: {
|
|
112
282
|
const info = _arg.fields[0];
|
|
113
|
-
|
|
283
|
+
const patternInput = sanitizeNameAndPushScope(info.Name, context_1);
|
|
284
|
+
return singleton(new FSharpMember(1, [new FSharpMemberInfo(singleton(new FSharpAttribute(3, [info.Name, "module"])), patternInput[0], info.Name, empty(), empty(), transformType(patternInput[1], info.Type), false, true, void 0, new FSharpAccessibility(0, []), empty())]));
|
|
114
285
|
}
|
|
115
286
|
case 6: {
|
|
116
287
|
const info_1 = _arg.fields[0];
|
|
117
|
-
|
|
288
|
+
const patternInput_1 = sanitizeNameAndPushScope(info_1.Name, context_1);
|
|
289
|
+
const context_3 = patternInput_1[1];
|
|
290
|
+
const xmlDocInfo = transformComment(info_1.Documentation);
|
|
291
|
+
return singleton(new FSharpMember(0, [(Attributes_1 = toList(delay(() => append(singleton_1(new FSharpAttribute(3, [info_1.Name, "module"])), delay(() => xmlDocInfo.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, true, void 0, new FSharpAccessibility(0, []), xmlDocInfo.Others)))]));
|
|
118
292
|
}
|
|
119
293
|
case 12: {
|
|
120
294
|
const info_2 = _arg.fields[0];
|
|
295
|
+
const patternInput_2 = sanitizeNameAndPushScope(info_2.Name, context_1);
|
|
296
|
+
const context_4 = patternInput_2[1];
|
|
121
297
|
return map((_arg_1) => {
|
|
122
|
-
let Attributes_2,
|
|
123
|
-
return new FSharpMember(0, [(Attributes_2 = toList(delay(() => (isTopLevel ? append(singleton_1(new FSharpAttribute(
|
|
298
|
+
let Attributes_2, Parameters_2;
|
|
299
|
+
return new FSharpMember(0, [(Attributes_2 = toList(delay(() => (isTopLevel ? append(singleton_1(new FSharpAttribute(3, [info_2.Name, "module"])), delay(() => singleton_1(new FSharpAttribute(12, [])))) : singleton_1(new FSharpAttribute(13, [info_2.Name]))))), (Parameters_2 = map((parameter_1) => transformParameter(context_4, parameter_1), _arg_1.fields[0]), new FSharpMemberInfo(Attributes_2, patternInput_2[0], info_2.Name, transformTypeParameters(context_4, info_2.TypeParameters), Parameters_2, new FSharpType(6, [new FSharpMapped(sanitizeName(info_2.Name), empty())]), false, true, void 0, new FSharpAccessibility(0, []), empty())))]);
|
|
124
300
|
}, info_2.Constructors);
|
|
125
301
|
}
|
|
126
302
|
case 11: {
|
|
127
303
|
const moduleDeclaration = _arg.fields[0];
|
|
128
304
|
return choose((typ) => {
|
|
129
305
|
if (typ.tag === 12) {
|
|
130
|
-
return new FSharpMember(1, [new FSharpMemberInfo(singleton(new FSharpAttribute(
|
|
306
|
+
return new FSharpMember(1, [new FSharpMemberInfo(singleton(new FSharpAttribute(4, ["module"])), moduleDeclaration.Name + "_", moduleDeclaration.Name, empty(), empty(), new FSharpType(6, [new FSharpMapped(`${moduleDeclaration.Name}.Exports`, empty())]), false, true, new FSharpAccessor(0, []), new FSharpAccessibility(0, []), empty())]);
|
|
131
307
|
}
|
|
132
308
|
else {
|
|
133
309
|
return void 0;
|
|
134
310
|
}
|
|
135
311
|
}, moduleDeclaration.Types);
|
|
136
312
|
}
|
|
313
|
+
case 24: {
|
|
314
|
+
const glueType = _arg.fields[0];
|
|
315
|
+
const patternInput_3 = sanitizeNameAndPushScope(GlueType__get_Name(glueType), context_1);
|
|
316
|
+
return singleton(new FSharpMember(1, [new FSharpMemberInfo(singleton(new FSharpAttribute(5, ["module"])), patternInput_3[0], GlueType__get_Name(glueType), empty(), empty(), transformType(patternInput_3[1], glueType), false, true, void 0, new FSharpAccessibility(0, []), empty())]));
|
|
317
|
+
}
|
|
137
318
|
default:
|
|
138
319
|
return toFail(printf("Could not generate exportMembers for: %A"))(_arg);
|
|
139
320
|
}
|
|
140
321
|
}, exports))]);
|
|
141
322
|
}
|
|
142
323
|
|
|
143
|
-
function transformParameter(parameter) {
|
|
144
|
-
|
|
324
|
+
function transformParameter(context, parameter) {
|
|
325
|
+
let typ;
|
|
326
|
+
const computedType = transformType(TransformContext__PushScope_Z721C83C5(context, parameter.Name), parameter.Type);
|
|
327
|
+
typ = (parameter.IsSpread ? ((computedType.tag === 13) ? computedType.fields[0] : computedType) : computedType);
|
|
328
|
+
return new FSharpParameter(toList(delay(() => (parameter.IsSpread ? singleton_1(new FSharpAttribute(17, [])) : empty_1()))), sanitizeName(parameter.Name), parameter.IsOptional, typ);
|
|
145
329
|
}
|
|
146
330
|
|
|
147
331
|
function transformAccessor(accessor) {
|
|
@@ -155,33 +339,99 @@ function transformAccessor(accessor) {
|
|
|
155
339
|
}
|
|
156
340
|
}
|
|
157
341
|
|
|
158
|
-
function
|
|
159
|
-
return
|
|
342
|
+
function TransformMembers_toFSharpMember(context, members) {
|
|
343
|
+
return choose((_arg) => {
|
|
160
344
|
switch (_arg.tag) {
|
|
161
345
|
case 2: {
|
|
162
346
|
const callSignatureInfo = _arg.fields[0];
|
|
163
|
-
|
|
347
|
+
const patternInput_1 = sanitizeNameAndPushScope("Invoke", context);
|
|
348
|
+
const context_2 = patternInput_1[1];
|
|
349
|
+
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())]);
|
|
164
350
|
}
|
|
165
351
|
case 1: {
|
|
166
352
|
const propertyInfo = _arg.fields[0];
|
|
167
|
-
|
|
353
|
+
const patternInput_2 = sanitizeNameAndPushScope(propertyInfo.Name, context);
|
|
354
|
+
const xmlDocInfo = transformComment(propertyInfo.Documentation);
|
|
355
|
+
if (propertyInfo.IsPrivate && !propertyInfo.IsStatic) {
|
|
356
|
+
return void 0;
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
return new FSharpMember(1, [new FSharpMemberInfo(toList(delay(() => xmlDocInfo.ObsoleteAttributes)), patternInput_2[0], propertyInfo.Name, empty(), empty(), transformType(patternInput_2[1], propertyInfo.Type), propertyInfo.IsOptional, propertyInfo.IsStatic, transformAccessor(propertyInfo.Accessor), propertyInfo.IsPrivate ? (new FSharpAccessibility(1, [])) : (new FSharpAccessibility(0, [])), xmlDocInfo.Others)]);
|
|
360
|
+
}
|
|
168
361
|
}
|
|
169
362
|
case 3: {
|
|
170
363
|
const indexSignature = _arg.fields[0];
|
|
171
|
-
|
|
364
|
+
const patternInput_3 = sanitizeNameAndPushScope("Item", context);
|
|
365
|
+
const context_4 = patternInput_3[1];
|
|
366
|
+
return new FSharpMember(1, [new FSharpMemberInfo(singleton(new FSharpAttribute(14, [])), patternInput_3[0], "Item", empty(), map((parameter_3) => transformParameter(context_4, parameter_3), indexSignature.Parameters), transformType(context_4, indexSignature.Type), false, false, new FSharpAccessor(2, []), new FSharpAccessibility(0, []), empty())]);
|
|
367
|
+
}
|
|
368
|
+
case 4: {
|
|
369
|
+
const methodSignature = _arg.fields[0];
|
|
370
|
+
const patternInput_4 = sanitizeNameAndPushScope(methodSignature.Name, context);
|
|
371
|
+
const context_5 = patternInput_4[1];
|
|
372
|
+
return new FSharpMember(0, [new FSharpMemberInfo(empty(), patternInput_4[0], methodSignature.Name, empty(), map((parameter_4) => transformParameter(context_5, parameter_4), methodSignature.Parameters), transformType(context_5, methodSignature.Type), false, false, void 0, new FSharpAccessibility(0, []), empty())]);
|
|
373
|
+
}
|
|
374
|
+
case 5: {
|
|
375
|
+
const constructSignature = _arg.fields[0];
|
|
376
|
+
const patternInput_5 = sanitizeNameAndPushScope("Create", context);
|
|
377
|
+
const context_6 = patternInput_5[1];
|
|
378
|
+
return new FSharpMember(0, [new FSharpMemberInfo(singleton(new FSharpAttribute(12, [])), patternInput_5[0], "Create", empty(), map((parameter_5) => transformParameter(context_6, parameter_5), constructSignature.Parameters), transformType(context_6, constructSignature.Type), false, false, void 0, new FSharpAccessibility(0, []), empty())]);
|
|
172
379
|
}
|
|
173
380
|
default: {
|
|
174
381
|
const methodInfo = _arg.fields[0];
|
|
175
|
-
|
|
382
|
+
const patternInput = sanitizeNameAndPushScope(methodInfo.Name, context);
|
|
383
|
+
const name = patternInput[0];
|
|
384
|
+
const context_1 = patternInput[1];
|
|
385
|
+
if (methodInfo.IsStatic) {
|
|
386
|
+
return new FSharpMember(2, [new FSharpStaticMemberInfo(empty(), name, methodInfo.Name, empty(), map((parameter) => transformParameter(context_1, parameter), methodInfo.Parameters), transformType(context_1, methodInfo.Type), methodInfo.IsOptional, void 0, new FSharpAccessibility(0, []))]);
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
return new FSharpMember(0, [new FSharpMemberInfo(empty(), name, 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, []), empty())]);
|
|
390
|
+
}
|
|
176
391
|
}
|
|
177
392
|
}
|
|
178
393
|
}, members);
|
|
179
394
|
}
|
|
180
395
|
|
|
181
|
-
function
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
396
|
+
function TransformMembers_toFSharpParameters(context, members) {
|
|
397
|
+
return map((_arg) => {
|
|
398
|
+
switch (_arg.tag) {
|
|
399
|
+
case 1: {
|
|
400
|
+
const propertyInfo = _arg.fields[0];
|
|
401
|
+
const patternInput_1 = sanitizeNameAndPushScope(propertyInfo.Name, context);
|
|
402
|
+
return new FSharpParameter(empty(), patternInput_1[0], propertyInfo.IsOptional, transformType(patternInput_1[1], propertyInfo.Type));
|
|
403
|
+
}
|
|
404
|
+
case 3: {
|
|
405
|
+
const patternInput_2 = sanitizeNameAndPushScope("Item", context);
|
|
406
|
+
return new FSharpParameter(empty(), patternInput_2[0], false, transformType(patternInput_2[1], _arg.fields[0].Type));
|
|
407
|
+
}
|
|
408
|
+
case 4: {
|
|
409
|
+
const methodSignature = _arg.fields[0];
|
|
410
|
+
const patternInput_3 = sanitizeNameAndPushScope(methodSignature.Name, context);
|
|
411
|
+
return new FSharpParameter(empty(), patternInput_3[0], false, transformType(patternInput_3[1], methodSignature.Type));
|
|
412
|
+
}
|
|
413
|
+
case 2: {
|
|
414
|
+
const patternInput_4 = sanitizeNameAndPushScope("Invoke", context);
|
|
415
|
+
return new FSharpParameter(empty(), patternInput_4[0], false, transformType(patternInput_4[1], _arg.fields[0].Type));
|
|
416
|
+
}
|
|
417
|
+
case 5: {
|
|
418
|
+
const patternInput_5 = sanitizeNameAndPushScope("Create", context);
|
|
419
|
+
return new FSharpParameter(empty(), patternInput_5[0], false, transformType(patternInput_5[1], _arg.fields[0].Type));
|
|
420
|
+
}
|
|
421
|
+
default: {
|
|
422
|
+
const methodInfo = _arg.fields[0];
|
|
423
|
+
const patternInput = sanitizeNameAndPushScope(methodInfo.Name, context);
|
|
424
|
+
return new FSharpParameter(empty(), patternInput[0], methodInfo.IsOptional, transformType(patternInput[1], methodInfo.Type));
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}, members);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function transformInterface(context, info) {
|
|
431
|
+
const patternInput = sanitizeNameAndPushScope(info.Name, context);
|
|
432
|
+
const context_1 = patternInput[1];
|
|
433
|
+
const Members = TransformMembers_toFSharpMember(context_1, info.Members);
|
|
434
|
+
return new FSharpInterface(ofArray([new FSharpAttribute(7, []), new FSharpAttribute(18, [])]), patternInput[0], info.Name, transformTypeParameters(context_1, info.TypeParameters), Members);
|
|
185
435
|
}
|
|
186
436
|
|
|
187
437
|
function transformEnum(glueEnum) {
|
|
@@ -209,7 +459,7 @@ function transformEnum(glueEnum) {
|
|
|
209
459
|
throw new Error(`Empty enum: ${glueEnum.Name}`);
|
|
210
460
|
}
|
|
211
461
|
else {
|
|
212
|
-
return new FSharpType(1, [new FSharpUnion(ofArray([new FSharpAttribute(
|
|
462
|
+
return new FSharpType(1, [new FSharpUnion(ofArray([new FSharpAttribute(11, []), new FSharpAttribute(9, [0])]), sanitizeName(glueEnum.Name), List_distinct(map((glueMember_1) => {
|
|
213
463
|
let caseValue;
|
|
214
464
|
const matchValue_3 = glueMember_1.Value;
|
|
215
465
|
if (matchValue_3.tag === 0) {
|
|
@@ -218,9 +468,9 @@ function transformEnum(glueEnum) {
|
|
|
218
468
|
else {
|
|
219
469
|
throw new Error("Should not happen");
|
|
220
470
|
}
|
|
221
|
-
const caseName =
|
|
471
|
+
const caseName = sanitizeName(glueMember_1.Name);
|
|
222
472
|
const differentName = nameNotEqualsDefaultFableValue(caseName, caseValue);
|
|
223
|
-
return new FSharpUnionCase(toList(delay(() => (differentName ? singleton_1(new FSharpAttribute(
|
|
473
|
+
return new FSharpUnionCase(toList(delay(() => (differentName ? singleton_1(new FSharpAttribute(10, [removeSurroundingQuotes(caseValue)])) : empty_1()))), sanitizeName(caseName));
|
|
224
474
|
}, stringValues), {
|
|
225
475
|
Equals: equals,
|
|
226
476
|
GetHashCode: safeHash,
|
|
@@ -228,7 +478,7 @@ function transformEnum(glueEnum) {
|
|
|
228
478
|
}
|
|
229
479
|
}
|
|
230
480
|
else if (isEmpty(stringValues)) {
|
|
231
|
-
return new FSharpType(0, [new FSharpEnum(
|
|
481
|
+
return new FSharpType(0, [new FSharpEnum(sanitizeName(glueEnum.Name), List_distinct(map((glueMember) => (new FSharpEnumCase(sanitizeName(glueMember.Name), transformLiteral(glueMember.Value))), integralValues), {
|
|
232
482
|
Equals: equals,
|
|
233
483
|
GetHashCode: safeHash,
|
|
234
484
|
}))]);
|
|
@@ -247,10 +497,16 @@ export function TypeAliasDeclaration_transformKeyOf(aliasName, glueType) {
|
|
|
247
497
|
let matchResult, caseName;
|
|
248
498
|
switch (m.tag) {
|
|
249
499
|
case 2:
|
|
500
|
+
case 5:
|
|
250
501
|
case 3: {
|
|
251
502
|
matchResult = 1;
|
|
252
503
|
break;
|
|
253
504
|
}
|
|
505
|
+
case 4: {
|
|
506
|
+
matchResult = 0;
|
|
507
|
+
caseName = m.fields[0].Name;
|
|
508
|
+
break;
|
|
509
|
+
}
|
|
254
510
|
case 1: {
|
|
255
511
|
matchResult = 0;
|
|
256
512
|
caseName = m.fields[0].Name;
|
|
@@ -264,24 +520,169 @@ export function TypeAliasDeclaration_transformKeyOf(aliasName, glueType) {
|
|
|
264
520
|
switch (matchResult) {
|
|
265
521
|
case 0: {
|
|
266
522
|
const caseValue = removeDoubleQuote(removeSingleQuote(caseName));
|
|
267
|
-
return (differentName = nameNotEqualsDefaultFableValue(caseName, caseValue), new FSharpUnionCase(toList(delay(() => (differentName ? singleton_1(new FSharpAttribute(
|
|
523
|
+
return (differentName = nameNotEqualsDefaultFableValue(caseName, caseValue), new FSharpUnionCase(toList(delay(() => (differentName ? singleton_1(new FSharpAttribute(10, [removeSurroundingQuotes(caseName)])) : empty_1()))), sanitizeName(caseValue)));
|
|
268
524
|
}
|
|
269
525
|
default:
|
|
270
526
|
return void 0;
|
|
271
527
|
}
|
|
272
528
|
}, glueType.fields[0].Members) : empty();
|
|
273
|
-
return new FSharpType(1, [new FSharpUnion(ofArray([new FSharpAttribute(
|
|
529
|
+
return new FSharpType(1, [new FSharpUnion(ofArray([new FSharpAttribute(11, []), new FSharpAttribute(9, [0])]), sanitizeName(aliasName), cases, false)]);
|
|
274
530
|
}
|
|
275
531
|
|
|
276
|
-
function
|
|
277
|
-
|
|
532
|
+
export function TypeAliasDeclaration_transformLiteral(typeAliasName, literalInfo) {
|
|
533
|
+
const makeTypeAlias = (primitiveType) => (new FSharpType(8, [new FSharpTypeAlias(typeAliasName, new FSharpType(7, [primitiveType]), empty())]));
|
|
534
|
+
switch (literalInfo.tag) {
|
|
535
|
+
case 1:
|
|
536
|
+
return makeTypeAlias(new FSharpPrimitive(1, []));
|
|
537
|
+
case 2:
|
|
538
|
+
return makeTypeAlias(new FSharpPrimitive(2, []));
|
|
539
|
+
case 3:
|
|
540
|
+
return makeTypeAlias(new FSharpPrimitive(3, []));
|
|
541
|
+
case 4:
|
|
542
|
+
return makeTypeAlias(new FSharpPrimitive(6, []));
|
|
543
|
+
default:
|
|
544
|
+
return new FSharpType(1, [new FSharpUnion(ofArray([new FSharpAttribute(11, []), new FSharpAttribute(9, [0])]), typeAliasName, singleton(new FSharpUnionCase(empty(), sanitizeName(removeDoubleQuote(removeSingleQuote(literalInfo.fields[0]))))), false)]);
|
|
545
|
+
}
|
|
278
546
|
}
|
|
279
547
|
|
|
280
|
-
function
|
|
548
|
+
function transformTypeParameters(context, typeParameters) {
|
|
549
|
+
return map((typeParameter) => FSharpTypeParameter_Create_Z6CFD3565(typeParameter.Name, unwrap(map_1((glueType) => transformType(context, glueType), typeParameter.Constraint)), unwrap(map_1((glueType_1) => transformType(context, glueType_1), typeParameter.Default))), typeParameters);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
|
|
553
|
+
let glueType_2;
|
|
554
|
+
const patternInput = sanitizeNameAndPushScope(glueTypeAliasDeclaration.Name, context);
|
|
555
|
+
const typeAliasName = patternInput[0];
|
|
556
|
+
const context_1 = patternInput[1];
|
|
281
557
|
const matchValue = glueTypeAliasDeclaration.Type;
|
|
282
558
|
switch (matchValue.tag) {
|
|
283
|
-
case
|
|
284
|
-
|
|
559
|
+
case 9:
|
|
560
|
+
return TypeAliasDeclaration_transformKeyOf(glueTypeAliasDeclaration.Name, matchValue.fields[0]);
|
|
561
|
+
case 10: {
|
|
562
|
+
const glueType_1 = matchValue.fields[0];
|
|
563
|
+
return new FSharpType(8, [new FSharpTypeAlias(typeAliasName, (glueType_1.tag === 9) ? ((glueType_2 = glueType_1.fields[0], (glueType_2.tag === 1) ? transformType(context_1, new GlueType(7, [new GlueTypeUnion(List_distinct(collect_1((m) => {
|
|
564
|
+
let typ;
|
|
565
|
+
switch (m.tag) {
|
|
566
|
+
case 1: {
|
|
567
|
+
typ = m.fields[0].Type;
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
case 2: {
|
|
571
|
+
typ = m.fields[0].Type;
|
|
572
|
+
break;
|
|
573
|
+
}
|
|
574
|
+
case 5: {
|
|
575
|
+
typ = m.fields[0].Type;
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
case 4: {
|
|
579
|
+
typ = m.fields[0].Type;
|
|
580
|
+
break;
|
|
581
|
+
}
|
|
582
|
+
case 3: {
|
|
583
|
+
typ = m.fields[0].Type;
|
|
584
|
+
break;
|
|
585
|
+
}
|
|
586
|
+
default:
|
|
587
|
+
typ = m.fields[0].Type;
|
|
588
|
+
}
|
|
589
|
+
if (typ.tag === 7) {
|
|
590
|
+
return typ.fields[0].fields[0];
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
return singleton(typ);
|
|
594
|
+
}
|
|
595
|
+
}, glueType_2.fields[0].Members), {
|
|
596
|
+
Equals: equals,
|
|
597
|
+
GetHashCode: safeHash,
|
|
598
|
+
}))])) : (new FSharpType(9, [])))) : (new FSharpType(9, [])), transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]);
|
|
599
|
+
}
|
|
600
|
+
case 8:
|
|
601
|
+
return TypeAliasDeclaration_transformLiteral(typeAliasName, matchValue.fields[0]);
|
|
602
|
+
case 3:
|
|
603
|
+
return new FSharpType(8, [new FSharpTypeAlias(typeAliasName, new FSharpType(7, [transformPrimitive(matchValue.fields[0])]), transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]);
|
|
604
|
+
case 13: {
|
|
605
|
+
const typeReference = matchValue.fields[0];
|
|
606
|
+
const context_2 = TransformContext__PushScope_Z721C83C5(context_1, typeReference.Name);
|
|
607
|
+
const handleDefaultCase = () => (new FSharpType(8, [new FSharpTypeAlias(typeAliasName, transformType(context_2, new GlueType(13, [typeReference])), transformTypeParameters(context_2, glueTypeAliasDeclaration.TypeParameters))]));
|
|
608
|
+
const matchValue_2 = typeReference.TypeArguments;
|
|
609
|
+
let matchResult_1, head;
|
|
610
|
+
if (!isEmpty(matchValue_2)) {
|
|
611
|
+
if (isEmpty(tail(matchValue_2))) {
|
|
612
|
+
matchResult_1 = 0;
|
|
613
|
+
head = head_1(matchValue_2);
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
matchResult_1 = 1;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
else {
|
|
620
|
+
matchResult_1 = 1;
|
|
621
|
+
}
|
|
622
|
+
switch (matchResult_1) {
|
|
623
|
+
case 0:
|
|
624
|
+
if (head.tag === 20) {
|
|
625
|
+
const makeInterfaceTyp = (name) => (new FSharpInterface(ofArray([new FSharpAttribute(7, []), new FSharpAttribute(18, [])]), name, glueTypeAliasDeclaration.Name, empty(), TransformMembers_toFSharpMember(context_2, head.fields[0])));
|
|
626
|
+
const exposedType = makeInterfaceTyp("ReturnType");
|
|
627
|
+
const typeArgument = makeInterfaceTyp(TransformContext__get_FullName(context_2) + ".ReturnType");
|
|
628
|
+
TransformContext__ExposeType_Z1D58A540(TransformContext__PushScope_Z721C83C5(context_2, typeReference.Name), new FSharpType(4, [exposedType]));
|
|
629
|
+
return new FSharpType(8, [new FSharpTypeAlias(typeAliasName, new FSharpType(10, [new FSharpTypeReference(typeReference.Name, typeReference.FullName, singleton(new FSharpType(4, [typeArgument])), new FSharpType(9, []))]), empty())]);
|
|
630
|
+
}
|
|
631
|
+
else {
|
|
632
|
+
return handleDefaultCase();
|
|
633
|
+
}
|
|
634
|
+
default:
|
|
635
|
+
return handleDefaultCase();
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
case 15:
|
|
639
|
+
return new FSharpType(8, [new FSharpTypeAlias(typeAliasName, transformType(context_1, new GlueType(15, [matchValue.fields[0]])), transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]);
|
|
640
|
+
case 14: {
|
|
641
|
+
const originalInterface = transformInterface(context_1, matchValue.fields[0]);
|
|
642
|
+
return new FSharpType(4, [new FSharpInterface(originalInterface.Attributes, typeAliasName, originalInterface.OriginalName, originalInterface.TypeParameters, map((m_1) => {
|
|
643
|
+
switch (m_1.tag) {
|
|
644
|
+
case 1: {
|
|
645
|
+
const property = m_1.fields[0];
|
|
646
|
+
return new FSharpMember(1, [new FSharpMemberInfo(property.Attributes, property.Name, property.OriginalName, property.TypeParameters, property.Parameters, property.Type, true, property.IsStatic, property.Accessor, property.Accessibility, property.XmlDoc)]);
|
|
647
|
+
}
|
|
648
|
+
case 2: {
|
|
649
|
+
const staticMember = m_1.fields[0];
|
|
650
|
+
return new FSharpMember(2, [new FSharpStaticMemberInfo(staticMember.Attributes, staticMember.Name, staticMember.OriginalName, staticMember.TypeParameters, staticMember.Parameters, staticMember.Type, true, staticMember.Accessor, staticMember.Accessibility)]);
|
|
651
|
+
}
|
|
652
|
+
default: {
|
|
653
|
+
const method = m_1.fields[0];
|
|
654
|
+
return new FSharpMember(0, [new FSharpMemberInfo(method.Attributes, method.Name, method.OriginalName, method.TypeParameters, method.Parameters, method.Type, true, method.IsStatic, method.Accessor, method.Accessibility, method.XmlDoc)]);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}, originalInterface.Members))]);
|
|
658
|
+
}
|
|
659
|
+
case 16: {
|
|
660
|
+
const functionType = matchValue.fields[0];
|
|
661
|
+
return new FSharpType(4, [new FSharpInterface(ofArray([new FSharpAttribute(7, []), new FSharpAttribute(18, [])]), typeAliasName, glueTypeAliasDeclaration.Name, transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters), singleton(new FSharpMember(0, [new FSharpMemberInfo(singleton(new FSharpAttribute(1, [])), "Invoke", "Invoke", empty(), map((parameter) => transformParameter(context_1, parameter), functionType.Parameters), transformType(context_1, functionType.Type), false, false, void 0, new FSharpAccessibility(0, []), empty())])))]);
|
|
662
|
+
}
|
|
663
|
+
case 19:
|
|
664
|
+
return new FSharpType(8, [new FSharpTypeAlias(typeAliasName, transformTupleType(context_1, matchValue.fields[0]), transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]);
|
|
665
|
+
case 20:
|
|
666
|
+
return new FSharpType(4, [new FSharpInterface(ofArray([new FSharpAttribute(7, []), new FSharpAttribute(18, [])]), typeAliasName, glueTypeAliasDeclaration.Name, transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters), TransformMembers_toFSharpMember(context_1, matchValue.fields[0]))]);
|
|
667
|
+
case 21:
|
|
668
|
+
return new FSharpType(4, [new FSharpInterface(ofArray([new FSharpAttribute(7, []), new FSharpAttribute(18, [])]), typeAliasName, glueTypeAliasDeclaration.Name, transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters), TransformMembers_toFSharpMember(context_1, matchValue.fields[0].Members))]);
|
|
669
|
+
case 23:
|
|
670
|
+
return new FSharpType(8, [new FSharpTypeAlias(typeAliasName, new FSharpType(17, []), transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]);
|
|
671
|
+
case 12:
|
|
672
|
+
case 4:
|
|
673
|
+
case 1:
|
|
674
|
+
case 11:
|
|
675
|
+
case 5:
|
|
676
|
+
case 17:
|
|
677
|
+
case 0:
|
|
678
|
+
case 6:
|
|
679
|
+
case 18:
|
|
680
|
+
case 2:
|
|
681
|
+
case 24:
|
|
682
|
+
case 22:
|
|
683
|
+
return new FSharpType(9, []);
|
|
684
|
+
default: {
|
|
685
|
+
const flattenCases = (cases_1) => collect_1((_arg) => {
|
|
285
686
|
switch (_arg.tag) {
|
|
286
687
|
case 8:
|
|
287
688
|
return singleton(_arg);
|
|
@@ -293,7 +694,7 @@ function transformTypeAliasDeclaration(glueTypeAliasDeclaration) {
|
|
|
293
694
|
return flattenCases(matchValue_1.fields[0].fields[0]);
|
|
294
695
|
}
|
|
295
696
|
else {
|
|
296
|
-
|
|
697
|
+
return empty();
|
|
297
698
|
}
|
|
298
699
|
}
|
|
299
700
|
default:
|
|
@@ -302,19 +703,19 @@ function transformTypeAliasDeclaration(glueTypeAliasDeclaration) {
|
|
|
302
703
|
}, cases_1);
|
|
303
704
|
const flattenedCases = flattenCases(matchValue.fields[0].fields[0]);
|
|
304
705
|
const isStringOnly = !isEmpty(flattenedCases) && forAll((_arg_1) => {
|
|
305
|
-
let
|
|
706
|
+
let matchResult_2;
|
|
306
707
|
if (_arg_1.tag === 8) {
|
|
307
708
|
if (_arg_1.fields[0].tag === 0) {
|
|
308
|
-
|
|
709
|
+
matchResult_2 = 0;
|
|
309
710
|
}
|
|
310
711
|
else {
|
|
311
|
-
|
|
712
|
+
matchResult_2 = 1;
|
|
312
713
|
}
|
|
313
714
|
}
|
|
314
715
|
else {
|
|
315
|
-
|
|
716
|
+
matchResult_2 = 1;
|
|
316
717
|
}
|
|
317
|
-
switch (
|
|
718
|
+
switch (matchResult_2) {
|
|
318
719
|
case 0:
|
|
319
720
|
return true;
|
|
320
721
|
default:
|
|
@@ -322,19 +723,19 @@ function transformTypeAliasDeclaration(glueTypeAliasDeclaration) {
|
|
|
322
723
|
}
|
|
323
724
|
}, flattenedCases);
|
|
324
725
|
const isNumericOnly = !isEmpty(flattenedCases) && forAll((_arg_2) => {
|
|
325
|
-
let
|
|
726
|
+
let matchResult_3;
|
|
326
727
|
if (_arg_2.tag === 8) {
|
|
327
728
|
if (_arg_2.fields[0].tag === 1) {
|
|
328
|
-
|
|
729
|
+
matchResult_3 = 0;
|
|
329
730
|
}
|
|
330
731
|
else {
|
|
331
|
-
|
|
732
|
+
matchResult_3 = 1;
|
|
332
733
|
}
|
|
333
734
|
}
|
|
334
735
|
else {
|
|
335
|
-
|
|
736
|
+
matchResult_3 = 1;
|
|
336
737
|
}
|
|
337
|
-
switch (
|
|
738
|
+
switch (matchResult_3) {
|
|
338
739
|
case 0:
|
|
339
740
|
return true;
|
|
340
741
|
default:
|
|
@@ -342,48 +743,47 @@ function transformTypeAliasDeclaration(glueTypeAliasDeclaration) {
|
|
|
342
743
|
}
|
|
343
744
|
}, flattenedCases);
|
|
344
745
|
if (isStringOnly) {
|
|
345
|
-
|
|
346
|
-
let
|
|
746
|
+
return new FSharpType(1, [new FSharpUnion(ofArray([new FSharpAttribute(11, []), new FSharpAttribute(9, [0])]), typeAliasName, List_distinct(map((value) => {
|
|
747
|
+
let matchResult_4, value_1;
|
|
347
748
|
if (value.tag === 8) {
|
|
348
749
|
if (value.fields[0].tag === 0) {
|
|
349
|
-
|
|
750
|
+
matchResult_4 = 0;
|
|
350
751
|
value_1 = value.fields[0].fields[0];
|
|
351
752
|
}
|
|
352
753
|
else {
|
|
353
|
-
|
|
754
|
+
matchResult_4 = 1;
|
|
354
755
|
}
|
|
355
756
|
}
|
|
356
757
|
else {
|
|
357
|
-
|
|
758
|
+
matchResult_4 = 1;
|
|
358
759
|
}
|
|
359
|
-
switch (
|
|
760
|
+
switch (matchResult_4) {
|
|
360
761
|
case 0:
|
|
361
|
-
return new FSharpUnionCase(empty(),
|
|
762
|
+
return new FSharpUnionCase(empty(), sanitizeName(removeDoubleQuote(removeSingleQuote(value_1))));
|
|
362
763
|
default:
|
|
363
764
|
throw new Error("Should not happen");
|
|
364
765
|
}
|
|
365
766
|
}, flattenedCases), {
|
|
366
767
|
Equals: equals,
|
|
367
768
|
GetHashCode: safeHash,
|
|
368
|
-
});
|
|
369
|
-
return new FSharpType(1, [new FSharpUnion(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(6, [0])]), escapeName(glueTypeAliasDeclaration.Name), cases_4, false)]);
|
|
769
|
+
}), false)]);
|
|
370
770
|
}
|
|
371
771
|
else if (isNumericOnly) {
|
|
372
|
-
|
|
373
|
-
let
|
|
772
|
+
return new FSharpType(0, [new FSharpEnum(typeAliasName, List_distinct(map((value_2) => {
|
|
773
|
+
let matchResult_5, value_3;
|
|
374
774
|
if (value_2.tag === 8) {
|
|
375
775
|
if (value_2.fields[0].tag === 1) {
|
|
376
|
-
|
|
776
|
+
matchResult_5 = 0;
|
|
377
777
|
value_3 = value_2.fields[0].fields[0];
|
|
378
778
|
}
|
|
379
779
|
else {
|
|
380
|
-
|
|
780
|
+
matchResult_5 = 1;
|
|
381
781
|
}
|
|
382
782
|
}
|
|
383
783
|
else {
|
|
384
|
-
|
|
784
|
+
matchResult_5 = 1;
|
|
385
785
|
}
|
|
386
|
-
switch (
|
|
786
|
+
switch (matchResult_5) {
|
|
387
787
|
case 0:
|
|
388
788
|
return new FSharpEnumCase(int32ToString(value_3), new FSharpLiteral(1, [value_3]));
|
|
389
789
|
default:
|
|
@@ -392,104 +792,48 @@ function transformTypeAliasDeclaration(glueTypeAliasDeclaration) {
|
|
|
392
792
|
}, flattenedCases), {
|
|
393
793
|
Equals: equals,
|
|
394
794
|
GetHashCode: safeHash,
|
|
395
|
-
});
|
|
396
|
-
return new FSharpType(0, [new FSharpEnum(escapeName(glueTypeAliasDeclaration.Name), cases_5)]);
|
|
795
|
+
}))]);
|
|
397
796
|
}
|
|
398
797
|
else {
|
|
399
|
-
return new FSharpType(8, [new FSharpTypeAlias(
|
|
798
|
+
return new FSharpType(8, [new FSharpTypeAlias(typeAliasName, transformType(context_1, matchValue), transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters))]);
|
|
400
799
|
}
|
|
401
800
|
}
|
|
402
|
-
case 9:
|
|
403
|
-
return TypeAliasDeclaration_transformKeyOf(glueTypeAliasDeclaration.Name, matchValue.fields[0]);
|
|
404
|
-
case 10: {
|
|
405
|
-
const glueType_1 = matchValue.fields[0];
|
|
406
|
-
let typ_1;
|
|
407
|
-
if (glueType_1.tag === 9) {
|
|
408
|
-
const glueType_2 = glueType_1.fields[0];
|
|
409
|
-
typ_1 = ((glueType_2.tag === 1) ? transformType(new GlueType(7, [new GlueTypeUnion(List_distinct(collect((m) => {
|
|
410
|
-
let typ;
|
|
411
|
-
switch (m.tag) {
|
|
412
|
-
case 1: {
|
|
413
|
-
typ = m.fields[0].Type;
|
|
414
|
-
break;
|
|
415
|
-
}
|
|
416
|
-
case 2: {
|
|
417
|
-
typ = m.fields[0].Type;
|
|
418
|
-
break;
|
|
419
|
-
}
|
|
420
|
-
case 3: {
|
|
421
|
-
typ = m.fields[0].Type;
|
|
422
|
-
break;
|
|
423
|
-
}
|
|
424
|
-
default:
|
|
425
|
-
typ = m.fields[0].Type;
|
|
426
|
-
}
|
|
427
|
-
if (typ.tag === 7) {
|
|
428
|
-
return typ.fields[0].fields[0];
|
|
429
|
-
}
|
|
430
|
-
else {
|
|
431
|
-
return singleton(typ);
|
|
432
|
-
}
|
|
433
|
-
}, glueType_2.fields[0].Members), {
|
|
434
|
-
Equals: equals,
|
|
435
|
-
GetHashCode: safeHash,
|
|
436
|
-
}))])) : (new FSharpType(9, [])));
|
|
437
|
-
}
|
|
438
|
-
else {
|
|
439
|
-
typ_1 = (new FSharpType(9, []));
|
|
440
|
-
}
|
|
441
|
-
return new FSharpType(8, [new FSharpTypeAlias(escapeName(glueTypeAliasDeclaration.Name), typ_1, transformTypeParameters(glueTypeAliasDeclaration.TypeParameters))]);
|
|
442
|
-
}
|
|
443
|
-
case 3:
|
|
444
|
-
return new FSharpType(8, [new FSharpTypeAlias(escapeName(glueTypeAliasDeclaration.Name), new FSharpType(7, [transformPrimitive(matchValue.fields[0])]), transformTypeParameters(glueTypeAliasDeclaration.TypeParameters))]);
|
|
445
|
-
case 13:
|
|
446
|
-
return new FSharpType(8, [new FSharpTypeAlias(escapeName(glueTypeAliasDeclaration.Name), transformType(new GlueType(13, [matchValue.fields[0]])), transformTypeParameters(glueTypeAliasDeclaration.TypeParameters))]);
|
|
447
|
-
case 15:
|
|
448
|
-
return new FSharpType(8, [new FSharpTypeAlias(escapeName(glueTypeAliasDeclaration.Name), transformType(new GlueType(15, [matchValue.fields[0]])), transformTypeParameters(glueTypeAliasDeclaration.TypeParameters))]);
|
|
449
|
-
case 14: {
|
|
450
|
-
const originalInterface = transformInterface(matchValue.fields[0]);
|
|
451
|
-
return new FSharpType(4, [new FSharpInterface(originalInterface.Attributes, escapeName(glueTypeAliasDeclaration.Name), originalInterface.TypeParameters, map((m_1) => {
|
|
452
|
-
if (m_1.tag === 1) {
|
|
453
|
-
const property = m_1.fields[0];
|
|
454
|
-
return new FSharpMember(1, [new FSharpMemberInfo(property.Attributes, property.Name, property.TypeParameters, property.Parameters, property.Type, true, property.IsStatic, property.Accessor, property.Accessibility)]);
|
|
455
|
-
}
|
|
456
|
-
else {
|
|
457
|
-
const method = m_1.fields[0];
|
|
458
|
-
return new FSharpMember(0, [new FSharpMemberInfo(method.Attributes, method.Name, method.TypeParameters, method.Parameters, method.Type, true, method.IsStatic, method.Accessor, method.Accessibility)]);
|
|
459
|
-
}
|
|
460
|
-
}, originalInterface.Members))]);
|
|
461
|
-
}
|
|
462
|
-
case 16: {
|
|
463
|
-
const functionType = matchValue.fields[0];
|
|
464
|
-
return new FSharpType(4, [new FSharpInterface(singleton(new FSharpAttribute(5, [])), escapeName(glueTypeAliasDeclaration.Name), transformTypeParameters(glueTypeAliasDeclaration.TypeParameters), singleton(new FSharpMember(0, [new FSharpMemberInfo(singleton(new FSharpAttribute(1, [])), "Invoke", empty(), map(transformParameter, functionType.Parameters), transformType(functionType.Type), false, false, void 0, new FSharpAccessibility(0, []))])))]);
|
|
465
|
-
}
|
|
466
|
-
default:
|
|
467
|
-
return new FSharpType(9, []);
|
|
468
801
|
}
|
|
469
802
|
}
|
|
470
803
|
|
|
471
804
|
function transformModuleDeclaration(moduleDeclaration) {
|
|
472
|
-
return new FSharpType(3, [new FSharpModule(
|
|
805
|
+
return new FSharpType(3, [new FSharpModule(sanitizeName(moduleDeclaration.Name), moduleDeclaration.IsRecursive, transform(false, moduleDeclaration.Types))]);
|
|
473
806
|
}
|
|
474
807
|
|
|
475
|
-
function transformClassDeclaration(classDeclaration) {
|
|
476
|
-
let
|
|
477
|
-
|
|
808
|
+
function transformClassDeclaration(context, classDeclaration) {
|
|
809
|
+
let Members;
|
|
810
|
+
const patternInput = sanitizeNameAndPushScope(classDeclaration.Name, context);
|
|
811
|
+
const context_1 = patternInput[1];
|
|
812
|
+
return new FSharpType(4, [(Members = TransformMembers_toFSharpMember(context_1, classDeclaration.Members), new FSharpInterface(ofArray([new FSharpAttribute(7, []), new FSharpAttribute(18, [])]), patternInput[0], classDeclaration.Name, transformTypeParameters(context_1, classDeclaration.TypeParameters), Members))]);
|
|
478
813
|
}
|
|
479
814
|
|
|
480
|
-
function transformToFsharp(glueTypes) {
|
|
815
|
+
function transformToFsharp(context, glueTypes) {
|
|
481
816
|
return map((_arg) => {
|
|
482
817
|
switch (_arg.tag) {
|
|
483
818
|
case 4:
|
|
484
819
|
return transformEnum(_arg.fields[0]);
|
|
485
820
|
case 5:
|
|
486
|
-
return transformTypeAliasDeclaration(_arg.fields[0]);
|
|
821
|
+
return transformTypeAliasDeclaration(context, _arg.fields[0]);
|
|
487
822
|
case 11:
|
|
488
823
|
return transformModuleDeclaration(_arg.fields[0]);
|
|
489
824
|
case 12:
|
|
490
|
-
return transformClassDeclaration(_arg.fields[0]);
|
|
491
|
-
case
|
|
825
|
+
return transformClassDeclaration(context, _arg.fields[0]);
|
|
826
|
+
case 24: {
|
|
827
|
+
const exportedType = _arg.fields[0];
|
|
828
|
+
if (exportedType.tag === 12) {
|
|
829
|
+
return transformClassDeclaration(context, exportedType.fields[0]);
|
|
830
|
+
}
|
|
831
|
+
else {
|
|
832
|
+
return new FSharpType(9, []);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
492
835
|
case 16:
|
|
836
|
+
case 17:
|
|
493
837
|
case 14:
|
|
494
838
|
case 15:
|
|
495
839
|
case 13:
|
|
@@ -499,11 +843,17 @@ function transformToFsharp(glueTypes) {
|
|
|
499
843
|
case 8:
|
|
500
844
|
case 2:
|
|
501
845
|
case 3:
|
|
846
|
+
case 23:
|
|
502
847
|
case 9:
|
|
503
848
|
case 0:
|
|
849
|
+
case 19:
|
|
850
|
+
case 20:
|
|
851
|
+
case 21:
|
|
852
|
+
case 22:
|
|
853
|
+
case 18:
|
|
504
854
|
return new FSharpType(9, []);
|
|
505
855
|
default:
|
|
506
|
-
return new FSharpType(4, [transformInterface(_arg.fields[0])]);
|
|
856
|
+
return new FSharpType(4, [transformInterface(context, _arg.fields[0])]);
|
|
507
857
|
}
|
|
508
858
|
}, glueTypes);
|
|
509
859
|
}
|
|
@@ -514,6 +864,13 @@ export function transform(isTopLevel, glueAst) {
|
|
|
514
864
|
case 2:
|
|
515
865
|
case 6:
|
|
516
866
|
return true;
|
|
867
|
+
case 24:
|
|
868
|
+
if (glueType.fields[0].tag === 2) {
|
|
869
|
+
return true;
|
|
870
|
+
}
|
|
871
|
+
else {
|
|
872
|
+
return false;
|
|
873
|
+
}
|
|
517
874
|
default:
|
|
518
875
|
return false;
|
|
519
876
|
}
|
|
@@ -532,11 +889,20 @@ export function transform(isTopLevel, glueAst) {
|
|
|
532
889
|
return false;
|
|
533
890
|
}
|
|
534
891
|
}, glueType_1.fields[0].Types);
|
|
892
|
+
case 24:
|
|
893
|
+
if (glueType_1.fields[0].tag === 12) {
|
|
894
|
+
return true;
|
|
895
|
+
}
|
|
896
|
+
else {
|
|
897
|
+
return false;
|
|
898
|
+
}
|
|
535
899
|
default:
|
|
536
900
|
return false;
|
|
537
901
|
}
|
|
538
902
|
}, rest));
|
|
539
|
-
|
|
903
|
+
const rootTransformContext = TransformContext_$ctor_Z535BF207("");
|
|
904
|
+
const rest_1 = transformToFsharp(rootTransformContext, rest);
|
|
905
|
+
return toList(delay(() => append(!isEmpty(exports_1) ? singleton_1(transformExports(rootTransformContext, isTopLevel, exports_1)) : empty_1(), delay(() => append(rest_1, delay(() => TransformContext__ToList(rootTransformContext)))))));
|
|
540
906
|
}
|
|
541
907
|
|
|
542
908
|
//# sourceMappingURL=Transform.js.map
|