@glutinum/cli 0.11.0 → 0.12.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 (46) hide show
  1. package/README.md +48 -0
  2. package/dist/Glutinum.Converter/FsharpAST.js +19 -4
  3. package/dist/Glutinum.Converter/FsharpAST.js.map +1 -1
  4. package/dist/Glutinum.Converter/Generate.js.map +1 -1
  5. package/dist/Glutinum.Converter/GlueAST.js +21 -3
  6. package/dist/Glutinum.Converter/GlueAST.js.map +1 -1
  7. package/dist/Glutinum.Converter/Merge.js.map +1 -1
  8. package/dist/Glutinum.Converter/Printer.js +70 -53
  9. package/dist/Glutinum.Converter/Printer.js.map +1 -1
  10. package/dist/Glutinum.Converter/Read.js.map +1 -1
  11. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js.map +1 -1
  12. package/dist/Glutinum.Converter/Reader/Declaration.js +1 -1
  13. package/dist/Glutinum.Converter/Reader/Declaration.js.map +1 -1
  14. package/dist/Glutinum.Converter/Reader/Documentation.js.map +1 -1
  15. package/dist/Glutinum.Converter/Reader/ExportAssignment.js.map +1 -1
  16. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +1 -1
  17. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js.map +1 -1
  18. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js.map +1 -1
  19. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +1 -1
  20. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js.map +1 -1
  21. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js.map +1 -1
  22. package/dist/Glutinum.Converter/Reader/NamedTupleMember.js.map +1 -1
  23. package/dist/Glutinum.Converter/Reader/Node.js +1 -1
  24. package/dist/Glutinum.Converter/Reader/Node.js.map +1 -1
  25. package/dist/Glutinum.Converter/Reader/Parameters.js.map +1 -1
  26. package/dist/Glutinum.Converter/Reader/Report.js.map +1 -1
  27. package/dist/Glutinum.Converter/Reader/TypeNode.js +163 -52
  28. package/dist/Glutinum.Converter/Reader/TypeNode.js.map +1 -1
  29. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +5 -5
  30. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js.map +1 -1
  31. package/dist/Glutinum.Converter/Reader/TypeParameters.js.map +1 -1
  32. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +7 -7
  33. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js.map +1 -1
  34. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js.map +1 -1
  35. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +2 -2
  36. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js.map +1 -1
  37. package/dist/Glutinum.Converter/Reader/Utils.js +34 -2
  38. package/dist/Glutinum.Converter/Reader/Utils.js.map +1 -1
  39. package/dist/Glutinum.Converter/Reader/VariableStatement.js +1 -1
  40. package/dist/Glutinum.Converter/Reader/VariableStatement.js.map +1 -1
  41. package/dist/Glutinum.Converter/Transform.js +311 -81
  42. package/dist/Glutinum.Converter/Transform.js.map +1 -1
  43. package/dist/Glutinum.Converter/TypeScript.Extensions.js +10 -0
  44. package/dist/Glutinum.Converter/TypeScript.Extensions.js.map +1 -1
  45. package/dist/Glutinum.Converter/Utils/Naming.js.map +1 -1
  46. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  import { bool_type, array_type, string_type, record_type, list_type, class_type } from "../fable_modules/fable-library-js.4.14.0/Reflection.js";
2
2
  import { printf, toFail, interpolate, toText, join, trimStart } from "../fable_modules/fable-library-js.4.14.0/String.js";
3
3
  import { Record } from "../fable_modules/fable-library-js.4.14.0/Types.js";
4
- import { FSharpSingleErasedCaseUnion, FSharpJSApi, FSharpTypeParameter_Create_Z6CFD3565, FSharpEnum, FSharpEnumCase, FSharpUnionCaseNamed, FSharpStaticMemberInfo, FSharpAccessor, FSharpMember, FSharpMemberInfo, FSharpMemberInfoBody, FSharpMapped, FSharpInterface, FSharpClass, FSharpConstructor, FSharpAccessibility, FSharpExplicitField, FSharpParameter, FSharpTypeAlias, FSharpDelegate, FSharpFunctionType, FSharpTypeReference, FSharpUnion, FSharpUnionCase, FSharpThisType, FSharpPrimitive, FSharpLiteral, FSharpCommentTypeParam, FSharpCommentParam, FSharpXmlDoc, FSharpAttribute, FSharpType, FSharpModule, FSharpType_$reflection, FSharpXmlDoc_$reflection, FSharpAttribute_$reflection } from "./FsharpAST.js";
4
+ import { FSharpSingleErasedCaseUnion, FSharpJSApi, FSharpTypeParameterInfo_Create_Z6CFD3565, FSharpEnum, FSharpEnumCase, FSharpUnionCaseNamed, FSharpStaticMemberInfo, FSharpAccessor, FSharpMember, FSharpMemberInfo, FSharpMemberInfoBody, FSharpClass, FSharpConstructor, FSharpAccessibility, FSharpExplicitField, FSharpParameter, FSharpTypeAlias, FSharpDelegate, FSharpFunctionType, FSharpTypeReference, FSharpThisType, FSharpUnion, FSharpUnionCase, FSharpInterface, FSharpTypeParameter, FSharpMapped, FSharpPrimitive, FSharpLiteral, FSharpCommentTypeParam, FSharpCommentParam, FSharpXmlDoc, FSharpAttribute, FSharpType, FSharpModule, FSharpType_$reflection, FSharpXmlDoc_$reflection, FSharpAttribute_$reflection } from "./FsharpAST.js";
5
5
  import { sanitizeNameWithResult, removeSurroundingQuotes, sanitizeName } from "./Utils/Naming.js";
