@idlizer/core 2.1.10-arktscgen-4 → 2.1.10-arktscgen-6
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/build/lib/src/Language.d.ts +0 -1
- package/build/lib/src/Language.js +1 -3
- package/build/lib/src/LanguageWriters/ArgConvertors.d.ts +18 -7
- package/build/lib/src/LanguageWriters/ArgConvertors.js +95 -103
- package/build/lib/src/LanguageWriters/LanguageWriter.d.ts +13 -7
- package/build/lib/src/LanguageWriters/LanguageWriter.js +10 -2
- package/build/lib/src/LanguageWriters/common.d.ts +1 -0
- package/build/lib/src/LanguageWriters/common.js +2 -1
- package/build/lib/src/LanguageWriters/convertors/CJConvertors.d.ts +0 -1
- package/build/lib/src/LanguageWriters/convertors/CJConvertors.js +1 -3
- package/build/lib/src/LanguageWriters/convertors/CppConvertors.d.ts +14 -8
- package/build/lib/src/LanguageWriters/convertors/CppConvertors.js +88 -36
- package/build/lib/src/LanguageWriters/convertors/ETSConvertors.d.ts +1 -0
- package/build/lib/src/LanguageWriters/convertors/ETSConvertors.js +10 -8
- package/build/lib/src/LanguageWriters/convertors/InteropConvertors.js +1 -1
- package/build/lib/src/LanguageWriters/convertors/KotlinConvertors.js +9 -5
- package/build/lib/src/LanguageWriters/convertors/TSConvertors.d.ts +4 -4
- package/build/lib/src/LanguageWriters/convertors/TSConvertors.js +98 -44
- package/build/lib/src/LanguageWriters/index.d.ts +5 -4
- package/build/lib/src/LanguageWriters/index.js +8 -15
- package/build/lib/src/LanguageWriters/nameConvertor.d.ts +2 -0
- package/build/lib/src/LanguageWriters/nameConvertor.js +11 -0
- package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.d.ts +2 -0
- package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.js +13 -1
- package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.d.ts +2 -0
- package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.js +8 -2
- package/build/lib/src/LanguageWriters/writers/ETSLanguageWriter.d.ts +2 -10
- package/build/lib/src/LanguageWriters/writers/ETSLanguageWriter.js +52 -92
- package/build/lib/src/LanguageWriters/writers/KotlinLanguageWriter.d.ts +8 -0
- package/build/lib/src/LanguageWriters/writers/KotlinLanguageWriter.js +75 -27
- package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.d.ts +5 -0
- package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.js +58 -18
- package/build/lib/src/LibraryInterface.d.ts +0 -1
- package/build/lib/src/config.d.ts +2 -1461
- package/build/lib/src/config.js +16 -32
- package/build/lib/src/configMerge.d.ts +3 -0
- package/build/lib/src/configMerge.js +63 -0
- package/build/lib/src/diagnostictypes.d.ts +1 -5
- package/build/lib/src/diagnostictypes.js +1 -27
- package/build/lib/src/from-idl/DtsPrinter.js +13 -6
- package/build/lib/src/from-idl/IDLLinter.d.ts +3 -4
- package/build/lib/src/from-idl/IDLLinter.js +30 -32
- package/build/lib/src/from-idl/deserialize.d.ts +3 -4
- package/build/lib/src/from-idl/deserialize.js +30 -642
- package/build/lib/src/from-idl/parser.d.ts +20 -2
- package/build/lib/src/from-idl/parser.js +97 -29
- package/build/lib/src/idl/builders.d.ts +43 -0
- package/build/lib/src/idl/builders.js +135 -0
- package/build/lib/src/idl/discriminators.d.ts +53 -0
- package/build/lib/src/idl/discriminators.js +232 -0
- package/build/lib/src/idl/dump.d.ts +48 -0
- package/build/lib/src/idl/dump.js +327 -0
- package/build/lib/src/idl/index.d.ts +9 -0
- package/build/lib/src/idl/index.js +23 -0
- package/build/lib/src/idl/keywords.d.ts +2 -0
- package/build/lib/src/{options.js → idl/keywords.js} +7 -3
- package/build/lib/src/idl/node.d.ts +233 -0
- package/build/lib/src/idl/node.js +103 -0
- package/build/lib/src/idl/stdlib.d.ts +34 -0
- package/build/lib/src/idl/stdlib.js +54 -0
- package/build/lib/src/idl/utils.d.ts +44 -0
- package/build/lib/src/idl/utils.js +215 -0
- package/build/lib/src/idl/visitors.d.ts +15 -0
- package/build/lib/src/idl/visitors.js +593 -0
- package/build/lib/src/index.d.ts +5 -6
- package/build/lib/src/index.js +6 -7
- package/build/lib/src/inheritance.d.ts +0 -2
- package/build/lib/src/inheritance.js +0 -17
- package/build/lib/src/inputPaths.d.ts +11 -0
- package/build/lib/src/inputPaths.js +81 -0
- package/build/lib/src/languageSpecificKeywords.d.ts +0 -1
- package/build/lib/src/languageSpecificKeywords.js +0 -5
- package/build/lib/src/peer-generation/ConflictingDeclarations.d.ts +6 -0
- package/build/lib/src/peer-generation/ConflictingDeclarations.js +43 -0
- package/build/lib/src/peer-generation/LayoutManager.d.ts +3 -1
- package/build/lib/src/peer-generation/LayoutManager.js +15 -0
- package/build/lib/src/peer-generation/Materialized.d.ts +8 -0
- package/build/lib/src/peer-generation/Materialized.js +26 -1
- package/build/lib/src/peer-generation/PeerLibrary.d.ts +10 -18
- package/build/lib/src/peer-generation/PeerLibrary.js +63 -227
- package/build/lib/src/peer-generation/ReferenceResolver.d.ts +6 -1
- package/build/lib/src/peer-generation/ReferenceResolver.js +93 -2
- package/build/lib/src/peer-generation/idl/IdlNameConvertor.d.ts +6 -0
- package/build/lib/src/peer-generation/idl/IdlNameConvertor.js +15 -3
- package/build/lib/src/peer-generation/idl/common.d.ts +6 -2
- package/build/lib/src/peer-generation/idl/common.js +7 -7
- package/build/lib/src/peer-generation/isMaterialized.js +2 -3
- package/build/lib/src/peer-generation/modules.js +2 -0
- package/build/lib/src/peer-generation/toDeclaration.d.ts +4 -0
- package/build/lib/src/peer-generation/toDeclaration.js +53 -0
- package/build/lib/src/peer-generation/unions.d.ts +1 -1
- package/build/lib/src/peer-generation/unions.js +15 -7
- package/build/lib/src/resolveNamedNode.d.ts +1 -0
- package/build/lib/src/resolveNamedNode.js +7 -0
- package/build/lib/src/transformers/FqnTransformer.d.ts +1 -1
- package/build/lib/src/transformers/FqnTransformer.js +20 -12
- package/build/lib/src/transformers/GenericTransformer.d.ts +4 -3
- package/build/lib/src/transformers/GenericTransformer.js +252 -158
- package/build/lib/src/transformers/IdlTransformer.d.ts +6 -0
- package/build/lib/src/transformers/IdlTransformer.js +7 -0
- package/build/lib/src/transformers/NullTransformer.d.ts +1 -1
- package/build/lib/src/transformers/NullTransformer.js +27 -21
- package/build/lib/src/transformers/OnSerializeTransformer.d.ts +1 -1
- package/build/lib/src/transformers/OnSerializeTransformer.js +28 -13
- package/build/lib/src/util.d.ts +9 -39
- package/build/lib/src/util.js +65 -369
- package/package.json +44 -49
- package/build/lib/src/LanguageWriters/convertors/JavaConvertors.d.ts +0 -37
- package/build/lib/src/LanguageWriters/convertors/JavaConvertors.js +0 -210
- package/build/lib/src/LanguageWriters/writers/JavaLanguageWriter.d.ts +0 -83
- package/build/lib/src/LanguageWriters/writers/JavaLanguageWriter.js +0 -295
- package/build/lib/src/from-idl/webidl2-utils.d.ts +0 -21
- package/build/lib/src/from-idl/webidl2-utils.js +0 -87
- package/build/lib/src/idl.d.ts +0 -439
- package/build/lib/src/idl.js +0 -1367
- package/build/lib/src/idlize.d.ts +0 -25
- package/build/lib/src/idlize.js +0 -198
- package/build/lib/src/options.d.ts +0 -13
- package/build/lib/src/peer-generation/BuilderClass.d.ts +0 -20
- package/build/lib/src/peer-generation/BuilderClass.js +0 -68
- package/webidl2.js/dist/webidl2.js +0 -4622
- package/webidl2.js/package.json +0 -55
package/build/lib/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
2
|
+
* Copyright (c) 2024-2025 Huawei Device Co., Ltd.
|
|
3
3
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License.
|
|
5
5
|
* You may obtain a copy of the License at
|
|
@@ -17,11 +17,10 @@ export * from "./idl";
|
|
|
17
17
|
export * from "./resolveNamedNode";
|
|
18
18
|
export * from "./visitor";
|
|
19
19
|
export * from "./library";
|
|
20
|
-
export * from "./idlize";
|
|
21
20
|
export * from "./inheritance";
|
|
21
|
+
export * from "./inputPaths";
|
|
22
22
|
export * from "./Language";
|
|
23
23
|
export * from "./languageSpecificKeywords";
|
|
24
|
-
export * from "./options";
|
|
25
24
|
export * from "./util";
|
|
26
25
|
export * from "./rand_utils";
|
|
27
26
|
export * from "./IndentedPrinter";
|
|
@@ -36,14 +35,12 @@ export * from "./LanguageWriters/nameConvertor";
|
|
|
36
35
|
export * from "./LanguageWriters/convertors/CppConvertors";
|
|
37
36
|
export * from "./LanguageWriters/convertors/TSConvertors";
|
|
38
37
|
export * from "./LanguageWriters/convertors/ETSConvertors";
|
|
39
|
-
export * from "./LanguageWriters/convertors/JavaConvertors";
|
|
40
38
|
export * from "./LanguageWriters/convertors/CJConvertors";
|
|
41
39
|
export * from "./LanguageWriters/convertors/InteropConvertors";
|
|
42
40
|
export * from "./LanguageWriters/convertors/KotlinConvertors";
|
|
43
41
|
export * from "./LanguageWriters/writers/CJLanguageWriter";
|
|
44
42
|
export * from "./LanguageWriters/writers/CLikeLanguageWriter";
|
|
45
43
|
export * from "./LanguageWriters/writers/CppLanguageWriter";
|
|
46
|
-
export * from "./LanguageWriters/writers/JavaLanguageWriter";
|
|
47
44
|
export * from "./LanguageWriters/writers/TsLanguageWriter";
|
|
48
45
|
export * from "./LanguageWriters/writers/ETSLanguageWriter";
|
|
49
46
|
export * from "./LanguageWriters/writers/KotlinLanguageWriter";
|
|
@@ -55,7 +52,6 @@ export * from "./peer-generation/PeerLibrary";
|
|
|
55
52
|
export * from "./peer-generation/PeerFile";
|
|
56
53
|
export * from "./peer-generation/PeerClass";
|
|
57
54
|
export * from "./peer-generation/PeerMethod";
|
|
58
|
-
export * from "./peer-generation/BuilderClass";
|
|
59
55
|
export * from "./peer-generation/Materialized";
|
|
60
56
|
export * from "./peer-generation/modules";
|
|
61
57
|
export * from "./peer-generation/isMaterialized";
|
|
@@ -63,17 +59,20 @@ export * from "./peer-generation/isStructureType";
|
|
|
63
59
|
export * from "./peer-generation/isEnumType";
|
|
64
60
|
export * from "./peer-generation/unions";
|
|
65
61
|
export * from "./peer-generation/getSuperType";
|
|
62
|
+
export * from "./peer-generation/ConflictingDeclarations";
|
|
63
|
+
export * from "./peer-generation/toDeclaration";
|
|
66
64
|
export * from "./transformers/FqnTransformer";
|
|
67
65
|
export * from "./transformers/GenericTransformer";
|
|
68
66
|
export * from "./transformers/NullTransformer";
|
|
69
67
|
export * from "./transformers/OnSerializeTransformer";
|
|
68
|
+
export * from "./transformers/IdlTransformer";
|
|
70
69
|
export * from "./LanguageWriters";
|
|
71
70
|
export * from "./peer-generation/ReferenceResolver";
|
|
72
71
|
export * from "./peer-generation/idl/common";
|
|
73
72
|
export * from "./from-idl/IDLLinter";
|
|
74
73
|
export { fromIDL, scanIDL } from "./from-idl/common";
|
|
75
74
|
export { idlToDtsString, CustomPrintVisitor } from "./from-idl/DtsPrinter";
|
|
76
|
-
export { parseIDLFile, addSyntheticType, resolveSyntheticType } from "./from-idl/deserialize";
|
|
75
|
+
export { parseIDLFile, addSyntheticType, resolveSyntheticType, compareNodes, toIdlType } from "./from-idl/deserialize";
|
|
77
76
|
export { Parser, FatalParserException } from "./from-idl/parser";
|
|
78
77
|
export { D, inspectSchema } from './configDescriber';
|
|
79
78
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as ts from "typescript";
|
|
2
1
|
export declare enum InheritanceRole {
|
|
3
2
|
Finalizable = 0,
|
|
4
3
|
PeerNode = 1,
|
|
@@ -6,7 +5,6 @@ export declare enum InheritanceRole {
|
|
|
6
5
|
Heir = 3,
|
|
7
6
|
Standalone = 4
|
|
8
7
|
}
|
|
9
|
-
export declare function isCommonMethodOrSubclass(typeChecker: ts.TypeChecker, decl: ts.ClassDeclaration): boolean;
|
|
10
8
|
export declare function determineInheritanceRole(name: string): InheritanceRole;
|
|
11
9
|
export declare function determineParentRole(name: string | undefined, parent: string | undefined): InheritanceRole;
|
|
12
10
|
export declare function isCommonMethod(name: string): boolean;
|
|
@@ -12,9 +12,7 @@
|
|
|
12
12
|
* See the License for the specific language governing permissions and
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
|
-
import * as ts from "typescript";
|
|
16
15
|
import { generatorConfiguration } from "./config";
|
|
17
|
-
import { asString, heritageDeclarations, identName } from "./util";
|
|
18
16
|
export var InheritanceRole;
|
|
19
17
|
(function (InheritanceRole) {
|
|
20
18
|
InheritanceRole[InheritanceRole["Finalizable"] = 0] = "Finalizable";
|
|
@@ -23,21 +21,6 @@ export var InheritanceRole;
|
|
|
23
21
|
InheritanceRole[InheritanceRole["Heir"] = 3] = "Heir";
|
|
24
22
|
InheritanceRole[InheritanceRole["Standalone"] = 4] = "Standalone";
|
|
25
23
|
})(InheritanceRole || (InheritanceRole = {}));
|
|
26
|
-
export function isCommonMethodOrSubclass(typeChecker, decl) {
|
|
27
|
-
var _a;
|
|
28
|
-
let name = identName(decl.name);
|
|
29
|
-
let isSubclass = isRoot(name);
|
|
30
|
-
(_a = decl.heritageClauses) === null || _a === void 0 ? void 0 : _a.forEach(it => {
|
|
31
|
-
heritageDeclarations(typeChecker, it).forEach(it => {
|
|
32
|
-
let name = asString(it.name);
|
|
33
|
-
isSubclass = isSubclass || isRoot(name);
|
|
34
|
-
if (!ts.isClassDeclaration(it))
|
|
35
|
-
return isSubclass;
|
|
36
|
-
isSubclass = isSubclass || isCommonMethodOrSubclass(typeChecker, it);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
return isSubclass;
|
|
40
|
-
}
|
|
41
24
|
export function determineInheritanceRole(name) {
|
|
42
25
|
if (generatorConfiguration().rootComponents.includes(name))
|
|
43
26
|
return InheritanceRole.Root;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type InputPaths = {
|
|
2
|
+
baseDirs: string[];
|
|
3
|
+
inputDirs: string[];
|
|
4
|
+
auxInputDirs: string[];
|
|
5
|
+
inputFiles: string[];
|
|
6
|
+
auxInputFiles: string[];
|
|
7
|
+
libraryPackages: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare function formatInputPaths(options: any): InputPaths;
|
|
10
|
+
export declare function validatePaths(paths: string[], type: 'file' | 'dir'): void;
|
|
11
|
+
//# sourceMappingURL=inputPaths.d.ts.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Huawei Device Co., Ltd.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
import * as fs from "fs";
|
|
16
|
+
import * as path from "path";
|
|
17
|
+
function processInputOption(option) {
|
|
18
|
+
if (typeof option === 'undefined') {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
else if (typeof option === 'string') {
|
|
22
|
+
return option.split(',')
|
|
23
|
+
.map(item => item.trim())
|
|
24
|
+
.filter(Boolean);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return option.flatMap(processInputOption);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// iterate through files in the same order even if input order changes
|
|
31
|
+
function sortFiles(files) {
|
|
32
|
+
return files.sort((a, b) => path.basename(a).localeCompare(path.basename(b)));
|
|
33
|
+
}
|
|
34
|
+
export function formatInputPaths(options) {
|
|
35
|
+
if (options.inputFiles) {
|
|
36
|
+
options.inputFiles = processInputOption(options.inputFiles);
|
|
37
|
+
}
|
|
38
|
+
if (options.auxInputFiles) {
|
|
39
|
+
options.auxInputFiles = processInputOption(options.auxInputFiles);
|
|
40
|
+
}
|
|
41
|
+
if (options.inputDir) {
|
|
42
|
+
options.inputDir = processInputOption(options.inputDir);
|
|
43
|
+
}
|
|
44
|
+
if (options.auxInputDir) {
|
|
45
|
+
options.auxInputDir = processInputOption(options.auxInputDir);
|
|
46
|
+
}
|
|
47
|
+
if (options.libraryPackages) {
|
|
48
|
+
options.libraryPackages = processInputOption(options.libraryPackages);
|
|
49
|
+
}
|
|
50
|
+
const inputDirs = options.inputDir || [];
|
|
51
|
+
const auxInputDirs = options.auxInputDir || [];
|
|
52
|
+
const inputFiles = options.inputFiles || [];
|
|
53
|
+
const auxInputFiles = options.auxInputFiles || [];
|
|
54
|
+
const libraryPackages = options.libraryPackages || [];
|
|
55
|
+
let baseDirs = options.baseDir ? processInputOption(options.baseDir) : inputDirs;
|
|
56
|
+
if (!baseDirs.length && inputFiles.length) {
|
|
57
|
+
baseDirs = [...(new Set(options.inputFiles.map((it) => path.dirname(it))).values())];
|
|
58
|
+
}
|
|
59
|
+
if (!baseDirs.length)
|
|
60
|
+
throw new Error("Check your --base-dir parameter, value is missing");
|
|
61
|
+
return {
|
|
62
|
+
baseDirs,
|
|
63
|
+
inputDirs,
|
|
64
|
+
auxInputDirs,
|
|
65
|
+
inputFiles: sortFiles(inputFiles),
|
|
66
|
+
auxInputFiles: sortFiles(auxInputFiles),
|
|
67
|
+
libraryPackages
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export function validatePaths(paths, type) {
|
|
71
|
+
paths.forEach(pathItem => {
|
|
72
|
+
if (!fs.existsSync(pathItem)) {
|
|
73
|
+
console.error(`Input ${type} does not exist: ${pathItem}`);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
console.log(`Input ${type} exists: ${pathItem}`);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=inputPaths.js.map
|
|
@@ -40,11 +40,6 @@ export const CJKeywords = new Set([
|
|
|
40
40
|
'open', 'operator', 'foreign', 'inout',
|
|
41
41
|
'prop', 'mut', 'unsafe', 'get', 'set', 'type'
|
|
42
42
|
]);
|
|
43
|
-
export const IDLKeywords = new Set([
|
|
44
|
-
"attribute", "callback", "object", "toString",
|
|
45
|
-
'sequence', 'record', 'or', 'Int8Array',
|
|
46
|
-
'interface', 'number', 'undefined'
|
|
47
|
-
]);
|
|
48
43
|
export const TSKeywords = new Set([
|
|
49
44
|
"namespace"
|
|
50
45
|
]);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as idl from "../idl";
|
|
2
|
+
import { Language } from "../Language";
|
|
3
|
+
import { LibraryInterface } from "../LibraryInterface";
|
|
4
|
+
export declare function findTopLevelConflicts(library: LibraryInterface, language: Language): string[];
|
|
5
|
+
export declare function isTopLevelConflicted(library: LibraryInterface, language: Language, node: idl.IDLEntry): boolean;
|
|
6
|
+
//# sourceMappingURL=ConflictingDeclarations.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as idl from "../idl";
|
|
2
|
+
import { Language } from "../Language";
|
|
3
|
+
const findTopLevelConflicts_cache = new Map();
|
|
4
|
+
export function findTopLevelConflicts(library, language) {
|
|
5
|
+
if (!findTopLevelConflicts_cache.has(library))
|
|
6
|
+
findTopLevelConflicts_cache.set(library, new Map);
|
|
7
|
+
const libraryCache = findTopLevelConflicts_cache.get(library);
|
|
8
|
+
if (!libraryCache.has(language))
|
|
9
|
+
libraryCache.set(language, findTopLevelConflictsUncached(library, language));
|
|
10
|
+
return libraryCache.get(language);
|
|
11
|
+
}
|
|
12
|
+
function findTopLevelConflictsUncached(library, language) {
|
|
13
|
+
const foundNames = new Set();
|
|
14
|
+
const conflictingNames = new Set();
|
|
15
|
+
const ignoreTypedefs = language === Language.CPP;
|
|
16
|
+
for (const file of library.files) {
|
|
17
|
+
for (const entry of file.entries) {
|
|
18
|
+
if (idl.isSyntheticEntry(entry))
|
|
19
|
+
continue;
|
|
20
|
+
if (ignoreTypedefs && idl.isTypedef(entry))
|
|
21
|
+
// for redefinitions like `typedef _Resource Resource;` - in CPP than anyway will be expanded to Resource declaration
|
|
22
|
+
continue;
|
|
23
|
+
if (idl.isCallback(entry) || idl.isInterface(entry) || idl.isTypedef(entry) || idl.isEnum(entry)) {
|
|
24
|
+
if (foundNames.has(entry.name)) {
|
|
25
|
+
conflictingNames.add(entry.name);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
foundNames.add(entry.name);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return Array.from(conflictingNames);
|
|
34
|
+
}
|
|
35
|
+
export function isTopLevelConflicted(library, language, node) {
|
|
36
|
+
const topLevelConflicts = findTopLevelConflicts(library, language);
|
|
37
|
+
while (node.parent && idl.isNamespace(node.parent)) {
|
|
38
|
+
node = node.parent;
|
|
39
|
+
}
|
|
40
|
+
return node.parent !== undefined
|
|
41
|
+
&& idl.isFile(node.parent) && idl.isEntry(node) && topLevelConflicts.includes(node.name);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ConflictingDeclarations.js.map
|
|
@@ -6,7 +6,7 @@ export declare enum LayoutNodeRole {
|
|
|
6
6
|
COMPONENT = 3,
|
|
7
7
|
SERIALIZER = 4
|
|
8
8
|
}
|
|
9
|
-
export type LayoutTargetDescriptionHint = 'component.implementation' | 'component.interface' | 'component.function' | 'component.modifier';
|
|
9
|
+
export type LayoutTargetDescriptionHint = 'component.implementation' | 'component.interface' | 'component.function' | 'component.modifier' | 'component.handwritten';
|
|
10
10
|
export interface LayoutTargetDescription {
|
|
11
11
|
node: IDLEntry;
|
|
12
12
|
role: LayoutNodeRole;
|
|
@@ -23,4 +23,6 @@ export declare class LayoutManager {
|
|
|
23
23
|
handwrittenPackage(): string;
|
|
24
24
|
static Empty(): LayoutManager;
|
|
25
25
|
}
|
|
26
|
+
export declare function wrapCurrentFileDescription<T>(description: LayoutTargetDescription, op: () => T): T;
|
|
27
|
+
export declare function isDeclaredInCurrentFile(layout: LayoutManagerStrategy, over: LayoutTargetDescription): boolean;
|
|
26
28
|
//# sourceMappingURL=LayoutManager.d.ts.map
|
|
@@ -35,4 +35,19 @@ export class LayoutManager {
|
|
|
35
35
|
return new LayoutManager({ resolve: () => '', handwrittenPackage: () => '' });
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
let currentGenerationDescription;
|
|
39
|
+
export function wrapCurrentFileDescription(description, op) {
|
|
40
|
+
const prev = currentGenerationDescription;
|
|
41
|
+
currentGenerationDescription = description;
|
|
42
|
+
const result = op();
|
|
43
|
+
currentGenerationDescription = prev;
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
export function isDeclaredInCurrentFile(layout, over) {
|
|
47
|
+
if (!currentGenerationDescription)
|
|
48
|
+
throw new Error("Current file context is not set up. Please use `wrapCurrentFileDescription` to set up current context. That must be temporary solution until structural printers are ready");
|
|
49
|
+
if (layout.resolve(currentGenerationDescription) === layout.resolve(over))
|
|
50
|
+
return true;
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
38
53
|
//# sourceMappingURL=LayoutManager.js.map
|
|
@@ -11,6 +11,14 @@ export declare class MaterializedField {
|
|
|
11
11
|
isNullableOriginalTypeField?: boolean | undefined;
|
|
12
12
|
extraMethodName: string | undefined;
|
|
13
13
|
constructor(field: Field, argConvertor: ArgConvertor, outArgConvertor?: ArgConvertor | undefined, isNullableOriginalTypeField?: boolean | undefined, extraMethodName?: string | undefined);
|
|
14
|
+
get state(): {
|
|
15
|
+
isAccessor: true;
|
|
16
|
+
hasGetter: boolean;
|
|
17
|
+
hasSetter: boolean;
|
|
18
|
+
} | {
|
|
19
|
+
isAccessor: false;
|
|
20
|
+
isReadonly: boolean;
|
|
21
|
+
};
|
|
14
22
|
}
|
|
15
23
|
export declare class MaterializedMethod extends PeerMethod {
|
|
16
24
|
decl: idl.IDLConstructor | idl.IDLMethod | undefined;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
15
|
import * as idl from '../idl';
|
|
16
|
-
import { copyMethod, Method, MethodModifier, NamedMethodSignature } from '../LanguageWriters/LanguageWriter';
|
|
16
|
+
import { copyMethod, FieldModifier, Method, MethodModifier, NamedMethodSignature } from '../LanguageWriters/LanguageWriter';
|
|
17
17
|
import { capitalize } from '../util';
|
|
18
18
|
import { qualifiedName } from './idl/common';
|
|
19
19
|
import { PeerMethod, PeerMethodSignature } from './PeerMethod';
|
|
@@ -24,6 +24,31 @@ export class MaterializedField {
|
|
|
24
24
|
this.outArgConvertor = outArgConvertor;
|
|
25
25
|
this.isNullableOriginalTypeField = isNullableOriginalTypeField;
|
|
26
26
|
this.extraMethodName = extraMethodName;
|
|
27
|
+
const isReadonly = field.modifiers.includes(FieldModifier.READONLY);
|
|
28
|
+
const isGetter = field.modifiers.includes(FieldModifier.GET);
|
|
29
|
+
const isSetter = field.modifiers.includes(FieldModifier.SET);
|
|
30
|
+
if (isReadonly && (isGetter || isSetter))
|
|
31
|
+
throw new Error(`Unsupported modifiers combination: field can be either readonly or getter/setter or mutable for field ${field.name}`);
|
|
32
|
+
if (isSetter && !isGetter)
|
|
33
|
+
throw new Error(`Unsupported modifiers combination: if setter is defined getter must be defined too for field ${field.name}`);
|
|
34
|
+
}
|
|
35
|
+
get state() {
|
|
36
|
+
const hasGetter = this.field.modifiers.includes(FieldModifier.GET);
|
|
37
|
+
const hasSetter = this.field.modifiers.includes(FieldModifier.SET);
|
|
38
|
+
if (hasGetter || hasSetter) {
|
|
39
|
+
return {
|
|
40
|
+
isAccessor: true,
|
|
41
|
+
hasGetter,
|
|
42
|
+
hasSetter
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const isReadonly = this.field.modifiers.includes(FieldModifier.READONLY);
|
|
47
|
+
return {
|
|
48
|
+
isAccessor: false,
|
|
49
|
+
isReadonly
|
|
50
|
+
};
|
|
51
|
+
}
|
|
27
52
|
}
|
|
28
53
|
}
|
|
29
54
|
export class MaterializedMethod extends PeerMethod {
|
|
@@ -4,11 +4,11 @@ import { LanguageWriter } from '../LanguageWriters/LanguageWriter';
|
|
|
4
4
|
import { IdlNameConvertor } from '../LanguageWriters';
|
|
5
5
|
import { ArgConvertor } from "../LanguageWriters/ArgConvertors";
|
|
6
6
|
import { LibraryInterface } from '../LibraryInterface';
|
|
7
|
-
import { BuilderClass } from './BuilderClass';
|
|
8
7
|
import { MaterializedClass } from './Materialized';
|
|
9
8
|
import { LayoutManager, LayoutManagerStrategy } from './LayoutManager';
|
|
10
9
|
import { IDLLibrary } from '../library';
|
|
11
10
|
import { NativeModuleType } from '../LanguageWriters/common';
|
|
11
|
+
import { ReferenceResolver } from './ReferenceResolver';
|
|
12
12
|
export interface GlobalScopeDeclarations {
|
|
13
13
|
methods: idl.IDLMethod[];
|
|
14
14
|
constants: idl.IDLConstant[];
|
|
@@ -10259,13 +10259,11 @@ export declare class PeerLibrary implements LibraryInterface {
|
|
|
10259
10259
|
asIDLLibrary(): IDLLibrary;
|
|
10260
10260
|
get globals(): GlobalScopeDeclarations[];
|
|
10261
10261
|
layout: LayoutManager;
|
|
10262
|
-
private
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
readonly files: idl.IDLFile[];
|
|
10262
|
+
private _files;
|
|
10263
|
+
get files(): idl.IDLFile[];
|
|
10264
|
+
set files(value: idl.IDLFile[]);
|
|
10266
10265
|
readonly auxFiles: idl.IDLFile[];
|
|
10267
|
-
|
|
10268
|
-
get buildersToGenerate(): BuilderClass[];
|
|
10266
|
+
private resolver;
|
|
10269
10267
|
readonly materializedClasses: Map<string, MaterializedClass>;
|
|
10270
10268
|
get orderedMaterialized(): MaterializedClass[];
|
|
10271
10269
|
constructor(language: Language, interopNativeModule: NativeModuleType, useMemoM3?: boolean);
|
|
@@ -10273,8 +10271,6 @@ export declare class PeerLibrary implements LibraryInterface {
|
|
|
10273
10271
|
readonly customComponentMethods: string[];
|
|
10274
10272
|
createLanguageWriter(language?: Language): LanguageWriter;
|
|
10275
10273
|
createTypeNameConvertor(language: Language): IdlNameConvertor;
|
|
10276
|
-
protected readonly targetNameConvertorInstance: IdlNameConvertor;
|
|
10277
|
-
private readonly interopNameConvertorInstance;
|
|
10278
10274
|
get libraryPrefix(): string;
|
|
10279
10275
|
createContinuationParameters(continuationType: idl.IDLType): idl.IDLParameter[];
|
|
10280
10276
|
createContinuationCallbackReference(continuationType: idl.IDLType): idl.IDLReferenceType;
|
|
@@ -10283,18 +10279,13 @@ export declare class PeerLibrary implements LibraryInterface {
|
|
|
10283
10279
|
setCurrentContext(context: string | undefined): void;
|
|
10284
10280
|
findFileByOriginalFilename(filename: string): idl.IDLFile | undefined;
|
|
10285
10281
|
mapType(type: idl.IDLType): string;
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
private _useFallback;
|
|
10291
|
-
disableFallback(): void;
|
|
10292
|
-
resolveNamedNode(target: string[], pov?: idl.IDLNode | undefined): idl.IDLEntry | undefined;
|
|
10293
|
-
resolveImport(target: idl.IDLImport): idl.IDLEntry | undefined;
|
|
10282
|
+
resolveTypeReference(type: idl.IDLReferenceType, options?: {
|
|
10283
|
+
terminalImports?: boolean;
|
|
10284
|
+
unresolvedOk?: boolean;
|
|
10285
|
+
}): idl.IDLEntry | undefined;
|
|
10294
10286
|
typeConvertor(param: string, type: idl.IDLType, isOptionalParam?: boolean): ArgConvertor;
|
|
10295
10287
|
declarationConvertor(param: string, type: idl.IDLReferenceType, declaration: idl.IDLEntry | undefined): ArgConvertor;
|
|
10296
10288
|
private customConvertor;
|
|
10297
|
-
getInteropName(node: idl.IDLNode): string;
|
|
10298
10289
|
toDeclaration(type: idl.IDLType | idl.IDLTypedef | idl.IDLCallback | idl.IDLEnum | idl.IDLInterface): idl.IDLEntry | idl.IDLType;
|
|
10299
10290
|
setFileLayout(strategy: LayoutManagerStrategy): void;
|
|
10300
10291
|
withFileLayout(strategy: LayoutManagerStrategy, op: () => void): void;
|
|
@@ -10305,4 +10296,5 @@ export declare const ArkFunction: idl.IDLPrimitiveType;
|
|
|
10305
10296
|
export declare const ArkDate: idl.IDLPrimitiveType;
|
|
10306
10297
|
export declare const ArkCustomObject: idl.IDLPrimitiveType;
|
|
10307
10298
|
export declare function cleanPrefix(name: string, prefix: string): string;
|
|
10299
|
+
export declare function forceTypedefAsResource(resolver: ReferenceResolver, type: idl.IDLType, decl: idl.IDLTypedef): boolean;
|
|
10308
10300
|
//# sourceMappingURL=PeerLibrary.d.ts.map
|