@glutinum/cli 1.0.0-beta.3 → 1.0.0-beta.5

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.
@@ -1,81 +1,39 @@
1
1
 
2
- import { length, exists, ofSeq, forAll, cons, tryFind, filter, choose, tail, head, isEmpty, map, fold, tryPick, append, empty, collect as collect_1, singleton } from "../../fable_modules/fable-library-js.5.17.2/List.js";
3
- import { FSharpSet__Contains, ofSeq as ofSeq_1, empty as empty_1, ofList, add, contains } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
4
- import { defaultOf, disposeSafe, getEnumerator, safeHash, equals, comparePrimitives, curry2 } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
5
- import { GlueType, GluePrimitive, GlueMember, GlueProperty } from "../GlueAST.js";
2
+ import { substring } from "../../fable_modules/fable-library-js.5.17.2/String.js";
3
+ import { length, collect, filter, choose, empty, append, forAll, exists, tail, head, isEmpty, map, fold, tryPick } from "../../fable_modules/fable-library-js.5.17.2/List.js";
4
+ import { FSharpSet__Contains, empty as empty_1, ofList, add, contains } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
5
+ import { safeHash, equals, comparePrimitives, curry2 } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
6
+ import { GluePrimitive, GlueSubstitution_substituteMember, GlueTypeUnion, GlueTypeReference, GlueType, GlueSubstitution_substitute, GlueSubstitution_ofTypeArguments, GlueMember, GlueProperty } from "../GlueAST.js";
6
7
  import { List_distinct, List_distinctBy } from "../../fable_modules/fable-library-js.5.17.2/Seq2.js";
7
8
  import { FSharpChoice$2 } from "../../fable_modules/fable-library-js.5.17.2/Choice.js";
