@glutinum/cli 1.0.0-beta.6 → 1.0.0-beta.8

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.
@@ -2,10 +2,10 @@
2
2
  import { Union, Record } from "../../fable_modules/fable-library-js.5.17.2/Types.js";
3
3
  import { GlueFunctionDeclaration, GlueProperty, GlueMethodSignature, GlueMember, GlueMethod, GlueTypeParameter, GlueParameter_$reflection, GlueTypeParameter_$reflection, GlueFunctionType, GlueParameter, GlueTypeUnion, GlueTypeReference, GlueSubstitution_mentionedTypeParameters, GlueConditionalType, GlueSubstitution_substitute, GlueType, GluePrimitive, GlueClassDeclaration_$reflection, GlueInterface_$reflection, GlueTypeAliasDeclaration_$reflection, GlueType_$reflection } from "../GlueAST.js";
4
4
  import { union_type, record_type, class_type, string_type, list_type } from "../../fable_modules/fable-library-js.5.17.2/Reflection.js";
5
- import { collect as collect_1, append, choose, singleton, cons, tryPick, zip, length, head as head_2, tail, item, mapIndexed, ofArray, forAll, empty as empty_1, contains, filter, isEmpty, map as map_1, exists, iterate } from "../../fable_modules/fable-library-js.5.17.2/List.js";
5
+ import { collect as collect_1, append, empty as empty_1, choose, singleton, cons, tryPick, zip, length, head as head_2, tail, item, mapIndexed, ofArray, filter, contains, forAll, isEmpty, map as map_1, exists, iterate } from "../../fable_modules/fable-library-js.5.17.2/List.js";
6
6
  import { ofSeq as ofSeq_1, add, empty, FSharpSet__Contains, FSharpSet__Add } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
7
7
  import { getItemFromDict } from "../../fable_modules/fable-library-js.5.17.2/MapUtil.js";
8
- import { safeHash, equals, stringHash, comparePrimitives, disposeSafe, getEnumerator, curry2 } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
8
+ import { safeHash, stringHash, equals, comparePrimitives, disposeSafe, getEnumerator, curry2 } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
9
9
  import { empty as empty_2, FSharpMap__get_IsEmpty, FSharpMap__get_Item, FSharpMap__TryFind, ofList, FSharpMap__ContainsKey, ofSeq } from "../../fable_modules/fable-library-js.5.17.2/Map.js";
10
10
  import { map } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
11
11
  import { defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
@@ -223,68 +223,6 @@ export function isInterfaceDeclaration(state, fullName) {
223
223
  }
224
224
  }
225
225
 