6
6
  import { empty as empty_1, singleton as singleton_1, collect, append, delay, toList } from "../fable_modules/fable-library-js.4.14.0/Seq.js";
7
- import { item, concat, tryFind, choose, collect as collect_1, ofArray, forAll, exists, filter, mapIndexed, length, partition, sortBy, map, append as append_1, head as head_1, tail, singleton, empty, isEmpty } from "../fable_modules/fable-library-js.4.14.0/List.js";
7
+ import { item, concat, collect as collect_1, forAll, exists, filter, tryFind, mapIndexed, partition, ofArray, length, choose, tryHead, iterate, sortBy, map, append as append_1, head as head_1, tail, singleton, empty, isEmpty } from "../fable_modules/fable-library-js.4.14.0/List.js";
8
8
  import { bind, unwrap, value as value_4, map as map_1, defaultArg } from "../fable_modules/fable-library-js.4.14.0/Option.js";
9
- import { int32ToString, safeHash, equals, comparePrimitives } from "../fable_modules/fable-library-js.4.14.0/Util.js";
9
+ import { int32ToString, safeHash, equals, disposeSafe, getEnumerator, comparePrimitives } from "../fable_modules/fable-library-js.4.14.0/Util.js";
10
10
  import { GlueTypeUnion, GlueType, GlueLiteral__ToText, GlueMember, GlueProperty, GlueAccessor, GlueConstructor, GlueType__get_Name } from "./GlueAST.js";
11
11
  import { List_distinct } from "../fable_modules/fable-library-js.4.14.0/Seq2.js";
12
12
  import { apply as apply_1 } from "./Merge.js";
@@ -17,6 +17,7 @@ export class Reporter {
17
17
  this["Errors@"] = [];
18
18
  this["HasRegEpx@"] = false;
19
19
  this["HasReadonlyArray@"] = false;
20
+ this["HasIterable@"] = false;
20
21
  }
21
22
  }
22
23
 
@@ -66,18 +67,19 @@ export function TransformCommentResult_$reflection() {
66
67
  }
67
68
 
