@idlizer/core 2.0.21 → 2.0.22

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.
@@ -35,6 +35,8 @@ export declare class InteropNameConvertor implements IdlNameConvertor {
35
35
  convert(node: idl.IDLNode): string;
36
36
  }
37
37
  export declare class InteropReturnTypeConvertor implements TypeConvertor<string> {
38
+ protected readonly resolver?: ReferenceResolver | undefined;
39
+ constructor(resolver?: ReferenceResolver | undefined);
38
40
  isVoid(method: PeerMethod): boolean;
39
41
  convert(type: idl.IDLType): string;
40
42
  convertContainer(type: idl.IDLContainerType): string;
@@ -173,6 +173,9 @@ export class InteropNameConvertor {
173
173
  }
174
174
  }
175
175
  export class InteropReturnTypeConvertor {
176
+ constructor(resolver) {
177
+ this.resolver = resolver;
178
+ }
176
179
  isVoid(method) {
177
180
  return this.convert(method.returnType) === idl.IDLVoidType.name;
178
181
  }
@@ -225,6 +228,10 @@ export class InteropReturnTypeConvertor {
225
228
  convertTypeReference(type) {
226
229
  if (type.name.endsWith("Attribute"))
227
230
  return idl.IDLVoidType.name;
231
+ // Callbacks and array types return by value
232
+ if (this.resolver && idl.isCallback(this.resolver.toDeclaration(type))) {
233
+ return type.name;
234
+ }
228
235
  return PrimitiveTypesInstance.NativePointer.getText();
229
236
  }
230
237
  convertUnion(type) {
@@ -87,6 +87,9 @@ export class MaterializedMethod extends PeerMethod {
87
87
  }
88
88
  return `(void*) 300`;
89
89
  }
90
+ if (idl.isReferenceType(this.method.signature.returnType)) {
91
+ return "{}";
92
+ }
90
93
  return undefined;
91
94
  }
92
95
  get receiverType() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idlizer/core",
3
- "version": "2.0.21",
3
+ "version": "2.0.22",
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.4.8",
37
+ "@koalaui/interop": "1.4.9",
38
38
  "typescript": "4.9.5",
39
39
  "@types/node": "^18.0.0"
40
40
  },