@glutinum/cli 1.0.0-beta.13 → 1.0.0-beta.15
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 +19 -14
- package/dist/Glutinum.Converter/Merge.js +480 -205
- package/dist/Glutinum.Converter/Packages.js +2 -2
- package/dist/Glutinum.Converter/Printer.js +26 -21
- package/dist/Glutinum.Converter/Read.js +377 -169
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +25 -8
- package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +2 -2
- package/dist/Glutinum.Converter/Reader/Declaration.js +15 -15
- package/dist/Glutinum.Converter/Reader/Deferred.js +114 -43
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +98 -44
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +2 -2
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +61 -46
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +4 -4
- package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +38 -25
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +6 -5
- package/dist/Glutinum.Converter/Reader/Node.js +1 -1
- package/dist/Glutinum.Converter/Reader/TypeNode.js +244 -29
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +1 -1
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +143 -35
- package/dist/Glutinum.Converter/Reader/UtilityType.js +153 -40
- package/dist/Glutinum.Converter/Reader/Utils.js +186 -17
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +46 -16
- package/dist/Glutinum.Converter/Transform.js +1062 -629
- package/dist/Glutinum.Converter/Transformer/CallableProperties.js +2 -2
- package/dist/Glutinum.Converter/Transformer/Conditionals.js +17 -16
- package/dist/Glutinum.Converter/Transformer/Context.js +12 -4
- package/dist/Glutinum.Converter/Transformer/Exports.js +242 -66
- package/dist/Glutinum.Converter/Transformer/Heritage.js +278 -19
- package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +4 -4
- package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +105 -19
- package/dist/Glutinum.Converter/Transformer/TypeParameters.js +2 -2
- package/dist/Glutinum.Converter/Transformer/Utils.js +3 -3
- package/dist/Glutinum.Converter/Utils/Naming.js +10 -3
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { orElse, defaultArg, some } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
|
|
3
3
|
import { GlueTypeParameter, GlueAccessor, GlueLiteral, GlueType, GluePrimitive } from "../GlueAST.js";
|
|
4
4
|
import { tryParse } from "../../fable_modules/fable-library-js.5.21.0/Int32.js";
|
|
5
|
-
import { FSharpRef } from "../../fable_modules/fable-library-js.5.21.0/Types.js";
|
|
5
|
+
import { toString, FSharpRef } from "../../fable_modules/fable-library-js.5.21.0/Types.js";
|
|
6
6
|
import { tryParse as tryParse_1 } from "../../fable_modules/fable-library-js.5.21.0/Double.js";
|
|
7
7
|
import { equals, comparePrimitives, stringHash, defaultOf } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
8
8
|
import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.21.0/FSharp.Core.js";
|
|
@@ -10,13 +10,13 @@ import { withoutDeclarationExtension, normalizePath } from "../Utils/String.js";
|
|
|
10
10
|
import { class_type } from "../../fable_modules/fable-library-js.5.21.0/Reflection.js";
|
|
11
11
|
import { tryPick, map as map_2, last, iterate, toList, tryHead, exists } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
12
12
|
import { PackageContext__ModulePath_Z7E147617, PackageContext__NestedAmbientModuleSegments_32BC514A, PackageContext__IsExternalLibFile_Z721C83C5, PackageContext__IsEntryFile_Z721C83C5, ambientSpecifier, PackageContext__IsExternal_Z721C83C5, PackageContext__TryFindExternalModulePath_Z721C83C5, PackageContext__TryFindPackage_Z721C83C5 } from "./Types.js";
|
|
13
|
-
import { tail,
|
|
13
|
+
import { tail, cons, tryHead as tryHead_1, exists as exists_1, tryFind, isEmpty, head, tryItem, mapIndexed, choose, append, fold, ofArray, contains, filter, collect as collect_1, empty, map as map_1 } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
14
14
|
import { item as item_1 } from "../../fable_modules/fable-library-js.5.21.0/Array.js";
|
|
15
|
-
import { contains as contains_1, ofSeq } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
|
|
16
|
-
import {
|
|
15
|
+
import { contains as contains_1, empty as empty_1, add, FSharpSet__Contains, ofSeq } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
|
|
16
|
+
import { ts } from "@ts-morph/bootstrap";
|
|
17
|
+
import { ofList, empty as empty_2 } from "../../fable_modules/fable-library-js.5.21.0/Map.js";
|
|
17
18
|
import { substring, split } from "../../fable_modules/fable-library-js.5.21.0/String.js";
|
|
18
19
|
import { sanitizeTypeName, removeSurroundingQuotes } from "../Utils/Naming.js";
|
|
19
|
-
import { ts } from "@ts-morph/bootstrap";
|
|
20
20
|
import { FSharpChoice$3, FSharpChoice$2 } from "../../fable_modules/fable-library-js.5.21.0/Choice.js";
|
|
21
21
|
|
|
22
22
|
export function $007CHasTypeFlags$007C_$007C(flag, flags) {
|
|
@@ -174,7 +174,7 @@ export function tryReadLiteral(checker, expression) {
|
|
|
174
174
|
break;
|
|
175
175
|
}
|
|
176
176
|
default:
|
|
177
|
-
if (expression.pos < 0) {
|
|
177
|
+
if ((expression.pos < 0) ? true : Operators_IsNull(expression.getSourceFile())) {
|
|
178
178
|
matchResult = 4;
|
|
179
179
|
}
|
|
180
180
|
else {
|
|
@@ -232,11 +232,63 @@ export function moduleExportNameText(name) {
|
|
|
232
232
|
* Nodes synthesized by <c>typeToTypeNode</c> have no source text
|
|
233
233
|
*/
|
|
234
234
|
export function identifierText(node) {
|
|
235
|
-
if (Operators_IsNull(node.text)) {
|
|
236
|
-
return node.
|
|
235
|
+
if (!Operators_IsNull(node.text)) {
|
|
236
|
+
return node.text;
|
|
237
237
|
}
|
|
238
238
|
else {
|
|
239
|
-
|
|
239
|
+
let matchValue_1;
|
|
240
|
+
if (node.kind === 168) {
|
|
241
|
+
const expression = node.expression;
|
|
242
|
+
const matchValue = expression.kind;
|
|
243
|
+
switch (matchValue) {
|
|
244
|
+
case 9:
|
|
245
|
+
case 11:
|
|
246
|
+
case 15: {
|
|
247
|
+
matchValue_1 = toString(expression.text);
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
default:
|
|
251
|
+
matchValue_1 = undefined;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
matchValue_1 = undefined;
|
|
256
|
+
}
|
|
257
|
+
if (matchValue_1 == null) {
|
|
258
|
+
return node.getText();
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
return matchValue_1;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* `[Events.MEDIA_ATTACHING]` with `MEDIA_ATTACHING = "hlsMediaAttaching"` is the member `hlsMediaAttaching`
|
|
268
|
+
*/
|
|
269
|
+
export function memberNameText(checker, node) {
|
|
270
|
+
if ((node.kind === 168) && (node.pos >= 0)) {
|
|
271
|
+
const typ = checker.getTypeAtLocation(node.expression);
|
|
272
|
+
const matchValue = typ.flags;
|
|
273
|
+
let matchResult;
|
|
274
|
+
if ($007CHasTypeFlags$007C_$007C(1024, matchValue) != null) {
|
|
275
|
+
matchResult = 0;
|
|
276
|
+
}
|
|
277
|
+
else if ($007CHasTypeFlags$007C_$007C(2048, matchValue) != null) {
|
|
278
|
+
matchResult = 0;
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
matchResult = 1;
|
|
282
|
+
}
|
|
283
|
+
switch (matchResult) {
|
|
284
|
+
case 0:
|
|
285
|
+
return toString(typ.value);
|
|
286
|
+
default:
|
|
287
|
+
return identifierText(node);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
return identifierText(node);
|
|
240
292
|
}
|
|
241
293
|
}
|
|
242
294
|
|
|
@@ -598,18 +650,66 @@ function readExternalBase(reader, clauseType) {
|
|
|
598
650
|
}
|
|
599
651
|
}
|
|
600
652
|
|
|
601
|
-
|
|
653
|
+
function tryModuleExports(reader, clauseType) {
|
|
654
|
+
let declarations;
|
|
655
|
+
const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeAtLocation(clauseType);
|
|
656
|
+
if (Operators_IsNull(typ) ? true : Operators_IsNull(typ.symbol)) {
|
|
657
|
+
return undefined;
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
660
|
+
const matchValue = typ.symbol.declarations;
|
|
661
|
+
let matchResult, declarations_1;
|
|
662
|
+
if (matchValue != null) {
|
|
663
|
+
if ((declarations = matchValue, (declarations.length > 0) && ((item_1(0, declarations).kind === 308) ? true : (item_1(0, declarations).kind === 268)))) {
|
|
664
|
+
matchResult = 0;
|
|
665
|
+
declarations_1 = matchValue;
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
matchResult = 1;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
matchResult = 1;
|
|
673
|
+
}
|
|
674
|
+
switch (matchResult) {
|
|
675
|
+
case 0:
|
|
676
|
+
return collect_1((property) => {
|
|
677
|
+
let option_1;
|
|
678
|
+
return map_1((declaration_1) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_1), filter((declaration) => {
|
|
679
|
+
if (declaration.kind === 263) {
|
|
680
|
+
return true;
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
return declaration.kind === 261;
|
|
684
|
+
}
|
|
685
|
+
}, defaultArg((option_1 = property.declarations, (option_1 != null) ? toList(option_1) : undefined), empty())));
|
|
686
|
+
}, toList(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getPropertiesOfType(typ)));
|
|
687
|
+
default:
|
|
688
|
+
return undefined;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
function clauseTypes(heritageClauses) {
|
|
602
694
|
if (heritageClauses == null) {
|
|
603
695
|
return empty();
|
|
604
696
|
}
|
|
605
697
|
else {
|
|
606
|
-
return collect_1((clause) =>
|
|
607
|
-
readExternalBase(reader, clauseType);
|
|
608
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](clauseType);
|
|
609
|
-
}, toList(clause.types)), toList(heritageClauses));
|
|
698
|
+
return collect_1((clause) => toList(clause.types), toList(heritageClauses));
|
|
610
699
|
}
|
|
611
700
|
}
|
|
612
701
|
|
|
702
|
+
export function readHeritageClauses(reader, heritageClauses) {
|
|
703
|
+
return map_1((clauseType_1) => {
|
|
704
|
+
readExternalBase(reader, clauseType_1);
|
|
705
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](clauseType_1);
|
|
706
|
+
}, filter((clauseType) => (tryModuleExports(reader, clauseType) == null), clauseTypes(heritageClauses)));
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
export function readModuleHeritageMembers(reader, heritageClauses) {
|
|
710
|
+
return collect_1((arg) => defaultArg(tryModuleExports(reader, arg), empty()), clauseTypes(heritageClauses));
|
|
711
|
+
}
|
|
712
|
+
|
|
613
713
|
function libDeclaration(symbolOpt) {
|
|
614
714
|
let option_3;
|
|
615
715
|
const option_1 = symbolOpt;
|
|
@@ -697,7 +797,7 @@ export function isFromEsLib(symbolOpt) {
|
|
|
697
797
|
}
|
|
698
798
|
}
|
|
699
799
|
|
|
700
|
-
export const knownExternalTypeNames = ofSeq(["Date", "Promise", "Array", "ReadonlyArray", "Boolean", "Function", "Error", "RegExp", "Iterable", "IterableIterator", "IteratorObject", "ArrayIterator", "MapIterator", "SetIterator", "StringIterator", "Uint8Array", "Int8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array"], {
|
|
800
|
+
export const knownExternalTypeNames = ofSeq(["Date", "Promise", "Array", "ReadonlyArray", "Boolean", "Function", "Error", "RegExp", "Iterable", "IterableIterator", "IteratorObject", "ArrayIterator", "MapIterator", "SetIterator", "StringIterator", "Uint8Array", "Int8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array", "ArrayBuffer", "ArrayBufferView", "DataView", "Map", "Set", "WeakMap", "WeakSet", "Number", "String", "BigInt", "EvalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError", "ArrayBufferLike", "ArrayLike", "ConcatArray", "Generator", "Iterator", "IteratorResult", "IteratorReturnResult", "IteratorYieldResult", "PromiseLike", "PropertyDescriptor", "PropertyDescriptorMap", "PropertyKey", "ProxyHandler", "ReadonlyMap", "ReadonlySet", "ReadonlySetLike", "SharedArrayBuffer", "TemplateStringsArray", "TypedPropertyDescriptor", "ErrorOptions"], {
|
|
701
801
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
702
802
|
});
|
|
703
803
|
|
|
@@ -717,6 +817,75 @@ export function resolveAlias(checker, symbol) {
|
|
|
717
817
|
}
|
|
718
818
|
}
|
|
719
819
|
|
|
820
|
+
function mentionsThisNode(node) {
|
|
821
|
+
if (node.kind === 198) {
|
|
822
|
+
return true;
|
|
823
|
+
}
|
|
824
|
+
else {
|
|
825
|
+
return defaultArg(ts.forEachChild(node, ((child) => (mentionsThisNode(child) ? true : undefined))), false);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
function nestsThisNode(typeNode) {
|
|
830
|
+
if (typeNode == null) {
|
|
831
|
+
return false;
|
|
832
|
+
}
|
|
833
|
+
else {
|
|
834
|
+
const typeNode_1 = typeNode;
|
|
835
|
+
if (typeNode_1.kind !== 198) {
|
|
836
|
+
return mentionsThisNode(typeNode_1);
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
return false;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
export function readInheritedNestedThisMethods(reader, heritageClauses, declaredNames) {
|
|
845
|
+
const key = (declaration) => (`${declaration.getSourceFile().fileName}:${declaration.pos}`);
|
|
846
|
+
const collect = (visited, taken, clauses) => {
|
|
847
|
+
const bases = collect_1((clauseType) => {
|
|
848
|
+
let option_5, option_3, option, binder, checker, option_1, symbol_1;
|
|
849
|
+
return filter((declaration_1) => {
|
|
850
|
+
if (((declaration_1.kind === 264) ? true : (declaration_1.kind === 265)) && Operators_IsNull(declaration_1.typeParameters)) {
|
|
851
|
+
return !FSharpSet__Contains(visited, key(declaration_1));
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
return false;
|
|
855
|
+
}
|
|
856
|
+
}, defaultArg((option_5 = ((option_3 = ((option = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(clauseType.expression), (binder = ((checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), (symbol) => resolveAlias(checker, symbol))), (option_1 = option, (option_1 != null) ? binder(option_1) : undefined)))), (option_3 != null) ? ((symbol_1 = option_3, symbol_1.declarations)) : undefined)), (option_5 != null) ? toList(option_5) : undefined), empty()));
|
|
857
|
+
}, clauseTypes(clauses));
|
|
858
|
+
const ownMethods = collect_1((declaration_2) => filter((element_1) => !FSharpSet__Contains(taken, identifierText(element_1.name)), filter((element) => {
|
|
859
|
+
const matchValue = element.kind;
|
|
860
|
+
switch (matchValue) {
|
|
861
|
+
case 174:
|
|
862
|
+
case 175: {
|
|
863
|
+
const signature = element;
|
|
864
|
+
if (!ModifierUtil_HasModifier_742AC9D(element.modifiers, 126)) {
|
|
865
|
+
if (nestsThisNode(signature.type)) {
|
|
866
|
+
return true;
|
|
867
|
+
}
|
|
868
|
+
else {
|
|
869
|
+
return exists((parameter) => nestsThisNode(parameter.type), signature.parameters);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
else {
|
|
873
|
+
return false;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
default:
|
|
877
|
+
return false;
|
|
878
|
+
}
|
|
879
|
+
}, toList(declaration_2.members))), bases);
|
|
880
|
+
const taken_2 = fold((taken_1, element_2) => add(identifierText(element_2.name), taken_1), taken, ownMethods);
|
|
881
|
+
const visited_2 = fold((visited_1, declaration_3) => add(key(declaration_3), visited_1), visited, bases);
|
|
882
|
+
return append(map_1((element_3) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](element_3), ownMethods), collect_1((declaration_4) => collect(visited_2, taken_2, declaration_4.heritageClauses), bases));
|
|
883
|
+
};
|
|
884
|
+
return collect(empty_1({
|
|
885
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
886
|
+
}), declaredNames, heritageClauses);
|
|
887
|
+
}
|
|
888
|
+
|
|
720
889
|
/**
|
|
721
890
|
* `type X` beside `export { x as X }` is one symbol flagged both `TypeAlias` and `Alias`
|
|
722
891
|
*/
|
|
@@ -736,7 +905,7 @@ export function resolveValueAlias(checker, symbol) {
|
|
|
736
905
|
export function defaultTypeArguments(reader, typeNode) {
|
|
737
906
|
let option_16, option_7, option_5, option_3, option, binder, checker, option_1, symbol_1, declaration;
|
|
738
907
|
if (typeNode.kind !== 184) {
|
|
739
|
-
return
|
|
908
|
+
return empty_2({
|
|
740
909
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
741
910
|
});
|
|
742
911
|
}
|
|
@@ -759,7 +928,7 @@ export function defaultTypeArguments(reader, typeNode) {
|
|
|
759
928
|
return [identifierText(typeParameter.name), argument];
|
|
760
929
|
}, toList(option_16))), {
|
|
761
930
|
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
762
|
-
}) : undefined),
|
|
931
|
+
}) : undefined), empty_2({
|
|
763
932
|
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
764
933
|
}));
|
|
765
934
|
}
|
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { choose as choose_1, toList, isEmpty } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
3
|
+
import { head, map, isEmpty as isEmpty_1, choose } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
4
|
+
import { exportedAlias, typeNodeBuilderFlags, identifierText, isExportedDeclaration, readMemberTypeParameters } from "./Utils.js";
|
|
5
|
+
import { GlueVariable, GlueType, GlueTypeLiteral, GlueMember, GlueCallSignature } from "../GlueAST.js";
|
|
3
6
|
import { ofSeq } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
|
|
4
|
-
import { toList, choose } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
5
7
|
import { Exception, comparePrimitives } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
6
|
-
import { head, isEmpty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
7
8
|
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
8
9
|
import { defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
function signaturesOfFunctionValue(reader, declaration) {
|
|
12
|
+
const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeAtLocation(declaration);
|
|
13
|
+
const isOnlyCallable = isEmpty(typ.getProperties()) && isEmpty(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSignaturesOfType(typ, 1));
|
|
14
|
+
const declarations = choose((signature) => {
|
|
15
|
+
const matchValue = signature.declaration;
|
|
16
|
+
if (matchValue == null) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return matchValue;
|
|
21
|
+
}
|
|
22
|
+
}, toList(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSignaturesOfType(typ, 0)));
|
|
23
|
+
if (isOnlyCallable && !isEmpty_1(declarations)) {
|
|
24
|
+
return map((signature_1) => (new GlueMember(/* CallSignature */ 4, [new GlueCallSignature(readMemberTypeParameters(reader, signature_1.typeParameters), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadParameters716C1F42"](signature_1.parameters), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](signature_1.type))])), declarations);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
10
30
|
|
|
11
31
|
export function readVariableStatement(reader, statement) {
|
|
12
|
-
|
|
32
|
+
let typeNode;
|
|
33
|
+
if (isExportedDeclaration(statement, ofSeq(choose_1((declaration) => {
|
|
13
34
|
const name = declaration.name;
|
|
14
35
|
if (name.kind === 80) {
|
|
15
36
|
return identifierText(name);
|
|
@@ -21,7 +42,7 @@ export function readVariableStatement(reader, statement) {
|
|
|
21
42
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
22
43
|
}))) {
|
|
23
44
|
const matchValue = toList(statement.declarationList.declarations);
|
|
24
|
-
if (!
|
|
45
|
+
if (!isEmpty_1(matchValue)) {
|
|
25
46
|
const declaration_1 = head(matchValue);
|
|
26
47
|
let name_1;
|
|
27
48
|
if (declaration_1.name.kind === 80) {
|
|
@@ -29,24 +50,28 @@ export function readVariableStatement(reader, statement) {
|
|
|
29
50
|
name_1 = id.getText();
|
|
30
51
|
}
|
|
31
52
|
else {
|
|
32
|
-
throw new Exception(Report_readerError_Z19516DCE("variable statement", "Unable to read variable name", declaration_1, "/_//src/Glutinum.Converter/Reader/VariableStatement.fs",
|
|
53
|
+
throw new Exception(Report_readerError_Z19516DCE("variable statement", "Unable to read variable name", declaration_1, "/_//src/Glutinum.Converter/Reader/VariableStatement.fs", 71));
|
|
33
54
|
}
|
|
34
55
|
let typ_1;
|
|
35
56
|
const matchValue_2 = declaration_1.type;
|
|
36
57
|
const matchValue_3 = declaration_1.initializer;
|
|
37
|
-
let matchResult,
|
|
38
|
-
if (matchValue_2
|
|
39
|
-
if (
|
|
40
|
-
matchResult =
|
|
58
|
+
let matchResult, typeNode_1, typeNode_2;
|
|
59
|
+
if (matchValue_2 != null) {
|
|
60
|
+
if ((typeNode = matchValue_2, typeNode.kind === 187)) {
|
|
61
|
+
matchResult = 1;
|
|
62
|
+
typeNode_1 = matchValue_2;
|
|
41
63
|
}
|
|
42
64
|
else {
|
|
43
|
-
matchResult =
|
|
44
|
-
|
|
65
|
+
matchResult = 2;
|
|
66
|
+
typeNode_2 = matchValue_2;
|
|
45
67
|
}
|
|
46
68
|
}
|
|
69
|
+
else if (matchValue_3 != null) {
|
|
70
|
+
matchResult = 0;
|
|
71
|
+
}
|
|
47
72
|
else {
|
|
48
|
-
matchResult =
|
|
49
|
-
|
|
73
|
+
matchResult = 2;
|
|
74
|
+
typeNode_2 = matchValue_2;
|
|
50
75
|
}
|
|
51
76
|
switch (matchResult) {
|
|
52
77
|
case 0: {
|
|
@@ -59,8 +84,13 @@ export function readVariableStatement(reader, statement) {
|
|
|
59
84
|
typ_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](typNode);
|
|
60
85
|
break;
|
|
61
86
|
}
|
|
87
|
+
case 1: {
|
|
88
|
+
const matchValue_5 = signaturesOfFunctionValue(reader, declaration_1);
|
|
89
|
+
typ_1 = ((matchValue_5 == null) ? reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](typeNode_1) : (new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(matchValue_5, undefined)])));
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
62
92
|
default:
|
|
63
|
-
typ_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](
|
|
93
|
+
typ_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](typeNode_2);
|
|
64
94
|
}
|
|
65
95
|
return new GlueType(/* Variable */ 2, [new GlueVariable(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](declaration_1), defaultArg(exportedAlias(statement, name_1), name_1), typ_1)]);
|
|
66
96
|
}
|