68
69
  export class TransformResult extends Record {
69
- constructor(FSharpAST, Warnings, Errors, IncludeRegExpAlias, IncludeReadonlyArrayAlias) {
70
+ constructor(FSharpAST, Warnings, Errors, IncludeRegExpAlias, IncludeReadonlyArrayAlias, IncludeIterableAlias) {
70
71
  super();
71
72
  this.FSharpAST = FSharpAST;
72
73
  this.Warnings = Warnings;
73
74
  this.Errors = Errors;
74
75
  this.IncludeRegExpAlias = IncludeRegExpAlias;
75
76
  this.IncludeReadonlyArrayAlias = IncludeReadonlyArrayAlias;
77
+ this.IncludeIterableAlias = IncludeIterableAlias;
76
78
  }
77
79
  }
78
80
 
79
81
  export function TransformResult_$reflection() {
80
- return record_type("Glutinum.Converter.Transform.TransformResult", [], TransformResult, () => [["FSharpAST", list_type(FSharpType_$reflection())], ["Warnings", array_type(string_type)], ["Errors", array_type(string_type)], ["IncludeRegExpAlias", bool_type], ["IncludeReadonlyArrayAlias", bool_type]]);
82
+ return record_type("Glutinum.Converter.Transform.TransformResult", [], TransformResult, () => [["FSharpAST", list_type(FSharpType_$reflection())], ["Warnings", array_type(string_type)], ["Errors", array_type(string_type)], ["IncludeRegExpAlias", bool_type], ["IncludeReadonlyArrayAlias", bool_type], ["IncludeIterableAlias", bool_type]]);
81
83
  }
82
84
 
83
85
  export function Reporter__get_Warnings(__) {
@@ -104,6 +106,14 @@ export function Reporter__set_HasReadonlyArray_Z1FBCCD16(__, v) {
104
106
  __["HasReadonlyArray@"] = v;
105
107
  }
106
108
 
109
+ export function Reporter__get_HasIterable(__) {
110
+ return __["HasIterable@"];
111
+ }
112
+
113
+ export function Reporter__set_HasIterable_Z1FBCCD16(__, v) {
114
+ __["HasIterable@"] = v;
115
+ }
116
+
107
117
  export function TransformContext__get_FullName(__) {
108
118
  return __["FullName@"];
109
119
  }
@@ -132,6 +142,10 @@ export function TransformContext__ExposeReadonlyArray(_) {
132
142
  Reporter__set_HasReadonlyArray_Z1FBCCD16(_.reporter, true);
133
143
  }
134
144
 
145
+ export function TransformContext__ExposeIterable(_) {
146
+ Reporter__set_HasIterable_Z1FBCCD16(_.reporter, true);
147
+ }
148
+
135
149
  export function TransformContext__ExposeType_Z1D58A540(_, typ) {
136
150
  const matchValue = _.parent;
137
151
  if (matchValue != null) {
@@ -172,39 +186,49 @@ export function TransformContext__AddError_Z721C83C5(_, error) {
172
186
  void (Reporter__get_Errors(_.reporter).push(error));
173
187
  }
174
188
 
189
+ export function TransformContext__ExposeTypeAlias_Z721C83C5(this$, name) {
190
+ switch (name) {
191
+ case "RegExp": {
192
+ TransformContext__ExposeRegExp(this$);
193
+ break;
194
+ }
195
+ case "ReadonlyArray": {
196
+ TransformContext__ExposeReadonlyArray(this$);
197
+ break;
198
+ }
199
+ case "Iterable": {
200
+ TransformContext__ExposeIterable(this$);
201
+ break;
202
+ }
203
+ default:
204
+ 0;
205
+ }
206
+ }
207
+
208
+ export function TransformContext__ExposeTypeAlias_1CE4A880(this$, typ) {
209
+ if (typ.tag === 13) {
210
+ const typeReference = typ.fields[0];
211
+ if (typeReference.IsStandardLibrary) {
212
+ TransformContext__ExposeTypeAlias_Z721C83C5(this$, typeReference.Name);
213
+ }
214
+ return typ;
215
+ }
216
+ else {
217
+ return typ;
218
+ }
219
+ }
220
+
175
221
  function mapTypeNameToFableCoreAwareName(context, typeReference) {
222
+ let mappedName;
176
223
  if (typeReference.IsStandardLibrary) {
177
224
  const matchValue = typeReference.Name;
178
- switch (matchValue) {
179
- case "Date":
180
- return "JS.Date";
181
- case "Promise":
182
- return "JS.Promise";
183
- case "Uint8Array":
184
- return "JS.Uint8Array";
185
- case "ReadonlyArray": {
186
- TransformContext__ExposeReadonlyArray(context);
187
- return "ReadonlyArray";
188
- }
189
- case "Array":
190
- return "ResizeArray";
191
- case "Boolean":
192
- return "bool";
193
- case "Function":
194
- return "Action";
195
- case "RegExp": {
196
- TransformContext__ExposeRegExp(context);
197
- return "RegExp";
198
- }
199
- case "Error":
200
- return "Exception";
201
- default:
202
- return matchValue;
203
- }
225
+ mappedName = ((matchValue === "Date") ? "JS.Date" : ((matchValue === "Promise") ? "JS.Promise" : ((matchValue === "Uint8Array") ? "JS.Uint8Array" : ((matchValue === "Array") ? "ResizeArray" : ((matchValue === "Boolean") ? "bool" : ((matchValue === "Function") ? "Action" : ((matchValue === "Error") ? "Exception" : matchValue)))))));
204
226
  }
205
227
  else {
206
- return typeReference.Name;
228
+ mappedName = typeReference.Name;
207
229
  }
230
+ TransformContext__ExposeTypeAlias_Z721C83C5(context, mappedName);
231
+ return mappedName;
208
232
  }
209
233
 
210
234
  function unwrapOptionIfAlreadyOptional(context, typ, isOptional) {
@@ -384,6 +408,129 @@ function transformTupleType(context, glueTypes) {
384
408
  return new FSharpType(12, [map((glueType) => transformType(context, glueType), glueTypes)]);
385
409
  }
386
410
 
411
+ export function TypeLiteral_tryFindIterableType(context, typeLiteralInfo) {
412
+ const makeIterable = (typeParameter) => (new FSharpType(7, [new FSharpMapped("Iterable", singleton(typeParameter))]));
413
+ const makeIterableObj = () => makeIterable(new FSharpTypeParameter(0, [new FSharpType(18, [])]));
414
+ return map_1((methodSignature_1) => {
415
+ const matchValue = methodSignature_1.Type;
416
+ switch (matchValue.tag) {
417
+ case 13: {
418
+ const typeReference = matchValue.fields[0];
419
+ if (typeReference.Name === "IterableIterator") {
420
+ return makeIterable(new FSharpTypeParameter(0, [transformType(context, head_1(typeReference.TypeArguments))]));
421
+ }
422
+ else {
423
+ return makeIterableObj();
424
+ }
425
+ }
426
+ case 21: {
427
+ let returnType = new FSharpTypeParameter(0, [new FSharpType(18, [])]);
428
+ const enumerator = getEnumerator(matchValue.fields[0].Members);
429
+ try {
430
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
431
+ const m = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
432
+ let matchResult, nextMethodSignature_1;
433
+ if (m.tag === 6) {
434
+ if (m.fields[0].Name === "next") {
435
+ matchResult = 0;
436
+ nextMethodSignature_1 = m.fields[0];
437
+ }
438
+ else {
439
+ matchResult = 1;
440
+ }
441
+ }
442
+ else {
443
+ matchResult = 1;
444
+ }
445
+ switch (matchResult) {
446
+ case 0: {
447
+ const matchValue_1 = nextMethodSignature_1.Type;
448
+ if (matchValue_1.tag === 21) {
449
+ iterate((_arg_1) => {
450
+ let matchResult_1, property_1;
451
+ if (_arg_1.tag === 1) {
452
+ if (_arg_1.fields[0].Name === "value") {
453
+ matchResult_1 = 0;
454
+ property_1 = _arg_1.fields[0];
455
+ }
456
+ else {
457
+ matchResult_1 = 1;
458
+ }
459
+ }
460
+ else {
461
+ matchResult_1 = 1;
462
+ }
463
+ switch (matchResult_1) {
464
+ case 0: {
465
+ returnType = (new FSharpTypeParameter(0, [transformType(context, property_1.Type)]));
466
+ break;
467
+ }
468
+ case 1: {
469
+ break;
470
+ }
471
+ }
472
+ }, matchValue_1.fields[0].Members);
473
+ }
474
+ break;
475
+ }
476
+ }
477
+ }
478
+ }
479
+ finally {
480
+ disposeSafe(enumerator);
481
+ }
482
+ return makeIterable(returnType);
483
+ }
484
+ default:
485
+ return makeIterableObj();
486
+ }
487
+ }, tryHead(choose((_arg) => {
488
+ if (_arg.tag === 6) {
489
+ const methodSignature = _arg.fields[0];
490
+ if (methodSignature.Name === "[Symbol.iterator]") {
491
+ TransformContext__ExposeIterable(context);
492
+ return methodSignature;
493
+ }
494
+ else {
495
+ return void 0;
496
+ }
497
+ }
498
+ else {
499
+ return void 0;
500
+ }
501
+ }, typeLiteralInfo.Members)));
502
+ }
503
+
504
+ function UtilityType_transformReadOnly(context, readonlyInfo, makeTypeAlias) {
505
+ if (readonlyInfo.tag === 1) {
506
+ const interfaces = readonlyInfo.fields[0];
507
+ const patternInput = sanitizeNameAndPushScope(`U${length(interfaces)}`, context);
508
+ const unionType = new FSharpType(1, [new FSharpUnion(empty(), patternInput[0], map((glueInterface) => {
509
+ const context_2 = TransformContext__PushScope_Z721C83C5(patternInput[1], `ReadOnly${glueInterface.Name}`);
510
+ const initialInterface = transformInterface(context_2, glueInterface);
511
+ const adaptedInterface = new FSharpInterface(initialInterface.Attributes, initialInterface.Name, initialInterface.OriginalName, initialInterface.TypeParameters, TransformMembers_forceReadonly(initialInterface.Members), initialInterface.Inheritance);
512
+ TransformContext__ExposeType_Z1D58A540(context_2, new FSharpType(5, [new FSharpInterface(adaptedInterface.Attributes, TransformContext__get_CurrentScopeName(context_2), adaptedInterface.OriginalName, adaptedInterface.TypeParameters, adaptedInterface.Members, adaptedInterface.Inheritance)]));
513
+ return new FSharpUnionCase(1, [new FSharpType(5, [new FSharpInterface(adaptedInterface.Attributes, TransformContext__get_FullName(context_2), adaptedInterface.OriginalName, adaptedInterface.TypeParameters, adaptedInterface.Members, adaptedInterface.Inheritance)])]);
514
+ }, interfaces), false)]);
515
+ if (makeTypeAlias == null) {
516
+ return unionType;
517
+ }
518
+ else {
519
+ return makeTypeAlias(unionType);
520
+ }
521
+ }
522
+ else {
523
+ const interfaceTyp = new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), TransformContext__get_CurrentScopeName(context), TransformContext__get_CurrentScopeName(context), empty(), TransformMembers_forceReadonly(TransformMembers_toFSharpMember(context, readonlyInfo.fields[0])), empty())]);
524
+ if (makeTypeAlias == null) {
525
+ TransformContext__ExposeType_Z1D58A540(context, interfaceTyp);
526
+ return new FSharpType(7, [new FSharpMapped(TransformContext__get_FullName(context), empty())]);
527
+ }
528
+ else {
529
+ return interfaceTyp;
530
+ }
531
+ }
532
+ }
533
+
387
534
  function transformType(context_mut, glueType_mut) {
388
535
  let originalInterface;
389
536
  transformType:
@@ -444,7 +591,14 @@ function transformType(context_mut, glueType_mut) {
444
591
  }
445
592
  case 13: {
446
593
  const typeReference = glueType.fields[0];
447
- return new FSharpType(11, [new FSharpTypeReference(mapTypeNameToFableCoreAwareName(context, typeReference), typeReference.FullName, map((glueType_4) => transformType(context, glueType_4), typeReference.TypeArguments), new FSharpType(8, [new FSharpPrimitive(0, [])]))]);
594
+ return new FSharpType(11, [new FSharpTypeReference(mapTypeNameToFableCoreAwareName(context, typeReference), typeReference.FullName, map((glueType_4) => transformType(context, glueType_4), typeReference.TypeArguments), defaultArg(map_1((glueType_6) => transformType(context, glueType_6), tryFind((glueType_5) => {
595
+ if (glueType_5.tag === 1) {
596
+ return glueType_5.fields[0].FullName === typeReference.FullName;
597
+ }
598
+ else {
599
+ return false;
600
+ }
601
+ }, TransformContext__get_TypeMemory(context))), new FSharpType(10, [])))]);
448
602
  }
449
603
  case 14:
450
604
  return new FSharpType(14, [transformType(context, glueType.fields[0])]);
@@ -512,7 +666,15 @@ function transformType(context_mut, glueType_mut) {
512
666
  TransformContext__ExposeType_Z1D58A540(context, new FSharpType(17, [new FSharpClass(ofArray([new FSharpAttribute(17, []), new FSharpAttribute(8, [])]), TransformContext__get_CurrentScopeName(context), empty(), new FSharpConstructor(typeLiteralParameters, ofArray([new FSharpAttribute(18, []), new FSharpAttribute(2, [])]), new FSharpAccessibility(0, [])), empty(), explicitFields)]));
513
667
  }
514
668
  else {
515
- TransformContext__ExposeType_Z1D58A540(context, new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), TransformContext__get_CurrentScopeName(context), "", empty(), TransformMembers_toFSharpMember(context, typeLiteralInfo.Members), empty())]));
669
+ TransformContext__ExposeType_Z1D58A540(context, new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), TransformContext__get_CurrentScopeName(context), "", empty(), TransformMembers_toFSharpMember(context, typeLiteralInfo.Members), toList(delay(() => {
670
+ const matchValue_2 = TypeLiteral_tryFindIterableType(context, typeLiteralInfo);
671
+ if (matchValue_2 == null) {
672
+ return empty_1();
673
+ }
674
+ else {
675
+ return singleton_1(matchValue_2);
676
+ }
677
+ })))]));
516
678
  }
