@idlizer/core 2.0.29 → 2.0.31
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.
|
@@ -262,7 +262,7 @@ export class JavaLanguageWriter extends CLikeLanguageWriter {
|
|
|
262
262
|
this.writeStatement(this.makeAssign(valueType, undefined, this.makeRuntimeTypeGetterCall(value), false));
|
|
263
263
|
}
|
|
264
264
|
makeEnumCast(enumName, _unsafe, _convertor) {
|
|
265
|
-
return `${enumName}.
|
|
265
|
+
return `${enumName}.value`;
|
|
266
266
|
}
|
|
267
267
|
castToBoolean(value) { return value; }
|
|
268
268
|
makeLengthSerializer(serializer, value) {
|
|
@@ -2,7 +2,7 @@ import * as idl from "../../idl";
|
|
|
2
2
|
import { Language } from "../../Language";
|
|
3
3
|
export declare function generateSyntheticIdlNodeName(type: idl.IDLType): string;
|
|
4
4
|
export declare function qualifiedName(decl: idl.IDLNode, languageOrDelimiter: Language | string): string;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function collapseTypes(types: idl.IDLType[], name?: string): idl.IDLType;
|
|
6
6
|
export declare function generifiedTypeName(refType: idl.IDLReferenceType | undefined, refName?: string): string | undefined;
|
|
7
7
|
export declare function generateSyntheticUnionName(types: idl.IDLType[]): string;
|
|
8
8
|
export declare function generateSyntheticFunctionName(parameters: idl.IDLParameter[], returnType: idl.IDLType, isAsync?: boolean): string;
|
|
@@ -43,7 +43,7 @@ export function qualifiedName(decl, languageOrDelimiter) {
|
|
|
43
43
|
return qualifiedName(decl.namespace, delimiter) + delimiter + idl.forceAsNamedNode(decl).name;
|
|
44
44
|
return idl.forceAsNamedNode(decl).name;
|
|
45
45
|
}
|
|
46
|
-
export function
|
|
46
|
+
export function collapseTypes(types, name) {
|
|
47
47
|
const seenNames = new Set();
|
|
48
48
|
const uniqueTypes = types.filter(it => {
|
|
49
49
|
const typeName = idl.printType(it);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { convertType } from "../LanguageWriters";
|
|
16
16
|
import { IDLCustomObjectType, IDLUndefinedType, isType, isUnionType } from '../idl';
|
|
17
|
-
import {
|
|
17
|
+
import { collapseTypes } from "./idl/common";
|
|
18
18
|
import { CustomTypeConvertor } from "../LanguageWriters/ArgConvertors";
|
|
19
19
|
import { RuntimeType } from "../LanguageWriters/common";
|
|
20
20
|
export class UnionFlattener {
|
|
@@ -115,7 +115,7 @@ export function flattenUnionType(library, type) {
|
|
|
115
115
|
if (isUnionType(type)) {
|
|
116
116
|
const allTypes = type.types.flatMap(it => convertType(unionFlattener, it));
|
|
117
117
|
const uniqueTypes = new Set(allTypes);
|
|
118
|
-
return uniqueTypes.size === allTypes.length ? type :
|
|
118
|
+
return uniqueTypes.size === allTypes.length ? type : collapseTypes(Array.from(uniqueTypes));
|
|
119
119
|
}
|
|
120
120
|
return type;
|
|
121
121
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idlizer/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.31",
|
|
4
4
|
"description": "",
|
|
5
5
|
"types": "build/lib/src/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"keywords": [],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@koalaui/interop": "1.5.
|
|
37
|
+
"@koalaui/interop": "1.5.5",
|
|
38
38
|
"typescript": "4.9.5",
|
|
39
39
|
"@types/node": "^18.0.0"
|
|
40
40
|
},
|