@glutinum/cli 1.0.0-beta.14 → 1.0.0-beta.16

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 (34) hide show
  1. package/dist/Glutinum.Converter/GlueAST.js +19 -14
  2. package/dist/Glutinum.Converter/Merge.js +490 -206
  3. package/dist/Glutinum.Converter/Packages.js +2 -2
  4. package/dist/Glutinum.Converter/Printer.js +26 -21
  5. package/dist/Glutinum.Converter/Read.js +377 -169
  6. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +25 -8
  7. package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +2 -2
  8. package/dist/Glutinum.Converter/Reader/Declaration.js +15 -15
  9. package/dist/Glutinum.Converter/Reader/Deferred.js +114 -43
  10. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +98 -44
  11. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +2 -2
  12. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +61 -46
  13. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +31 -26
  14. package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +38 -25
  15. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +6 -5
  16. package/dist/Glutinum.Converter/Reader/Node.js +1 -1
  17. package/dist/Glutinum.Converter/Reader/TypeNode.js +292 -30
  18. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +1 -1
  19. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +143 -35
  20. package/dist/Glutinum.Converter/Reader/UtilityType.js +179 -34
  21. package/dist/Glutinum.Converter/Reader/Utils.js +186 -17
  22. package/dist/Glutinum.Converter/Reader/VariableStatement.js +46 -16
  23. package/dist/Glutinum.Converter/Transform.js +1073 -638
  24. package/dist/Glutinum.Converter/Transformer/CallableProperties.js +2 -2
  25. package/dist/Glutinum.Converter/Transformer/Conditionals.js +17 -16
  26. package/dist/Glutinum.Converter/Transformer/Context.js +12 -4
  27. package/dist/Glutinum.Converter/Transformer/Exports.js +242 -66
  28. package/dist/Glutinum.Converter/Transformer/Heritage.js +449 -17
  29. package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +4 -4
  30. package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +105 -19
  31. package/dist/Glutinum.Converter/Transformer/TypeParameters.js +2 -2
  32. package/dist/Glutinum.Converter/Transformer/Utils.js +3 -3
  33. package/dist/Glutinum.Converter/Utils/Naming.js +10 -3
  34. package/package.json +1 -1
@@ -1,12 +1,13 @@
1
1
 
