Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generates invalid syntax #14

Open
Qix- opened this issue Jun 12, 2022 · 2 comments
Open

Generates invalid syntax #14

Qix- opened this issue Jun 12, 2022 · 2 comments

Comments

@Qix-
Copy link

Qix- commented Jun 12, 2022

When trying to generate FFI bindings for libfuse:

> 50 | types.["fuse_args"] = fuse_args;
     |       ^
  51 | types.["fuse_opt_proc_t"] = fuse_opt_proc_t;
  52 | types.["js_CString"] = js_CString;
  53 | types.["js_int32"] = js_int32;
    at p (/src/qix-/test-fuse-ffi/node_modules/prettier/parser-babel.js:22:1038)
    at d (/src/qix-/test-fuse-ffi/node_modules/prettier/parser-babel.js:22:1271)
    at Object.parse (/src/qix-/test-fuse-ffi/node_modules/prettier/parser-babel.js:27:50335)
    at Object.parse (/src/qix-/test-fuse-ffi/node_modules/prettier/index.js:7361:23)
    at coreFormat (/src/qix-/test-fuse-ffi/node_modules/prettier/index.js:8672:18)
    at formatWithCursor2 (/src/qix-/test-fuse-ffi/node_modules/prettier/index.js:8864:18)
    at /src/qix-/test-fuse-ffi/node_modules/prettier/index.js:39174:12
    at Object.format (/src/qix-/test-fuse-ffi/node_modules/prettier/index.js:39188:12)
    at generate (/src/qix-/test-fuse-ffi/node_modules/@ffi-packager/ffi-generate/lib/generate.js:53:29)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runGenerator (/src/qix-/test-fuse-ffi/node_modules/@ffi-packager/ffi-generate/bin/ffi-generate.js:132:20)
    at async loadAndGenerate (/src/qix-/test-fuse-ffi/node_modules/@ffi-packager/ffi-generate/bin/ffi-generate.js:160:3)
    at async mainAsync (/src/qix-/test-fuse-ffi/node_modules/@ffi-packager/ffi-generate/bin/ffi-generate.js:166:3) {
  loc: { start: { line: 50, column: 7 } },
  codeFrame: '  48 | ;\n' +
    '  49 |\n' +
    '> 50 | types.["fuse_args"] = fuse_args;\n' +
    '     |       ^\n' +
    '  51 | types.["fuse_opt_proc_t"] = fuse_opt_proc_t;\n' +
    '  52 | types.["js_CString"] = js_CString;\n' +
    '  53 | types.["js_int32"] = js_int32;'

Looks like it's incorrectly trying to do 'types.' + name or something, where name == '["fuse_args"]' or something.

cc @joelpurra

@joelpurra
Copy link

@Qix-: well, that looks broken.

Unsure, but might be fixed in the fork at @node-ffi-packager? If not, feel free to open a pull request there. (I do not personally have time to spend on debugging/fixing.)

@Qix-
Copy link
Author

Qix- commented Jun 12, 2022

That's the one I tried, you just don't have issues enabled 😅 So I opened it here.

I tried to look into the source but it's pretty hairy. I've kind of given up on doing this with any amount of certainty :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants