@glutinum/cli 0.4.0 → 0.6.0

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