@idlizer/core 2.0.26 → 2.0.28
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/LanguageWriters/ArgConvertors.d.ts +1 -1
- package/build/lib/src/LanguageWriters/ArgConvertors.js +7 -7
- package/build/lib/src/LanguageWriters/LanguageWriter.d.ts +4 -3
- package/build/lib/src/LanguageWriters/LanguageWriter.js +10 -5
- package/build/lib/src/LanguageWriters/convertors/CppConvertors.d.ts +45 -5
- package/build/lib/src/LanguageWriters/convertors/CppConvertors.js +200 -9
- package/build/lib/src/LanguageWriters/convertors/InteropConvertors.d.ts +4 -35
- package/build/lib/src/LanguageWriters/convertors/InteropConvertors.js +24 -169
- package/build/lib/src/LanguageWriters/convertors/JavaConvertors.js +1 -0
- package/build/lib/src/LanguageWriters/convertors/TSConvertors.js +2 -0
- package/build/lib/src/LanguageWriters/index.js +3 -3
- package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.d.ts +4 -1
- package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.js +13 -9
- package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.d.ts +1 -1
- package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.js +7 -3
- package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.d.ts +1 -1
- package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.js +2 -2
- package/build/lib/src/LibraryInterface.d.ts +1 -0
- package/build/lib/src/config.d.ts +13 -16
- package/build/lib/src/config.js +13 -17
- package/build/lib/src/idl.d.ts +1 -1
- package/build/lib/src/idl.js +4 -19
- package/build/lib/src/index.d.ts +2 -0
- package/build/lib/src/index.js +2 -0
- package/build/lib/src/inheritance.js +2 -2
- package/build/lib/src/languageSpecificKeywords.js +1 -1
- package/build/lib/src/library.d.ts +5 -4
- package/build/lib/src/library.js +3 -0
- package/build/lib/src/peer-generation/BuilderClass.js +1 -1
- package/build/lib/src/peer-generation/LayoutManager.d.ts +2 -1
- package/build/lib/src/peer-generation/LayoutManager.js +1 -0
- package/build/lib/src/peer-generation/Materialized.d.ts +0 -1
- package/build/lib/src/peer-generation/Materialized.js +3 -48
- package/build/lib/src/peer-generation/PeerFile.d.ts +1 -0
- package/build/lib/src/peer-generation/PeerFile.js +4 -1
- package/build/lib/src/peer-generation/PeerLibrary.d.ts +10246 -2
- package/build/lib/src/peer-generation/PeerLibrary.js +48 -10
- package/build/lib/src/peer-generation/PrimitiveType.d.ts +1 -0
- package/build/lib/src/peer-generation/PrimitiveType.js +1 -0
- package/build/lib/src/peer-generation/isMaterialized.d.ts +4 -0
- package/build/lib/src/peer-generation/isMaterialized.js +46 -0
- package/build/lib/src/peer-generation/isStructureType.d.ts +4 -0
- package/build/lib/src/peer-generation/isStructureType.js +25 -0
- package/build/lib/src/peer-generation/unions.d.ts +1 -1
- package/build/lib/src/peer-generation/unions.js +14 -3
- package/package.json +2 -2
|
@@ -38,7 +38,7 @@ export const CJKeywords = new Set([
|
|
|
38
38
|
/*'false', */ 'static', 'public', 'private',
|
|
39
39
|
'protected', 'override', 'redef', 'abstract',
|
|
40
40
|
'open', 'operator', 'foreign', 'inout',
|
|
41
|
-
'prop', 'mut', 'unsafe', 'get', 'set'
|
|
41
|
+
'prop', 'mut', 'unsafe', 'get', 'set', 'type'
|
|
42
42
|
]);
|
|
43
43
|
export const IDLKeywords = new Set([
|
|
44
44
|
"attribute", "callback", "object", "toString",
|
|
@@ -24,7 +24,7 @@ declare function req<A, R>(key: string, fn: (x: A) => R): LibraryQuery<A, R>;
|
|
|
24
24
|
declare function compose<B, R>(base: LibraryReducer<B>, next: LibraryQuery<B, R>): LibraryReducer<R>;
|
|
25
25
|
declare function concat<A, R1, R2>(f: LibraryQuery<A, R1>, g: LibraryQuery<A, R2>): LibraryQuery<A, [R1, R2]>;
|
|
26
26
|
declare class LensBuilder<R> {
|
|
27
|
-
|
|
27
|
+
req: LibraryReducer<R>;
|
|
28
28
|
private constructor();
|
|
29
29
|
static make<R>(r: LibraryReducer<R>): LensBuilder<R>;
|
|
30
30
|
pipe<T>(r: LibraryQuery<R, T>): LensBuilder<T>;
|
|
@@ -48,13 +48,14 @@ export declare const lib: {
|
|
|
48
48
|
nodes(params: EntitiesParams): LibraryQuery<readonly IDLFile[], idl.IDLNode[]>;
|
|
49
49
|
entries(): LibraryQuery<idl.IDLNode[], idl.IDLEntry[]>;
|
|
50
50
|
interfaces(): LibraryQuery<idl.IDLNode[], idl.IDLInterface[]>;
|
|
51
|
+
hasExt<T extends idl.IDLNode>(attr: idl.IDLExtendedAttributes): LibraryQuery<T[], T[]>;
|
|
51
52
|
names(): LibraryQuery<idl.IDLNode[], string[]>;
|
|
52
53
|
name(name: string): LibraryReducer<idl.IDLNode[]>;
|
|
53
54
|
};
|
|
54
55
|
utils: {
|
|
55
|
-
idx: <
|
|
56
|
-
fst: <
|
|
57
|
-
lst: <
|
|
56
|
+
idx: <T_1>(x: number) => LibraryQuery<T_1[], T_1 | undefined>;
|
|
57
|
+
fst: <T_2>() => LibraryQuery<T_2[], T_2 | undefined>;
|
|
58
|
+
lst: <T_3>() => LibraryQuery<T_3[], T_3 | undefined>;
|
|
58
59
|
};
|
|
59
60
|
req: typeof req;
|
|
60
61
|
compose: typeof compose;
|
package/build/lib/src/library.js
CHANGED
|
@@ -157,6 +157,9 @@ const select = {
|
|
|
157
157
|
interfaces() {
|
|
158
158
|
return req('interfaces', it => it.filter(idl.isInterface));
|
|
159
159
|
},
|
|
160
|
+
hasExt(attr) {
|
|
161
|
+
return req('with_attr=' + serializeParam(attr), it => it.filter(x => idl.hasExtAttribute(x, attr)));
|
|
162
|
+
},
|
|
160
163
|
names() {
|
|
161
164
|
return req('names', xs => xs.flatMap(x => idl.isNamedNode(x) ? [x.name] : []));
|
|
162
165
|
},
|
|
@@ -32,7 +32,7 @@ export class BuilderClass {
|
|
|
32
32
|
*/
|
|
33
33
|
export function isBuilderClass(declaration) {
|
|
34
34
|
const className = declaration.name;
|
|
35
|
-
if (generatorConfiguration().
|
|
35
|
+
if (generatorConfiguration().builderClasses.includes(className)) {
|
|
36
36
|
return true;
|
|
37
37
|
}
|
|
38
38
|
if (isCustomBuilderClass(className)) {
|
|
@@ -16,6 +16,7 @@ export var LayoutNodeRole;
|
|
|
16
16
|
(function (LayoutNodeRole) {
|
|
17
17
|
LayoutNodeRole[LayoutNodeRole["PEER"] = 0] = "PEER";
|
|
18
18
|
LayoutNodeRole[LayoutNodeRole["INTERFACE"] = 1] = "INTERFACE";
|
|
19
|
+
LayoutNodeRole[LayoutNodeRole["GLOBAL"] = 2] = "GLOBAL";
|
|
19
20
|
})(LayoutNodeRole || (LayoutNodeRole = {}));
|
|
20
21
|
export class LayoutManager {
|
|
21
22
|
constructor(strategy) {
|
|
@@ -4,7 +4,6 @@ import { Field, Method } from '../LanguageWriters/LanguageWriter';
|
|
|
4
4
|
import { PeerClassBase } from './PeerClass';
|
|
5
5
|
import { PeerMethod } from './PeerMethod';
|
|
6
6
|
import { ReferenceResolver } from './ReferenceResolver';
|
|
7
|
-
export declare function isMaterialized(declaration: idl.IDLInterface, resolver: ReferenceResolver): boolean;
|
|
8
7
|
export declare class MaterializedField {
|
|
9
8
|
field: Field;
|
|
10
9
|
argConvertor: ArgConvertor;
|
|
@@ -12,42 +12,11 @@
|
|
|
12
12
|
* See the License for the specific language governing permissions and
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
|
-
import { generatorConfiguration } from '../config';
|
|
16
15
|
import * as idl from '../idl';
|
|
17
|
-
import { CppReturnTypeConvertor } from '../LanguageWriters/convertors/CppConvertors';
|
|
18
16
|
import { copyMethod, Method, MethodModifier, NamedMethodSignature } from '../LanguageWriters/LanguageWriter';
|
|
19
17
|
import { capitalize } from '../util';
|
|
20
|
-
import { isBuilderClass } from './BuilderClass';
|
|
21
18
|
import { qualifiedName } from './idl/common';
|
|
22
19
|
import { PeerMethod } from './PeerMethod';
|
|
23
|
-
export function isMaterialized(declaration, resolver) {
|
|
24
|
-
if (!idl.isInterfaceSubkind(declaration) && !idl.isClassSubkind(declaration))
|
|
25
|
-
return false;
|
|
26
|
-
if (idl.isHandwritten(declaration) || isBuilderClass(declaration))
|
|
27
|
-
return false;
|
|
28
|
-
for (const forceMaterialized of generatorConfiguration().param("forceMaterialized")) {
|
|
29
|
-
if (declaration.name == forceMaterialized)
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
for (const ignore of generatorConfiguration().param("ignoreMaterialized")) {
|
|
33
|
-
if (declaration.name.endsWith(ignore))
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
// A materialized class is a class or an interface with methods
|
|
37
|
-
// excluding components and related classes
|
|
38
|
-
if (declaration.methods.length > 0 || declaration.constructors.length > 0)
|
|
39
|
-
return true;
|
|
40
|
-
// Or a class or an interface derived from materialized class
|
|
41
|
-
if (idl.hasSuperType(declaration)) {
|
|
42
|
-
const superType = resolver.resolveTypeReference(idl.getSuperType(declaration));
|
|
43
|
-
if (!superType || !idl.isInterface(superType)) {
|
|
44
|
-
console.log(`Unable to resolve ${idl.getSuperType(declaration).name} type, consider ${declaration.name} to be not materialized`);
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
return isMaterialized(superType, resolver);
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
20
|
export class MaterializedField {
|
|
52
21
|
constructor(field, argConvertor, outArgConvertor, isNullableOriginalTypeField) {
|
|
53
22
|
this.field = field;
|
|
@@ -76,28 +45,14 @@ export class MaterializedMethod extends PeerMethod {
|
|
|
76
45
|
}
|
|
77
46
|
}
|
|
78
47
|
dummyReturnValue(resolver) {
|
|
79
|
-
var _a;
|
|
80
48
|
if (this.method.name === "ctor")
|
|
81
|
-
return `(${this.originalParentName}
|
|
49
|
+
return `(Ark_${this.originalParentName}) 100`;
|
|
82
50
|
if (this.method.name === "getFinalizer")
|
|
83
51
|
return `fnPtr<KNativePointer>(dummyClassFinalizer)`;
|
|
84
|
-
if ((_a = this.method.modifiers) === null || _a === void 0 ? void 0 : _a.includes(MethodModifier.STATIC)) {
|
|
85
|
-
if (this.method.signature.returnType === idl.IDLNumberType) {
|
|
86
|
-
return '100';
|
|
87
|
-
}
|
|
88
|
-
if (this.method.signature.returnType === idl.IDLBooleanType) {
|
|
89
|
-
return '0';
|
|
90
|
-
}
|
|
91
|
-
const convertor = new CppReturnTypeConvertor(resolver);
|
|
92
|
-
return `(${convertor.convert(this.returnType)}) 300`;
|
|
93
|
-
}
|
|
94
|
-
if (idl.isReferenceType(this.method.signature.returnType)) {
|
|
95
|
-
return "{}";
|
|
96
|
-
}
|
|
97
52
|
return undefined;
|
|
98
53
|
}
|
|
99
54
|
get receiverType() {
|
|
100
|
-
return
|
|
55
|
+
return `Ark_${this.originalParentName}`;
|
|
101
56
|
}
|
|
102
57
|
get apiCall() {
|
|
103
58
|
return "GetAccessors()";
|
|
@@ -110,7 +65,7 @@ export class MaterializedMethod extends PeerMethod {
|
|
|
110
65
|
return undefined;
|
|
111
66
|
return {
|
|
112
67
|
argName: 'peer',
|
|
113
|
-
argType:
|
|
68
|
+
argType: `Ark_${this.originalParentName}`
|
|
114
69
|
};
|
|
115
70
|
}
|
|
116
71
|
getImplementationName() {
|
|
@@ -8,6 +8,7 @@ export declare class PeerFile implements LibraryFileInterface {
|
|
|
8
8
|
readonly peers: Map<string, PeerClass>;
|
|
9
9
|
constructor(originalFilename: string, entries: idl.IDLEntry[], isPredefined?: boolean);
|
|
10
10
|
packageName(): string;
|
|
11
|
+
package(): idl.IDLPackage | undefined;
|
|
11
12
|
get peersToGenerate(): PeerClass[];
|
|
12
13
|
}
|
|
13
14
|
//# sourceMappingURL=PeerFile.d.ts.map
|
|
@@ -21,7 +21,7 @@ export class PeerFile {
|
|
|
21
21
|
this.peers = new Map();
|
|
22
22
|
}
|
|
23
23
|
packageName() {
|
|
24
|
-
|
|
24
|
+
const packageTag = this.package();
|
|
25
25
|
if (packageTag === undefined) {
|
|
26
26
|
return "";
|
|
27
27
|
}
|
|
@@ -30,6 +30,9 @@ export class PeerFile {
|
|
|
30
30
|
}
|
|
31
31
|
return packageTag.name;
|
|
32
32
|
}
|
|
33
|
+
package() {
|
|
34
|
+
return this.entries.find(it => idl.isPackage(it));
|
|
35
|
+
}
|
|
33
36
|
get peersToGenerate() {
|
|
34
37
|
const peers = Array.from(this.peers.values());
|
|
35
38
|
return peers;
|