@glutinum/cli 1.0.0-beta.1 → 1.0.0-beta.11
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 +16 -39
- package/dist/Glutinum.Converter/DelegateExtensions.js +378 -0
- package/dist/Glutinum.Converter/FreeTypeParameters.js +211 -0
- package/dist/Glutinum.Converter/FsharpAST.js +117 -66
- package/dist/Glutinum.Converter/Generate.js +52 -26
- package/dist/Glutinum.Converter/GlueAST.js +85 -46
- package/dist/Glutinum.Converter/Hosting.js +148 -174
- package/dist/Glutinum.Converter/Merge.js +463 -355
- package/dist/Glutinum.Converter/Packages.js +387 -97
- package/dist/Glutinum.Converter/Printer.js +439 -400
- package/dist/Glutinum.Converter/Read.js +362 -100
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +7 -7
- package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
- package/dist/Glutinum.Converter/Reader/Declaration.js +13 -19
- package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
- package/dist/Glutinum.Converter/Reader/Documentation.js +28 -40
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +2 -2
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +104 -37
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +24 -39
- package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +30 -17
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +16 -22
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +49 -6
- package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +178 -0
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +4 -4
- package/dist/Glutinum.Converter/Reader/MemberTypes.js +126 -0
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +54 -6
- package/dist/Glutinum.Converter/Reader/Node.js +11 -14
- package/dist/Glutinum.Converter/Reader/Parameters.js +39 -30
- package/dist/Glutinum.Converter/Reader/Report.js +4 -4
- package/dist/Glutinum.Converter/Reader/TypeNode.js +390 -1584
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +80 -53
- package/dist/Glutinum.Converter/Reader/TypeParameters.js +2 -2
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +24 -47
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +24 -6
- package/dist/Glutinum.Converter/Reader/Types.js +297 -17
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +16 -30
- package/dist/Glutinum.Converter/Reader/UtilityType.js +811 -0
- package/dist/Glutinum.Converter/Reader/Utils.js +497 -111
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +7 -8
- package/dist/Glutinum.Converter/Transform.js +2915 -8180
- 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 +338 -0
- package/dist/Glutinum.Converter/Transformer/Utils.js +341 -0
- package/dist/Glutinum.Converter/TypeScript.Extensions.js +0 -10
- package/dist/Glutinum.Converter/Utils/Keywords.js +3 -3
- package/dist/Glutinum.Converter/Utils/List.js +2 -2
- package/dist/Glutinum.Converter/Utils/Naming.js +6 -6
- package/dist/Glutinum.Converter/Utils/String.js +16 -5
- package/dist/Program.js +104 -241
- package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs.js +2 -2
- package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs.js +4 -4
- package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs.js +2 -2
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs.js +5 -5
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs.js +4 -4
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs.js +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs.js +4 -4
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs.js +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs.js +2 -2
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs.js +2 -2
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs.js +7 -7
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs.js +1 -1
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Async.js +21 -7
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/AsyncBuilder.js +51 -6
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/CHANGELOG.md +23 -1
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/CollectionUtil.js +10 -16
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MailboxProcessor.js +19 -3
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MutableMap.js +5 -1
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MutableSet.js +5 -1
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Util.js +15 -3
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/package.json +1 -1
- package/package.json +3 -2
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Array.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/BigInt.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/BitConverter.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Boolean.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Char.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Choice.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/ConditionalWeakTable.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Date.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOffset.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOnly.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOnlyTemporal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeFormat.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeOffsetTemporal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeTemporal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Decimal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Directory.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Double.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Encoding.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Environment.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Event.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Collections.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Core.CompilerServices.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Core.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/File.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Global.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Guid.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Int32.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/List.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Long.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Map.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MapUtil.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Native.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Numeric.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Observable.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Option.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Path.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/README.md +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Random.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Range.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Reflection.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/RegExp.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Result.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Seq.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Seq2.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Set.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/String.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.Collections.Generic.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.Text.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Task.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TaskBuilder.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeOnly.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeOnlyTemporal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeSpan.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeSpanTemporal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Timer.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Types.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Unicode.13.0.0.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Uri.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/big.d.ts +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/lib/big.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/quotation.js +0 -0
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
|
|
2
|
-
import { toString } from "../fable_modules/fable-library-js.5.
|
|
3
|
-
import { StringBuilder__AppendLine, StringBuilder__Append_Z721C83C5, StringBuilder_$ctor } from "../fable_modules/fable-library-js.5.
|
|
4
|
-
import { class_type } from "../fable_modules/fable-library-js.5.
|
|
5
|
-
import { max } from "../fable_modules/fable-library-js.5.
|
|
6
|
-
import { trimStart, interpolate, substring, join, replace, concat, isNullOrWhiteSpace, replicate } from "../fable_modules/fable-library-js.5.
|
|
7
|
-
import { isDigit2 } from "../fable_modules/fable-library-js.5.17.2/Char.js";
|
|
2
|
+
import { toString } from "../fable_modules/fable-library-js.5.21.0/Types.js";
|
|
3
|
+
import { StringBuilder__AppendLine, StringBuilder__Append_Z721C83C5, StringBuilder_$ctor } from "../fable_modules/fable-library-js.5.21.0/System.Text.js";
|
|
4
|
+
import { class_type } from "../fable_modules/fable-library-js.5.21.0/Reflection.js";
|
|
5
|
+
import { max } from "../fable_modules/fable-library-js.5.21.0/Double.js";
|
|
6
|
+
import { trimStart, interpolate, substring, join, replace, concat, isNullOrWhiteSpace, replicate } from "../fable_modules/fable-library-js.5.21.0/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.21.0/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.21.0/List.js";
|
|
10
|
+
import { stringHash, disposeSafe, getEnumerator, int32ToString, Exception } from "../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
11
11
|
import { sanitizeTypeParameterName } from "./Utils/Naming.js";
|
|
12
|
-
import { escape, create, isMatch, replace as replace_2 } from "../fable_modules/fable-library-js.5.
|
|
12
|
+
import { escape, create, isMatch, replace as replace_2 } from "../fable_modules/fable-library-js.5.21.0/RegExp.js";
|
|
13
13
|
import { removeConsecutiveEmptyLines, trimEmptyLines } from "./Utils/List.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { FSharpInterface, FSharpAttribute } from "./FsharpAST.js";
|
|
15
|
+
import { singleton as singleton_1, append as append_1, delay, toList } from "../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
16
|
+
import { List_distinctBy } from "../fable_modules/fable-library-js.5.21.0/Seq2.js";
|
|
16
17
|
|
|
17
18
|
export class Printer {
|
|
18
19
|
constructor() {
|
|
@@ -44,16 +45,14 @@ export function Printer__get_Unindent(__) {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
|
-
* Write the
|
|
48
|
+
* Write the text prefixed with the indentation
|
|
48
49
|
*/
|
|
49
50
|
export function Printer__Write_Z721C83C5(__, text) {
|
|
50
51
|
StringBuilder__Append_Z721C83C5(__.buffer, replicate(__.indentationLevel, __.indentationText) + text);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
/**
|
|
54
|
-
* Write the
|
|
55
|
-
*
|
|
56
|
-
* Useful when you don't want to prefix the text with indentation
|
|
55
|
+
* Write the text without indentation
|
|
57
56
|
*/
|
|
58
57
|
export function Printer__WriteInline_Z721C83C5(__, text) {
|
|
59
58
|
StringBuilder__Append_Z721C83C5(__.buffer, text);
|
|
@@ -75,21 +74,9 @@ export function Printer__set_ImportSpecifier_Z721C83C5(__, v) {
|
|
|
75
74
|
__["ImportSpecifier@"] = v;
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
export function Naming_$007CDigit$007C_$007C(digit) {
|
|
79
|
-
if (isNullOrWhiteSpace(digit)) {
|
|
80
|
-
return undefined;
|
|
81
|
-
}
|
|
82
|
-
else if (isDigit2(digit, 0)) {
|
|
83
|
-
return digit;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
return undefined;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
77
|
function sanitizeEnumCaseName(name) {
|
|
91
78
|
const name_1 = capitalizeFirstLetter(removeDoubleQuote(removeSingleQuote(name)));
|
|
92
|
-
if (
|
|
79
|
+
if (!isNullOrWhiteSpace(name_1) && isDigit2(name_1, 0)) {
|
|
93
80
|
return concat("``", name_1, "``");
|
|
94
81
|
}
|
|
95
82
|
else {
|
|
@@ -125,6 +112,10 @@ function caseRulesToText(caseRules) {
|
|
|
125
112
|
}
|
|
126
113
|
}
|
|
127
114
|
|
|
115
|
+
function escapeStringLiteral(text) {
|
|
116
|
+
return replace(replace(replace(replace(replace(text, "\\", "\\\\"), "\"", "\\\""), "\r", "\\r"), "\n", "\\n"), "\t", "\\t");
|
|
117
|
+
}
|
|
118
|
+
|
|
128
119
|
function attributeToText(fsharpAttribute) {
|
|
129
120
|
switch (fsharpAttribute.tag) {
|
|
130
121
|
case 1:
|
|
@@ -142,7 +133,7 @@ function attributeToText(fsharpAttribute) {
|
|
|
142
133
|
case 8:
|
|
143
134
|
return `[<TypeScriptTaggedUnion("${fsharpAttribute.fields[0]}", ${caseRulesToText(fsharpAttribute.fields[1])})>]`;
|
|
144
135
|
case 13:
|
|
145
|
-
return concat("[<CompiledName(\"",
|
|
136
|
+
return concat("[<CompiledName(\"", escapeStringLiteral(fsharpAttribute.fields[0]), "\")>]");
|
|
146
137
|
case 14:
|
|
147
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")))), ")>]");
|
|
148
139
|
case 15:
|
|
@@ -159,8 +150,8 @@ function attributeToText(fsharpAttribute) {
|
|
|
159
150
|
return "[<EmitIndexer>]";
|
|
160
151
|
case 21:
|
|
161
152
|
if (fsharpAttribute.fields[0] != null) {
|
|
162
|
-
const
|
|
163
|
-
return concat("[<Global(\"",
|
|
153
|
+
const name_2 = fsharpAttribute.fields[0];
|
|
154
|
+
return concat("[<Global(\"", name_2, "\")>]");
|
|
164
155
|
}
|
|
165
156
|
else {
|
|
166
157
|
return "[<Global>]";
|
|
@@ -180,16 +171,7 @@ function attributeToText(fsharpAttribute) {
|
|
|
180
171
|
return "[<Obsolete>]";
|
|
181
172
|
}
|
|
182
173
|
else {
|
|
183
|
-
|
|
184
|
-
if ((message_1.indexOf("``") >= 0) ? true : (message_1.indexOf("\"\"\"") >= 0)) {
|
|
185
|
-
return concat("[<Obsolete(\"", replace(replace(replace(replace(replace(message_1, "\\", "\\\\"), "\"", "\\\""), "\r", "\\r"), "\n", "\\n"), "\t", "\\t"), "\")>]");
|
|
186
|
-
}
|
|
187
|
-
else if ((message_1.indexOf("\n") >= 0) ? true : (message_1.indexOf("\"") >= 0)) {
|
|
188
|
-
return concat("[<Obsolete(\"\"\"", message_1, "\"\"\")>]");
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
return concat("[<Obsolete(\"", message_1, "\")>]");
|
|
192
|
-
}
|
|
174
|
+
return concat("[<Obsolete(\"", escapeStringLiteral(fsharpAttribute.fields[0]), "\")>]");
|
|
193
175
|
}
|
|
194
176
|
case 9:
|
|
195
177
|
return "[<AbstractClass>]";
|
|
@@ -202,21 +184,20 @@ function attributeToText(fsharpAttribute) {
|
|
|
202
184
|
}
|
|
203
185
|
}
|
|
204
186
|
|
|
205
|
-
function
|
|
206
|
-
|
|
207
|
-
Printer__WriteInline_Z721C83C5(printer, " ");
|
|
187
|
+
function compactAttributesText(fsharpAttributes) {
|
|
188
|
+
return replace_1(">][<", "; ", join("", map(attributeToText, fsharpAttributes)));
|
|
208
189
|
}
|
|
209
190
|
|
|
210
191
|
function printInlineAttributes(printer, fsharpAttributes) {
|
|
211
|
-
if (
|
|
212
|
-
Printer__WriteInline_Z721C83C5(printer,
|
|
192
|
+
if (!isEmpty(fsharpAttributes)) {
|
|
193
|
+
Printer__WriteInline_Z721C83C5(printer, compactAttributesText(fsharpAttributes));
|
|
213
194
|
Printer__WriteInline_Z721C83C5(printer, " ");
|
|
214
195
|
}
|
|
215
196
|
}
|
|
216
197
|
|
|
217
198
|
function printCompactAttributesAndNewLine(printer, fsharpAttributes) {
|
|
218
|
-
if (
|
|
219
|
-
Printer__Write_Z721C83C5(printer,
|
|
199
|
+
if (!isEmpty(fsharpAttributes)) {
|
|
200
|
+
Printer__Write_Z721C83C5(printer, compactAttributesText(fsharpAttributes));
|
|
220
201
|
Printer__get_NewLine(printer);
|
|
221
202
|
}
|
|
222
203
|
}
|
|
@@ -229,18 +210,18 @@ function printAttributes(printer, fsharpAttributes) {
|
|
|
229
210
|
}
|
|
230
211
|
|
|
231
212
|
export function printTypeParametersDeclaration(printer, typeParameters) {
|
|
232
|
-
const
|
|
213
|
+
const innerPrinter = Printer_$ctor();
|
|
233
214
|
if (!isEmpty(typeParameters)) {
|
|
234
|
-
Printer__WriteInline_Z721C83C5(
|
|
215
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, "<");
|
|
235
216
|
iterateIndexed((index, typeParameter) => {
|
|
236
217
|
if (index !== 0) {
|
|
237
|
-
Printer__WriteInline_Z721C83C5(
|
|
218
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, ", ");
|
|
238
219
|
}
|
|
239
220
|
if (typeParameter.tag === 1) {
|
|
240
|
-
Printer__WriteInline_Z721C83C5(
|
|
221
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, concat("\'", sanitizeTypeParameterName(typeParameter.fields[0].Name)));
|
|
241
222
|
}
|
|
242
223
|
else {
|
|
243
|
-
Printer__WriteInline_Z721C83C5(
|
|
224
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, `'T${index}`);
|
|
244
225
|
}
|
|
245
226
|
}, typeParameters);
|
|
246
227
|
iterateIndexed((index_1, typeParameter_3) => {
|
|
@@ -250,14 +231,14 @@ export function printTypeParametersDeclaration(printer, typeParameters) {
|
|
|
250
231
|
else {
|
|
251
232
|
const constraint_ = matchValue;
|
|
252
233
|
if (index_1 === 0) {
|
|
253
|
-
Printer__WriteInline_Z721C83C5(
|
|
234
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, " when ");
|
|
254
235
|
}
|
|
255
236
|
else {
|
|
256
|
-
Printer__WriteInline_Z721C83C5(
|
|
237
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, " and ");
|
|
257
238
|
}
|
|
258
|
-
Printer__WriteInline_Z721C83C5(
|
|
259
|
-
Printer__WriteInline_Z721C83C5(
|
|
260
|
-
Printer__WriteInline_Z721C83C5(
|
|
239
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, concat("\'", typeParameter_3.Name));
|
|
240
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, " :> ");
|
|
241
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, printType(constraint_));
|
|
261
242
|
}
|
|
262
243
|
}, filter((_arg_1) => (_arg_1.Constraint != null), choose((_arg) => {
|
|
263
244
|
if (_arg.tag === 1) {
|
|
@@ -267,11 +248,11 @@ export function printTypeParametersDeclaration(printer, typeParameters) {
|
|
|
267
248
|
return undefined;
|
|
268
249
|
}
|
|
269
250
|
}, typeParameters)));
|
|
270
|
-
if (Printer__ToStringWithoutTrailNewLine(
|
|
271
|
-
Printer__WriteInline_Z721C83C5(
|
|
251
|
+
if (Printer__ToStringWithoutTrailNewLine(innerPrinter).endsWith(">")) {
|
|
252
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, " ");
|
|
272
253
|
}
|
|
273
|
-
Printer__WriteInline_Z721C83C5(
|
|
274
|
-
Printer__WriteInline_Z721C83C5(printer, Printer__ToStringWithoutTrailNewLine(
|
|
254
|
+
Printer__WriteInline_Z721C83C5(innerPrinter, ">");
|
|
255
|
+
Printer__WriteInline_Z721C83C5(printer, Printer__ToStringWithoutTrailNewLine(innerPrinter));
|
|
275
256
|
}
|
|
276
257
|
}
|
|
277
258
|
|
|
@@ -402,34 +383,23 @@ export function printType(fsharpType) {
|
|
|
402
383
|
}
|
|
403
384
|
}
|
|
404
385
|
|
|
405
|
-
|
|
386
|
+
function FSharpAccessibility_text(accessibility) {
|
|
406
387
|
switch (accessibility.tag) {
|
|
407
|
-
case 1:
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
case 2: {
|
|
412
|
-
Printer__Write_Z721C83C5(printer, "protected ");
|
|
413
|
-
break;
|
|
414
|
-
}
|
|
388
|
+
case 1:
|
|
389
|
+
return "private ";
|
|
390
|
+
case 2:
|
|
391
|
+
return "protected ";
|
|
415
392
|
default:
|
|
416
|
-
|
|
393
|
+
return "";
|
|
417
394
|
}
|
|
418
395
|
}
|
|
419
396
|
|
|
397
|
+
export function FSharpAccessibility_print(printer, accessibility) {
|
|
398
|
+
Printer__Write_Z721C83C5(printer, FSharpAccessibility_text(accessibility));
|
|
399
|
+
}
|
|
400
|
+
|
|
420
401
|
export function FSharpAccessibility_printInline(printer, accessibility) {
|
|
421
|
-
|
|
422
|
-
case 1: {
|
|
423
|
-
Printer__WriteInline_Z721C83C5(printer, "private ");
|
|
424
|
-
break;
|
|
425
|
-
}
|
|
426
|
-
case 2: {
|
|
427
|
-
Printer__WriteInline_Z721C83C5(printer, "protected ");
|
|
428
|
-
break;
|
|
429
|
-
}
|
|
430
|
-
default:
|
|
431
|
-
Printer__WriteInline_Z721C83C5(printer, "");
|
|
432
|
-
}
|
|
402
|
+
Printer__WriteInline_Z721C83C5(printer, FSharpAccessibility_text(accessibility));
|
|
433
403
|
}
|
|
434
404
|
|
|
435
405
|
function codeInline(line) {
|
|
@@ -541,24 +511,194 @@ function printParameterType(typ) {
|
|
|
541
511
|
}
|
|
542
512
|
}
|
|
543
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
|
+
|
|
544
530
|
export function printParameters(printer, parameters) {
|
|
545
|
-
if (
|
|
531
|
+
if (isEmpty(parameters)) {
|
|
546
532
|
Printer__WriteInline_Z721C83C5(printer, "unit");
|
|
547
533
|
}
|
|
548
534
|
else {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
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 ");
|
|
552
613
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
Printer__WriteInline_Z721C83C5(printer, "?");
|
|
614
|
+
else {
|
|
615
|
+
Printer__Write_Z721C83C5(printer, "with ");
|
|
556
616
|
}
|
|
557
|
-
Printer__WriteInline_Z721C83C5(printer, concat(
|
|
558
|
-
|
|
559
|
-
|
|
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();
|
|
560
641
|
}
|
|
561
|
-
}
|
|
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);
|
|
562
702
|
}
|
|
563
703
|
}
|
|
564
704
|
|
|
@@ -575,189 +715,17 @@ function printInterface(printer, interfaceInfo) {
|
|
|
575
715
|
Printer__get_NewLine(printer);
|
|
576
716
|
}, interfaceInfo.Inheritance);
|
|
577
717
|
iterate((_arg) => {
|
|
578
|
-
let _arg_1;
|
|
579
718
|
switch (_arg.tag) {
|
|
580
719
|
case 1: {
|
|
581
|
-
|
|
582
|
-
printXmlDoc(printer, propertyInfo.XmlDoc);
|
|
583
|
-
printAttributes(printer, propertyInfo.Attributes);
|
|
584
|
-
if (propertyInfo.IsStatic) {
|
|
585
|
-
if (propertyInfo.Body.tag === 1) {
|
|
586
|
-
Printer__Write_Z721C83C5(printer, concat("[<Emit(\"\"\"", ((((((("import { " + interfaceInfo.OriginalName) + " } from \"") + Printer__get_ImportSpecifier(printer)) + "\";\n") + interfaceInfo.OriginalName) + ".") + propertyInfo.OriginalName) + "{{=$0}}", "\"\"\")>]"));
|
|
587
|
-
Printer__get_NewLine(printer);
|
|
588
|
-
}
|
|
589
|
-
Printer__Write_Z721C83C5(printer, "static member inline ");
|
|
590
|
-
FSharpAccessibility_printInline(printer, propertyInfo.Accessibility);
|
|
591
|
-
Printer__WriteInline_Z721C83C5(printer, propertyInfo.Name);
|
|
592
|
-
const printGetter = () => {
|
|
593
|
-
Printer__get_Indent(printer);
|
|
594
|
-
Printer__Write_Z721C83C5(printer, concat("with get () : ", printType(propertyInfo.Type), " ="));
|
|
595
|
-
Printer__get_NewLine(printer);
|
|
596
|
-
Printer__get_Indent(printer);
|
|
597
|
-
Printer__Write_Z721C83C5(printer, "nativeOnly");
|
|
598
|
-
Printer__get_Unindent(printer);
|
|
599
|
-
Printer__get_Unindent(printer);
|
|
600
|
-
};
|
|
601
|
-
const printerSetter = (useAndKeyword) => {
|
|
602
|
-
Printer__get_Indent(printer);
|
|
603
|
-
if (useAndKeyword) {
|
|
604
|
-
Printer__Write_Z721C83C5(printer, "and ");
|
|
605
|
-
}
|
|
606
|
-
else {
|
|
607
|
-
Printer__Write_Z721C83C5(printer, "with ");
|
|
608
|
-
}
|
|
609
|
-
Printer__WriteInline_Z721C83C5(printer, concat("set (value: ", printType(propertyInfo.Type), ") ="));
|
|
610
|
-
Printer__get_NewLine(printer);
|
|
611
|
-
Printer__get_Indent(printer);
|
|
612
|
-
Printer__Write_Z721C83C5(printer, "nativeOnly");
|
|
613
|
-
Printer__get_Unindent(printer);
|
|
614
|
-
Printer__get_Unindent(printer);
|
|
615
|
-
};
|
|
616
|
-
const matchValue_1 = propertyInfo.Accessor;
|
|
617
|
-
if (matchValue_1 != null) {
|
|
618
|
-
const accessor = matchValue_1;
|
|
619
|
-
Printer__get_NewLine(printer);
|
|
620
|
-
switch (accessor.tag) {
|
|
621
|
-
case 1: {
|
|
622
|
-
printerSetter(false);
|
|
623
|
-
break;
|
|
624
|
-
}
|
|
625
|
-
case 2: {
|
|
626
|
-
printGetter();
|
|
627
|
-
Printer__get_NewLine(printer);
|
|
628
|
-
printerSetter(true);
|
|
629
|
-
break;
|
|
630
|
-
}
|
|
631
|
-
default:
|
|
632
|
-
printGetter();
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
else {
|
|
636
|
-
Printer__WriteInline_Z721C83C5(printer, concat(": ", printType(propertyInfo.Type)));
|
|
637
|
-
Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
else {
|
|
641
|
-
Printer__Write_Z721C83C5(printer, concat("abstract member ", propertyInfo.Name));
|
|
642
|
-
iterateIndexed((index_1, p_1) => {
|
|
643
|
-
if (index_1 === 0) {
|
|
644
|
-
Printer__WriteInline_Z721C83C5(printer, ": ");
|
|
645
|
-
}
|
|
646
|
-
else {
|
|
647
|
-
Printer__WriteInline_Z721C83C5(printer, " -> ");
|
|
648
|
-
}
|
|
649
|
-
const option = p_1.IsOptional ? " option" : "";
|
|
650
|
-
Printer__WriteInline_Z721C83C5(printer, concat(p_1.Name, ": ", printParameterType(p_1.Type), option));
|
|
651
|
-
}, propertyInfo.Parameters);
|
|
652
|
-
if (length(propertyInfo.Parameters) > 0) {
|
|
653
|
-
Printer__WriteInline_Z721C83C5(printer, " -> ");
|
|
654
|
-
}
|
|
655
|
-
else {
|
|
656
|
-
Printer__WriteInline_Z721C83C5(printer, ": ");
|
|
657
|
-
}
|
|
658
|
-
Printer__WriteInline_Z721C83C5(printer, printType(propertyInfo.Type));
|
|
659
|
-
if (propertyInfo.IsOptional) {
|
|
660
|
-
Printer__WriteInline_Z721C83C5(printer, " option");
|
|
661
|
-
}
|
|
662
|
-
let option_4;
|
|
663
|
-
const option_2 = propertyInfo.Accessor;
|
|
664
|
-
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);
|
|
665
|
-
if (option_4 != null) {
|
|
666
|
-
Printer__WriteInline_Z721C83C5(printer, option_4);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
Printer__get_NewLine(printer);
|
|
720
|
+
printInterfaceProperty(printer, interfaceInfo, _arg.fields[0]);
|
|
670
721
|
break;
|
|
671
722
|
}
|
|
672
723
|
case 2: {
|
|
673
|
-
|
|
674
|
-
printXmlDoc(printer, staticMemberInfo.XmlDoc);
|
|
675
|
-
printCompactAttributesAndNewLine(printer, staticMemberInfo.Attributes);
|
|
676
|
-
const macroArguments = join(", ", mapIndexed((index_2, _arg_2) => (`$${index_2}`), staticMemberInfo.Parameters));
|
|
677
|
-
Printer__Write_Z721C83C5(printer, `[<Emit("""import { ${interfaceInfo.OriginalName} } from "${Printer__get_ImportSpecifier(printer)}";
|
|
678
|
-
${interfaceInfo.OriginalName}.${staticMemberInfo.OriginalName}(${macroArguments})""")>]`);
|
|
679
|
-
Printer__get_NewLine(printer);
|
|
680
|
-
Printer__Write_Z721C83C5(printer, concat("static member inline ", staticMemberInfo.Name, " "));
|
|
681
|
-
printTypeParametersDeclaration(printer, staticMemberInfo.TypeParameters);
|
|
682
|
-
if (isEmpty(staticMemberInfo.Parameters)) {
|
|
683
|
-
Printer__WriteInline_Z721C83C5(printer, "() : ");
|
|
684
|
-
Printer__WriteInline_Z721C83C5(printer, printType(staticMemberInfo.Type));
|
|
685
|
-
Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
|
|
686
|
-
Printer__get_NewLine(printer);
|
|
687
|
-
}
|
|
688
|
-
else {
|
|
689
|
-
Printer__WriteInline_Z721C83C5(printer, "(");
|
|
690
|
-
iterateIndexed((index_3, p_2) => {
|
|
691
|
-
if (index_3 !== 0) {
|
|
692
|
-
Printer__WriteInline_Z721C83C5(printer, ", ");
|
|
693
|
-
}
|
|
694
|
-
printInlineAttributes(printer, p_2.Attributes);
|
|
695
|
-
if (p_2.IsOptional) {
|
|
696
|
-
Printer__WriteInline_Z721C83C5(printer, "?");
|
|
697
|
-
}
|
|
698
|
-
Printer__WriteInline_Z721C83C5(printer, concat(p_2.Name, ": ", printParameterType(p_2.Type)));
|
|
699
|
-
if (hasParamArrayAttribute(p_2.Attributes)) {
|
|
700
|
-
Printer__WriteInline_Z721C83C5(printer, " []");
|
|
701
|
-
}
|
|
702
|
-
}, staticMemberInfo.Parameters);
|
|
703
|
-
Printer__WriteInline_Z721C83C5(printer, "): ");
|
|
704
|
-
Printer__WriteInline_Z721C83C5(printer, printType(staticMemberInfo.Type));
|
|
705
|
-
Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
|
|
706
|
-
Printer__get_NewLine(printer);
|
|
707
|
-
}
|
|
724
|
+
printInterfaceStaticMember(printer, interfaceInfo, _arg.fields[0]);
|
|
708
725
|
break;
|
|
709
726
|
}
|
|
710
|
-
default:
|
|
711
|
-
|
|
712
|
-
printXmlDoc(printer, methodInfo.XmlDoc);
|
|
713
|
-
printCompactAttributesAndNewLine(printer, methodInfo.Attributes);
|
|
714
|
-
if (methodInfo.IsStatic) {
|
|
715
|
-
Printer__Write_Z721C83C5(printer, "static ");
|
|
716
|
-
}
|
|
717
|
-
else {
|
|
718
|
-
Printer__Write_Z721C83C5(printer, "abstract ");
|
|
719
|
-
}
|
|
720
|
-
Printer__WriteInline_Z721C83C5(printer, concat("member ", methodInfo.Name));
|
|
721
|
-
printTypeParametersDeclaration(printer, methodInfo.TypeParameters);
|
|
722
|
-
if (methodInfo.IsStatic) {
|
|
723
|
-
Printer__WriteInline_Z721C83C5(printer, " ");
|
|
724
|
-
if (length(methodInfo.Parameters) === 0) {
|
|
725
|
-
Printer__WriteInline_Z721C83C5(printer, "()");
|
|
726
|
-
}
|
|
727
|
-
else {
|
|
728
|
-
Printer__WriteInline_Z721C83C5(printer, "(");
|
|
729
|
-
iterateIndexed((index, p) => {
|
|
730
|
-
if (index !== 0) {
|
|
731
|
-
Printer__WriteInline_Z721C83C5(printer, ", ");
|
|
732
|
-
}
|
|
733
|
-
printInlineAttributes(printer, p.Attributes);
|
|
734
|
-
if (p.IsOptional) {
|
|
735
|
-
Printer__WriteInline_Z721C83C5(printer, "?");
|
|
736
|
-
}
|
|
737
|
-
Printer__WriteInline_Z721C83C5(printer, concat(p.Name, ": ", printParameterType(p.Type)));
|
|
738
|
-
if (hasParamArrayAttribute(p.Attributes)) {
|
|
739
|
-
Printer__WriteInline_Z721C83C5(printer, " []");
|
|
740
|
-
}
|
|
741
|
-
}, methodInfo.Parameters);
|
|
742
|
-
Printer__WriteInline_Z721C83C5(printer, ")");
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
else {
|
|
746
|
-
Printer__WriteInline_Z721C83C5(printer, ": ");
|
|
747
|
-
printParameters(printer, methodInfo.Parameters);
|
|
748
|
-
}
|
|
749
|
-
if (methodInfo.IsStatic) {
|
|
750
|
-
Printer__WriteInline_Z721C83C5(printer, " : ");
|
|
751
|
-
}
|
|
752
|
-
else {
|
|
753
|
-
Printer__WriteInline_Z721C83C5(printer, " -> ");
|
|
754
|
-
}
|
|
755
|
-
Printer__WriteInline_Z721C83C5(printer, printType(methodInfo.Type));
|
|
756
|
-
if (methodInfo.IsStatic) {
|
|
757
|
-
Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
|
|
758
|
-
}
|
|
759
|
-
Printer__get_NewLine(printer);
|
|
760
|
-
}
|
|
727
|
+
default:
|
|
728
|
+
printInterfaceMethod(printer, _arg.fields[0]);
|
|
761
729
|
}
|
|
762
730
|
}, interfaceInfo.Members);
|
|
763
731
|
if (isEmpty(interfaceInfo.Members) && isEmpty(interfaceInfo.Inheritance)) {
|
|
@@ -841,14 +809,13 @@ function printClass(printer, classInfo) {
|
|
|
841
809
|
}
|
|
842
810
|
if (!isEmpty(classInfo.ExplicitFields)) {
|
|
843
811
|
iterate((explicitField) => {
|
|
844
|
-
let _arg;
|
|
845
812
|
printXmlDoc(printer, explicitField.XmlDoc);
|
|
846
813
|
Printer__Write_Z721C83C5(printer, concat("member val ", explicitField.Name, " : "));
|
|
847
814
|
Printer__WriteInline_Z721C83C5(printer, printType(explicitField.Type));
|
|
848
815
|
Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
|
|
849
816
|
let option_3;
|
|
850
817
|
const option_1 = explicitField.Accessor;
|
|
851
|
-
option_3 = ((option_1 != null) ? (
|
|
818
|
+
option_3 = ((option_1 != null) ? accessorSuffix(option_1) : undefined);
|
|
852
819
|
if (option_3 != null) {
|
|
853
820
|
Printer__WriteInline_Z721C83C5(printer, option_3);
|
|
854
821
|
}
|
|
@@ -859,8 +826,7 @@ function printClass(printer, classInfo) {
|
|
|
859
826
|
}
|
|
860
827
|
|
|
861
828
|
function printEnum(printer, enumInfo) {
|
|
862
|
-
|
|
863
|
-
Printer__get_NewLine(printer);
|
|
829
|
+
printAttributes(printer, singleton(FSharpAttribute.RequireQualifiedAccess));
|
|
864
830
|
Printer__Write_Z721C83C5(printer, concat("type ", enumInfo.Name, " ="));
|
|
865
831
|
Printer__get_NewLine(printer);
|
|
866
832
|
Printer__get_Indent(printer);
|
|
@@ -883,22 +849,43 @@ function printEnum(printer, enumInfo) {
|
|
|
883
849
|
}
|
|
884
850
|
|
|
885
851
|
function printTypeAlias(printer, aliasInfo) {
|
|
886
|
-
|
|
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
|
+
}
|
|
887
874
|
const usageText = join(" ", append(singleton(aliasedType), choose((_arg) => {
|
|
888
|
-
let
|
|
875
|
+
let matchResult_1, constraint_;
|
|
889
876
|
if (_arg.tag === 1) {
|
|
890
877
|
if (_arg.fields[0].Constraint != null) {
|
|
891
|
-
|
|
878
|
+
matchResult_1 = 0;
|
|
892
879
|
constraint_ = _arg.fields[0].Constraint;
|
|
893
880
|
}
|
|
894
881
|
else {
|
|
895
|
-
|
|
882
|
+
matchResult_1 = 1;
|
|
896
883
|
}
|
|
897
884
|
}
|
|
898
885
|
else {
|
|
899
|
-
|
|
886
|
+
matchResult_1 = 1;
|
|
900
887
|
}
|
|
901
|
-
switch (
|
|
888
|
+
switch (matchResult_1) {
|
|
902
889
|
case 0:
|
|
903
890
|
return printType(constraint_);
|
|
904
891
|
default:
|
|
@@ -943,14 +930,155 @@ function printDelegate(printer, delegateInfo) {
|
|
|
943
930
|
Printer__get_Unindent(printer);
|
|
944
931
|
}
|
|
945
932
|
|
|
946
|
-
function
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
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
|
+
}
|
|
951
964
|
}
|
|
952
|
-
|
|
953
|
-
|
|
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"]();
|
|
954
1082
|
Printer__get_NewLine(printer);
|
|
955
1083
|
switch (fsharpType.tag) {
|
|
956
1084
|
case 0: {
|
|
@@ -994,33 +1122,7 @@ function print(printer_mut, fsharpTypes_mut) {
|
|
|
994
1122
|
break;
|
|
995
1123
|
}
|
|
996
1124
|
case 2: {
|
|
997
|
-
|
|
998
|
-
printXmlDoc(printer, erasedCaseUnionInfo.XmlDoc);
|
|
999
|
-
printAttributes(printer, cons(FSharpAttribute.Erase, erasedCaseUnionInfo.Attributes));
|
|
1000
|
-
Printer__Write_Z721C83C5(printer, concat("type ", erasedCaseUnionInfo.Name));
|
|
1001
|
-
printTypeParametersDeclaration(printer, singleton(erasedCaseUnionInfo.TypeParameter));
|
|
1002
|
-
Printer__WriteInline_Z721C83C5(printer, " =");
|
|
1003
|
-
Printer__get_NewLine(printer);
|
|
1004
|
-
Printer__get_Indent(printer);
|
|
1005
|
-
Printer__Write_Z721C83C5(printer, concat("| ", erasedCaseUnionInfo.Name, " of "));
|
|
1006
|
-
const matchValue = erasedCaseUnionInfo.TypeParameter;
|
|
1007
|
-
if (matchValue.tag === 1) {
|
|
1008
|
-
Printer__WriteInline_Z721C83C5(printer, concat("\'", matchValue.fields[0].Name));
|
|
1009
|
-
}
|
|
1010
|
-
else {
|
|
1011
|
-
Printer__WriteInline_Z721C83C5(printer, printType(matchValue.fields[0]));
|
|
1012
|
-
}
|
|
1013
|
-
Printer__get_NewLine(printer);
|
|
1014
|
-
Printer__get_NewLine(printer);
|
|
1015
|
-
Printer__Write_Z721C83C5(printer, "member inline this.Value =");
|
|
1016
|
-
Printer__get_NewLine(printer);
|
|
1017
|
-
Printer__get_Indent(printer);
|
|
1018
|
-
Printer__Write_Z721C83C5(printer, concat("let (", erasedCaseUnionInfo.Name, " output) = this"));
|
|
1019
|
-
Printer__get_NewLine(printer);
|
|
1020
|
-
Printer__Write_Z721C83C5(printer, "output");
|
|
1021
|
-
Printer__get_NewLine(printer);
|
|
1022
|
-
Printer__get_Unindent(printer);
|
|
1023
|
-
Printer__get_Unindent(printer);
|
|
1125
|
+
printSingleErasedCaseUnion(printer, fsharpType.fields[0]);
|
|
1024
1126
|
break;
|
|
1025
1127
|
}
|
|
1026
1128
|
case 20: {
|
|
@@ -1028,34 +1130,7 @@ function print(printer_mut, fsharpTypes_mut) {
|
|
|
1028
1130
|
break;
|
|
1029
1131
|
}
|
|
1030
1132
|
case 21: {
|
|
1031
|
-
|
|
1032
|
-
printAttributes(printer, singleton(FSharpAttribute.AutoOpen));
|
|
1033
|
-
Printer__Write_Z721C83C5(printer, concat("module ", extensionInfo.ModuleName, " ="));
|
|
1034
|
-
Printer__get_NewLine(printer);
|
|
1035
|
-
Printer__get_Indent(printer);
|
|
1036
|
-
Printer__get_NewLine(printer);
|
|
1037
|
-
Printer__Write_Z721C83C5(printer, concat("type ", printTypeNameWithTypeParameters(extensionInfo.TargetName, extensionInfo.TypeParameters), " with"));
|
|
1038
|
-
Printer__get_NewLine(printer);
|
|
1039
|
-
Printer__get_Indent(printer);
|
|
1040
|
-
const enumerator = getEnumerator(extensionInfo.Members);
|
|
1041
|
-
try {
|
|
1042
|
-
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1043
|
-
const extensionMember = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1044
|
-
const parameters = join(", ", map((parameter) => concat(parameter.Name, ": ", printParameterType(parameter.Type)), extensionMember.Parameters));
|
|
1045
|
-
const arguments$ = join(", ", map((_arg) => _arg.Name, extensionMember.Parameters));
|
|
1046
|
-
Printer__Write_Z721C83C5(printer, `member inline this.${extensionMember.Name}(${parameters}) : ${printType(extensionMember.ReturnType)} =`);
|
|
1047
|
-
Printer__get_NewLine(printer);
|
|
1048
|
-
Printer__get_Indent(printer);
|
|
1049
|
-
Printer__Write_Z721C83C5(printer, `this.${extensionMember.Name}.Invoke(${arguments$})`);
|
|
1050
|
-
Printer__get_NewLine(printer);
|
|
1051
|
-
Printer__get_Unindent(printer);
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
finally {
|
|
1055
|
-
disposeSafe(enumerator);
|
|
1056
|
-
}
|
|
1057
|
-
Printer__get_Unindent(printer);
|
|
1058
|
-
Printer__get_Unindent(printer);
|
|
1133
|
+
printTypeExtension(printer, fsharpType.fields[0]);
|
|
1059
1134
|
break;
|
|
1060
1135
|
}
|
|
1061
1136
|
case 7:
|
|
@@ -1072,54 +1147,13 @@ function print(printer_mut, fsharpTypes_mut) {
|
|
|
1072
1147
|
case 15: {
|
|
1073
1148
|
break;
|
|
1074
1149
|
}
|
|
1075
|
-
default:
|
|
1076
|
-
|
|
1077
|
-
printAttributes(printer, unionInfo.Attributes);
|
|
1078
|
-
Printer__Write_Z721C83C5(printer, concat("type ", printTypeNameWithTypeParameters(unionInfo.Name, unionInfo.TypeParameters), " ="));
|
|
1079
|
-
Printer__get_NewLine(printer);
|
|
1080
|
-
Printer__get_Indent(printer);
|
|
1081
|
-
iterate((enumCaseInfo) => {
|
|
1082
|
-
Printer__Write_Z721C83C5(printer, "| ");
|
|
1083
|
-
switch (enumCaseInfo.tag) {
|
|
1084
|
-
case 1: {
|
|
1085
|
-
Printer__WriteInline_Z721C83C5(printer, printType(enumCaseInfo.fields[0]));
|
|
1086
|
-
Printer__get_NewLine(printer);
|
|
1087
|
-
break;
|
|
1088
|
-
}
|
|
1089
|
-
case 2: {
|
|
1090
|
-
Printer__WriteInline_Z721C83C5(printer, concat(enumCaseInfo.fields[0], " of ", printType(enumCaseInfo.fields[1])));
|
|
1091
|
-
break;
|
|
1092
|
-
}
|
|
1093
|
-
case 3: {
|
|
1094
|
-
const fields = enumCaseInfo.fields[1];
|
|
1095
|
-
const caseInfo = enumCaseInfo.fields[0];
|
|
1096
|
-
printInlineAttributes(printer, caseInfo.Attributes);
|
|
1097
|
-
Printer__WriteInline_Z721C83C5(printer, caseInfo.Name);
|
|
1098
|
-
if (!isEmpty(fields)) {
|
|
1099
|
-
Printer__WriteInline_Z721C83C5(printer, concat(" of ", join(" * ", map((tupledArg) => concat(tupledArg[0], ": ", printType(tupledArg[1])), fields))));
|
|
1100
|
-
}
|
|
1101
|
-
break;
|
|
1102
|
-
}
|
|
1103
|
-
default: {
|
|
1104
|
-
const enumCaseInfo_1 = enumCaseInfo.fields[0];
|
|
1105
|
-
printInlineAttributes(printer, enumCaseInfo_1.Attributes);
|
|
1106
|
-
Printer__WriteInline_Z721C83C5(printer, enumCaseInfo_1.Name);
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
Printer__get_NewLine(printer);
|
|
1110
|
-
}, unionInfo.Cases);
|
|
1111
|
-
iterate((constant) => {
|
|
1112
|
-
Printer__Write_Z721C83C5(printer, `static member inline ${constant.Name}: ${unionInfo.Name} = ${unionInfo.Name}.${constant.Case} ${constant.Value}`);
|
|
1113
|
-
Printer__get_NewLine(printer);
|
|
1114
|
-
}, unionInfo.Constants);
|
|
1115
|
-
Printer__get_Unindent(printer);
|
|
1116
|
-
}
|
|
1150
|
+
default:
|
|
1151
|
+
printUnion(printer, fsharpType.fields[0]);
|
|
1117
1152
|
}
|
|
1118
|
-
printer_mut = printer;
|
|
1119
|
-
fsharpTypes_mut = tail_1(fsharpTypes);
|
|
1120
|
-
continue print;
|
|
1121
1153
|
}
|
|
1122
|
-
|
|
1154
|
+
}
|
|
1155
|
+
finally {
|
|
1156
|
+
disposeSafe(enumerator);
|
|
1123
1157
|
}
|
|
1124
1158
|
}
|
|
1125
1159
|
|
|
@@ -1134,19 +1168,24 @@ export function printFileWith(namespace_, isPackage, externalBindings, printer,
|
|
|
1134
1168
|
const bodyPrinter = Printer_$ctor();
|
|
1135
1169
|
print(bodyPrinter, transformResult.FSharpAST);
|
|
1136
1170
|
body = toString(bodyPrinter);
|
|
1137
|
-
const outFile = new FSharpOutFile(namespace_, ofArray(["Fable.Core", "Fable.Core.JsInterop", "System"]));
|
|
1138
1171
|
if (isPackage) {
|
|
1139
|
-
Printer__Write_Z721C83C5(printer, concat("namespace rec ",
|
|
1172
|
+
Printer__Write_Z721C83C5(printer, concat("namespace rec ", namespace_));
|
|
1140
1173
|
}
|
|
1141
1174
|
else {
|
|
1142
|
-
Printer__Write_Z721C83C5(printer, concat("module rec ",
|
|
1175
|
+
Printer__Write_Z721C83C5(printer, concat("module rec ", namespace_));
|
|
1143
1176
|
}
|
|
1144
1177
|
Printer__get_NewLine(printer);
|
|
1145
1178
|
Printer__get_NewLine(printer);
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
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
|
+
}
|
|
1150
1189
|
if (transformResult.IncludeReadonlyArrayAlias && !namespace_.startsWith("Glutinum.Types")) {
|
|
1151
1190
|
Printer__get_NewLine(printer);
|
|
1152
1191
|
Printer__Write_Z721C83C5(printer, "// You need to add Glutinum.Types NuGet package to your project");
|
|
@@ -1154,10 +1193,10 @@ export function printFileWith(namespace_, isPackage, externalBindings, printer,
|
|
|
1154
1193
|
Printer__Write_Z721C83C5(printer, "open Glutinum.Types.TypeScript");
|
|
1155
1194
|
Printer__get_NewLine(printer);
|
|
1156
1195
|
}
|
|
1157
|
-
const
|
|
1196
|
+
const enumerator_1 = getEnumerator(externalBindings);
|
|
1158
1197
|
try {
|
|
1159
|
-
while (
|
|
1160
|
-
const externalBinding =
|
|
1198
|
+
while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1199
|
+
const externalBinding = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1161
1200
|
if (body.indexOf(concat("Glutinum.", externalBinding, ".")) >= 0) {
|
|
1162
1201
|
Printer__get_NewLine(printer);
|
|
1163
1202
|
Printer__Write_Z721C83C5(printer, concat("// You need to add Glutinum.", externalBinding, " NuGet package to your project"));
|
|
@@ -1166,7 +1205,7 @@ export function printFileWith(namespace_, isPackage, externalBindings, printer,
|
|
|
1166
1205
|
}
|
|
1167
1206
|
}
|
|
1168
1207
|
finally {
|
|
1169
|
-
disposeSafe(
|
|
1208
|
+
disposeSafe(enumerator_1);
|
|
1170
1209
|
}
|
|
1171
1210
|
if (transformResult.IncludeRegExpAlias) {
|
|
1172
1211
|
Printer__get_NewLine(printer);
|