226
- /**
227
- * The type parameters of the function type `type Fn = <T>(value: T) => T` aliases
228
- */
229
- export function genericDelegateTypeParameters(state, fullName) {
230
- const matchValue = FSharpMap__TryFind(state.AllAliases, fullName);
231
- let matchResult, alias_1;
232
- if (matchValue != null) {
233
- if (isEmpty(matchValue.TypeParameters)) {
234
- matchResult = 0;
235
- alias_1 = matchValue;
236
- }
237
- else {
238
- matchResult = 1;
239
- }
240
- }
241
- else {
242
- matchResult = 1;
243
- }
244
- switch (matchResult) {
245
- case 0: {
246
- const matchValue_1 = alias_1.Type;
247
- if (matchValue_1.tag === 15) {
248
- const functionType = matchValue_1.fields[0];
249
- return map_1((_arg) => _arg.Name, filter((typeParameter) => {
250
- if (contains(typeParameter.Name, functionType.OwnTypeParameterNames, {
251
- Equals: (x, y) => (x === y),
252
- GetHashCode: (x) => (stringHash(x) | 0),
253
- })) {
254
- const matchValue_2 = typeParameter.Constraint;
255
- let matchResult_1;
256
- if (matchValue_2 != null) {
257
- if (matchValue_2.tag === 13) {
258
- matchResult_1 = 0;
259
- }
260
- else {
261
- matchResult_1 = 1;
262
- }
263
- }
264
- else {
265
- matchResult_1 = 0;
266
- }
267
- switch (matchResult_1) {
268
- case 0:
269
- return true;
270
- default:
271
- return false;
272
- }
273
- }
274
- else {
275
- return false;
276
- }
277
- }, functionType.TypeParameters));
278
- }
279
- else {
280
- return empty_1();
281
- }
282
- }
283
- default:
284
- return empty_1();
285
- }
286
- }
287
-
288
226
  function tryCollapse(resolve_1, conditionalType) {
289
227
  let head;
290
228
  const trueType = equals(conditionalType.TrueType, conditionalType.CheckType) ? conditionalType.ExtendsType : conditionalType.TrueType;
@@ -7,9 +7,9 @@ import { FSharpModule, FSharpTypeAlias, FSharpEnum, FSharpUnion, FSharpDelegate,
7
7
  import { Union, FSharpRef, Record } from "../../fable_modules/fable-library-js.5.17.2/Types.js";
8
8
  import { create, State_$reflection } from "./Conditionals.js";
9
9
  import { create as create_1, State_$reflection as State_$reflection_1 } from "./KeyOfMaps.js";
10
+ import { setItem, item } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
10
11
  import { getItemFromDict, tryGetValue } from "../../fable_modules/fable-library-js.5.17.2/MapUtil.js";
11
12
  import { collect, append, delay, toList, tryFindIndex } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
12
- import { setItem } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
13
13
  import { unwrap, defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
14
14
  import { FSharpMap__TryFind } from "../../fable_modules/fable-library-js.5.17.2/Map.js";
15
15
  import { FSharpSet__Contains, empty as empty_1, ofSeq } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
@@ -192,6 +192,7 @@ export class TypeLiteralsMemory {
192
192
  this.pending = (new Map([]));
193
193
  this.byDeclaration = (new Map([]));
194
194
  this.modulePath = [];
195
+ this.rootIsFileModule = false;
195
196
  }
196
197
  }
197
198
 
@@ -207,6 +208,20 @@ export function TypeLiteralsMemory__EnterModule_Z721C83C5(_, name) {
207
208
  void (_.modulePath.push(name));
208
209
  }
209
210
 
211
+ export function TypeLiteralsMemory__EnterFileModule_Z721C83C5(_, name) {
212
+ _.rootIsFileModule = (_.modulePath.length === 0);
213
+ void (_.modulePath.push(name));
214
+ }
215
+
216
+ export function TypeLiteralsMemory__get_RootModuleName(_) {
217
+ if (_.modulePath.length === 0) {
218
+ return undefined;
219
+ }
220
+ else {
221
+ return item(0, _.modulePath);
222
+ }
223
+ }
224
+
210
225
  export function TypeLiteralsMemory__LeaveModule(_) {
211
226
  _.modulePath.splice(_.modulePath.length - 1, 1);
212
227
  }
@@ -342,21 +357,19 @@ export function TypeLiteralsMemory__Remember_74C8CBB(_, id, root, name) {
342
357
  * The qualified name to reference the type named `name` by `GetTypeName` in `fullName`
343
358
  */
344
359
  export function TypeLiteralsMemory__ReferenceName_Z384F8060(_, fullName, name) {
360
+ let qualified;
345
361
  let matchValue;
346
362
  let outArg = defaultOf();
347
363
  matchValue = [tryGetValue(_.assigned, `${TypeLiteralsMemory__moduleKey(_)}|${fullName}/${name}`, new FSharpRef(() => outArg, (v) => {
348
364
  outArg = v;
349
365
  })), outArg];
350
- if (matchValue[0]) {
351
- if (matchValue[1][1] === 0) {
352
- return matchValue[1][0];
353
- }
354
- else {
355
- return withCountSuffix(matchValue[1][0], matchValue[1][1]);
356
- }
366
+ qualified = (matchValue[0] ? ((matchValue[1][1] === 0) ? matchValue[1][0] : withCountSuffix(matchValue[1][0], matchValue[1][1])) : fullName);
367
+ const rootDepth = (_.rootIsFileModule ? 1 : 0) | 0;
368
+ if (_.modulePath.length <= rootDepth) {
369
+ return qualified;
357
370
  }
358
371
  else {
359
- return fullName;
372
+ return concat(TypeLiteralsMemory__moduleKey(_), ".", qualified);
360
373
  }
361
374
  }
362
375
 
@@ -577,7 +590,7 @@ export function TransformContext__set_SiblingTypeNames_2FCB1351(__, v) {
577
590
 
578
591
  export function TransformContext__PushScope_27AED5E3(this$, scopeName, originalScopeName) {
579
592
  let option_1;
580
- const childContext = TransformContext_$ctor_Z1635F75A(this$.reporter, sanitizeName(FSharpSet__Contains(TransformContext__get_SiblingTypeNames(this$), scopeName + "Module") ? (scopeName + "_") : scopeName), this$.typeMemory, this$.state, this$.typeLiteralsMemory, this$.importSource, this$, unwrap((option_1 = originalScopeName, (option_1 != null) ? sanitizeName(option_1) : undefined)));
593
+ const childContext = TransformContext_$ctor_Z1635F75A(this$.reporter, sanitizeName(FSharpSet__Contains(TransformContext__get_SiblingTypeNames(this$), scopeName + "Module") ? (scopeName + "_") : (equals(TypeLiteralsMemory__get_RootModuleName(this$.typeLiteralsMemory), sanitizeTypeName(scopeName)) ? (scopeName + "_") : scopeName)), this$.typeMemory, this$.state, this$.typeLiteralsMemory, this$.importSource, this$, unwrap((option_1 = originalScopeName, (option_1 != null) ? sanitizeName(option_1) : undefined)));
581
594
  void (this$.modules.push(childContext));
582
595
  return childContext;
583
596
  }