@glutinum/cli 1.0.0-beta.6 → 1.0.0-beta.7
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.
- package/dist/Glutinum.Converter/GlueAST.js +3 -2
- package/dist/Glutinum.Converter/Packages.js +1 -1
- package/dist/Glutinum.Converter/Read.js +103 -140
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +53 -5
- package/dist/Glutinum.Converter/Reader/Node.js +3 -3
- package/dist/Glutinum.Converter/Reader/Parameters.js +3 -2
- package/dist/Glutinum.Converter/Reader/TypeNode.js +76 -22
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +53 -14
- package/dist/Glutinum.Converter/Reader/Types.js +5 -0
- package/dist/Glutinum.Converter/Reader/Utils.js +62 -31
- package/dist/Glutinum.Converter/Transform.js +98 -109
- package/dist/Glutinum.Converter/Transformer/Conditionals.js +2 -64
- package/dist/Glutinum.Converter/Transformer/Context.js +23 -10
- package/dist/Glutinum.Converter/Transformer/Heritage.js +89 -2
- package/package.json +1 -1
|
@@ -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
|
-
|
|
351
|
-
|
|
352
|
-
|
|
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
|
|
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
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { ofList as ofList_1, empty as empty_1, FSharpSet__Add, FSharpSet__Contains, ofSeq } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
|
|
3
3
|
import { equals, comparePrimitives } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
4
|
-
import {
|
|
4
|
+
import { exists, take, forAll2, length, forAll, indexed as indexed_1, fold, head, tail, isEmpty, map, singleton, filter, empty, choose, append, collect, tryPick } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
5
5
|
import { defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
|
|
6
6
|
import { Record } from "../../fable_modules/fable-library-js.5.17.2/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";
|
|
@@ -20,7 +20,7 @@ export function isInheritableType(typ) {
|
|
|
20
20
|
return false;
|
|
21
21
|
case 11: {
|
|
22
22
|
const typeReference = typ.fields[0];
|
|
23
|
-
if (!typeReference.Name.startsWith("JS.") && (typeReference.Name !== "Action")) {
|
|
23
|
+
if ((!typeReference.Name.startsWith("JS.") && (typeReference.Name !== "Action")) && (typeReference.Name !== "RegExp")) {
|
|
24
24
|
return !FSharpSet__Contains(primitiveNames, typeReference.Name);
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
@@ -210,6 +210,93 @@ function tryFindBase(typeMemory, typeReference) {
|
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
/**
|
|
214
|
+
* F# rejects an interface inherited twice with different type arguments (FS3360)
|
|
215
|
+
*/
|
|
216
|
+
export function withoutBasesOfBases(typeMemory, heritageClauses) {
|
|
217
|
+
const basesBelow = (visited, clause) => {
|
|
218
|
+
let typeReference;
|
|
219
|
+
let matchResult, typeReference_1;
|
|
220
|
+
if (clause.tag === 13) {
|
|
221
|
+
if ((typeReference = clause.fields[0], (typeReference.FullName !== "") && !FSharpSet__Contains(visited, typeReference.FullName))) {
|
|
222
|
+
matchResult = 0;
|
|
223
|
+
typeReference_1 = clause.fields[0];
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
matchResult = 1;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
matchResult = 1;
|
|
231
|
+
}
|
|
232
|
+
switch (matchResult) {
|
|
233
|
+
case 0: {
|
|
234
|
+
const matchValue = tryFindBase(typeMemory, typeReference_1);
|
|
235
|
+
if (matchValue == null) {
|
|
236
|
+
return visited;
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
return fold((acc, baseClause) => {
|
|
240
|
+
let matchResult_1, baseReference_1;
|
|
241
|
+
if (baseClause.tag === 13) {
|
|
242
|
+
if (baseClause.fields[0].FullName !== "") {
|
|
243
|
+
matchResult_1 = 0;
|
|
244
|
+
baseReference_1 = baseClause.fields[0];
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
matchResult_1 = 1;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
matchResult_1 = 1;
|
|
252
|
+
}
|
|
253
|
+
switch (matchResult_1) {
|
|
254
|
+
case 0:
|
|
255
|
+
return basesBelow(FSharpSet__Add(acc, baseReference_1.FullName), baseClause);
|
|
256
|
+
default:
|
|
257
|
+
return acc;
|
|
258
|
+
}
|
|
259
|
+
}, visited, matchValue.HeritageClauses);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
default:
|
|
263
|
+
return visited;
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
const indexed = indexed_1(heritageClauses);
|
|
267
|
+
return map((tuple) => tuple[1], filter((tupledArg) => {
|
|
268
|
+
const clause_1 = tupledArg[1];
|
|
269
|
+
let matchResult_2, typeReference_3;
|
|
270
|
+
if (clause_1.tag === 13) {
|
|
271
|
+
if (clause_1.fields[0].FullName !== "") {
|
|
272
|
+
matchResult_2 = 0;
|
|
273
|
+
typeReference_3 = clause_1.fields[0];
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
matchResult_2 = 1;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
matchResult_2 = 1;
|
|
281
|
+
}
|
|
282
|
+
switch (matchResult_2) {
|
|
283
|
+
case 0:
|
|
284
|
+
return forAll((tupledArg_1) => {
|
|
285
|
+
if (tupledArg_1[0] === tupledArg[0]) {
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
return !FSharpSet__Contains(basesBelow(empty_1({
|
|
290
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
291
|
+
}), tupledArg_1[1]), typeReference_3.FullName);
|
|
292
|
+
}
|
|
293
|
+
}, indexed);
|
|
294
|
+
default:
|
|
295
|
+
return true;
|
|
296
|
+
}
|
|
297
|
+
}, indexed));
|
|
298
|
+
}
|
|
299
|
+
|
|
213
300
|
function memberName(glueMember) {
|
|
214
301
|
switch (glueMember.tag) {
|
|
215
302
|
case 6:
|