517
679
  return new FSharpType(11, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), new FSharpType(10, []))]);
518
680
  }
@@ -527,12 +689,12 @@ function transformType(context_mut, glueType_mut) {
527
689
  continue transformType;
528
690
  }
529
691
  case 9: {
530
- const matchValue_2 = TypeAliasDeclaration_tryTransformKeyOf(TransformContext__get_CurrentScopeName(context), glueType.fields[0]);
531
- if (matchValue_2 == null) {
692
+ const matchValue_3 = TypeAliasDeclaration_tryTransformKeyOf(TransformContext__get_CurrentScopeName(context), glueType.fields[0]);
693
+ if (matchValue_3 == null) {
532
694
  return new FSharpType(18, []);
533
695
  }
534
696
  else {
535
- TransformContext__ExposeType_Z1D58A540(context, matchValue_2);
697
+ TransformContext__ExposeType_Z1D58A540(context, matchValue_3);
536
698
  return new FSharpType(11, [new FSharpTypeReference(TransformContext__get_FullName(context), TransformContext__get_FullName(context), empty(), new FSharpType(10, []))]);
537
699
  }
538
700
  }
@@ -590,6 +752,14 @@ function transformType(context_mut, glueType_mut) {
590
752
  innerType = utilityType.fields[0];
591
753
  break;
592
754
  }
755
+ case 4: {
756
+ matchResult_1 = 3;
757
+ break;
758
+ }
759
+ case 5: {
760
+ matchResult_1 = 4;
761
+ break;
762
+ }
593
763
  default:
594
764
  matchResult_1 = 0;
595
765
  }