8
- import { defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
9
- import { FSharpRef, Record } from "../../fable_modules/fable-library-js.5.17.2/Types.js";
10
- import { record_type, class_type, string_type } from "../../fable_modules/fable-library-js.5.17.2/Reflection.js";
11
- import { tryGetValue, addToSet } from "../../fable_modules/fable-library-js.5.17.2/MapUtil.js";
12
9
  import { isUnionCaseName } from "./Utils.js";
13
10
  import { memberTypeParameterNames } from "./TypeParameters.js";
11
+ import { defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
14
12
 
15
- function typeReferenceFullNames(glueType) {
16
- switch (glueType.tag) {
17
- case 13:
18
- return singleton(glueType.fields[0].FullName);
19
- case 7:
20
- return collect_1(typeReferenceFullNames, glueType.fields[0].fields[0]);
21
- default:
22
- return empty();
13
+ function containerOf(fullName) {
14
+ let unquoted;
15
+ if (fullName.startsWith("\"")) {
16
+ const matchValue = fullName.indexOf("\".", 1) | 0;
17
+ unquoted = ((matchValue === -1) ? fullName : substring(fullName, matchValue + 2));
23
18
  }
24
- }
25
-
26
- function memberParameters(glueMember) {
27
- switch (glueMember.tag) {
28
- case 6:
29
- return glueMember.fields[0].Parameters;
30
- case 4:
31
- return glueMember.fields[0].Parameters;
32
- case 7:
33
- return glueMember.fields[0].Parameters;
34
- case 1:
35
- case 2:
36
- case 3:
37
- case 5:
38
- return empty();
39
- default:
40
- return glueMember.fields[0].Parameters;
19
+ else {
20
+ unquoted = fullName;
21
+ }
22
+ const matchValue_1 = unquoted.lastIndexOf(".") | 0;
23
+ if (matchValue_1 === -1) {
24
+ return "";
25
+ }
26
+ else {
27
+ return substring(unquoted, 0, matchValue_1);
41
28
  }
42
29
  }
43
30
 
44
- function parameters(glueType_mut) {
45
- parameters:
46
- while (true) {
47
- const glueType = glueType_mut;
48
- switch (glueType.tag) {
49
- case 6:
50
- return glueType.fields[0].Parameters;
51
- case 12: {
52
- const info_1 = glueType.fields[0];
53
- return append(collect_1((_arg) => _arg.Parameters, info_1.Constructors), collect_1(memberParameters, info_1.Members));
54
- }
55
- case 1:
56
- return collect_1(memberParameters, glueType.fields[0].Members);
57
- case 22:
58
- return collect_1(memberParameters, glueType.fields[0].Members);
59
- case 15:
60
- return glueType.fields[0].Parameters;
61
- case 29:
62
- return glueType.fields[0].Parameters;
63
- case 5: {
64
- glueType_mut = glueType.fields[0].Type;
65
- continue parameters;
66
- }
67
- case 2: {
68
- glueType_mut = glueType.fields[0].Type;
69
- continue parameters;
70
- }
71
- case 25: {
72
- glueType_mut = glueType.fields[0];
73
- continue parameters;
74
- }
75
- default:
76
- return empty();
77
- }
78
- break;
31
+ function isEnclosing(container, inner) {
32
+ if ((container === "") ? true : (container === inner)) {
33
+ return true;
34
+ }
35
+ else {
36
+ return inner.startsWith(container + ".");
79
37
  }
80
38
  }
81
39
 
@@ -108,9 +66,9 @@ export function tryResolveMembers(typeMemory, info) {
108
66
  }
109
67
  else {
110
68
  const visited_1 = add(info_1.FullName, visited);
111
- const option_7 = fold((acc, heritageClause_1) => {
69
+ const option_9 = fold((acc, heritageClause_1) => {
112
70
  let typeReference;
113
- let matchValue_1;
71
+ let matchValue_3;
114
72
  const heritageClause = heritageClause_1;
115
73
  let matchResult_1, typeReference_1, members, typeReference_2;
116
74
  switch (heritageClause.tag) {
@@ -173,7 +131,7 @@ export function tryResolveMembers(typeMemory, info) {
173
131
  const binder = curry2(resolve)(visited_1);
174
132
  const option_1 = option;
175
133
  option_3 = ((option_1 != null) ? binder(option_1) : undefined);
176
- matchValue_1 = ((option_3 != null) ? map((_arg_1) => {
134
+ matchValue_3 = ((option_3 != null) ? map((_arg_1) => {
177
135
  if (_arg_1.tag === 1) {
178
136
  const property = _arg_1.fields[0];
179
137
  return new GlueMember(/* Property */ 1, [new GlueProperty(property.Name, property.Documentation, property.Type, property.IsStatic, true, property.Accessor, property.IsPrivate)]);
@@ -185,65 +143,225 @@ export function tryResolveMembers(typeMemory, info) {
185
143
  break;
186
144
  }
187
145
  default:
188
- matchValue_1 = undefined;
146
+ matchValue_3 = undefined;
189
147
  }
190
148
  break;
191
149
  }
192
150
  case 1: {
193
- matchValue_1 = members;
151
+ matchValue_3 = members;
194
152
  break;
195
153
  }
196
154
  case 2: {
197
- const option_4 = tryFindInterface(typeReference_2.FullName);
198
- const binder_2 = curry2(resolve)(visited_1);
199
- const option_5 = option_4;
200
- matchValue_1 = ((option_5 != null) ? binder_2(option_5) : undefined);
155
+ const matchValue_1 = tryFindInterface(typeReference_2.FullName);
156
+ if (matchValue_1 == null) {
157
+ matchValue_3 = undefined;
158
+ }
159
+ else {
160
+ const baseInterface = matchValue_1;
161
+ const substitutions = GlueSubstitution_ofTypeArguments(baseInterface.TypeParameters, typeReference_2.TypeArguments);
162
+ const qualifySelf = (glueType) => {
163
+ let reference;
164
+ let matchResult_3, thisType_1, reference_1, reference_2, cases, elementType, innerType, glueType_2;
165
+ switch (glueType.tag) {
166
+ case 17: {
167
+ if (glueType.fields[0].Name === baseInterface.Name) {
168
+ matchResult_3 = 0;
169
+ thisType_1 = glueType.fields[0];
170
+ }
171
+ else {
172
+ matchResult_3 = 6;
173
+ glueType_2 = glueType;
174
+ }
175
+ break;
176
+ }
177
+ case 13: {
178
+ if ((reference = glueType.fields[0], (reference.FullName === baseInterface.FullName) && isEmpty(reference.ModulePath))) {
179
+ matchResult_3 = 1;
180
+ reference_1 = glueType.fields[0];
181
+ }
182
+ else {
183
+ matchResult_3 = 2;
184
+ reference_2 = glueType.fields[0];
185
+ }
186
+ break;
187
+ }
188
+ case 7: {
189
+ matchResult_3 = 3;
190
+ cases = glueType.fields[0].fields[0];
191
+ break;
192
+ }
193
+ case 14: {
194
+ matchResult_3 = 4;
195
+ elementType = glueType.fields[0];
196
+ break;
197
+ }
198
+ case 23: {
199
+ matchResult_3 = 5;
200
+ innerType = glueType.fields[0];
201
+ break;
202
+ }
203
+ default: {
204
+ matchResult_3 = 6;
205
+ glueType_2 = glueType;
206
+ }
207
+ }
208
+ switch (matchResult_3) {
209
+ case 0:
210
+ return new GlueType(/* TypeReference */ 13, [new GlueTypeReference(baseInterface.Name, baseInterface.FullName, typeReference_2.ModulePath, map((typeParameter) => GlueSubstitution_substitute(substitutions, new GlueType(/* TypeParameter */ 16, [typeParameter.Name])), thisType_1.TypeParameters), false)]);
211
+ case 1:
212
+ return new GlueType(/* TypeReference */ 13, [new GlueTypeReference(reference_1.Name, reference_1.FullName, typeReference_2.ModulePath, map(qualifySelf, reference_1.TypeArguments), reference_1.IsStandardLibrary)]);
213
+ case 2:
214
+ return new GlueType(/* TypeReference */ 13, [new GlueTypeReference(reference_2.Name, reference_2.FullName, reference_2.ModulePath, map(qualifySelf, reference_2.TypeArguments), reference_2.IsStandardLibrary)]);
215
+ case 3:
216
+ return new GlueType(/* Union */ 7, [new GlueTypeUnion(map(qualifySelf, cases))]);
217
+ case 4:
218
+ return new GlueType(/* Array */ 14, [qualifySelf(elementType)]);
219
+ case 5:
220
+ return new GlueType(/* OptionalType */ 23, [qualifySelf(innerType)]);
221
+ default:
222
+ return glueType_2;
223
+ }
224
+ };
225
+ const namesForeignType = (glueType_3_mut) => {
226
+ namesForeignType:
227
+ while (true) {
228
+ const glueType_3 = glueType_3_mut;
229
+ let matchResult_4, innerType_1;
230
+ switch (glueType_3.tag) {
231
+ case 13: {
232
+ matchResult_4 = 0;
233
+ break;
234
+ }
235
+ case 7: {
236
+ matchResult_4 = 1;
237
+ break;
238
+ }
239
+ case 14: {
240
+ matchResult_4 = 2;
241
+ innerType_1 = glueType_3.fields[0];
242
+ break;
243
+ }
244
+ case 30: {
245
+ matchResult_4 = 2;
246
+ innerType_1 = glueType_3.fields[0];
247
+ break;
248
+ }
249
+ case 23: {
250
+ matchResult_4 = 2;
251
+ innerType_1 = glueType_3.fields[0];
252
+ break;
253
+ }
254
+ case 18: {
255
+ matchResult_4 = 3;
256
+ break;
257
+ }
258
+ case 15: {
259
+ matchResult_4 = 4;
260
+ break;
261
+ }
262
+ default:
263
+ matchResult_4 = 5;
264
+ }
265
+ switch (matchResult_4) {
266
+ case 0: {
267
+ const reference_3 = glueType_3.fields[0];
268
+ if ((isEmpty(reference_3.ModulePath) && !reference_3.IsStandardLibrary) && !isEnclosing(containerOf(reference_3.FullName), containerOf(info_1.FullName))) {
269
+ return true;
270
+ }
271
+ else {
272
+ return exists(namesForeignType, reference_3.TypeArguments);
273
+ }
274
+ }
275
+ case 1:
276
+ return exists(namesForeignType, glueType_3.fields[0].fields[0]);
277
+ case 2: {
278
+ glueType_3_mut = innerType_1;
279
+ continue namesForeignType;
280
+ }
281
+ case 3:
282
+ return exists(namesForeignType, glueType_3.fields[0]);
283
+ case 4: {
284
+ const functionType = glueType_3.fields[0];
285
+ if (namesForeignType(functionType.Type)) {
286
+ return true;
287
+ }
288
+ else {
289
+ return exists((parameter) => namesForeignType(parameter.Type), functionType.Parameters);
290
+ }
291
+ }
292
+ default:
293
+ return false;
294
+ }
295
+ break;
296
+ }
297
+ };
298
+ let option_7;
299
+ const option_5 = resolve(visited_1, baseInterface);
300
+ option_7 = ((option_5 != null) ? map((glueMember_1) => {
301
+ const matchValue_2 = GlueSubstitution_substituteMember(substitutions, glueMember_1);
302
+ if (matchValue_2.tag === 1) {
303
+ const property_1 = matchValue_2.fields[0];
304
+ return new GlueMember(/* Property */ 1, [new GlueProperty(property_1.Name, property_1.Documentation, qualifySelf(property_1.Type), property_1.IsStatic, property_1.IsOptional, property_1.Accessor, property_1.IsPrivate)]);
305
+ }
306
+ else {
307
+ return matchValue_2;
308
+ }
309
+ }, option_5) : undefined);
310
+ matchValue_3 = ((option_7 != null) ? (forAll((_arg_2) => {
311
+ if (_arg_2.tag === 1) {
312
+ return !namesForeignType(_arg_2.fields[0].Type);
313
+ }
314
+ else {
315
+ return true;
316
+ }
317
+ }, option_7) ? option_7 : undefined) : undefined);
318
+ }
201
319
  break;
202
320
  }
203
321
  default:
204
- matchValue_1 = undefined;
322
+ matchValue_3 = undefined;
205
323
  }
206
- let matchResult_3, acc_1, members_1;
324
+ let matchResult_5, acc_1, members_1;
207
325
  if (acc != null) {
208
- if (matchValue_1 != null) {
209
- matchResult_3 = 0;
326
+ if (matchValue_3 != null) {
327
+ matchResult_5 = 0;
210
328
  acc_1 = acc;
211
- members_1 = matchValue_1;
329
+ members_1 = matchValue_3;
212
330
  }
213
331
  else {
214
- matchResult_3 = 1;
332
+ matchResult_5 = 1;
215
333
  }
216
334
  }
217
335
  else {
218
- matchResult_3 = 1;
336
+ matchResult_5 = 1;
219
337
  }
220
- switch (matchResult_3) {
338
+ switch (matchResult_5) {
221
339
  case 0:
222
340
  return append(acc_1, members_1);
223
341
  default:
224
342
  return undefined;
225
343
  }
226
344
  }, empty(), info_1.HeritageClauses);
227
- if (option_7 != null) {
228
- return (inheritedMembers = option_7, (ownNames = ofList(choose((_arg_2) => {
229
- if (_arg_2.tag === 1) {
230
- return _arg_2.fields[0].Name;
345
+ if (option_9 != null) {
346
+ return (inheritedMembers = option_9, (ownNames = ofList(choose((_arg_3) => {
347
+ if (_arg_3.tag === 1) {
348
+ return _arg_3.fields[0].Name;
231
349
  }
232
350
  else {
233
351
  return undefined;
234
352
  }
235
353
  }, info_1.Members), {
236
354
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
237
- }), append(List_distinctBy((_arg_4) => {
238
- if (_arg_4.tag === 1) {
239
- return new FSharpChoice$2(/* Choice1Of2 */ 0, [_arg_4.fields[0].Name]);
355
+ }), append(List_distinctBy((_arg_5) => {
356
+ if (_arg_5.tag === 1) {
357
+ return new FSharpChoice$2(/* Choice1Of2 */ 0, [_arg_5.fields[0].Name]);
240
358
  }
241
359
  else {
242
- return new FSharpChoice$2(/* Choice2Of2 */ 1, [_arg_4]);
360
+ return new FSharpChoice$2(/* Choice2Of2 */ 1, [_arg_5]);
243
361
  }
244
- }, filter((_arg_3) => {
245
- if (_arg_3.tag === 1) {
246
- return !contains(_arg_3.fields[0].Name, ownNames);
362
+ }, filter((_arg_4) => {
363
+ if (_arg_4.tag === 1) {
364
+ return !contains(_arg_4.fields[0].Name, ownNames);
247
365
  }
248
366
  else {
249
367
  return true;
@@ -263,260 +381,7 @@ export function tryResolveMembers(typeMemory, info) {
263
381
  }), info);
264
382
  }
265
383
 
266
- function constrainedParameterFullNames(glueType) {
267
- const ofSignature = (typeParameters, parameters_1) => collect_1((parameter) => {
268
- let option_3, option_1;
269
- const matchValue = parameter.Type;
270
- if (matchValue.tag === 16) {
271
- return defaultArg((option_3 = ((option_1 = tryFind((typeParameter) => (typeParameter.Name === matchValue.fields[0]), typeParameters), (option_1 != null) ? option_1.Constraint : undefined)), (option_3 != null) ? typeReferenceFullNames(option_3) : undefined), empty());
272
- }
273
- else {
274
- return empty();
275
- }
276
- }, parameters_1);
277
- const ofMember = (glueMember) => {
278
- switch (glueMember.tag) {
279
- case 0: {
280
- const info = glueMember.fields[0];
281
- return ofSignature(info.TypeParameters, info.Parameters);
282
- }
283
- case 6: {
284
- const info_1 = glueMember.fields[0];
285
- return ofSignature(info_1.TypeParameters, info_1.Parameters);
286
- }
287
- case 4: {
288
- const info_2 = glueMember.fields[0];
289
- return ofSignature(info_2.TypeParameters, info_2.Parameters);
290
- }
291
- default:
292
- return empty();
293
- }
294
- };
295
- const collect = (glueType_2_mut) => {
296
- collect:
297
- while (true) {
298
- const glueType_2 = glueType_2_mut;
299
- switch (glueType_2.tag) {
300
- case 6: {
301
- const info_3 = glueType_2.fields[0];
302
- return ofSignature(info_3.TypeParameters, info_3.Parameters);
303
- }
304
- case 12:
305
- return collect_1(ofMember, glueType_2.fields[0].Members);
306
- case 1:
307
- return collect_1(ofMember, glueType_2.fields[0].Members);
308
- case 22:
309
- return collect_1(ofMember, glueType_2.fields[0].Members);
310
- case 5: {
311
- glueType_2_mut = glueType_2.fields[0].Type;
312
- continue collect;
313
- }
314
- case 2: {
315
- glueType_2_mut = glueType_2.fields[0].Type;
316
- continue collect;
317
- }
318
- case 25: {
319
- glueType_2_mut = glueType_2.fields[0];
320
- continue collect;
321
- }
322
- default:
323
- return empty();
324
- }
325
- break;
326
- }
327
- };
328
- return collect(glueType);
329
- }
330
-
331
- function propertyTypeReferences(glueType_mut) {
332
- propertyTypeReferences:
333
- while (true) {
334
- const glueType = glueType_mut;
335
- let matchResult, innerType;
336
- switch (glueType.tag) {
337
- case 13: {
338
- matchResult = 0;
339
- break;
340
- }
341
- case 7: {
342
- matchResult = 1;
343
- break;
344
- }
345
- case 14: {
346
- matchResult = 2;
347
- innerType = glueType.fields[0];
348
- break;
349
- }
350
- case 30: {
351
- matchResult = 2;
352
- innerType = glueType.fields[0];
353
- break;
354
- }
355
- case 23: {
356
- matchResult = 2;
357
- innerType = glueType.fields[0];
358
- break;
359
- }
360
- case 18: {
361
- matchResult = 3;
362
- break;
363
- }
364
- default:
365
- matchResult = 4;
366
- }
367
- switch (matchResult) {
368
- case 0: {
369
- const typeReference = glueType.fields[0];
370
- return cons(typeReference.FullName, collect_1(propertyTypeReferences, typeReference.TypeArguments));
371
- }
372
- case 1:
373
- return collect_1(propertyTypeReferences, glueType.fields[0].fields[0]);
374
- case 2: {
375
- glueType_mut = innerType;
376
- continue propertyTypeReferences;
377
- }
378
- case 3:
379
- return collect_1(propertyTypeReferences, glueType.fields[0]);
380
- default:
381
- return empty();
382
- }
383
- break;
384
- }
385
- }
386
-
387
- export class State extends Record {
388
- constructor(ArgumentReachable) {
389
- super();
390
- this.ArgumentReachable = ArgumentReachable;
391
- }
392
- }
393
-
394
- export function State_$reflection() {
395
- return record_type("Glutinum.Converter.Transformer.ParamObjectCandidate.State", [], State, () => [["ArgumentReachable", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type])]]);
396
- }
397
-
398
- export function create(typeMemory) {
399
- const argumentReachable = new Set([]);
400
- const optionBags = new Map([]);
401
- const enumerator = getEnumerator(typeMemory);
402
- try {
403
- while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
404
- let info;
405
- const glueType = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
406
- let matchResult, info_1;
407
- if (glueType.tag === 1) {
408
- if ((info = glueType.fields[0], !isEmpty(info.Members) && forAll((_arg) => {
409
- if (_arg.tag === 1) {
410
- return true;
411
- }
412
- else {
413
- return false;
414
- }
415
- }, info.Members))) {
416
- matchResult = 0;
417
- info_1 = glueType.fields[0];
418
- }
419
- else {
420
- matchResult = 1;
421
- }
422
- }
423
- else {
424
- matchResult = 1;
425
- }
426
- switch (matchResult) {
427
- case 0: {
428
- optionBags.set(info_1.FullName, info_1);
429
- break;
430
- }
431
- }
432
- }
433
- }
434
- finally {
435
- disposeSafe(enumerator);
436
- }
437
- const enumerator_1 = getEnumerator(typeMemory);
438
- try {
439
- while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
440
- const glueType_1 = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
441
- const enumerator_2 = getEnumerator(parameters(glueType_1));
442
- try {
443
- while (enumerator_2["System.Collections.IEnumerator.MoveNext"]()) {
444
- const enumerator_3 = getEnumerator(typeReferenceFullNames(enumerator_2["System.Collections.Generic.IEnumerator`1.get_Current"]().Type));
445
- try {
446
- while (enumerator_3["System.Collections.IEnumerator.MoveNext"]()) {
447
- addToSet(enumerator_3["System.Collections.Generic.IEnumerator`1.get_Current"](), argumentReachable);
448
- }
449
- }
450
- finally {
451
- disposeSafe(enumerator_3);
452
- }
453
- }
454
- }
455
- finally {
456
- disposeSafe(enumerator_2);
457
- }
458
- const enumerator_4 = getEnumerator(constrainedParameterFullNames(glueType_1));
459
- try {
460
- while (enumerator_4["System.Collections.IEnumerator.MoveNext"]()) {
461
- addToSet(enumerator_4["System.Collections.Generic.IEnumerator`1.get_Current"](), argumentReachable);
462
- }
463
- }
464
- finally {
465
- disposeSafe(enumerator_4);
466
- }
467
- }
468
- }
469
- finally {
470
- disposeSafe(enumerator_1);
471
- }
472
- let changed = true;
473
- while (changed) {
474
- changed = false;
475
- const enumerator_5 = getEnumerator(ofSeq(argumentReachable));
476
- try {
477
- while (enumerator_5["System.Collections.IEnumerator.MoveNext"]()) {
478
- const fullName_2 = enumerator_5["System.Collections.Generic.IEnumerator`1.get_Current"]();
479
- let matchValue;
480
- let outArg = defaultOf();
481
- matchValue = [tryGetValue(optionBags, fullName_2, new FSharpRef(() => outArg, (v) => {
482
- outArg = v;
483
- })), outArg];
484
- if (matchValue[0]) {
485
- const enumerator_6 = getEnumerator(matchValue[1].Members);
486
- try {
487
- while (enumerator_6["System.Collections.IEnumerator.MoveNext"]()) {
488
- const glueMember = enumerator_6["System.Collections.Generic.IEnumerator`1.get_Current"]();
489
- if (glueMember.tag === 1) {
490
- const enumerator_7 = getEnumerator(propertyTypeReferences(glueMember.fields[0].Type));
491
- try {
492
- while (enumerator_7["System.Collections.IEnumerator.MoveNext"]()) {
493
- if (addToSet(enumerator_7["System.Collections.Generic.IEnumerator`1.get_Current"](), argumentReachable)) {
494
- changed = true;
495
- }
496
- }
497
- }
498
- finally {
499
- disposeSafe(enumerator_7);
500
- }
501
- }
502
- }
503
- }
504
- finally {
505
- disposeSafe(enumerator_6);
506
- }
507
- }
508
- }
509
- }
510
- finally {
511
- disposeSafe(enumerator_5);
512
- }
513
- }
514
- return new State(ofSeq_1(argumentReachable, {
515
- Compare: (x, y) => (comparePrimitives(x, y) | 0),
516
- }));
517
- }
518
-
519
- export function isCandidate(state, typeMemory, info) {
384
+ export function isCandidate(typeMemory, info) {
520
385
  const members = tryResolveMembers(typeMemory, info);
521
386
  let hasOnlyProperties;
522
387
  if (members == null) {
@@ -550,7 +415,7 @@ export function isCandidate(state, typeMemory, info) {
550
415
  }, members_1));
551
416
  }
552
417
  let typeParametersAreInferable;
553
- const mentioned = ofList(collect_1(memberTypeParameterNames, defaultArg(members, info.Members)), {
418
+ const mentioned = ofList(collect(memberTypeParameterNames, defaultArg(members, info.Members)), {
554
419
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
555
420
  });
556
421
  typeParametersAreInferable = forAll((typeParameter) => {
@@ -561,7 +426,6 @@ export function isCandidate(state, typeMemory, info) {
561
426
  return typeParameter.Default != null;
562
427
  }
563
428
  }, info.TypeParameters);
564
- const isUsedAsArgument = FSharpSet__Contains(state.ArgumentReachable, info.FullName);
565
429
  const isDeclaredOnce = length(List_distinct(choose((_arg_2) => {
566
430
  let matchResult, candidate_1;
567
431
  if (_arg_2.tag === 1) {
@@ -586,7 +450,7 @@ export function isCandidate(state, typeMemory, info) {
586
450
  Equals: equals,
587
451
  GetHashCode: (x_1) => (safeHash(x_1) | 0),
588
452
  })) <= 1;
589
- if ((hasOnlyProperties && typeParametersAreInferable) && isUsedAsArgument) {
453
+ if (hasOnlyProperties && typeParametersAreInferable) {
590
454
  return isDeclaredOnce;
591
455
  }
592
456
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glutinum/cli",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0-beta.5",
4
4
  "description": "TypeScript definition to F# bindings converter",
5
5
  "type": "module",
6
6
  "main": "index.js",