lukaskollmer / objc

🔮 NodeJS ↔ Objective-C bridge (experimental)
MIT License
98 stars 20 forks source link

"Unexpected token 'o'" in type-encodings.js #36

Open chrillek opened 2 years ago

chrillek commented 2 years ago

This code

'use strict';
const objc = require('objc');

const {
  NSURL,
  NSURLTypeIdentifierKey
} = objc;

const uti = objc.allocRef();
const error = objc.allocRef();
const fileURL = NSURL.fileURLWithPath('/Users/ck');
fileURL.getResourceValue_forKey_error(uti, NSURLTypeIdentifierKey, error);

throws this error:

Node.js v17.5.0

…/node_modules/objc/src/type-encodings.js:175
          throw new Error(`Unexpected token ${this.currentToken}`);
          ^

Error: Unexpected token o
    at TypeEncodingParser.parseType (…/node_modules/objc/src/type-encodings.js:175:17)
    at TypeEncodingParser.parse (…/node_modules/objc/src/type-encodings.js:125:23)
    at coerceType (…/node_modules/objc/src/type-encodings.js:258:28)
    at …node_modules/objc/src/instance.js:63:14
    at Array.map (<anonymous>)
    at Instance.call (…/node_modules/objc/src/instance.js:62:72)
    at Object.apply (…/node_modules/objc/src/proxies.js:27:19)
    at Object.<anonymous> (…/testcase.js:12:9)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)

I think that the call to getResourceValue_forKey_error should be ok, but may of course be wrong. In that case, what should I change?