@@ -602,11 +772,17 @@ function transformType(context_mut, glueType_mut) {
602
772
  TransformContext__ExposeType_Z1D58A540(context, transformRecord(context, TransformContext__get_CurrentScopeName(context), empty(), utilityType.fields[0]));
603
773
  return new FSharpType(7, [new FSharpMapped(TransformContext__get_FullName(context), empty())]);
604
774
  }
605
- default: {
775
+ case 2: {
606
776
  context_mut = context;
607
777
  glueType_mut = innerType;
608
778
  continue transformType;
609
779
  }
780
+ case 3: {
781
+ TransformContext__ExposeType_Z1D58A540(context, new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), TransformContext__get_CurrentScopeName(context), TransformContext__get_CurrentScopeName(context), empty(), TransformMembers_toFSharpMember(context, utilityType.fields[0]), empty())]));
782
+ return new FSharpType(7, [new FSharpMapped(TransformContext__get_FullName(context), empty())]);
783
+ }
784
+ default:
785
+ return UtilityType_transformReadOnly(context, utilityType.fields[0], void 0);
610
786
  }
611
787
  }
612
788
  case 5:
@@ -721,16 +897,16 @@ function transformAccessor(accessor) {
721
897
  }
722
898
 
723
899
  function TransformMembers_toFSharpMember(context, members) {
724
- return choose((_arg_3) => {
725
- switch (_arg_3.tag) {
900
+ return choose((_arg_4) => {
901
+ switch (_arg_4.tag) {
726
902
  case 4: {
727
- const callSignatureInfo = _arg_3.fields[0];
903
+ const callSignatureInfo = _arg_4.fields[0];
728
904
  const patternInput_1 = sanitizeNameAndPushScope("Invoke", context);
729
905
  const context_2 = patternInput_1[1];
730
906
  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(), new FSharpMemberInfoBody(0, []))]);
731
907
  }
732
908
  case 1: {
733
- const propertyInfo = _arg_3.fields[0];
909
+ const propertyInfo = _arg_4.fields[0];
734
910
  const patternInput_2 = sanitizeNameAndPushScope(propertyInfo.Name, context);
735
911
  const xmlDocInfo = transformComment(propertyInfo.Documentation);
736
912
  if (propertyInfo.IsPrivate && !propertyInfo.IsStatic) {
@@ -741,98 +917,138 @@ function TransformMembers_toFSharpMember(context, members) {
741
917
  }
742
918
  }
743
919
  case 2: {
744
- const getAccessorInfo_1 = _arg_3.fields[0];
920
+ const getAccessorInfo_1 = _arg_4.fields[0];
745
921
  const patternInput_3 = sanitizeNameAndPushScope(getAccessorInfo_1.Name, context);
746
922
  const xmlDocInfo_1 = transformComment(getAccessorInfo_1.Documentation);
747
923
  return new FSharpMember(1, [new FSharpMemberInfo(toList(delay(() => xmlDocInfo_1.ObsoleteAttributes)), patternInput_3[0], getAccessorInfo_1.Name, empty(), empty(), transformType(patternInput_3[1], getAccessorInfo_1.Type), false, getAccessorInfo_1.IsStatic, new FSharpAccessor(0, []), new FSharpAccessibility(0, []), xmlDocInfo_1.XmlDoc, new FSharpMemberInfoBody(0, []))]);
748
924
  }
749
925
  case 3: {
750
- const setAccessorInfo_1 = _arg_3.fields[0];
926
+ const setAccessorInfo_1 = _arg_4.fields[0];
751
927
  const patternInput_4 = sanitizeNameAndPushScope(setAccessorInfo_1.Name, context);
752
928
  const xmlDocInfo_2 = transformComment(setAccessorInfo_1.Documentation);
753
929
  return new FSharpMember(1, [new FSharpMemberInfo(toList(delay(() => xmlDocInfo_2.ObsoleteAttributes)), patternInput_4[0], setAccessorInfo_1.Name, empty(), empty(), transformType(patternInput_4[1], setAccessorInfo_1.ArgumentType), false, setAccessorInfo_1.IsStatic, new FSharpAccessor(1, []), new FSharpAccessibility(0, []), xmlDocInfo_2.XmlDoc, new FSharpMemberInfoBody(0, []))]);
754
930
  }
755
931
  case 5: {
756
- const indexSignature = _arg_3.fields[0];
932
+ const indexSignature = _arg_4.fields[0];
757
933
  const patternInput_5 = sanitizeNameAndPushScope("Item", context);
758
934
  const context_6 = patternInput_5[1];
759
935
  return new FSharpMember(1, [new FSharpMemberInfo(singleton(new FSharpAttribute(16, [])), patternInput_5[0], "Item", empty(), map((parameter_3) => transformParameter(context_6, parameter_3), indexSignature.Parameters), transformType(context_6, indexSignature.Type), false, false, indexSignature.IsReadOnly ? (new FSharpAccessor(0, [])) : (new FSharpAccessor(2, [])), new FSharpAccessibility(0, []), empty(), new FSharpMemberInfoBody(0, []))]);
760
936
  }
761
937
  case 6: {
762
- const methodSignature = _arg_3.fields[0];
938
+ const methodSignature = _arg_4.fields[0];
763
939
  const patternInput_6 = sanitizeNameAndPushScope(methodSignature.Name, context);
764
940
  const context_7 = patternInput_6[1];
765
941
  const xmlDocInfo_3 = transformComment(methodSignature.Documentation);
766
942
  return new FSharpMember(0, [new FSharpMemberInfo(toList(delay(() => xmlDocInfo_3.ObsoleteAttributes)), patternInput_6[0], methodSignature.Name, empty(), map((parameter_4) => transformParameter(context_7, parameter_4), methodSignature.Parameters), transformType(context_7, methodSignature.Type), false, false, void 0, new FSharpAccessibility(0, []), xmlDocInfo_3.XmlDoc, new FSharpMemberInfoBody(0, []))]);
767
943
  }
768
944
  case 7: {
769
- const constructSignature = _arg_3.fields[0];
945
+ const constructSignature = _arg_4.fields[0];
770
946
  const patternInput_7 = sanitizeNameAndPushScope("Create", context);
771
947
  const context_8 = patternInput_7[1];
772
948
  return new FSharpMember(0, [new FSharpMemberInfo(singleton(new FSharpAttribute(13, [])), patternInput_7[0], "Create", empty(), map((parameter_5) => transformParameter(context_8, parameter_5), constructSignature.Parameters), transformType(context_8, constructSignature.Type), false, false, void 0, new FSharpAccessibility(0, []), empty(), new FSharpMemberInfoBody(0, []))]);
773
949
  }
774
950
  default: {
775
- const methodInfo = _arg_3.fields[0];
951
+ const methodInfo = _arg_4.fields[0];
776
952
  const patternInput = sanitizeNameAndPushScope(methodInfo.Name, context);
777
- const name = patternInput[0];
953
+ const name_1 = patternInput[0];
778
954
  const context_1 = patternInput[1];
779
955
  if (methodInfo.IsStatic) {
780
- 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, []))]);
956
+ return new FSharpMember(2, [new FSharpStaticMemberInfo(empty(), name_1, methodInfo.Name, empty(), map((parameter) => transformParameter(context_1, parameter), methodInfo.Parameters), transformType(context_1, methodInfo.Type), methodInfo.IsOptional, void 0, new FSharpAccessibility(0, []))]);
781
957
  }
782
958
  else {
783
- 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(), new FSharpMemberInfoBody(0, []))]);
959
+ return new FSharpMember(0, [new FSharpMemberInfo(empty(), name_1, 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(), new FSharpMemberInfoBody(0, []))]);
784
960
  }