2
- import { ofList as ofList_1, empty as empty_1, FSharpSet__Add, FSharpSet__Contains, ofSeq } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
3
- import { equals, comparePrimitives } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
4
- import { exists, take, forAll2, length, forAll, indexed as indexed_1, fold, head, tail, map, singleton, filter, empty, choose, append, collect, tryPick, isEmpty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
5
- import { defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
2
+ import { ofList, add, empty as empty_1, FSharpSet__Add, FSharpSet__Contains, ofSeq } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
3
+ import { equals, stringHash, comparePrimitives } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
4
+ import { cons, exists, take, forAll2, length, indexed as indexed_1, fold, forAll, head, tail, map, singleton, filter, empty, choose, append, collect as collect_1, tryPick, ofArray, contains, isEmpty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
5
+ import { value as value_1, defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
6
6
  import { Record } from "../../fable_modules/fable-library-js.5.21.0/Types.js";
7
7
  import { GlueSubstitution_substitute, GlueSubstitution_substituteMember, GlueSubstitution_ofTypeArguments, GlueSubstitution_substituteParameter, GluePrimitive, GlueTypeReference, GlueTypeUnion, GlueType, GlueFunctionType, GlueParameter, GlueType_$reflection, GlueMember_$reflection, GlueTypeParameter_$reflection } from "../GlueAST.js";
8
8
  import { record_type, list_type } from "../../fable_modules/fable-library-js.5.21.0/Reflection.js";
9
- import { ofList } from "../../fable_modules/fable-library-js.5.21.0/Map.js";
9
+ import { List_distinctBy } from "../../fable_modules/fable-library-js.5.21.0/Seq2.js";
10
+ import { FSharpMap__get_Item, add as add_1, ofList as ofList_1 } from "../../fable_modules/fable-library-js.5.21.0/Map.js";
10
11
  import { max } from "../../fable_modules/fable-library-js.5.21.0/Double.js";
11
12
 
12
13
  const primitiveNames = ofSeq(["string", "float", "int", "bool", "obj", "unit", "bigint"], {
@@ -54,7 +55,10 @@ export function isErrorHeritage(heritageClause) {
54
55
  if (heritageClause.tag === 13) {
55
56
  const typeReference = heritageClause.fields[0];
56
57
  if (typeReference.IsStandardLibrary) {
57
- return typeReference.Name === "Error";
58
+ return contains(typeReference.Name, ofArray(["Error", "EvalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError"]), {
59
+ Equals: (x, y) => (x === y),
60
+ GetHashCode: (x) => (stringHash(x) | 0),
61
+ });
58
62
  }
59
63
  else {
60
64
  return false;
@@ -102,7 +106,7 @@ export function withoutBaseClassProperties(typeMemory, heritageClauses, members)
102
106
  moduleDeclaration = glueType.fields[0];
103
107
  break;
104
108
  }
105
- case 31: {
109
+ case 32: {
106
110
  matchResult = 2;
107
111
  fileModule = glueType.fields[0];
108
112
  break;
@@ -121,7 +125,7 @@ export function withoutBaseClassProperties(typeMemory, heritageClauses, members)
121
125
  return undefined;
122
126
  }
123
127
  }, glueTypes);
124
- const baseProperties = (visited, heritageClauses_1) => collect((heritageClause) => {
128
+ const baseProperties = (visited, heritageClauses_1) => collect_1((heritageClause) => {
125
129
  let option_1, baseClass;
126
130
  let matchResult_1, typeReference_1;
127
131
  if (heritageClause.tag === 13) {
@@ -179,7 +183,7 @@ function BaseDeclaration_$reflection() {
179
183
  }
180
184
 
181
185
  function declarations(glueTypes) {
182
- return collect((glueType) => {
186
+ return collect_1((glueType) => {
183
187
  switch (glueType.tag) {
184
188
  case 12: {
185
189
  const info = glueType.fields[0];
@@ -191,7 +195,7 @@ function declarations(glueTypes) {
191
195
  }
192
196
  case 11:
193
197
  return declarations(glueType.fields[0].Types);
194
- case 31:
198
+ case 32:
195
199
  return declarations(glueType.fields[0].Types);
196
200
  default:
197
201
  return empty();
@@ -204,13 +208,62 @@ function tryFindBase(typeMemory, typeReference) {
204
208
  const candidates = declarations(typeMemory);
205
209
  const found = map((tupledArg_2) => tupledArg_2[2], (typeReference.FullName !== "") ? filter((tupledArg) => (tupledArg[0] === typeReference.FullName), candidates) : ((matchValue = filter((tupledArg_1) => (tupledArg_1[1] === typeReference.Name), candidates), !isEmpty(matchValue) ? (isEmpty(tail(matchValue)) ? singleton(head(matchValue)) : empty()) : empty())));
206
210
  if (!isEmpty(found)) {
207
- return new BaseDeclaration(head(found).TypeParameters, collect((_arg_6) => _arg_6.Members, found), collect((_arg_7) => _arg_7.HeritageClauses, found));
211
+ return new BaseDeclaration(head(found).TypeParameters, collect_1((_arg_6) => _arg_6.Members, found), collect_1((_arg_7) => _arg_7.HeritageClauses, found));
208
212
  }
209
213
  else {
210
214
  return undefined;
211
215
  }
212
216
  }
213
217
 
218
+ export function tryAllProperties(typeMemory, visited, typeReference) {
219
+ if (!isEmpty(typeReference.TypeArguments) ? true : FSharpSet__Contains(visited, typeReference.FullName)) {
220
+ return undefined;
221
+ }
222
+ else {
223
+ let option_6;
224
+ const option_1 = tryFindBase(typeMemory, typeReference);
225
+ option_6 = ((option_1 != null) ? (isEmpty(option_1.TypeParameters) ? option_1 : undefined) : undefined);
226
+ if (option_6 != null) {
227
+ const declaration_1 = option_6;
228
+ const own = map((_arg) => {
229
+ if (_arg.tag === 1) {
230
+ return _arg.fields[0];
231
+ }
232
+ else {
233
+ return undefined;
234
+ }
235
+ }, declaration_1.Members);
236
+ const bases = map((_arg_1) => {
237
+ if (_arg_1.tag === 13) {
238
+ return tryAllProperties(typeMemory, add(typeReference.FullName, visited), _arg_1.fields[0]);
239
+ }
240
+ else {
241
+ return undefined;
242
+ }
243
+ }, declaration_1.HeritageClauses);
244
+ if (forAll((option_2) => (option_2 != null), own) && forAll((option_3) => (option_3 != null), bases)) {
245
+ const own_1 = List_distinctBy((_arg_2) => _arg_2.Name, choose((x) => x, own), {
246
+ Equals: (x_1, y) => (x_1 === y),
247
+ GetHashCode: (x_1) => (stringHash(x_1) | 0),
248
+ });
249
+ const ownNames = ofList(map((_arg_3) => _arg_3.Name, own_1), {
250
+ Compare: (x_2, y_1) => (comparePrimitives(x_2, y_1) | 0),
251
+ });
252
+ return append(List_distinctBy((_arg_4) => _arg_4.Name, filter((property_1) => !FSharpSet__Contains(ownNames, property_1.Name), collect_1(value_1, bases)), {
253
+ Equals: (x_3, y_2) => (x_3 === y_2),
254
+ GetHashCode: (x_3) => (stringHash(x_3) | 0),
255
+ }), own_1);
256
+ }
257
+ else {
258
+ return undefined;
259
+ }
260
+ }
261
+ else {
262
+ return undefined;
263
+ }
264
+ }
265
+ }
266
+
214
267
  /**
215
268
  * F# rejects an interface inherited twice with different type arguments (FS3360)
216
269
  */
@@ -327,8 +380,8 @@ function comparable(glueType) {
327
380
  return new GlueType(/* Union */ 7, [new GlueTypeUnion(map(comparable, glueType.fields[0].fields[0]))]);
328
381
  case 14:
329
382
  return new GlueType(/* Array */ 14, [comparable(glueType.fields[0])]);
330
- case 30:
331
- return new GlueType(/* ReadOnly */ 30, [comparable(glueType.fields[0])]);
383
+ case 31:
384
+ return new GlueType(/* ReadOnly */ 31, [comparable(glueType.fields[0])]);
332
385
  case 23:
333
386
  return new GlueType(/* OptionalType */ 23, [comparable(glueType.fields[0])]);
334
387
  case 18:
@@ -343,7 +396,7 @@ function comparable(glueType) {
343
396
  }
344
397
 
345
398
  function shape(typeParameters, parameters) {
346
- const substitutions = ofList(map((typeParameter) => [typeParameter.Name, defaultArg(typeParameter.Constraint, new GlueType(/* Primitive */ 3, [GluePrimitive.Any]))], typeParameters), {
399
+ const substitutions = ofList_1(map((typeParameter) => [typeParameter.Name, defaultArg(typeParameter.Constraint, new GlueType(/* Primitive */ 3, [GluePrimitive.Any]))], typeParameters), {
347
400
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
348
401
  });
349
402
  return map((parameter_1) => [comparable(parameter_1.Type), parameter_1.IsOptional, parameter_1.IsSpread], map((parameter) => GlueSubstitution_substituteParameter(substitutions, parameter), parameters));
@@ -432,8 +485,9 @@ function isSameKind(a, b) {
432
485
  * `class RecordService extends CrudService { getOne(id, options?: RecordOptions) }` has one
433
486
  * `getOne` in TypeScript, the subclass takes the base heritage and the members it does not redeclare
434
487
  */
435
- export function withoutRedeclaredBases(typeMemory, members, heritageClauses) {
488
+ export function withoutRedeclaredBases(typeMemory, thisType, members, heritageClauses) {
436
489
  const resolve = (visited, members_1, heritageClauses_1) => fold((tupledArg, heritageClause) => {
490
+ let substitutions_1;
437
491
  const members_2 = tupledArg[0];
438
492
  const kept = tupledArg[1];
439
493
  if (heritageClause.tag === 13) {
@@ -456,9 +510,9 @@ export function withoutRedeclaredBases(typeMemory, members, heritageClauses) {
456
510
  switch (matchResult) {
457
511
  case 0: {
458
512
  const substitutions = GlueSubstitution_ofTypeArguments(baseDeclaration_1.TypeParameters, typeReference.TypeArguments);
459
- const baseMembers = map((glueMember) => GlueSubstitution_substituteMember(substitutions, glueMember), baseDeclaration_1.Members);
513
+ const baseMembers = map((substitutions_1 = add_1("this", new GlueType(/* ThisType */ 17, [thisType]), substitutions), (glueMember) => GlueSubstitution_substituteMember(substitutions_1, glueMember)), baseDeclaration_1.Members);
460
514
  if (hasCollision(members_2, baseMembers)) {
461
- const names = ofList_1(choose(memberName, members_2), {
515
+ const names = ofList(choose(memberName, members_2), {
462
516
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
463
517
  });
464
518
  const copied = filter((baseMember) => {
@@ -492,3 +546,381 @@ export function withoutRedeclaredBases(typeMemory, members, heritageClauses) {
492
546
  return [patternInput_1[1], patternInput_1[0]];
493
547
  }
494
548
 
549
+ function keyOf(typeReference) {
550
+ if (typeReference.FullName !== "") {
551
+ return typeReference.FullName;
552
+ }
553
+ else {
554
+ return typeReference.Name;
555
+ }
556
+ }
557
+
558
+ function instantiations(typeMemory, visited, heritageClause) {
559
+ let f2, visited_1;
560
+ let matchResult, typeReference_1;
561
+ if (heritageClause.tag === 13) {
562
+ if (!FSharpSet__Contains(visited, keyOf(heritageClause.fields[0]))) {
563
+ matchResult = 0;
564
+ typeReference_1 = heritageClause.fields[0];
565
+ }
566
+ else {
567
+ matchResult = 1;
568
+ }
569
+ }
570
+ else {
571
+ matchResult = 1;
572
+ }
573
+ switch (matchResult) {
574
+ case 0: {
575
+ const key = keyOf(typeReference_1);
576
+ const matchValue = tryFindBase(typeMemory, typeReference_1);
577
+ if (matchValue == null) {
578
+ return singleton([key, map(comparable, typeReference_1.TypeArguments)]);
579
+ }
580
+ else {
581
+ const declaration = matchValue;
582
+ const substitutions = GlueSubstitution_ofTypeArguments(declaration.TypeParameters, typeReference_1.TypeArguments);
583
+ return cons([key, map((typeParameter) => comparable(FSharpMap__get_Item(substitutions, typeParameter.Name)), declaration.TypeParameters)], collect_1((f2 = ((visited_1 = FSharpSet__Add(visited, key), (heritageClause_1) => instantiations(typeMemory, visited_1, heritageClause_1))), (arg) => f2(GlueSubstitution_substitute(substitutions, arg))), declaration.HeritageClauses));
584
+ }
585
+ }
586
+ default:
587
+ return empty();
588
+ }
589
+ }
590
+
591
+ function mentionsTypeParameter(glueType_mut) {
592
+ mentionsTypeParameter:
593
+ while (true) {
594
+ const glueType = glueType_mut;
595
+ let matchResult, elementType;
596
+ switch (glueType.tag) {
597
+ case 16: {
598
+ matchResult = 0;
599
+ break;
600
+ }
601
+ case 13: {
602
+ matchResult = 1;
603
+ break;
604
+ }
605
+ case 14: {
606
+ matchResult = 2;
607
+ elementType = glueType.fields[0];
608
+ break;
609
+ }
610
+ case 31: {
611
+ matchResult = 2;
612
+ elementType = glueType.fields[0];
613
+ break;
614
+ }
615
+ case 23: {
616
+ matchResult = 2;
617
+ elementType = glueType.fields[0];
618
+ break;
619
+ }
620
+ case 7: {
621
+ matchResult = 3;
622
+ break;
623
+ }
624
+ case 18: {
625
+ matchResult = 4;
626
+ break;
627
+ }
628
+ default:
629
+ matchResult = 5;
630
+ }
631
+ switch (matchResult) {
632
+ case 0:
633
+ return true;
634
+ case 1:
635
+ return exists(mentionsTypeParameter, glueType.fields[0].TypeArguments);
636
+ case 2: {
637
+ glueType_mut = elementType;
638
+ continue mentionsTypeParameter;
639
+ }
640
+ case 3:
641
+ return exists(mentionsTypeParameter, glueType.fields[0].fields[0]);
642
+ case 4:
643
+ return exists(mentionsTypeParameter, glueType.fields[0]);
644
+ default:
645
+ return false;
646
+ }
647
+ break;
648
+ }
649
+ }
650
+
651
+ /**
652
+ * F# rejects an interface reached with two instantiations that may unify (FS3360)
653
+ */
654
+ export function withoutConflictingInstantiations(typeMemory, thisType, members, heritageClauses) {
655
+ const resolve = (tupledArg_2, heritageClauses_1) => fold((tupledArg_3, heritageClause) => {
656
+ let substitutions_1;
657
+ const members_2 = tupledArg_3[0];
658
+ const kept_1 = tupledArg_3[1];
659
+ const inherited_2 = tupledArg_3[2];
660
+ const candidate_1 = instantiations(typeMemory, empty_1({
661
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
662
+ }), heritageClause);
663
+ if (!exists((tupledArg) => {
664
+ const arguments$ = tupledArg[1];
665
+ return exists((tupledArg_1) => {
666
+ const inheritedArguments = tupledArg_1[1];
667
+ if ((tupledArg_1[0] === tupledArg[0]) && !equals(inheritedArguments, arguments$)) {
668
+ return exists(mentionsTypeParameter, append(inheritedArguments, arguments$));
669
+ }
670
+ else {
671
+ return false;
672
+ }
673
+ }, inherited_2);
674
+ }, candidate_1)) {
675
+ return [members_2, append(kept_1, singleton(heritageClause)), append(inherited_2, candidate_1)];
676
+ }
677
+ else {
678
+ let matchResult, typeReference_1;
679
+ if (heritageClause.tag === 13) {
680
+ if (!exists((tupledArg_4) => (tupledArg_4[0] === keyOf(heritageClause.fields[0])), inherited_2)) {
681
+ matchResult = 0;
682
+ typeReference_1 = heritageClause.fields[0];
683
+ }
684
+ else {
685
+ matchResult = 1;
686
+ }
687
+ }
688
+ else {
689
+ matchResult = 1;
690
+ }
691
+ switch (matchResult) {
692
+ case 0: {
693
+ const matchValue = tryFindBase(typeMemory, typeReference_1);
694
+ if (matchValue == null) {
695
+ return [members_2, kept_1, inherited_2];
696
+ }
697
+ else {
698
+ const baseDeclaration = matchValue;
699
+ const substitutions = GlueSubstitution_ofTypeArguments(baseDeclaration.TypeParameters, typeReference_1.TypeArguments);
700
+ const names = ofList(choose(memberName, members_2), {
701
+ Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
702
+ });
703
+ return resolve([append(members_2, filter((baseMember) => {
704
+ const matchValue_1 = memberName(baseMember);
705
+ if (matchValue_1 == null) {
706
+ return !exists((b) => isSameKind(baseMember, b), members_2);
707
+ }
708
+ else {
709
+ return !FSharpSet__Contains(names, matchValue_1);
710
+ }
711
+ }, map((substitutions_1 = add_1("this", new GlueType(/* ThisType */ 17, [thisType]), substitutions), (glueMember_1) => GlueSubstitution_substituteMember(substitutions_1, glueMember_1)), baseDeclaration.Members))), kept_1, inherited_2], map((glueType_1) => GlueSubstitution_substitute(substitutions, glueType_1), baseDeclaration.HeritageClauses));
712
+ }
713
+ }
714
+ default:
715
+ return [members_2, kept_1, inherited_2];
716
+ }
717
+ }
718
+ }, [tupledArg_2[0], tupledArg_2[1], tupledArg_2[2]], heritageClauses_1);
719
+ const patternInput = resolve([members, empty(), empty()], heritageClauses);
720
+ return [patternInput[1], patternInput[0]];
721
+ }
722
+
723
+ function mentionsThis(glueType_mut) {
724
+ mentionsThis:
725
+ while (true) {
726
+ const glueType = glueType_mut;
727
+ let matchResult, innerType;
728
+ switch (glueType.tag) {
729
+ case 17: {
730
+ matchResult = 0;
731
+ break;
732
+ }
733
+ case 13: {
734
+ matchResult = 1;
735
+ break;
736
+ }
737
+ case 7: {
738
+ matchResult = 2;
739
+ break;
740
+ }
741
+ case 14: {
742
+ matchResult = 3;
743
+ innerType = glueType.fields[0];
744
+ break;
745
+ }
746
+ case 31: {
747
+ matchResult = 3;
748
+ innerType = glueType.fields[0];
749
+ break;
750
+ }
751
+ case 23: {
752
+ matchResult = 3;
753
+ innerType = glueType.fields[0];
754
+ break;
755
+ }
756
+ case 18: {
757
+ matchResult = 4;
758
+ break;
759
+ }
760
+ case 15: {
761
+ matchResult = 5;
762
+ break;
763
+ }
764
+ default:
765
+ matchResult = 6;
766
+ }
767
+ switch (matchResult) {
768
+ case 0:
769
+ return true;
770
+ case 1:
771
+ return exists(mentionsThis, glueType.fields[0].TypeArguments);
772
+ case 2:
773
+ return exists(mentionsThis, glueType.fields[0].fields[0]);
774
+ case 3: {
775
+ glueType_mut = innerType;
776
+ continue mentionsThis;
777
+ }
778
+ case 4:
779
+ return exists(mentionsThis, glueType.fields[0]);
780
+ case 5: {
781
+ const functionType = glueType.fields[0];
782
+ if (mentionsThis(functionType.Type)) {
783
+ return true;
784
+ }
785
+ else {
786
+ return exists((parameter) => mentionsThis(parameter.Type), functionType.Parameters);
787
+ }
788
+ }
789
+ default:
790
+ return false;
791
+ }
792
+ break;
793
+ }
794
+ }
795
+
796
+ function nestsThis(glueType) {
797
+ let matchResult, glueType_1;
798
+ switch (glueType.tag) {
799
+ case 17: {
800
+ matchResult = 0;
801
+ break;
802
+ }
803
+ case 23: {
804
+ if (glueType.fields[0].tag === 17) {
805
+ matchResult = 0;
806
+ }
807
+ else {
808
+ matchResult = 1;
809
+ glueType_1 = glueType;
810
+ }
811
+ break;
812
+ }
813
+ default: {
814
+ matchResult = 1;
815
+ glueType_1 = glueType;
816
+ }
817
+ }
818
+ switch (matchResult) {
819
+ case 0:
820
+ return false;
821
+ default:
822
+ return mentionsThis(glueType_1);
823
+ }
824
+ }
825
+
826
+ function nestsThisInSignature(glueMember) {
827
+ const inSignature = (returnType, parameters) => {
828
+ if (nestsThis(returnType)) {
829
+ return true;
830
+ }
831
+ else {
832
+ return exists((parameter) => nestsThis(parameter.Type), parameters);
833
+ }
834
+ };
835
+ let matchResult, info_1, info_2;
836
+ switch (glueMember.tag) {
837
+ case 0: {
838
+ if (!glueMember.fields[0].IsStatic) {
839
+ matchResult = 0;
840
+ info_1 = glueMember.fields[0];
841
+ }
842
+ else {
843
+ matchResult = 2;
844
+ }
845
+ break;
846
+ }
847
+ case 6: {
848
+ matchResult = 1;
849
+ info_2 = glueMember.fields[0];
850
+ break;
851
+ }
852
+ default:
853
+ matchResult = 2;
854
+ }
855
+ switch (matchResult) {
856
+ case 0:
857
+ return inSignature(info_1.Type, info_1.Parameters);
858
+ case 1:
859
+ return inSignature(info_2.Type, info_2.Parameters);
860
+ default:
861
+ return false;
862
+ }
863
+ }
864
+
865
+ export function thisMembersOfBases(typeMemory, thisType, members, heritageClauses) {
866
+ const collect = (visited, heritageClauses_1) => collect_1((_arg) => {
867
+ if (_arg.tag === 13) {
868
+ const typeReference = _arg.fields[0];
869
+ const key = (typeReference.FullName !== "") ? typeReference.FullName : typeReference.Name;
870
+ const matchValue = tryFindBase(typeMemory, typeReference);
871
+ let matchResult, baseDeclaration_1;
872
+ if (matchValue != null) {
873
+ if (!FSharpSet__Contains(visited, key)) {
874
+ matchResult = 0;
875
+ baseDeclaration_1 = matchValue;
876
+ }
877
+ else {
878
+ matchResult = 1;
879
+ }
880
+ }
881
+ else {
882
+ matchResult = 1;
883
+ }
884
+ switch (matchResult) {
885
+ case 0: {
886
+ const substitutions = GlueSubstitution_ofTypeArguments(baseDeclaration_1.TypeParameters, typeReference.TypeArguments);
887
+ const withThis = add_1("this", new GlueType(/* ThisType */ 17, [thisType]), substitutions);
888
+ const ownMembers = map((glueMember_1) => GlueSubstitution_substituteMember(withThis, glueMember_1), filter(nestsThisInSignature, baseDeclaration_1.Members));
889
+ const baseClauses = map((glueType) => GlueSubstitution_substitute(substitutions, glueType), baseDeclaration_1.HeritageClauses);
890
+ return append(singleton(ownMembers), collect(FSharpSet__Add(visited, key), baseClauses));
891
+ }
892
+ default:
893
+ return empty();
894
+ }
895
+ }
896
+ else {
897
+ return empty();
898
+ }
899
+ }, heritageClauses_1);
900
+ return fold((tupledArg, levelMembers) => {
901
+ const taken = tupledArg[0];
902
+ const added = filter((glueMember_3) => {
903
+ const matchValue_1 = memberName(glueMember_3);
904
+ if (matchValue_1 == null) {
905
+ return false;
906
+ }
907
+ else {
908
+ return !FSharpSet__Contains(taken, matchValue_1);
909
+ }
910
+ }, levelMembers);
911
+ return [fold((taken_1, glueMember_4) => {
912
+ const matchValue_2 = memberName(glueMember_4);
913
+ if (matchValue_2 == null) {
914
+ return taken_1;
915
+ }
916
+ else {
917
+ return add(matchValue_2, taken_1);
918
+ }
919
+ }, taken, added), append(tupledArg[1], added)];
920
+ }, [ofList(choose(memberName, members), {
921
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
922
+ }), empty()], collect(empty_1({
923
+ Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
924
+ }), heritageClauses))[1];
925
+ }
926
+
@@ -169,7 +169,7 @@ export function create(typeMemory) {
169
169
  info_7 = glueType.fields[0];
170
170
  break;
171
171
  }
172
- case 31: {
172
+ case 32: {
173
173
  matchResult_1 = 6;
174
174
  info_8 = glueType.fields[0];
175
175
  break;
@@ -231,7 +231,7 @@ export function create(typeMemory) {
231
231
  iterate(collectDeclared, glueType_1.fields[0].Types);
232
232
  break;
233
233
  }
234
- case 31: {
234
+ case 32: {
235
235
  iterate(collectDeclared, glueType_1.fields[0].Types);
236
236
  break;
237
237
  }
@@ -349,7 +349,7 @@ function substitute(state, name, map, glueType) {
349
349
  elementType = glueType.fields[0];
350
350
  break;
351
351
  }
352
- case 30: {
352
+ case 31: {
353
353
  matchResult = 6;
354
354
  innerType = glueType.fields[0];
355
355
  break;
@@ -386,7 +386,7 @@ function substitute(state, name, map, glueType) {
386
386
  case 5:
387
387
  return new GlueType(/* Array */ 14, [substitute_1(elementType)]);
388
388
  case 6:
389
- return new GlueType(/* ReadOnly */ 30, [substitute_1(innerType)]);
389
+ return new GlueType(/* ReadOnly */ 31, [substitute_1(innerType)]);
390
390
  case 7:
391
391
  return new GlueType(/* OptionalType */ 23, [substitute_1(innerType_1)]);
392
392
  case 8: