@glutinum/cli 1.0.0-beta.1 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/dist/Glutinum.Converter/Abbreviations.js +9 -32
- package/dist/Glutinum.Converter/DelegateExtensions.js +378 -0
- package/dist/Glutinum.Converter/FreeTypeParameters.js +211 -0
- package/dist/Glutinum.Converter/FsharpAST.js +116 -65
- package/dist/Glutinum.Converter/Generate.js +38 -25
- package/dist/Glutinum.Converter/GlueAST.js +82 -43
- package/dist/Glutinum.Converter/Hosting.js +143 -169
- package/dist/Glutinum.Converter/Merge.js +369 -337
- package/dist/Glutinum.Converter/Packages.js +384 -94
- package/dist/Glutinum.Converter/Printer.js +432 -393
- package/dist/Glutinum.Converter/Read.js +361 -99
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +4 -4
- package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
- package/dist/Glutinum.Converter/Reader/Declaration.js +6 -12
- package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
- package/dist/Glutinum.Converter/Reader/Documentation.js +23 -35
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +103 -36
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +21 -36
- package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +26 -13
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +15 -21
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +45 -2
- package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +178 -0
- package/dist/Glutinum.Converter/Reader/MemberTypes.js +126 -0
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +53 -5
- package/dist/Glutinum.Converter/Reader/Node.js +8 -11
- package/dist/Glutinum.Converter/Reader/Parameters.js +36 -27
- package/dist/Glutinum.Converter/Reader/TypeNode.js +389 -1583
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +76 -49
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +14 -37
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +23 -5
- package/dist/Glutinum.Converter/Reader/Types.js +295 -15
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +14 -28
- package/dist/Glutinum.Converter/Reader/UtilityType.js +811 -0
- package/dist/Glutinum.Converter/Reader/Utils.js +487 -101
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +2 -3
- package/dist/Glutinum.Converter/Transform.js +2915 -8176
- package/dist/Glutinum.Converter/Transformer/AnyFunctionOverloads.js +116 -0
- package/dist/Glutinum.Converter/Transformer/CallableProperties.js +454 -0
- package/dist/Glutinum.Converter/Transformer/Comment.js +136 -0
- package/dist/Glutinum.Converter/Transformer/Conditionals.js +1087 -0
- package/dist/Glutinum.Converter/Transformer/Context.js +678 -0
- package/dist/Glutinum.Converter/Transformer/Enum.js +80 -0
- package/dist/Glutinum.Converter/Transformer/Exports.js +704 -0
- package/dist/Glutinum.Converter/Transformer/Heritage.js +493 -0
- package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +488 -0
- package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +460 -0
- package/dist/Glutinum.Converter/Transformer/TypeParameter.js +219 -0
- package/dist/Glutinum.Converter/Transformer/TypeParameters.js +448 -0
- package/dist/Glutinum.Converter/Transformer/UnionOverloads.js +356 -0
- package/dist/Glutinum.Converter/Transformer/Utils.js +341 -0
- package/dist/Glutinum.Converter/TypeScript.Extensions.js +0 -10
- package/dist/Glutinum.Converter/Utils/String.js +14 -3
- package/dist/Program.js +102 -239
- package/package.json +3 -2
|
@@ -1,91 +1,118 @@
|
|
|
1
1
|
|
|
2
|
+
import { withInProgress, removeParenthesizedType } from "./Utils.js";
|
|
2
3
|
import { GlueTypeUnion, GlueType, GluePrimitive } from "../GlueAST.js";
|
|
3
4
|
import { ofArray } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
4
|
-
import { structuralHash, equals, Exception } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
5
|
-
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
6
5
|
import { defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
|
|
7
6
|
import { tryFind } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
8
7
|
import { contains, item as item_2 } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
|
|
8
|
+
import { Exception, structuralHash, equals } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
9
|
+
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
9
10
|
import { readTypeQueryNode } from "./TypeQueryNode.js";
|
|
10
11
|
import { concat } from "../../fable_modules/fable-library-js.5.17.2/String.js";
|
|
11
12
|
import { TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name } from "../TypeScript.Extensions.js";
|
|
12
13
|
|
|
13
|
-
function removeParenthesizedType(node_mut) {
|
|
14
|
-
removeParenthesizedType:
|
|
15
|
-
while (true) {
|
|
16
|
-
const node = node_mut;
|
|
17
|
-
if (node.kind === 197) {
|
|
18
|
-
node_mut = node.type;
|
|
19
|
-
continue removeParenthesizedType;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return node;
|
|
23
|
-
}
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const declarationsInProgress = [];
|
|
29
|
-
|
|
30
14
|
export function readTypeOperatorNode(reader, node) {
|
|
31
15
|
let declarations;
|
|
32
16
|
const matchValue = node.operator;
|
|
33
17
|
switch (matchValue) {
|
|
34
18
|
case 143: {
|
|
35
19
|
const operandNode = removeParenthesizedType(node.type);
|
|
20
|
+
const arrayKeys = new GlueType(/* Union */ 7, [new GlueTypeUnion(ofArray([new GlueType(/* Primitive */ 3, [GluePrimitive.String$]), new GlueType(/* Primitive */ 3, [GluePrimitive.Number$])]))]);
|
|
36
21
|
const matchValue_1 = operandNode.kind;
|
|
22
|
+
let matchResult;
|
|
37
23
|
switch (matchValue_1) {
|
|
38
|
-
case 133:
|
|
39
|
-
|
|
24
|
+
case 133: {
|
|
25
|
+
matchResult = 3;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
40
28
|
case 184: {
|
|
29
|
+
matchResult = 0;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
case 187: {
|
|
33
|
+
matchResult = 1;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case 189: {
|
|
37
|
+
matchResult = 4;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case 194:
|
|
41
|
+
case 200: {
|
|
42
|
+
matchResult = 2;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case 199: {
|
|
46
|
+
if (operandNode.type.kind === 189) {
|
|
47
|
+
matchResult = 5;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
matchResult = 6;
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
default:
|
|
55
|
+
matchResult = 6;
|
|
56
|
+
}
|
|
57
|
+
switch (matchResult) {
|
|
58
|
+
case 0: {
|
|
41
59
|
const typeReferenceNode = operandNode;
|
|
42
60
|
const symbolOpt = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(typeReferenceNode.typeName);
|
|
43
61
|
if (symbolOpt != null) {
|
|
44
62
|
const symbol = symbolOpt;
|
|
45
63
|
const matchValue_2 = symbol.declarations;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const declaration_1 = defaultArg(tryFind((declaration) => (declaration.kind === 264), declarations_1), item_2(0, declarations_1));
|
|
52
|
-
if (declaration_1.kind === 169) {
|
|
53
|
-
return new GlueType(/* KeyOf */ 9, [new GlueType(/* TypeParameter */ 16, [symbol.name])]);
|
|
54
|
-
}
|
|
55
|
-
else if (contains(declaration_1, declarationsInProgress, {
|
|
56
|
-
Equals: equals,
|
|
57
|
-
GetHashCode: (x) => (structuralHash(x) | 0),
|
|
58
|
-
})) {
|
|
59
|
-
return new GlueType(/* KeyOf */ 9, [GlueType.Discard]);
|
|
64
|
+
let matchResult_1, declarations_1;
|
|
65
|
+
if (matchValue_2 != null) {
|
|
66
|
+
if ((declarations = matchValue_2, declarations.length > 0)) {
|
|
67
|
+
matchResult_1 = 0;
|
|
68
|
+
declarations_1 = matchValue_2;
|
|
60
69
|
}
|
|
61
70
|
else {
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
return new GlueType(/* KeyOf */ 9, [reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration_1)]);
|
|
65
|
-
}
|
|
66
|
-
finally {
|
|
67
|
-
declarationsInProgress.splice(declarationsInProgress.length - 1, 1);
|
|
68
|
-
}
|
|
71
|
+
matchResult_1 = 1;
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
74
|
else {
|
|
72
|
-
|
|
75
|
+
matchResult_1 = 1;
|
|
76
|
+
}
|
|
77
|
+
switch (matchResult_1) {
|
|
78
|
+
case 0: {
|
|
79
|
+
const declaration_1 = defaultArg(tryFind((declaration) => (declaration.kind === 264), declarations_1), item_2(0, declarations_1));
|
|
80
|
+
if (declaration_1.kind === 169) {
|
|
81
|
+
return new GlueType(/* KeyOf */ 9, [new GlueType(/* TypeParameter */ 16, [symbol.name])]);
|
|
82
|
+
}
|
|
83
|
+
else if (contains(declaration_1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().KeyOfDeclarations, {
|
|
84
|
+
Equals: equals,
|
|
85
|
+
GetHashCode: (x) => (structuralHash(x) | 0),
|
|
86
|
+
})) {
|
|
87
|
+
return new GlueType(/* KeyOf */ 9, [GlueType.Discard]);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return withInProgress(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().KeyOfDeclarations, declaration_1, () => (new GlueType(/* KeyOf */ 9, [reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration_1)])));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
default:
|
|
94
|
+
throw new Exception(Report_readerError_Z19516DCE("type operator (keyof)", "Missing declarations", node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 61));
|
|
73
95
|
}
|
|
74
96
|
}
|
|
75
97
|
else if (node.pos < 0) {
|
|
76
98
|
return new GlueType(/* KeyOf */ 9, [GlueType.Discard]);
|
|
77
99
|
}
|
|
78
100
|
else {
|
|
79
|
-
throw new Exception(Report_readerError_Z19516DCE("type operator (keyof)", "Missing symbol", node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs",
|
|
101
|
+
throw new Exception(Report_readerError_Z19516DCE("type operator (keyof)", "Missing symbol", node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 37));
|
|
80
102
|
}
|
|
81
103
|
}
|
|
82
|
-
case
|
|
104
|
+
case 1:
|
|
83
105
|
return new GlueType(/* KeyOf */ 9, [readTypeQueryNode(reader, operandNode)]);
|
|
84
|
-
case
|
|
85
|
-
case 200:
|
|
106
|
+
case 2:
|
|
86
107
|
return new GlueType(/* KeyOf */ 9, [GlueType.Discard]);
|
|
108
|
+
case 3:
|
|
109
|
+
return new GlueType(/* Union */ 7, [new GlueTypeUnion(ofArray([new GlueType(/* Primitive */ 3, [GluePrimitive.String$]), new GlueType(/* Primitive */ 3, [GluePrimitive.Number$]), new GlueType(/* Primitive */ 3, [GluePrimitive.Symbol$])]))]);
|
|
110
|
+
case 4:
|
|
111
|
+
return arrayKeys;
|
|
112
|
+
case 5:
|
|
113
|
+
return arrayKeys;
|
|
87
114
|
default: {
|
|
88
|
-
const item = Report_readerError_Z19516DCE("type operator (keyof)", concat("Was expecting a type reference or a type query instead got a Node of type ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(operandNode.kind)), node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs",
|
|
115
|
+
const item = Report_readerError_Z19516DCE("type operator (keyof)", concat("Was expecting a type reference or a type query instead got a Node of type ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(operandNode.kind)), node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 91);
|
|
89
116
|
const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
90
117
|
void (objectArg.push(item));
|
|
91
118
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
@@ -97,7 +124,7 @@ export function readTypeOperatorNode(reader, node) {
|
|
|
97
124
|
case 158:
|
|
98
125
|
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](node.type);
|
|
99
126
|
default: {
|
|
100
|
-
const item_1 = Report_readerError_Z19516DCE("type operator", concat("Unsupported operator ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(node.operator)), node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs",
|
|
127
|
+
const item_1 = Report_readerError_Z19516DCE("type operator", concat("Unsupported operator ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(node.operator)), node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 105);
|
|
101
128
|
const objectArg_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
102
129
|
void (objectArg_1.push(item_1));
|
|
103
130
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { isFromEsLib, isFromEs5Lib, identifierText, isTopLevelModuleDeclaration, modulePathForSymbol, declaredName, $007CHasSymbolFlags$007C_$007C, resolveAlias, $007CHasTypeFlags$007C_$007C } from "./Utils.js";
|
|
2
|
+
import { primitiveOfFlags, isFromEsLib, isFromEs5Lib, withInProgress, identifierText, isTopLevelModuleDeclaration, modulePathForSymbol, declaredName, $007CHasSymbolFlags$007C_$007C, resolveAlias, $007CHasTypeFlags$007C_$007C } from "./Utils.js";
|
|
3
3
|
import { defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
|
|
4
4
|
import { contains, item } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
|
|
5
5
|
import { collect as collect_1, append as append_1, delay, toList, exists } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
@@ -17,8 +17,6 @@ import { FSharpResult$2 } from "../../fable_modules/fable-library-js.5.17.2/Resu
|
|
|
17
17
|
import { concat } from "../../fable_modules/fable-library-js.5.17.2/String.js";
|
|
18
18
|
import { TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name } from "../TypeScript.Extensions.js";
|
|
19
19
|
|
|
20
|
-
const declarationsInProgress = [];
|
|
21
|
-
|
|
22
20
|
export function readTypeQueryNode(reader, typeQueryNode) {
|
|
23
21
|
let declarations_1;
|
|
24
22
|
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
@@ -169,14 +167,14 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
169
167
|
collect:
|
|
170
168
|
while (true) {
|
|
171
169
|
const node = node_mut, acc = acc_mut;
|
|
170
|
+
let input_11;
|
|
172
171
|
if (Operators_IsNull(node)) {
|
|
173
172
|
return acc;
|
|
174
173
|
}
|
|
175
174
|
else {
|
|
176
|
-
const
|
|
177
|
-
const acc_1 = (typeParameters_1 == null) ? acc : append(acc, map((typeParameter) => identifierText(typeParameter.name), toList(typeParameters_1)));
|
|
175
|
+
const names = defaultArg((input_11 = node.typeParameters, (input_11 == null) ? undefined : map((typeParameter) => identifierText(typeParameter.name), toList(input_11))), empty());
|
|
178
176
|
node_mut = node.parent;
|
|
179
|
-
acc_mut =
|
|
177
|
+
acc_mut = append(acc, names);
|
|
180
178
|
continue collect;
|
|
181
179
|
}
|
|
182
180
|
break;
|
|
@@ -208,20 +206,14 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
208
206
|
case 5:
|
|
209
207
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
210
208
|
default:
|
|
211
|
-
if (contains(declaration_1,
|
|
209
|
+
if (contains(declaration_1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().TypeQueryDeclarations, {
|
|
212
210
|
Equals: equals,
|
|
213
211
|
GetHashCode: (x_10) => (structuralHash(x_10) | 0),
|
|
214
212
|
})) {
|
|
215
213
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
216
214
|
}
|
|
217
215
|
else {
|
|
218
|
-
|
|
219
|
-
try {
|
|
220
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration_1);
|
|
221
|
-
}
|
|
222
|
-
finally {
|
|
223
|
-
declarationsInProgress.splice(declarationsInProgress.length - 1, 1);
|
|
224
|
-
}
|
|
216
|
+
return withInProgress(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().TypeQueryDeclarations, declaration_1, () => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration_1));
|
|
225
217
|
}
|
|
226
218
|
}
|
|
227
219
|
}
|
|
@@ -234,7 +226,7 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
234
226
|
let _arg_5;
|
|
235
227
|
let input_9;
|
|
236
228
|
const option = checker.getSymbolAtLocation(exprName);
|
|
237
|
-
const error = Report_readerError_Z19516DCE("type node (TypeQuery)", "Missing symbol", typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs",
|
|
229
|
+
const error = Report_readerError_Z19516DCE("type node (TypeQuery)", "Missing symbol", typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs", 29);
|
|
238
230
|
const option_1 = option;
|
|
239
231
|
input_9 = ((option_1 == null) ? (new FSharpResult$2(/* Error */ 1, [error])) : (new FSharpResult$2(/* Ok */ 0, [option_1])));
|
|
240
232
|
if (input_9.tag === 1) {
|
|
@@ -243,7 +235,7 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
243
235
|
else {
|
|
244
236
|
let input_7;
|
|
245
237
|
const option_2 = input_9.fields[0].declarations;
|
|
246
|
-
const error_2 = Report_readerError_Z19516DCE("type node (TypeQuery)", "Missing declarations", typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs",
|
|
238
|
+
const error_2 = Report_readerError_Z19516DCE("type node (TypeQuery)", "Missing declarations", typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs", 39);
|
|
247
239
|
const option_3 = option_2;
|
|
248
240
|
input_7 = ((option_3 == null) ? (new FSharpResult$2(/* Error */ 1, [error_2])) : (new FSharpResult$2(/* Ok */ 0, [option_3])));
|
|
249
241
|
if (input_7.tag === 1) {
|
|
@@ -251,7 +243,7 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
251
243
|
}
|
|
252
244
|
else {
|
|
253
245
|
const declarations = input_7.fields[0];
|
|
254
|
-
const input_5 = (declarations.length !== 1) ? (new FSharpResult$2(/* Error */ 1, [Report_readerError_Z19516DCE("type node (TypeQuery)", "Expected exactly one declaration", typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs",
|
|
246
|
+
const input_5 = (declarations.length !== 1) ? (new FSharpResult$2(/* Error */ 1, [Report_readerError_Z19516DCE("type node (TypeQuery)", "Expected exactly one declaration", typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs", 48)])) : (new FSharpResult$2(/* Ok */ 0, [item(0, declarations)]));
|
|
255
247
|
if (input_5.tag === 1) {
|
|
256
248
|
_arg_5 = (new FSharpResult$2(/* Error */ 1, [input_5.fields[0]]));
|
|
257
249
|
}
|
|
@@ -259,14 +251,14 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
259
251
|
const declaration = input_5.fields[0];
|
|
260
252
|
let input_3;
|
|
261
253
|
const matchValue_3 = declaration.kind;
|
|
262
|
-
input_3 = ((matchValue_3 === 261) ? (new FSharpResult$2(/* Ok */ 0, [declaration])) : (new FSharpResult$2(/* Error */ 1, [Report_readerError_Z19516DCE("type node (TypeQuery)", concat("Unsupported declaration kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue_3)), typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs",
|
|
254
|
+
input_3 = ((matchValue_3 === 261) ? (new FSharpResult$2(/* Ok */ 0, [declaration])) : (new FSharpResult$2(/* Error */ 1, [Report_readerError_Z19516DCE("type node (TypeQuery)", concat("Unsupported declaration kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue_3)), typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs", 64)])));
|
|
263
255
|
if (input_3.tag === 1) {
|
|
264
256
|
_arg_5 = (new FSharpResult$2(/* Error */ 1, [input_3.fields[0]]));
|
|
265
257
|
}
|
|
266
258
|
else {
|
|
267
259
|
let input_1;
|
|
268
260
|
const option_4 = input_3.fields[0].type;
|
|
269
|
-
const error_4 = Report_readerError_Z19516DCE("type node (TypeQuery)", "Missing type", typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs",
|
|
261
|
+
const error_4 = Report_readerError_Z19516DCE("type node (TypeQuery)", "Missing type", typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs", 74);
|
|
270
262
|
const option_5 = option_4;
|
|
271
263
|
input_1 = ((option_5 == null) ? (new FSharpResult$2(/* Error */ 1, [error_4])) : (new FSharpResult$2(/* Ok */ 0, [option_5])));
|
|
272
264
|
if (input_1.tag === 1) {
|
|
@@ -286,7 +278,7 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
286
278
|
break;
|
|
287
279
|
}
|
|
288
280
|
default:
|
|
289
|
-
_arg_5 = (new FSharpResult$2(/* Error */ 1, [Report_readerError_Z19516DCE("type node (TypeQuery)", concat("Unsupported declaration kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue_4)), typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs",
|
|
281
|
+
_arg_5 = (new FSharpResult$2(/* Error */ 1, [Report_readerError_Z19516DCE("type node (TypeQuery)", concat("Unsupported declaration kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue_4)), typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs", 86)]));
|
|
290
282
|
}
|
|
291
283
|
}
|
|
292
284
|
}
|
|
@@ -302,28 +294,13 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
302
294
|
}
|
|
303
295
|
}
|
|
304
296
|
else {
|
|
305
|
-
const warning_1 = Report_readerError_Z19516DCE("type node (TypeQuery)", "Expected an Identifier", typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs",
|
|
297
|
+
const warning_1 = Report_readerError_Z19516DCE("type node (TypeQuery)", "Expected an Identifier", typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs", 102);
|
|
306
298
|
void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().push(warning_1));
|
|
307
299
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
308
300
|
}
|
|
309
301
|
}
|
|
310
|
-
else if ($007CHasTypeFlags$007C_$007C(32, matchValue) != null) {
|
|
311
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
|
|
312
|
-
}
|
|
313
|
-
else if ($007CHasTypeFlags$007C_$007C(64, matchValue) != null) {
|
|
314
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Number$]);
|
|
315
|
-
}
|
|
316
|
-
else if ($007CHasTypeFlags$007C_$007C(256, matchValue) != null) {
|
|
317
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Bool]);
|
|
318
|
-
}
|
|
319
|
-
else if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
|
|
320
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
321
|
-
}
|
|
322
|
-
else if ($007CHasTypeFlags$007C_$007C(16, matchValue) != null) {
|
|
323
|
-
return new GlueType(/* Primitive */ 3, [GluePrimitive.Unit]);
|
|
324
|
-
}
|
|
325
302
|
else {
|
|
326
|
-
return
|
|
303
|
+
return primitiveOfFlags(typ);
|
|
327
304
|
}
|
|
328
305
|
}
|
|
329
306
|
|
|
@@ -4,9 +4,10 @@ import { readClassDeclaration } from "./ClassDeclaration.js";
|
|
|
4
4
|
import { readEnumDeclaration } from "./EnumDeclaration.js";
|
|
5
5
|
import { GluePrimitive, GlueType } from "../GlueAST.js";
|
|
6
6
|
import { readFunctionDeclaration } from "./FunctionDeclaration.js";
|
|
7
|
-
import { readInterfaceDeclaration } from "./InterfaceDeclaration.js";
|
|
7
|
+
import { tryReadExternalRedeclaration, readInterfaceDeclaration } from "./InterfaceDeclaration.js";
|
|
8
8
|
import { readModuleDeclaration } from "./ModuleDeclaration.js";
|
|
9
9
|
import { readNode } from "./Node.js";
|
|
10
|
+
import { addToSet } from "../../fable_modules/fable-library-js.5.17.2/MapUtil.js";
|
|
10
11
|
import { readTypeAliasDeclaration } from "./TypeAliasDeclaration.js";
|
|
11
12
|
import { readTypeNode } from "./TypeNode.js";
|
|
12
13
|
import { readVariableStatement } from "./VariableStatement.js";
|
|
@@ -20,19 +21,28 @@ import { readExportAssignment } from "./ExportAssignment.js";
|
|
|
20
21
|
import { readDocumentationForNode, readDocumentationForSignature } from "./Documentation.js";
|
|
21
22
|
import { readNamedTupleMember } from "./NamedTupleMember.js";
|
|
22
23
|
import { readMappedTypeNode } from "./MappedTypeNode.js";
|
|
24
|
+
import { HashSet } from "../../fable_modules/fable-library-js.5.17.2/MutableSet.js";
|
|
25
|
+
import { HashIdentity_Reference } from "../../fable_modules/fable-library-js.5.17.2/FSharp.Collections.js";
|
|
26
|
+
import { ReadInProgress_Create } from "./Types.js";
|
|
23
27
|
import { class_type } from "../../fable_modules/fable-library-js.5.17.2/Reflection.js";
|
|
24
28
|
|
|
25
29
|
export class TypeScriptReader {
|
|
26
30
|
constructor(checker, packageContext) {
|
|
27
|
-
this["checker@
|
|
31
|
+
this["checker@28"] = checker;
|
|
28
32
|
this.packageContext = packageContext;
|
|
29
33
|
this.warnings = [];
|
|
30
34
|
this.typeMemory = [];
|
|
35
|
+
this.readNodes = (new HashSet([], HashIdentity_Reference()));
|
|
36
|
+
this.inProgress = ReadInProgress_Create();
|
|
31
37
|
this["SyntheticContext@"] = undefined;
|
|
32
38
|
}
|
|
33
39
|
"Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"() {
|
|
34
40
|
const _ = this;
|
|
35
|
-
return _["checker@
|
|
41
|
+
return _["checker@28"];
|
|
42
|
+
}
|
|
43
|
+
"Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"() {
|
|
44
|
+
const _ = this;
|
|
45
|
+
return _.inProgress;
|
|
36
46
|
}
|
|
37
47
|
"Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"() {
|
|
38
48
|
const _ = this;
|
|
@@ -72,16 +82,24 @@ export class TypeScriptReader {
|
|
|
72
82
|
}
|
|
73
83
|
"Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadInterfaceDeclaration1CB6FA10"(interfaceDeclaration) {
|
|
74
84
|
const this$ = this;
|
|
75
|
-
|
|
85
|
+
const glueInterface = readInterfaceDeclaration(this$, interfaceDeclaration);
|
|
86
|
+
const matchValue = tryReadExternalRedeclaration(this$, interfaceDeclaration, glueInterface);
|
|
87
|
+
return (matchValue == null) ? (new GlueType(/* Interface */ 1, [glueInterface])) : matchValue;
|
|
76
88
|
}
|
|
77
89
|
"Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadModuleDeclarationC29C54F"(moduleDeclaration) {
|
|
78
90
|
const this$ = this;
|
|
79
91
|
return new GlueType(/* ModuleDeclaration */ 11, [readModuleDeclaration(this$, moduleDeclaration)]);
|
|
80
92
|
}
|
|
93
|
+
"Glutinum.Converter.Reader.Types.ITypeScriptReader.HasRead6C0FD055"(node) {
|
|
94
|
+
const _ = this;
|
|
95
|
+
return _.readNodes.has(node);
|
|
96
|
+
}
|
|
81
97
|
"Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"(node) {
|
|
82
98
|
const this$ = this;
|
|
83
99
|
const typ = readNode(this$, node);
|
|
84
|
-
|
|
100
|
+
if (addToSet(node, this$.readNodes)) {
|
|
101
|
+
void (this$.typeMemory.push(typ));
|
|
102
|
+
}
|
|
85
103
|
return typ;
|
|
86
104
|
}
|
|
87
105
|
"Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeAliasDeclarationZ7FA16745"(typeAliasDeclaration) {
|