785
961
  }
786
962
  }
787
- }, choose((_arg) => {
788
- switch (_arg.tag) {
963
+ }, choose((_arg_1) => {
964
+ switch (_arg_1.tag) {
789
965
  case 3: {
790
- const associatedGetAccessor = tryFind((_arg_2) => {
791
- if (_arg_2.tag === 2) {
792
- return _arg.fields[0].Name === _arg_2.fields[0].Name;
966
+ const associatedGetAccessor = tryFind((_arg_3) => {
967
+ if (_arg_3.tag === 2) {
968
+ return _arg_1.fields[0].Name === _arg_3.fields[0].Name;
793
969
  }
794
970
  else {
795
971
  return false;
796
972
  }
797
973
  }, members);
798
974
  if (associatedGetAccessor == null) {
799
- return _arg;
975
+ return _arg_1;
800
976
  }
801
977
  else {
802
978
  return void 0;
803
979
  }
804
980
  }
805
981
  case 4:
806
- return _arg;
982
+ return _arg_1;
807
983
  case 0:
808
- return _arg;
984
+ return _arg_1;
809
985
  case 1:
810
- return _arg;
986
+ return _arg_1;
811
987
  case 5:
812
- return _arg;
988
+ return _arg_1;
813
989
  case 6:
814
- return _arg;
990
+ return _arg_1;
815
991
  case 7:
816
- return _arg;
992
+ return _arg_1;
817
993
  default: {
818
- const getAccessorInfo = _arg.fields[0];
819
- const associatedSetAccessor = tryFind((_arg_1) => {
820
- if (_arg_1.tag === 3) {
821
- return getAccessorInfo.Name === _arg_1.fields[0].Name;
994
+ const getAccessorInfo = _arg_1.fields[0];
995
+ const associatedSetAccessor = tryFind((_arg_2) => {
996
+ if (_arg_2.tag === 3) {
997
+ return getAccessorInfo.Name === _arg_2.fields[0].Name;
822
998
  }
823
999
  else {
824
1000
  return false;
825
1001
  }
826
1002
  }, members);
827
1003
  if (associatedSetAccessor == null) {
828
- return _arg;
1004
+ return _arg_1;
829
1005
  }
830
1006
  else {
831
1007
  return new GlueMember(1, [new GlueProperty(getAccessorInfo.Name, getAccessorInfo.Documentation, getAccessorInfo.Type, getAccessorInfo.IsStatic, false, new GlueAccessor(2, []), getAccessorInfo.IsPrivate)]);
832
1008
  }
833
1009
  }
834
1010
  }
835
- }, members));
1011
+ }, filter((_arg) => {
1012
+ let matchResult, name;
1013
+ switch (_arg.tag) {
1014
+ case 2:
1015
+ case 3:
1016
+ case 1:
1017
+ case 4:
1018
+ case 7:
1019
+ case 5: {
1020
+ matchResult = 1;
1021
+ break;
1022
+ }
1023
+ case 6: {
1024
+ matchResult = 0;
1025
+ name = _arg.fields[0].Name;
1026
+ break;
1027
+ }
1028
+ default: {
1029
+ matchResult = 0;
1030
+ name = _arg.fields[0].Name;
1031
+ }
1032
+ }
1033
+ switch (matchResult) {
1034
+ case 0:
1035
+ return name !== "[Symbol.iterator]";
1036
+ default:
1037
+ return true;
1038
+ }
1039
+ }, members)));
1040
+ }
1041
+
1042
+ function TransformMembers_forceReadonly(members) {
1043
+ return map((_arg) => {
1044
+ if (_arg.tag === 1) {
1045
+ const property = _arg.fields[0];
1046
+ return new FSharpMember(1, [new FSharpMemberInfo(property.Attributes, property.Name, property.OriginalName, property.TypeParameters, property.Parameters, property.Type, property.IsOptional, property.IsStatic, new FSharpAccessor(0, []), property.Accessibility, property.XmlDoc, property.Body)]);
1047
+ }
1048
+ else {
1049
+ return _arg;
1050
+ }
1051
+ }, members);
836
1052
  }
837
1053
 
838
1054
  function TransformMembers_toFSharpParameters(context, members) {
@@ -919,7 +1135,7 @@ function transformInterface(context, info) {
919
1135
  else {
920
1136
  return void 0;
921
1137
  }
922
- }, info.HeritageClauses)));
1138
+ }, map((typ) => TransformContext__ExposeTypeAlias_1CE4A880(context_1, typ), info.HeritageClauses))));
923
1139
  const standardMembers = TransformMembers_toFSharpMember(context_1, info.Members);
924
1140
  const inheritance = filter((heritageClause_1) => {
925
1141
  if (heritageClause_1.tag === 13) {
@@ -929,7 +1145,7 @@ function transformInterface(context, info) {
929
1145
  else {
930
1146
  return true;
931
1147
  }
932
- }, info.HeritageClauses);
1148
+ }, map((typ_1) => TransformContext__ExposeTypeAlias_1CE4A880(context_1, typ_1), info.HeritageClauses));
933
1149
  const Members = append_1(standardMembers, membersComingFromPartial);
934
1150
  return new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), patternInput[0], info.Name, transformTypeParameters(context_1, info.TypeParameters), Members, map((glueType_1) => transformType(context_1, glueType_1), inheritance));
935
1151
  }
@@ -1097,7 +1313,7 @@ function transformRecord(context, name, typeParameters, recordInfo) {
1097
1313
  }
1098
1314
 
1099
1315
  function transformTypeParameter(context, typeParameter) {
1100
- return FSharpTypeParameter_Create_Z6CFD3565(typeParameter.Name, unwrap(bind((glueType) => {
1316
+ return new FSharpTypeParameter(1, [FSharpTypeParameterInfo_Create_Z6CFD3565(typeParameter.Name, unwrap(bind((glueType) => {
1101
1317
  const matchValue = transformType(context, glueType);
1102
1318
  if (matchValue.tag === 16) {
1103
1319
  return void 0;
@@ -1105,7 +1321,7 @@ function transformTypeParameter(context, typeParameter) {
1105
1321
  else {
1106
1322
  return matchValue;
1107
1323
  }
1108
- }, typeParameter.Constraint)), unwrap(map_1((glueType_1) => transformType(context, glueType_1), typeParameter.Default)));
1324
+ }, typeParameter.Constraint)), unwrap(map_1((glueType_1) => transformType(context, glueType_1), typeParameter.Default)))]);
1109
1325
  }
1110
1326
 
1111
1327
  function transformTypeParameters(context, typeParameters) {
@@ -1435,6 +1651,10 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
1435
1651
  return makeTypeAlias(transformType(TransformContext__PushScope_Z721C83C5(context_1, "ReturnType"), utilityType.fields[0]));
1436
1652
  case 3:
1437
1653
  return makeTypeAlias(transformType(context_1, utilityType.fields[0]));
1654
+ case 4:
1655
+ return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), typeAliasName, glueTypeAliasDeclaration.Name, transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters), TransformMembers_toFSharpMember(context_1, utilityType.fields[0]), empty())]);
1656
+ case 5:
1657
+ return UtilityType_transformReadOnly(context_1, utilityType.fields[0], makeTypeAlias);
1438
1658
  default:
