@glutinum/cli 0.14.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 +154 -69
- package/dist/Glutinum.Converter/Generate.js +44 -23
- package/dist/Glutinum.Converter/GlueAST.js +122 -74
- package/dist/Glutinum.Converter/Hosting.js +892 -0
- package/dist/Glutinum.Converter/Merge.js +469 -301
- package/dist/Glutinum.Converter/Packages.js +403 -77
- package/dist/Glutinum.Converter/Printer.js +455 -388
- package/dist/Glutinum.Converter/Read.js +366 -104
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +9 -9
- package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
- package/dist/Glutinum.Converter/Reader/Declaration.js +24 -30
- package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
- package/dist/Glutinum.Converter/Reader/Documentation.js +56 -67
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +105 -38
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +52 -55
- package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +28 -16
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +46 -45
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +48 -5
- package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +178 -0
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +82 -4
- package/dist/Glutinum.Converter/Reader/MemberTypes.js +126 -0
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +55 -7
- package/dist/Glutinum.Converter/Reader/Node.js +23 -26
- package/dist/Glutinum.Converter/Reader/Parameters.js +39 -30
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +5 -5
- package/dist/Glutinum.Converter/Reader/TypeNode.js +410 -1545
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +78 -51
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +116 -71
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +25 -7
- package/dist/Glutinum.Converter/Reader/Types.js +296 -16
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +21 -34
- package/dist/Glutinum.Converter/Reader/UtilityType.js +811 -0
- package/dist/Glutinum.Converter/Reader/Utils.js +584 -148
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +2 -3
- package/dist/Glutinum.Converter/Transform.js +2971 -6875
- 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 +193 -211
- package/dist/Glutinum.Converter/Utils/Naming.js +7 -0
- package/dist/Glutinum.Converter/Utils/String.js +15 -4
- package/dist/Program.js +107 -232
- package/package.json +4 -3
- package/dist/Glutinum.Converter/TypeScript.js +0 -12
- package/src/Glutinum.Converter/js/bootstrap.js +0 -123
- package/src/Glutinum.Converter/js/host.js +0 -144
- package/src/Glutinum.Converter/js/npm.js +0 -137
- package/src/Glutinum.Converter/js/resolve.js +0 -402
|
@@ -3,15 +3,17 @@ import { toString } from "../fable_modules/fable-library-js.5.17.2/Types.js";
|
|
|
3
3
|
import { StringBuilder__AppendLine, StringBuilder__Append_Z721C83C5, StringBuilder_$ctor } from "../fable_modules/fable-library-js.5.17.2/System.Text.js";
|
|
4
4
|
import { class_type } from "../fable_modules/fable-library-js.5.17.2/Reflection.js";
|
|
5
5
|
import { max } from "../fable_modules/fable-library-js.5.17.2/Double.js";
|
|
6
|
-
import { trimStart, interpolate, join, replace, concat, isNullOrWhiteSpace, replicate } from "../fable_modules/fable-library-js.5.17.2/String.js";
|
|
7
|
-
import { isDigit2 } from "../fable_modules/fable-library-js.5.17.2/Char.js";
|
|
6
|
+
import { trimStart, interpolate, substring, join, replace, concat, isNullOrWhiteSpace, replicate } from "../fable_modules/fable-library-js.5.17.2/String.js";
|
|
8
7
|
import { splitLines, replace as replace_1, removeSingleQuote, removeDoubleQuote, capitalizeFirstLetter } from "./Utils/String.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { isDigit2 } from "../fable_modules/fable-library-js.5.17.2/Char.js";
|
|
9
|
+
import { cons, mapIndexed, empty, forAll, ofArray, concat as concat_1, partition, length, singleton, append, choose, filter, iterateIndexed, iterate, isEmpty, map, exists } from "../fable_modules/fable-library-js.5.17.2/List.js";
|
|
10
|
+
import { stringHash, disposeSafe, getEnumerator, int32ToString, Exception } from "../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
11
|
+
import { sanitizeTypeParameterName } from "./Utils/Naming.js";
|
|
11
12
|
import { escape, create, isMatch, replace as replace_2 } from "../fable_modules/fable-library-js.5.17.2/RegExp.js";
|
|
12
13
|
import { removeConsecutiveEmptyLines, trimEmptyLines } from "./Utils/List.js";
|
|
14
|
+
import { FSharpInterface, FSharpAttribute } from "./FsharpAST.js";
|
|
13
15
|
import { singleton as singleton_1, append as append_1, delay, toList } from "../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
14
|
-
import {
|
|
16
|
+
import { List_distinctBy } from "../fable_modules/fable-library-js.5.17.2/Seq2.js";
|
|
15
17
|
|
|
16
18
|
export class Printer {
|
|
17
19
|
constructor() {
|
|
@@ -43,16 +45,14 @@ export function Printer__get_Unindent(__) {
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
/**
|
|
46
|
-
* Write the
|
|
48
|
+
* Write the text prefixed with the indentation
|
|
47
49
|
*/
|
|
48
50
|
export function Printer__Write_Z721C83C5(__, text) {
|
|
49
51
|
StringBuilder__Append_Z721C83C5(__.buffer, replicate(__.indentationLevel, __.indentationText) + text);
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
/**
|
|
53
|
-
* Write the
|
|
54
|
-
*
|
|
55
|
-
* Useful when you don't want to prefix the text with indentation
|
|
55
|
+
* Write the text without indentation
|
|
56
56
|
*/
|
|
57
57
|
export function Printer__WriteInline_Z721C83C5(__, text) {
|
|
58
58
|
StringBuilder__Append_Z721C83C5(__.buffer, text);
|
|
@@ -74,21 +74,9 @@ export function Printer__set_ImportSpecifier_Z721C83C5(__, v) {
|
|
|
74
74
|
__["ImportSpecifier@"] = v;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
export function Naming_$007CDigit$007C_$007C(digit) {
|
|
78
|
-
if (isNullOrWhiteSpace(digit)) {
|
|
79
|
-
return undefined;
|
|
80
|
-
}
|
|
81
|
-
else if (isDigit2(digit, 0)) {
|
|
82
|
-
return digit;
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
return undefined;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
77
|
function sanitizeEnumCaseName(name) {
|
|
90
78
|
const name_1 = capitalizeFirstLetter(removeDoubleQuote(removeSingleQuote(name)));
|
|
91
|
-
if (
|
|
79
|
+
if (!isNullOrWhiteSpace(name_1) && isDigit2(name_1, 0)) {
|
|
92
80
|
return concat("``", name_1, "``");
|
|
93
81
|
}
|
|
94
82
|
else {
|
|
@@ -124,6 +112,10 @@ function caseRulesToText(caseRules) {
|
|
|
124
112
|
}
|
|
125
113
|
}
|
|
126
114
|
|
|
115
|
+
function escapeStringLiteral(text) {
|
|
116
|
+
return replace(replace(replace(replace(replace(text, "\\", "\\\\"), "\"", "\\\""), "\r", "\\r"), "\n", "\\n"), "\t", "\\t");
|
|
117
|
+
}
|
|
118
|
+
|
|
127
119
|
function attributeToText(fsharpAttribute) {
|
|
128
120
|
switch (fsharpAttribute.tag) {
|
|
129
121
|
case 1:
|
|
@@ -141,7 +133,7 @@ function attributeToText(fsharpAttribute) {
|
|
|
141
133
|
case 8:
|
|
142
134
|
return `[<TypeScriptTaggedUnion("${fsharpAttribute.fields[0]}", ${caseRulesToText(fsharpAttribute.fields[1])})>]`;
|
|
143
135
|
case 13:
|
|
144
|
-
return concat("[<CompiledName(\"",
|
|
136
|
+
return concat("[<CompiledName(\"", escapeStringLiteral(fsharpAttribute.fields[0]), "\")>]");
|
|
145
137
|
case 14:
|
|
146
138
|
return concat("[<CompiledValue(", (fsharpAttribute.fields[0].tag === 1) ? int32ToString(fsharpAttribute.fields[0].fields[0]) : ((fsharpAttribute.fields[0].tag === 2) ? fsharpAttribute.fields[0].fields[0].toString() : ((fsharpAttribute.fields[0].tag === 0) ? concat("\"", fsharpAttribute.fields[0].fields[0], "\"") : ((fsharpAttribute.fields[0].tag === 4) ? "null" : (fsharpAttribute.fields[0].fields[0] ? "true" : "false")))), ")>]");
|
|
147
139
|
case 15:
|
|
@@ -158,8 +150,8 @@ function attributeToText(fsharpAttribute) {
|
|
|
158
150
|
return "[<EmitIndexer>]";
|
|
159
151
|
case 21:
|
|
160
152
|
if (fsharpAttribute.fields[0] != null) {
|
|
161
|
-
const
|
|
162
|
-
return concat("[<Global(\"",
|
|
153
|
+
const name_2 = fsharpAttribute.fields[0];
|
|
154
|
+
return concat("[<Global(\"", name_2, "\")>]");
|
|
163
155
|
}
|
|
164
156
|
else {
|
|
165
157
|
return "[<Global>]";
|
|
@@ -172,18 +164,14 @@ function attributeToText(fsharpAttribute) {
|
|
|
172
164
|
return "[<ParamArray>]";
|
|
173
165
|
case 24:
|
|
174
166
|
return "[<Interface>]";
|
|
167
|
+
case 25:
|
|
168
|
+
return "[<AutoOpen>]";
|
|
175
169
|
case 11:
|
|
176
170
|
if (fsharpAttribute.fields[0] == null) {
|
|
177
171
|
return "[<Obsolete>]";
|
|
178
172
|
}
|
|
179
173
|
else {
|
|
180
|
-
|
|
181
|
-
if ((message_1.indexOf("\n") >= 0) ? true : (message_1.indexOf("\"") >= 0)) {
|
|
182
|
-
return concat("[<Obsolete(\"\"\"", message_1, "\"\"\")>]");
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
return concat("[<Obsolete(\"", message_1, "\")>]");
|
|
186
|
-
}
|
|
174
|
+
return concat("[<Obsolete(\"", escapeStringLiteral(fsharpAttribute.fields[0]), "\")>]");
|
|
187
175
|
}
|
|
188
176
|
case 9:
|
|
189
177
|
return "[<AbstractClass>]";
|
|
@@ -196,21 +184,20 @@ function attributeToText(fsharpAttribute) {
|
|
|
196
184
|
}
|
|
197
185
|
}
|
|
198
186
|
|
|
199
|
-
function
|
|
200
|
-
|
|
201
|
-
Printer__WriteInline_Z721C83C5(printer, " ");
|
|
187
|
+
function compactAttributesText(fsharpAttributes) {
|
|
188
|
+
return replace_1(">][<", "; ", join("", map(attributeToText, fsharpAttributes)));
|
|
202
189
|
}
|
|
203
190
|
|
|
204
191
|
function printInlineAttributes(printer, fsharpAttributes) {
|
|
205
|
-
if (
|
|
206
|
-
Printer__WriteInline_Z721C83C5(printer,
|
|
192
|
+
if (!isEmpty(fsharpAttributes)) {
|
|
193
|
+
Printer__WriteInline_Z721C83C5(printer, compactAttributesText(fsharpAttributes));
|
|
207
194
|
Printer__WriteInline_Z721C83C5(printer, " ");
|
|
208
195
|
}
|
|
209
196
|
}
|
|
210
197
|
|
|
211
198
|
function printCompactAttributesAndNewLine(printer, fsharpAttributes) {
|
|
212
|
-
if (
|
|
213
|
-
Printer__Write_Z721C83C5(printer,
|
|
199
|
+
if (!isEmpty(fsharpAttributes)) {
|
|
200
|
+
Printer__Write_Z721C83C5(printer, compactAttributesText(fsharpAttributes));
|
|
214
201
|
Printer__get_NewLine(printer);
|
|
215
202
|
}
|
|
216
203
|
}
|
|
@@ -223,18 +210,18 @@ function printAttributes(printer, fsharpAttributes) {
|
|
|
223
210
|
}
|
|
224
211
|
|
|
225
212
|
export function printTypeParametersDeclaration(printer, typeParameters) {
|
|
226
|
-
const
|
|
213
|
+
const innerPrinter = Printer_$ctor();
|
|
227
214
|
if (!isEmpty(typeParameters)) {
|
|
228
|
-
Printer__WriteInline_Z721C83C5(
|
|
215
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, "<");
|
|
229
216
|
iterateIndexed((index, typeParameter) => {
|
|
230
217
|
if (index !== 0) {
|
|
231
|
-
Printer__WriteInline_Z721C83C5(
|
|
218
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, ", ");
|
|
232
219
|
}
|
|
233
220
|
if (typeParameter.tag === 1) {
|
|
234
|
-
Printer__WriteInline_Z721C83C5(
|
|
221
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, concat("\'", sanitizeTypeParameterName(typeParameter.fields[0].Name)));
|
|
235
222
|
}
|
|
236
223
|
else {
|
|
237
|
-
Printer__WriteInline_Z721C83C5(
|
|
224
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, `'T${index}`);
|
|
238
225
|
}
|
|
239
226
|
}, typeParameters);
|
|
240
227
|
iterateIndexed((index_1, typeParameter_3) => {
|
|
@@ -244,14 +231,14 @@ export function printTypeParametersDeclaration(printer, typeParameters) {
|
|
|
244
231
|
else {
|
|
245
232
|
const constraint_ = matchValue;
|
|
246
233
|
if (index_1 === 0) {
|
|
247
|
-
Printer__WriteInline_Z721C83C5(
|
|
234
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, " when ");
|
|
248
235
|
}
|
|
249
236
|
else {
|
|
250
|
-
Printer__WriteInline_Z721C83C5(
|
|
237
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, " and ");
|
|
251
238
|
}
|
|
252
|
-
Printer__WriteInline_Z721C83C5(
|
|
253
|
-
Printer__WriteInline_Z721C83C5(
|
|
254
|
-
Printer__WriteInline_Z721C83C5(
|
|
239
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, concat("\'", typeParameter_3.Name));
|
|
240
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, " :> ");
|
|
241
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, printType(constraint_));
|
|
255
242
|
}
|
|
256
243
|
}, filter((_arg_1) => (_arg_1.Constraint != null), choose((_arg) => {
|
|
257
244
|
if (_arg.tag === 1) {
|
|
@@ -261,16 +248,17 @@ export function printTypeParametersDeclaration(printer, typeParameters) {
|
|
|
261
248
|
return undefined;
|
|
262
249
|
}
|
|
263
250
|
}, typeParameters)));
|
|
264
|
-
if (Printer__ToStringWithoutTrailNewLine(
|
|
265
|
-
Printer__WriteInline_Z721C83C5(
|
|
251
|
+
if (Printer__ToStringWithoutTrailNewLine(innerPrinter).endsWith(">")) {
|
|
252
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, " ");
|
|
266
253
|
}
|
|
267
|
-
Printer__WriteInline_Z721C83C5(
|
|
268
|
-
Printer__WriteInline_Z721C83C5(printer, Printer__ToStringWithoutTrailNewLine(
|
|
254
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, ">");
|
|
255
|
+
Printer__WriteInline_Z721C83C5(printer, Printer__ToStringWithoutTrailNewLine(innerPrinter));
|
|
269
256
|
}
|
|
270
257
|
}
|
|
271
258
|
|
|
272
259
|
export function printTypeNameWithTypeParameters(name, typeParameters) {
|
|
273
260
|
const printer = Printer_$ctor();
|
|
261
|
+
const name_1 = name.startsWith("\'") ? ("\'" + sanitizeTypeParameterName(substring(name, 1))) : name;
|
|
274
262
|
if (!isEmpty(typeParameters)) {
|
|
275
263
|
Printer__WriteInline_Z721C83C5(printer, "<");
|
|
276
264
|
iterateIndexed((index, typeParameter) => {
|
|
@@ -278,7 +266,7 @@ export function printTypeNameWithTypeParameters(name, typeParameters) {
|
|
|
278
266
|
Printer__WriteInline_Z721C83C5(printer, ", ");
|
|
279
267
|
}
|
|
280
268
|
if (typeParameter.tag === 1) {
|
|
281
|
-
Printer__WriteInline_Z721C83C5(printer, concat("\'", typeParameter.fields[0].Name));
|
|
269
|
+
Printer__WriteInline_Z721C83C5(printer, concat("\'", sanitizeTypeParameterName(typeParameter.fields[0].Name)));
|
|
282
270
|
}
|
|
283
271
|
else {
|
|
284
272
|
Printer__WriteInline_Z721C83C5(printer, printType(typeParameter.fields[0]));
|
|
@@ -286,7 +274,7 @@ export function printTypeNameWithTypeParameters(name, typeParameters) {
|
|
|
286
274
|
}, typeParameters);
|
|
287
275
|
Printer__WriteInline_Z721C83C5(printer, ">");
|
|
288
276
|
}
|
|
289
|
-
return concat(
|
|
277
|
+
return concat(name_1, Printer__ToStringWithoutTrailNewLine(printer));
|
|
290
278
|
}
|
|
291
279
|
|
|
292
280
|
export function printType(fsharpType) {
|
|
@@ -364,7 +352,7 @@ export function printType(fsharpType) {
|
|
|
364
352
|
}
|
|
365
353
|
}
|
|
366
354
|
case 13:
|
|
367
|
-
return concat("\'", fsharpType.fields[0]);
|
|
355
|
+
return concat("\'", sanitizeTypeParameterName(fsharpType.fields[0]));
|
|
368
356
|
case 3:
|
|
369
357
|
return printType(fsharpType.fields[0]) + " option";
|
|
370
358
|
case 14:
|
|
@@ -386,6 +374,7 @@ export function printType(fsharpType) {
|
|
|
386
374
|
return printTypeNameWithTypeParameters(delegateInfo.Name, delegateInfo.TypeParameters);
|
|
387
375
|
}
|
|
388
376
|
case 4:
|
|
377
|
+
case 21:
|
|
389
378
|
case 6:
|
|
390
379
|
case 10:
|
|
391
380
|
return "obj";
|
|
@@ -394,34 +383,23 @@ export function printType(fsharpType) {
|
|
|
394
383
|
}
|
|
395
384
|
}
|
|
396
385
|
|
|
397
|
-
|
|
386
|
+
function FSharpAccessibility_text(accessibility) {
|
|
398
387
|
switch (accessibility.tag) {
|
|
399
|
-
case 1:
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
case 2: {
|
|
404
|
-
Printer__Write_Z721C83C5(printer, "protected ");
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
388
|
+
case 1:
|
|
389
|
+
return "private ";
|
|
390
|
+
case 2:
|
|
391
|
+
return "protected ";
|
|
407
392
|
default:
|
|
408
|
-
|
|
393
|
+
return "";
|
|
409
394
|
}
|
|
410
395
|
}
|
|
411
396
|
|
|
397
|
+
export function FSharpAccessibility_print(printer, accessibility) {
|
|
398
|
+
Printer__Write_Z721C83C5(printer, FSharpAccessibility_text(accessibility));
|
|
399
|
+
}
|
|
400
|
+
|
|
412
401
|
export function FSharpAccessibility_printInline(printer, accessibility) {
|
|
413
|
-
|
|
414
|
-
case 1: {
|
|
415
|
-
Printer__WriteInline_Z721C83C5(printer, "private ");
|
|
416
|
-
break;
|
|
417
|
-
}
|
|
418
|
-
case 2: {
|
|
419
|
-
Printer__WriteInline_Z721C83C5(printer, "protected ");
|
|
420
|
-
break;
|
|
421
|
-
}
|
|
422
|
-
default:
|
|
423
|
-
Printer__WriteInline_Z721C83C5(printer, "");
|
|
424
|
-
}
|
|
402
|
+
Printer__WriteInline_Z721C83C5(printer, FSharpAccessibility_text(accessibility));
|
|
425
403
|
}
|
|
426
404
|
|
|
427
405
|
function codeInline(line) {
|
|
@@ -524,24 +502,203 @@ function printXmlDoc(printer, elements) {
|
|
|
524
502
|
}, patternInput[1]);
|
|
525
503
|
}
|
|
526
504
|
|
|
505
|
+
function printParameterType(typ) {
|
|
506
|
+
if (typ.tag === 12) {
|
|
507
|
+
return concat("(", printType(typ), ")");
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
return printType(typ);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
function printParameterList(printer, separator, parameters) {
|
|
515
|
+
iterateIndexed((index, p) => {
|
|
516
|
+
if (index !== 0) {
|
|
517
|
+
Printer__WriteInline_Z721C83C5(printer, separator);
|
|
518
|
+
}
|
|
519
|
+
printInlineAttributes(printer, p.Attributes);
|
|
520
|
+
if (p.IsOptional) {
|
|
521
|
+
Printer__WriteInline_Z721C83C5(printer, "?");
|
|
522
|
+
}
|
|
523
|
+
Printer__WriteInline_Z721C83C5(printer, concat(p.Name, ": ", printParameterType(p.Type)));
|
|
524
|
+
if (hasParamArrayAttribute(p.Attributes)) {
|
|
525
|
+
Printer__WriteInline_Z721C83C5(printer, " []");
|
|
526
|
+
}
|
|
527
|
+
}, parameters);
|
|
528
|
+
}
|
|
529
|
+
|
|
527
530
|
export function printParameters(printer, parameters) {
|
|
528
|
-
if (
|
|
531
|
+
if (isEmpty(parameters)) {
|
|
529
532
|
Printer__WriteInline_Z721C83C5(printer, "unit");
|
|
530
533
|
}
|
|
531
534
|
else {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
+
printParameterList(printer, " * ", parameters);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function accessorSuffix(accessor) {
|
|
540
|
+
switch (accessor.tag) {
|
|
541
|
+
case 1:
|
|
542
|
+
return " with set";
|
|
543
|
+
case 2:
|
|
544
|
+
return " with get, set";
|
|
545
|
+
default:
|
|
546
|
+
return " with get";
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function printInterfaceMethod(printer, methodInfo) {
|
|
551
|
+
printXmlDoc(printer, methodInfo.XmlDoc);
|
|
552
|
+
printCompactAttributesAndNewLine(printer, methodInfo.Attributes);
|
|
553
|
+
if (methodInfo.IsStatic) {
|
|
554
|
+
Printer__Write_Z721C83C5(printer, "static ");
|
|
555
|
+
}
|
|
556
|
+
else {
|
|
557
|
+
Printer__Write_Z721C83C5(printer, "abstract ");
|
|
558
|
+
}
|
|
559
|
+
Printer__WriteInline_Z721C83C5(printer, concat("member ", methodInfo.Name));
|
|
560
|
+
printTypeParametersDeclaration(printer, methodInfo.TypeParameters);
|
|
561
|
+
if (methodInfo.IsStatic) {
|
|
562
|
+
Printer__WriteInline_Z721C83C5(printer, " ");
|
|
563
|
+
if (isEmpty(methodInfo.Parameters)) {
|
|
564
|
+
Printer__WriteInline_Z721C83C5(printer, "()");
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
Printer__WriteInline_Z721C83C5(printer, "(");
|
|
568
|
+
printParameterList(printer, ", ", methodInfo.Parameters);
|
|
569
|
+
Printer__WriteInline_Z721C83C5(printer, ")");
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
else {
|
|
573
|
+
Printer__WriteInline_Z721C83C5(printer, ": ");
|
|
574
|
+
printParameters(printer, methodInfo.Parameters);
|
|
575
|
+
}
|
|
576
|
+
if (methodInfo.IsStatic) {
|
|
577
|
+
Printer__WriteInline_Z721C83C5(printer, " : ");
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
Printer__WriteInline_Z721C83C5(printer, " -> ");
|
|
581
|
+
}
|
|
582
|
+
Printer__WriteInline_Z721C83C5(printer, printType(methodInfo.Type));
|
|
583
|
+
if (methodInfo.IsStatic) {
|
|
584
|
+
Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
|
|
585
|
+
}
|
|
586
|
+
Printer__get_NewLine(printer);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
function printInterfaceProperty(printer, interfaceInfo, propertyInfo) {
|
|
590
|
+
printXmlDoc(printer, propertyInfo.XmlDoc);
|
|
591
|
+
printAttributes(printer, propertyInfo.Attributes);
|
|
592
|
+
if (propertyInfo.IsStatic) {
|
|
593
|
+
if (propertyInfo.Body.tag === 1) {
|
|
594
|
+
Printer__Write_Z721C83C5(printer, concat("[<Emit(\"\"\"", ((((((("import { " + interfaceInfo.OriginalName) + " } from \"") + Printer__get_ImportSpecifier(printer)) + "\";\n") + interfaceInfo.OriginalName) + ".") + propertyInfo.OriginalName) + "{{=$0}}", "\"\"\")>]"));
|
|
595
|
+
Printer__get_NewLine(printer);
|
|
596
|
+
}
|
|
597
|
+
Printer__Write_Z721C83C5(printer, "static member inline ");
|
|
598
|
+
FSharpAccessibility_printInline(printer, propertyInfo.Accessibility);
|
|
599
|
+
Printer__WriteInline_Z721C83C5(printer, propertyInfo.Name);
|
|
600
|
+
const printGetter = () => {
|
|
601
|
+
Printer__get_Indent(printer);
|
|
602
|
+
Printer__Write_Z721C83C5(printer, concat("with get () : ", printType(propertyInfo.Type), " ="));
|
|
603
|
+
Printer__get_NewLine(printer);
|
|
604
|
+
Printer__get_Indent(printer);
|
|
605
|
+
Printer__Write_Z721C83C5(printer, "nativeOnly");
|
|
606
|
+
Printer__get_Unindent(printer);
|
|
607
|
+
Printer__get_Unindent(printer);
|
|
608
|
+
};
|
|
609
|
+
const printerSetter = (useAndKeyword) => {
|
|
610
|
+
Printer__get_Indent(printer);
|
|
611
|
+
if (useAndKeyword) {
|
|
612
|
+
Printer__Write_Z721C83C5(printer, "and ");
|
|
535
613
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
Printer__WriteInline_Z721C83C5(printer, "?");
|
|
614
|
+
else {
|
|
615
|
+
Printer__Write_Z721C83C5(printer, "with ");
|
|
539
616
|
}
|
|
540
|
-
Printer__WriteInline_Z721C83C5(printer, concat(
|
|
541
|
-
|
|
542
|
-
|
|
617
|
+
Printer__WriteInline_Z721C83C5(printer, concat("set (value: ", printType(propertyInfo.Type), ") ="));
|
|
618
|
+
Printer__get_NewLine(printer);
|
|
619
|
+
Printer__get_Indent(printer);
|
|
620
|
+
Printer__Write_Z721C83C5(printer, "nativeOnly");
|
|
621
|
+
Printer__get_Unindent(printer);
|
|
622
|
+
Printer__get_Unindent(printer);
|
|
623
|
+
};
|
|
624
|
+
const matchValue_1 = propertyInfo.Accessor;
|
|
625
|
+
if (matchValue_1 != null) {
|
|
626
|
+
const accessor = matchValue_1;
|
|
627
|
+
Printer__get_NewLine(printer);
|
|
628
|
+
switch (accessor.tag) {
|
|
629
|
+
case 1: {
|
|
630
|
+
printerSetter(false);
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
case 2: {
|
|
634
|
+
printGetter();
|
|
635
|
+
Printer__get_NewLine(printer);
|
|
636
|
+
printerSetter(true);
|
|
637
|
+
break;
|
|
638
|
+
}
|
|
639
|
+
default:
|
|
640
|
+
printGetter();
|
|
543
641
|
}
|
|
544
|
-
}
|
|
642
|
+
}
|
|
643
|
+
else {
|
|
644
|
+
Printer__WriteInline_Z721C83C5(printer, concat(": ", printType(propertyInfo.Type)));
|
|
645
|
+
Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
Printer__Write_Z721C83C5(printer, concat("abstract member ", propertyInfo.Name));
|
|
650
|
+
iterateIndexed((index, p) => {
|
|
651
|
+
if (index === 0) {
|
|
652
|
+
Printer__WriteInline_Z721C83C5(printer, ": ");
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
655
|
+
Printer__WriteInline_Z721C83C5(printer, " -> ");
|
|
656
|
+
}
|
|
657
|
+
const option = p.IsOptional ? " option" : "";
|
|
658
|
+
Printer__WriteInline_Z721C83C5(printer, concat(p.Name, ": ", printParameterType(p.Type), option));
|
|
659
|
+
}, propertyInfo.Parameters);
|
|
660
|
+
if (length(propertyInfo.Parameters) > 0) {
|
|
661
|
+
Printer__WriteInline_Z721C83C5(printer, " -> ");
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
Printer__WriteInline_Z721C83C5(printer, ": ");
|
|
665
|
+
}
|
|
666
|
+
Printer__WriteInline_Z721C83C5(printer, printType(propertyInfo.Type));
|
|
667
|
+
if (propertyInfo.IsOptional) {
|
|
668
|
+
Printer__WriteInline_Z721C83C5(printer, " option");
|
|
669
|
+
}
|
|
670
|
+
let option_4;
|
|
671
|
+
const option_2 = propertyInfo.Accessor;
|
|
672
|
+
option_4 = ((option_2 != null) ? accessorSuffix(option_2) : undefined);
|
|
673
|
+
if (option_4 != null) {
|
|
674
|
+
Printer__WriteInline_Z721C83C5(printer, option_4);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
Printer__get_NewLine(printer);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
function printInterfaceStaticMember(printer, interfaceInfo, staticMemberInfo) {
|
|
681
|
+
printXmlDoc(printer, staticMemberInfo.XmlDoc);
|
|
682
|
+
printCompactAttributesAndNewLine(printer, staticMemberInfo.Attributes);
|
|
683
|
+
const macroArguments = join(", ", mapIndexed((index, _arg) => (`$${index}`), staticMemberInfo.Parameters));
|
|
684
|
+
Printer__Write_Z721C83C5(printer, `[<Emit("""import { ${interfaceInfo.OriginalName} } from "${Printer__get_ImportSpecifier(printer)}";
|
|
685
|
+
${interfaceInfo.OriginalName}.${staticMemberInfo.OriginalName}(${macroArguments})""")>]`);
|
|
686
|
+
Printer__get_NewLine(printer);
|
|
687
|
+
Printer__Write_Z721C83C5(printer, concat("static member inline ", staticMemberInfo.Name, " "));
|
|
688
|
+
printTypeParametersDeclaration(printer, staticMemberInfo.TypeParameters);
|
|
689
|
+
if (isEmpty(staticMemberInfo.Parameters)) {
|
|
690
|
+
Printer__WriteInline_Z721C83C5(printer, "() : ");
|
|
691
|
+
Printer__WriteInline_Z721C83C5(printer, printType(staticMemberInfo.Type));
|
|
692
|
+
Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
|
|
693
|
+
Printer__get_NewLine(printer);
|
|
694
|
+
}
|
|
695
|
+
else {
|
|
696
|
+
Printer__WriteInline_Z721C83C5(printer, "(");
|
|
697
|
+
printParameterList(printer, ", ", staticMemberInfo.Parameters);
|
|
698
|
+
Printer__WriteInline_Z721C83C5(printer, "): ");
|
|
699
|
+
Printer__WriteInline_Z721C83C5(printer, printType(staticMemberInfo.Type));
|
|
700
|
+
Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
|
|
701
|
+
Printer__get_NewLine(printer);
|
|
545
702
|
}
|
|
546
703
|
}
|
|
547
704
|
|
|
@@ -558,209 +715,17 @@ function printInterface(printer, interfaceInfo) {
|
|
|
558
715
|
Printer__get_NewLine(printer);
|
|
559
716
|
}, interfaceInfo.Inheritance);
|
|
560
717
|
iterate((_arg) => {
|
|
561
|
-
let _arg_1;
|
|
562
718
|
switch (_arg.tag) {
|
|
563
719
|
case 1: {
|
|
564
|
-
|
|
565
|
-
printXmlDoc(printer, propertyInfo.XmlDoc);
|
|
566
|
-
printAttributes(printer, propertyInfo.Attributes);
|
|
567
|
-
if (propertyInfo.IsStatic) {
|
|
568
|
-
Printer__Write_Z721C83C5(printer, "static member inline ");
|
|
569
|
-
FSharpAccessibility_printInline(printer, propertyInfo.Accessibility);
|
|
570
|
-
Printer__WriteInline_Z721C83C5(printer, propertyInfo.Name);
|
|
571
|
-
const printGetter = () => {
|
|
572
|
-
Printer__get_Indent(printer);
|
|
573
|
-
Printer__Write_Z721C83C5(printer, concat("with get () : ", printType(propertyInfo.Type), " ="));
|
|
574
|
-
Printer__get_NewLine(printer);
|
|
575
|
-
Printer__get_Indent(printer);
|
|
576
|
-
if (propertyInfo.Body.tag === 1) {
|
|
577
|
-
Printer__Write_Z721C83C5(printer, `emitJsExpr () $$"""
|
|
578
|
-
import { ${interfaceInfo.OriginalName} } from "${Printer__get_ImportSpecifier(printer)}";
|
|
579
|
-
${interfaceInfo.OriginalName}.${propertyInfo.OriginalName}"""`);
|
|
580
|
-
}
|
|
581
|
-
else {
|
|
582
|
-
Printer__Write_Z721C83C5(printer, "nativeOnly");
|
|
583
|
-
}
|
|
584
|
-
Printer__get_Unindent(printer);
|
|
585
|
-
Printer__get_Unindent(printer);
|
|
586
|
-
};
|
|
587
|
-
const printerSetter = (useAndKeyword) => {
|
|
588
|
-
Printer__get_Indent(printer);
|
|
589
|
-
if (useAndKeyword) {
|
|
590
|
-
Printer__Write_Z721C83C5(printer, "and ");
|
|
591
|
-
}
|
|
592
|
-
else {
|
|
593
|
-
Printer__Write_Z721C83C5(printer, "with ");
|
|
594
|
-
}
|
|
595
|
-
Printer__WriteInline_Z721C83C5(printer, concat("set (value: ", printType(propertyInfo.Type), ") ="));
|
|
596
|
-
Printer__get_NewLine(printer);
|
|
597
|
-
Printer__get_Indent(printer);
|
|
598
|
-
if (propertyInfo.Body.tag === 1) {
|
|
599
|
-
Printer__Write_Z721C83C5(printer, `emitJsExpr (value) $$"""
|
|
600
|
-
import { ${interfaceInfo.OriginalName} } from "${Printer__get_ImportSpecifier(printer)}";
|
|
601
|
-
${interfaceInfo.OriginalName}.${propertyInfo.OriginalName} = $0"""`);
|
|
602
|
-
}
|
|
603
|
-
else {
|
|
604
|
-
Printer__Write_Z721C83C5(printer, "nativeOnly");
|
|
605
|
-
}
|
|
606
|
-
Printer__get_Unindent(printer);
|
|
607
|
-
Printer__get_Unindent(printer);
|
|
608
|
-
};
|
|
609
|
-
const matchValue_2 = propertyInfo.Accessor;
|
|
610
|
-
if (matchValue_2 != null) {
|
|
611
|
-
const accessor = matchValue_2;
|
|
612
|
-
Printer__get_NewLine(printer);
|
|
613
|
-
switch (accessor.tag) {
|
|
614
|
-
case 1: {
|
|
615
|
-
printerSetter(false);
|
|
616
|
-
break;
|
|
617
|
-
}
|
|
618
|
-
case 2: {
|
|
619
|
-
printGetter();
|
|
620
|
-
Printer__get_NewLine(printer);
|
|
621
|
-
printerSetter(true);
|
|
622
|
-
break;
|
|
623
|
-
}
|
|
624
|
-
default:
|
|
625
|
-
printGetter();
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
else {
|
|
629
|
-
Printer__WriteInline_Z721C83C5(printer, concat(": ", printType(propertyInfo.Type)));
|
|
630
|
-
Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
else {
|
|
634
|
-
Printer__Write_Z721C83C5(printer, concat("abstract member ", propertyInfo.Name));
|
|
635
|
-
iterateIndexed((index_1, p_1) => {
|
|
636
|
-
if (index_1 === 0) {
|
|
637
|
-
Printer__WriteInline_Z721C83C5(printer, ": ");
|
|
638
|
-
}
|
|
639
|
-
else {
|
|
640
|
-
Printer__WriteInline_Z721C83C5(printer, " -> ");
|
|
641
|
-
}
|
|
642
|
-
const option = p_1.IsOptional ? " option" : "";
|
|
643
|
-
Printer__WriteInline_Z721C83C5(printer, concat(p_1.Name, ": ", printType(p_1.Type), option));
|
|
644
|
-
}, propertyInfo.Parameters);
|
|
645
|
-
if (length(propertyInfo.Parameters) > 0) {
|
|
646
|
-
Printer__WriteInline_Z721C83C5(printer, " -> ");
|
|
647
|
-
}
|
|
648
|
-
else {
|
|
649
|
-
Printer__WriteInline_Z721C83C5(printer, ": ");
|
|
650
|
-
}
|
|
651
|
-
Printer__WriteInline_Z721C83C5(printer, printType(propertyInfo.Type));
|
|
652
|
-
if (propertyInfo.IsOptional) {
|
|
653
|
-
Printer__WriteInline_Z721C83C5(printer, " option");
|
|
654
|
-
}
|
|
655
|
-
let option_4;
|
|
656
|
-
const option_2 = propertyInfo.Accessor;
|
|
657
|
-
option_4 = ((option_2 != null) ? ((_arg_1 = option_2, (_arg_1.tag === 1) ? " with set" : ((_arg_1.tag === 2) ? " with get, set" : " with get"))) : undefined);
|
|
658
|
-
if (option_4 != null) {
|
|
659
|
-
Printer__WriteInline_Z721C83C5(printer, option_4);
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
Printer__get_NewLine(printer);
|
|
720
|
+
printInterfaceProperty(printer, interfaceInfo, _arg.fields[0]);
|
|
663
721
|
break;
|
|
664
722
|
}
|
|
665
723
|
case 2: {
|
|
666
|
-
|
|
667
|
-
printXmlDoc(printer, staticMemberInfo.XmlDoc);
|
|
668
|
-
printCompactAttributesAndNewLine(printer, staticMemberInfo.Attributes);
|
|
669
|
-
Printer__Write_Z721C83C5(printer, concat("static member inline ", staticMemberInfo.Name, " "));
|
|
670
|
-
printTypeParametersDeclaration(printer, staticMemberInfo.TypeParameters);
|
|
671
|
-
if (isEmpty(staticMemberInfo.Parameters)) {
|
|
672
|
-
Printer__WriteInline_Z721C83C5(printer, "() : ");
|
|
673
|
-
Printer__WriteInline_Z721C83C5(printer, printType(staticMemberInfo.Type));
|
|
674
|
-
Printer__WriteInline_Z721C83C5(printer, " =");
|
|
675
|
-
Printer__get_Indent(printer);
|
|
676
|
-
Printer__get_NewLine(printer);
|
|
677
|
-
Printer__Write_Z721C83C5(printer, `emitJsExpr () $$"""
|
|
678
|
-
import { ${interfaceInfo.OriginalName} } from "${Printer__get_ImportSpecifier(printer)}";
|
|
679
|
-
${interfaceInfo.OriginalName}.${staticMemberInfo.OriginalName}()"""`);
|
|
680
|
-
Printer__get_NewLine(printer);
|
|
681
|
-
Printer__get_Unindent(printer);
|
|
682
|
-
}
|
|
683
|
-
else {
|
|
684
|
-
Printer__WriteInline_Z721C83C5(printer, "(");
|
|
685
|
-
iterateIndexed((index_2, p_2) => {
|
|
686
|
-
if (index_2 !== 0) {
|
|
687
|
-
Printer__WriteInline_Z721C83C5(printer, ", ");
|
|
688
|
-
}
|
|
689
|
-
printInlineAttributes(printer, p_2.Attributes);
|
|
690
|
-
if (p_2.IsOptional) {
|
|
691
|
-
Printer__WriteInline_Z721C83C5(printer, "?");
|
|
692
|
-
}
|
|
693
|
-
Printer__WriteInline_Z721C83C5(printer, concat(p_2.Name, ": ", printType(p_2.Type)));
|
|
694
|
-
if (hasParamArrayAttribute(p_2.Attributes)) {
|
|
695
|
-
Printer__WriteInline_Z721C83C5(printer, " []");
|
|
696
|
-
}
|
|
697
|
-
}, staticMemberInfo.Parameters);
|
|
698
|
-
Printer__WriteInline_Z721C83C5(printer, "): ");
|
|
699
|
-
Printer__WriteInline_Z721C83C5(printer, printType(staticMemberInfo.Type));
|
|
700
|
-
Printer__WriteInline_Z721C83C5(printer, " =");
|
|
701
|
-
Printer__get_NewLine(printer);
|
|
702
|
-
Printer__get_Indent(printer);
|
|
703
|
-
const forwardedArgments = join(", ", map((p_3) => p_3.Name, staticMemberInfo.Parameters));
|
|
704
|
-
const macroArguments = join(", ", mapIndexed((index_3, _arg_2) => (`$${index_3}`), staticMemberInfo.Parameters));
|
|
705
|
-
Printer__Write_Z721C83C5(printer, `emitJsExpr (${forwardedArgments}) $$"""
|
|
706
|
-
import { ${interfaceInfo.OriginalName} } from "${Printer__get_ImportSpecifier(printer)}";
|
|
707
|
-
${interfaceInfo.OriginalName}.${staticMemberInfo.OriginalName}(${macroArguments})"""`);
|
|
708
|
-
Printer__get_NewLine(printer);
|
|
709
|
-
Printer__get_Unindent(printer);
|
|
710
|
-
}
|
|
724
|
+
printInterfaceStaticMember(printer, interfaceInfo, _arg.fields[0]);
|
|
711
725
|
break;
|
|
712
726
|
}
|
|
713
|
-
default:
|
|
714
|
-
|
|
715
|
-
printXmlDoc(printer, methodInfo.XmlDoc);
|
|
716
|
-
printCompactAttributesAndNewLine(printer, methodInfo.Attributes);
|
|
717
|
-
if (methodInfo.IsStatic) {
|
|
718
|
-
Printer__Write_Z721C83C5(printer, "static ");
|
|
719
|
-
}
|
|
720
|
-
else {
|
|
721
|
-
Printer__Write_Z721C83C5(printer, "abstract ");
|
|
722
|
-
}
|
|
723
|
-
Printer__WriteInline_Z721C83C5(printer, concat("member ", methodInfo.Name));
|
|
724
|
-
printTypeParametersDeclaration(printer, methodInfo.TypeParameters);
|
|
725
|
-
if (methodInfo.IsStatic) {
|
|
726
|
-
Printer__WriteInline_Z721C83C5(printer, " ");
|
|
727
|
-
if (length(methodInfo.Parameters) === 0) {
|
|
728
|
-
Printer__WriteInline_Z721C83C5(printer, "()");
|
|
729
|
-
}
|
|
730
|
-
else {
|
|
731
|
-
Printer__WriteInline_Z721C83C5(printer, "(");
|
|
732
|
-
iterateIndexed((index, p) => {
|
|
733
|
-
if (index !== 0) {
|
|
734
|
-
Printer__WriteInline_Z721C83C5(printer, ", ");
|
|
735
|
-
}
|
|
736
|
-
printInlineAttributes(printer, p.Attributes);
|
|
737
|
-
if (p.IsOptional) {
|
|
738
|
-
Printer__WriteInline_Z721C83C5(printer, "?");
|
|
739
|
-
}
|
|
740
|
-
Printer__WriteInline_Z721C83C5(printer, concat(p.Name, ": ", printType(p.Type)));
|
|
741
|
-
if (hasParamArrayAttribute(p.Attributes)) {
|
|
742
|
-
Printer__WriteInline_Z721C83C5(printer, " []");
|
|
743
|
-
}
|
|
744
|
-
}, methodInfo.Parameters);
|
|
745
|
-
Printer__WriteInline_Z721C83C5(printer, ")");
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
else {
|
|
749
|
-
Printer__WriteInline_Z721C83C5(printer, ": ");
|
|
750
|
-
printParameters(printer, methodInfo.Parameters);
|
|
751
|
-
}
|
|
752
|
-
if (methodInfo.IsStatic) {
|
|
753
|
-
Printer__WriteInline_Z721C83C5(printer, " : ");
|
|
754
|
-
}
|
|
755
|
-
else {
|
|
756
|
-
Printer__WriteInline_Z721C83C5(printer, " -> ");
|
|
757
|
-
}
|
|
758
|
-
Printer__WriteInline_Z721C83C5(printer, printType(methodInfo.Type));
|
|
759
|
-
if (methodInfo.IsStatic) {
|
|
760
|
-
Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
|
|
761
|
-
}
|
|
762
|
-
Printer__get_NewLine(printer);
|
|
763
|
-
}
|
|
727
|
+
default:
|
|
728
|
+
printInterfaceMethod(printer, _arg.fields[0]);
|
|
764
729
|
}
|
|
765
730
|
}, interfaceInfo.Members);
|
|
766
731
|
if (isEmpty(interfaceInfo.Members) && isEmpty(interfaceInfo.Inheritance)) {
|
|
@@ -791,7 +756,7 @@ function printPrimaryConstructor(printer, constructor) {
|
|
|
791
756
|
else {
|
|
792
757
|
Printer__Write_Z721C83C5(printer, "");
|
|
793
758
|
}
|
|
794
|
-
Printer__WriteInline_Z721C83C5(printer, concat(p.Name, ": ",
|
|
759
|
+
Printer__WriteInline_Z721C83C5(printer, concat(p.Name, ": ", printParameterType(p.Type)));
|
|
795
760
|
if (hasParamArrayAttribute(p.Attributes)) {
|
|
796
761
|
Printer__WriteInline_Z721C83C5(printer, " []");
|
|
797
762
|
}
|
|
@@ -824,7 +789,7 @@ function printClass(printer, classInfo) {
|
|
|
824
789
|
if (p.IsOptional) {
|
|
825
790
|
Printer__WriteInline_Z721C83C5(printer, "?");
|
|
826
791
|
}
|
|
827
|
-
Printer__WriteInline_Z721C83C5(printer, concat(p.Name, ": ",
|
|
792
|
+
Printer__WriteInline_Z721C83C5(printer, concat(p.Name, ": ", printParameterType(p.Type)));
|
|
828
793
|
if (hasParamArrayAttribute(p.Attributes)) {
|
|
829
794
|
Printer__WriteInline_Z721C83C5(printer, " []");
|
|
830
795
|
}
|
|
@@ -844,14 +809,13 @@ function printClass(printer, classInfo) {
|
|
|
844
809
|
}
|
|
845
810
|
if (!isEmpty(classInfo.ExplicitFields)) {
|
|
846
811
|
iterate((explicitField) => {
|
|
847
|
-
let _arg;
|
|
848
812
|
printXmlDoc(printer, explicitField.XmlDoc);
|
|
849
813
|
Printer__Write_Z721C83C5(printer, concat("member val ", explicitField.Name, " : "));
|
|
850
814
|
Printer__WriteInline_Z721C83C5(printer, printType(explicitField.Type));
|
|
851
815
|
Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
|
|
852
816
|
let option_3;
|
|
853
817
|
const option_1 = explicitField.Accessor;
|
|
854
|
-
option_3 = ((option_1 != null) ? (
|
|
818
|
+
option_3 = ((option_1 != null) ? accessorSuffix(option_1) : undefined);
|
|
855
819
|
if (option_3 != null) {
|
|
856
820
|
Printer__WriteInline_Z721C83C5(printer, option_3);
|
|
857
821
|
}
|
|
@@ -862,8 +826,7 @@ function printClass(printer, classInfo) {
|
|
|
862
826
|
}
|
|
863
827
|
|
|
864
828
|
function printEnum(printer, enumInfo) {
|
|
865
|
-
|
|
866
|
-
Printer__get_NewLine(printer);
|
|
829
|
+
printAttributes(printer, singleton(FSharpAttribute.RequireQualifiedAccess));
|
|
867
830
|
Printer__Write_Z721C83C5(printer, concat("type ", enumInfo.Name, " ="));
|
|
868
831
|
Printer__get_NewLine(printer);
|
|
869
832
|
Printer__get_Indent(printer);
|
|
@@ -886,22 +849,43 @@ function printEnum(printer, enumInfo) {
|
|
|
886
849
|
}
|
|
887
850
|
|
|
888
851
|
function printTypeAlias(printer, aliasInfo) {
|
|
889
|
-
|
|
852
|
+
let aliasedType;
|
|
853
|
+
const text = printType(aliasInfo.Type);
|
|
854
|
+
let matchResult;
|
|
855
|
+
if (aliasInfo.Type.tag === 16) {
|
|
856
|
+
if (text.startsWith("(") && text.endsWith(")")) {
|
|
857
|
+
matchResult = 0;
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
matchResult = 1;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
else {
|
|
864
|
+
matchResult = 1;
|
|
865
|
+
}
|
|
866
|
+
switch (matchResult) {
|
|
867
|
+
case 0: {
|
|
868
|
+
aliasedType = substring(text, 1, text.length - 2);
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
default:
|
|
872
|
+
aliasedType = text;
|
|
873
|
+
}
|
|
890
874
|
const usageText = join(" ", append(singleton(aliasedType), choose((_arg) => {
|
|
891
|
-
let
|
|
875
|
+
let matchResult_1, constraint_;
|
|
892
876
|
if (_arg.tag === 1) {
|
|
893
877
|
if (_arg.fields[0].Constraint != null) {
|
|
894
|
-
|
|
878
|
+
matchResult_1 = 0;
|
|
895
879
|
constraint_ = _arg.fields[0].Constraint;
|
|
896
880
|
}
|
|
897
881
|
else {
|
|
898
|
-
|
|
882
|
+
matchResult_1 = 1;
|
|
899
883
|
}
|
|
900
884
|
}
|
|
901
885
|
else {
|
|
902
|
-
|
|
886
|
+
matchResult_1 = 1;
|
|
903
887
|
}
|
|
904
|
-
switch (
|
|
888
|
+
switch (matchResult_1) {
|
|
905
889
|
case 0:
|
|
906
890
|
return printType(constraint_);
|
|
907
891
|
default:
|
|
@@ -946,14 +930,155 @@ function printDelegate(printer, delegateInfo) {
|
|
|
946
930
|
Printer__get_Unindent(printer);
|
|
947
931
|
}
|
|
948
932
|
|
|
949
|
-
function
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
933
|
+
function printUnion(printer, unionInfo) {
|
|
934
|
+
printAttributes(printer, unionInfo.Attributes);
|
|
935
|
+
Printer__Write_Z721C83C5(printer, concat("type ", printTypeNameWithTypeParameters(unionInfo.Name, unionInfo.TypeParameters), " ="));
|
|
936
|
+
Printer__get_NewLine(printer);
|
|
937
|
+
Printer__get_Indent(printer);
|
|
938
|
+
iterate((enumCaseInfo) => {
|
|
939
|
+
Printer__Write_Z721C83C5(printer, "| ");
|
|
940
|
+
switch (enumCaseInfo.tag) {
|
|
941
|
+
case 1: {
|
|
942
|
+
Printer__WriteInline_Z721C83C5(printer, printType(enumCaseInfo.fields[0]));
|
|
943
|
+
break;
|
|
944
|
+
}
|
|
945
|
+
case 2: {
|
|
946
|
+
Printer__WriteInline_Z721C83C5(printer, concat(enumCaseInfo.fields[0], " of ", printType(enumCaseInfo.fields[1])));
|
|
947
|
+
break;
|
|
948
|
+
}
|
|
949
|
+
case 3: {
|
|
950
|
+
const fields = enumCaseInfo.fields[1];
|
|
951
|
+
const caseInfo = enumCaseInfo.fields[0];
|
|
952
|
+
printInlineAttributes(printer, caseInfo.Attributes);
|
|
953
|
+
Printer__WriteInline_Z721C83C5(printer, caseInfo.Name);
|
|
954
|
+
if (!isEmpty(fields)) {
|
|
955
|
+
Printer__WriteInline_Z721C83C5(printer, concat(" of ", join(" * ", map((tupledArg) => concat(tupledArg[0], ": ", printType(tupledArg[1])), fields))));
|
|
956
|
+
}
|
|
957
|
+
break;
|
|
958
|
+
}
|
|
959
|
+
default: {
|
|
960
|
+
const enumCaseInfo_1 = enumCaseInfo.fields[0];
|
|
961
|
+
printInlineAttributes(printer, enumCaseInfo_1.Attributes);
|
|
962
|
+
Printer__WriteInline_Z721C83C5(printer, enumCaseInfo_1.Name);
|
|
963
|
+
}
|
|
954
964
|
}
|
|
955
|
-
|
|
956
|
-
|
|
965
|
+
Printer__get_NewLine(printer);
|
|
966
|
+
}, unionInfo.Cases);
|
|
967
|
+
iterate((constant) => {
|
|
968
|
+
Printer__Write_Z721C83C5(printer, `static member inline ${constant.Name}: ${unionInfo.Name} = ${unionInfo.Name}.${constant.Case} ${constant.Value}`);
|
|
969
|
+
Printer__get_NewLine(printer);
|
|
970
|
+
}, unionInfo.Constants);
|
|
971
|
+
if (exists((_arg) => {
|
|
972
|
+
switch (_arg.tag) {
|
|
973
|
+
case 6:
|
|
974
|
+
case 7:
|
|
975
|
+
return true;
|
|
976
|
+
default:
|
|
977
|
+
return false;
|
|
978
|
+
}
|
|
979
|
+
}, unionInfo.Attributes)) {
|
|
980
|
+
const returnType = printTypeNameWithTypeParameters(unionInfo.Name, unionInfo.TypeParameters);
|
|
981
|
+
iterate((caseType_1) => {
|
|
982
|
+
const enumerator = getEnumerator(["op_Implicit", "op_ErasedCast"]);
|
|
983
|
+
try {
|
|
984
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
985
|
+
const name_2 = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
986
|
+
Printer__get_NewLine(printer);
|
|
987
|
+
Printer__Write_Z721C83C5(printer, "[<Emit(\"$0\")>]");
|
|
988
|
+
Printer__get_NewLine(printer);
|
|
989
|
+
Printer__Write_Z721C83C5(printer, `static member ${name_2}(value: ${caseType_1}) : ${returnType} = nativeOnly`);
|
|
990
|
+
Printer__get_NewLine(printer);
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
finally {
|
|
994
|
+
disposeSafe(enumerator);
|
|
995
|
+
}
|
|
996
|
+
}, List_distinctBy((caseType) => {
|
|
997
|
+
if (caseType === "JS.Uint8ClampedArray") {
|
|
998
|
+
return "JS.Uint8Array";
|
|
999
|
+
}
|
|
1000
|
+
else {
|
|
1001
|
+
return caseType;
|
|
1002
|
+
}
|
|
1003
|
+
}, choose((_arg_1) => {
|
|
1004
|
+
if (_arg_1.tag === 2) {
|
|
1005
|
+
return printType(_arg_1.fields[1]);
|
|
1006
|
+
}
|
|
1007
|
+
else {
|
|
1008
|
+
return undefined;
|
|
1009
|
+
}
|
|
1010
|
+
}, unionInfo.Cases), {
|
|
1011
|
+
Equals: (x, y) => (x === y),
|
|
1012
|
+
GetHashCode: (x) => (stringHash(x) | 0),
|
|
1013
|
+
}));
|
|
1014
|
+
}
|
|
1015
|
+
Printer__get_Unindent(printer);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
function printSingleErasedCaseUnion(printer, erasedCaseUnionInfo) {
|
|
1019
|
+
printXmlDoc(printer, erasedCaseUnionInfo.XmlDoc);
|
|
1020
|
+
printAttributes(printer, cons(FSharpAttribute.Erase, erasedCaseUnionInfo.Attributes));
|
|
1021
|
+
Printer__Write_Z721C83C5(printer, concat("type ", erasedCaseUnionInfo.Name));
|
|
1022
|
+
printTypeParametersDeclaration(printer, singleton(erasedCaseUnionInfo.TypeParameter));
|
|
1023
|
+
Printer__WriteInline_Z721C83C5(printer, " =");
|
|
1024
|
+
Printer__get_NewLine(printer);
|
|
1025
|
+
Printer__get_Indent(printer);
|
|
1026
|
+
Printer__Write_Z721C83C5(printer, concat("| ", erasedCaseUnionInfo.Name, " of "));
|
|
1027
|
+
const matchValue = erasedCaseUnionInfo.TypeParameter;
|
|
1028
|
+
if (matchValue.tag === 1) {
|
|
1029
|
+
Printer__WriteInline_Z721C83C5(printer, concat("\'", matchValue.fields[0].Name));
|
|
1030
|
+
}
|
|
1031
|
+
else {
|
|
1032
|
+
Printer__WriteInline_Z721C83C5(printer, printType(matchValue.fields[0]));
|
|
1033
|
+
}
|
|
1034
|
+
Printer__get_NewLine(printer);
|
|
1035
|
+
Printer__get_NewLine(printer);
|
|
1036
|
+
Printer__Write_Z721C83C5(printer, "member inline this.Value =");
|
|
1037
|
+
Printer__get_NewLine(printer);
|
|
1038
|
+
Printer__get_Indent(printer);
|
|
1039
|
+
Printer__Write_Z721C83C5(printer, concat("let (", erasedCaseUnionInfo.Name, " output) = this"));
|
|
1040
|
+
Printer__get_NewLine(printer);
|
|
1041
|
+
Printer__Write_Z721C83C5(printer, "output");
|
|
1042
|
+
Printer__get_NewLine(printer);
|
|
1043
|
+
Printer__get_Unindent(printer);
|
|
1044
|
+
Printer__get_Unindent(printer);
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
function printTypeExtension(printer, extensionInfo) {
|
|
1048
|
+
printAttributes(printer, singleton(FSharpAttribute.AutoOpen));
|
|
1049
|
+
Printer__Write_Z721C83C5(printer, concat("module ", extensionInfo.ModuleName, " ="));
|
|
1050
|
+
Printer__get_NewLine(printer);
|
|
1051
|
+
Printer__get_Indent(printer);
|
|
1052
|
+
Printer__get_NewLine(printer);
|
|
1053
|
+
Printer__Write_Z721C83C5(printer, concat("type ", printTypeNameWithTypeParameters(extensionInfo.TargetName, extensionInfo.TypeParameters), " with"));
|
|
1054
|
+
Printer__get_NewLine(printer);
|
|
1055
|
+
Printer__get_Indent(printer);
|
|
1056
|
+
const enumerator = getEnumerator(extensionInfo.Members);
|
|
1057
|
+
try {
|
|
1058
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1059
|
+
const extensionMember = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1060
|
+
const parameters = join(", ", map((parameter) => concat(parameter.Name, ": ", printParameterType(parameter.Type)), extensionMember.Parameters));
|
|
1061
|
+
const arguments$ = join(", ", map((_arg) => _arg.Name, extensionMember.Parameters));
|
|
1062
|
+
Printer__Write_Z721C83C5(printer, `member inline this.${extensionMember.Name}(${parameters}) : ${printType(extensionMember.ReturnType)} =`);
|
|
1063
|
+
Printer__get_NewLine(printer);
|
|
1064
|
+
Printer__get_Indent(printer);
|
|
1065
|
+
Printer__Write_Z721C83C5(printer, `this.${extensionMember.Name}.Invoke(${arguments$})`);
|
|
1066
|
+
Printer__get_NewLine(printer);
|
|
1067
|
+
Printer__get_Unindent(printer);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
finally {
|
|
1071
|
+
disposeSafe(enumerator);
|
|
1072
|
+
}
|
|
1073
|
+
Printer__get_Unindent(printer);
|
|
1074
|
+
Printer__get_Unindent(printer);
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
function print(printer, fsharpTypes) {
|
|
1078
|
+
const enumerator = getEnumerator(fsharpTypes);
|
|
1079
|
+
try {
|
|
1080
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1081
|
+
const fsharpType = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
957
1082
|
Printer__get_NewLine(printer);
|
|
958
1083
|
switch (fsharpType.tag) {
|
|
959
1084
|
case 0: {
|
|
@@ -997,39 +1122,17 @@ function print(printer_mut, fsharpTypes_mut) {
|
|
|
997
1122
|
break;
|
|
998
1123
|
}
|
|
999
1124
|
case 2: {
|
|
1000
|
-
|
|
1001
|
-
printXmlDoc(printer, erasedCaseUnionInfo.XmlDoc);
|
|
1002
|
-
printAttributes(printer, cons(FSharpAttribute.Erase, erasedCaseUnionInfo.Attributes));
|
|
1003
|
-
Printer__Write_Z721C83C5(printer, concat("type ", erasedCaseUnionInfo.Name));
|
|
1004
|
-
printTypeParametersDeclaration(printer, singleton(erasedCaseUnionInfo.TypeParameter));
|
|
1005
|
-
Printer__WriteInline_Z721C83C5(printer, " =");
|
|
1006
|
-
Printer__get_NewLine(printer);
|
|
1007
|
-
Printer__get_Indent(printer);
|
|
1008
|
-
Printer__Write_Z721C83C5(printer, concat("| ", erasedCaseUnionInfo.Name, " of "));
|
|
1009
|
-
const matchValue = erasedCaseUnionInfo.TypeParameter;
|
|
1010
|
-
if (matchValue.tag === 1) {
|
|
1011
|
-
Printer__WriteInline_Z721C83C5(printer, concat("\'", matchValue.fields[0].Name));
|
|
1012
|
-
}
|
|
1013
|
-
else {
|
|
1014
|
-
Printer__WriteInline_Z721C83C5(printer, printType(matchValue.fields[0]));
|
|
1015
|
-
}
|
|
1016
|
-
Printer__get_NewLine(printer);
|
|
1017
|
-
Printer__get_NewLine(printer);
|
|
1018
|
-
Printer__Write_Z721C83C5(printer, "member inline this.Value =");
|
|
1019
|
-
Printer__get_NewLine(printer);
|
|
1020
|
-
Printer__get_Indent(printer);
|
|
1021
|
-
Printer__Write_Z721C83C5(printer, concat("let (", erasedCaseUnionInfo.Name, " output) = this"));
|
|
1022
|
-
Printer__get_NewLine(printer);
|
|
1023
|
-
Printer__Write_Z721C83C5(printer, "output");
|
|
1024
|
-
Printer__get_NewLine(printer);
|
|
1025
|
-
Printer__get_Unindent(printer);
|
|
1026
|
-
Printer__get_Unindent(printer);
|
|
1125
|
+
printSingleErasedCaseUnion(printer, fsharpType.fields[0]);
|
|
1027
1126
|
break;
|
|
1028
1127
|
}
|
|
1029
1128
|
case 20: {
|
|
1030
1129
|
printDelegate(printer, fsharpType.fields[0]);
|
|
1031
1130
|
break;
|
|
1032
1131
|
}
|
|
1132
|
+
case 21: {
|
|
1133
|
+
printTypeExtension(printer, fsharpType.fields[0]);
|
|
1134
|
+
break;
|
|
1135
|
+
}
|
|
1033
1136
|
case 7:
|
|
1034
1137
|
case 8:
|
|
1035
1138
|
case 18:
|
|
@@ -1044,54 +1147,13 @@ function print(printer_mut, fsharpTypes_mut) {
|
|
|
1044
1147
|
case 15: {
|
|
1045
1148
|
break;
|
|
1046
1149
|
}
|
|
1047
|
-
default:
|
|
1048
|
-
|
|
1049
|
-
printAttributes(printer, unionInfo.Attributes);
|
|
1050
|
-
Printer__Write_Z721C83C5(printer, concat("type ", printTypeNameWithTypeParameters(unionInfo.Name, unionInfo.TypeParameters), " ="));
|
|
1051
|
-
Printer__get_NewLine(printer);
|
|
1052
|
-
Printer__get_Indent(printer);
|
|
1053
|
-
iterate((enumCaseInfo) => {
|
|
1054
|
-
Printer__Write_Z721C83C5(printer, "| ");
|
|
1055
|
-
switch (enumCaseInfo.tag) {
|
|
1056
|
-
case 1: {
|
|
1057
|
-
Printer__WriteInline_Z721C83C5(printer, printType(enumCaseInfo.fields[0]));
|
|
1058
|
-
Printer__get_NewLine(printer);
|
|
1059
|
-
break;
|
|
1060
|
-
}
|
|
1061
|
-
case 2: {
|
|
1062
|
-
Printer__WriteInline_Z721C83C5(printer, concat(enumCaseInfo.fields[0], " of ", printType(enumCaseInfo.fields[1])));
|
|
1063
|
-
break;
|
|
1064
|
-
}
|
|
1065
|
-
case 3: {
|
|
1066
|
-
const fields = enumCaseInfo.fields[1];
|
|
1067
|
-
const caseInfo = enumCaseInfo.fields[0];
|
|
1068
|
-
printInlineAttributes(printer, caseInfo.Attributes);
|
|
1069
|
-
Printer__WriteInline_Z721C83C5(printer, caseInfo.Name);
|
|
1070
|
-
if (!isEmpty(fields)) {
|
|
1071
|
-
Printer__WriteInline_Z721C83C5(printer, concat(" of ", join(" * ", map((tupledArg) => concat(tupledArg[0], ": ", printType(tupledArg[1])), fields))));
|
|
1072
|
-
}
|
|
1073
|
-
break;
|
|
1074
|
-
}
|
|
1075
|
-
default: {
|
|
1076
|
-
const enumCaseInfo_1 = enumCaseInfo.fields[0];
|
|
1077
|
-
printInlineAttributes(printer, enumCaseInfo_1.Attributes);
|
|
1078
|
-
Printer__WriteInline_Z721C83C5(printer, enumCaseInfo_1.Name);
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
Printer__get_NewLine(printer);
|
|
1082
|
-
}, unionInfo.Cases);
|
|
1083
|
-
iterate((constant) => {
|
|
1084
|
-
Printer__Write_Z721C83C5(printer, `static member inline ${constant.Name}: ${unionInfo.Name} = ${unionInfo.Name}.${constant.Case} ${constant.Value}`);
|
|
1085
|
-
Printer__get_NewLine(printer);
|
|
1086
|
-
}, unionInfo.Constants);
|
|
1087
|
-
Printer__get_Unindent(printer);
|
|
1088
|
-
}
|
|
1150
|
+
default:
|
|
1151
|
+
printUnion(printer, fsharpType.fields[0]);
|
|
1089
1152
|
}
|
|
1090
|
-
printer_mut = printer;
|
|
1091
|
-
fsharpTypes_mut = tail_1(fsharpTypes);
|
|
1092
|
-
continue print;
|
|
1093
1153
|
}
|
|
1094
|
-
|
|
1154
|
+
}
|
|
1155
|
+
finally {
|
|
1156
|
+
disposeSafe(enumerator);
|
|
1095
1157
|
}
|
|
1096
1158
|
}
|
|
1097
1159
|
|
|
@@ -1106,19 +1168,24 @@ export function printFileWith(namespace_, isPackage, externalBindings, printer,
|
|
|
1106
1168
|
const bodyPrinter = Printer_$ctor();
|
|
1107
1169
|
print(bodyPrinter, transformResult.FSharpAST);
|
|
1108
1170
|
body = toString(bodyPrinter);
|
|
1109
|
-
const outFile = new FSharpOutFile(namespace_, ofArray(["Fable.Core", "Fable.Core.JsInterop", "System"]));
|
|
1110
1171
|
if (isPackage) {
|
|
1111
|
-
Printer__Write_Z721C83C5(printer, concat("namespace rec ",
|
|
1172
|
+
Printer__Write_Z721C83C5(printer, concat("namespace rec ", namespace_));
|
|
1112
1173
|
}
|
|
1113
1174
|
else {
|
|
1114
|
-
Printer__Write_Z721C83C5(printer, concat("module rec ",
|
|
1175
|
+
Printer__Write_Z721C83C5(printer, concat("module rec ", namespace_));
|
|
1115
1176
|
}
|
|
1116
1177
|
Printer__get_NewLine(printer);
|
|
1117
1178
|
Printer__get_NewLine(printer);
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1179
|
+
const enumerator = getEnumerator(["Fable.Core", "Fable.Core.JsInterop", "System"]);
|
|
1180
|
+
try {
|
|
1181
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1182
|
+
Printer__Write_Z721C83C5(printer, concat("open ", enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]()));
|
|
1183
|
+
Printer__get_NewLine(printer);
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
finally {
|
|
1187
|
+
disposeSafe(enumerator);
|
|
1188
|
+
}
|
|
1122
1189
|
if (transformResult.IncludeReadonlyArrayAlias && !namespace_.startsWith("Glutinum.Types")) {
|
|
1123
1190
|
Printer__get_NewLine(printer);
|
|
1124
1191
|
Printer__Write_Z721C83C5(printer, "// You need to add Glutinum.Types NuGet package to your project");
|
|
@@ -1126,10 +1193,10 @@ export function printFileWith(namespace_, isPackage, externalBindings, printer,
|
|
|
1126
1193
|
Printer__Write_Z721C83C5(printer, "open Glutinum.Types.TypeScript");
|
|
1127
1194
|
Printer__get_NewLine(printer);
|
|
1128
1195
|
}
|
|
1129
|
-
const
|
|
1196
|
+
const enumerator_1 = getEnumerator(externalBindings);
|
|
1130
1197
|
try {
|
|
1131
|
-
while (
|
|
1132
|
-
const externalBinding =
|
|
1198
|
+
while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1199
|
+
const externalBinding = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1133
1200
|
if (body.indexOf(concat("Glutinum.", externalBinding, ".")) >= 0) {
|
|
1134
1201
|
Printer__get_NewLine(printer);
|
|
1135
1202
|
Printer__Write_Z721C83C5(printer, concat("// You need to add Glutinum.", externalBinding, " NuGet package to your project"));
|
|
@@ -1138,7 +1205,7 @@ export function printFileWith(namespace_, isPackage, externalBindings, printer,
|
|
|
1138
1205
|
}
|
|
1139
1206
|
}
|
|
1140
1207
|
finally {
|
|
1141
|
-
disposeSafe(
|
|
1208
|
+
disposeSafe(enumerator_1);
|
|
1142
1209
|
}
|
|
1143
1210
|
if (transformResult.IncludeRegExpAlias) {
|
|
1144
1211
|
Printer__get_NewLine(printer);
|