1439
1659
  return new FSharpType(5, [Interface_makePartial(typeAliasName, transformInterface(context_1, utilityType.fields[0]))]);
1440
1660
  }
@@ -1447,8 +1667,18 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
1447
1667
  return makeTypeAlias(transformTupleType(context_1, matchValue.fields[0]));
1448
1668
  case 20:
1449
1669
  return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), typeAliasName, glueTypeAliasDeclaration.Name, transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters), TransformMembers_toFSharpMember(context_1, matchValue.fields[0]), empty())]);
1450
- case 21:
1451
- return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), typeAliasName, glueTypeAliasDeclaration.Name, transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters), TransformMembers_toFSharpMember(context_1, matchValue.fields[0].Members), empty())]);
1670
+ case 21: {
1671
+ const typeLiteralInfo = matchValue.fields[0];
1672
+ return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), typeAliasName, glueTypeAliasDeclaration.Name, transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters), TransformMembers_toFSharpMember(context_1, typeLiteralInfo.Members), toList(delay(() => {
1673
+ const matchValue_4 = TypeLiteral_tryFindIterableType(context_1, typeLiteralInfo);
1674
+ if (matchValue_4 == null) {
1675
+ return empty_1();
1676
+ }
1677
+ else {
1678
+ return singleton_1(matchValue_4);
1679
+ }
1680
+ })))]);
1681
+ }
1452
1682
  case 23:
1453
1683
  return makeTypeAlias(new FSharpType(18, []));
1454
1684
  case 16:
@@ -1456,10 +1686,10 @@ function transformTypeAliasDeclaration(context, glueTypeAliasDeclaration) {
1456
1686
  case 27:
1457
1687
  return new FSharpType(5, [new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), typeAliasName, glueTypeAliasDeclaration.Name, transformTypeParameters(context_1, glueTypeAliasDeclaration.TypeParameters), TransformMembers_toFSharpMember(context_1, transformMappedTypeMembers(context_1, matchValue.fields[0])), empty())]);
1458
1688
  case 28: {
1459
- const matchValue_4 = glueTypeAliasDeclaration.TypeParameters;
1460
- if (!isEmpty(matchValue_4)) {
1461
- if (isEmpty(tail(matchValue_4))) {
1462
- return new FSharpType(2, [new FSharpSingleErasedCaseUnion(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc, transformTypeParameter(context_1, head_1(matchValue_4)))]);
1689
+ const matchValue_5 = glueTypeAliasDeclaration.TypeParameters;
1690
+ if (!isEmpty(matchValue_5)) {
1691
+ if (isEmpty(tail(matchValue_5))) {
1692
+ return new FSharpType(2, [new FSharpSingleErasedCaseUnion(toList(delay(() => xmlDoc.ObsoleteAttributes)), typeAliasName, xmlDoc.XmlDoc, transformTypeParameter(context_1, head_1(matchValue_5)))]);
1463
1693
  }
1464
1694
  else {
1465
1695
  TransformContext__AddWarning_Z721C83C5(context_1, `${glueTypeAliasDeclaration.Name} contains a ConstructorType with multiple type parameters, please open an issue at https://github.com/glutinum-org/cli/issues`);
@@ -1505,7 +1735,7 @@ function transformClassDeclaration(context, classDeclaration) {
1505
1735
  let Members;
1506
1736
  const patternInput = sanitizeNameAndPushScope(classDeclaration.Name, context);
1507
1737
  const context_1 = patternInput[1];
1508
- return new FSharpType(5, [(Members = TransformMembers_toFSharpMember(context_1, classDeclaration.Members), new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), patternInput[0], classDeclaration.Name, transformTypeParameters(context_1, classDeclaration.TypeParameters), Members, map((glueType) => transformType(context_1, glueType), classDeclaration.HeritageClauses)))]);
1738
+ return new FSharpType(5, [(Members = TransformMembers_toFSharpMember(context_1, classDeclaration.Members), new FSharpInterface(ofArray([new FSharpAttribute(8, []), new FSharpAttribute(20, [])]), patternInput[0], classDeclaration.Name, transformTypeParameters(context_1, classDeclaration.TypeParameters), Members, map((arg) => transformType(context_1, TransformContext__ExposeTypeAlias_1CE4A880(context_1, arg)), classDeclaration.HeritageClauses)))]);
1509
1739
  }
1510
1740
 
1511
1741
  function transformToFsharp(context, glueTypes) {
@@ -1609,7 +1839,7 @@ function transform(typeMemory, reporter, isTopLevel, glueAst) {
1609
1839
 
1610
1840
  export function apply(typeMemory, glueAst) {
1611
1841
  const reporter = Reporter_$ctor();
1612
- return new TransformResult(apply_1(transform(typeMemory, reporter, true, glueAst)), Reporter__get_Warnings(reporter), Reporter__get_Errors(reporter), Reporter__get_HasRegEpx(reporter), Reporter__get_HasReadonlyArray(reporter));
1842
+ return new TransformResult(apply_1(transform(typeMemory, reporter, true, glueAst)), Reporter__get_Warnings(reporter), Reporter__get_Errors(reporter), Reporter__get_HasRegEpx(reporter), Reporter__get_HasReadonlyArray(reporter), Reporter__get_HasIterable(reporter));
1613
1843
  }
1614
1844
 
1615
1845
  //# sourceMappingURL=Transform.js.map