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

imports analysis: panicked when src is incorrect #35

Open
SteelAlloy opened this issue Jan 9, 2021 · 0 comments
Open

imports analysis: panicked when src is incorrect #35

SteelAlloy opened this issue Jan 9, 2021 · 0 comments

Comments

@SteelAlloy
Copy link
Member

Hi Divy
I'm currently working on a rewrite of the dep tree module but I'm facing a few issues
Consider the folloing code:

import init, { source, tree } from "https://x.nest.land/[email protected]/wasm/wasm.js";

await init(source);

try {
  tree("", "{{");
} catch (err) {
  console.log(err);
}

try {
  tree("", "const x = 5;");
} catch (err) {
  console.log(err);
}

The first call analyzes {{. This code is obviously not valid javascript.
Some error messages are displayed even if I remove the console.log.
The second call analyzes const x = 5; which is valid javascript but the wasm function is still stuck.

panicked at 'called `Result::unwrap()` on an `Err` value: SwcDiagnosticBuffer { diagnostics: ["Unexpected eof at :1:2"] }', src/lib.rs:19:6

Stack:

Error
    at Y.g.wbg.__wbg_new_59cb74e423758ede (https://3cfd3lulgczqtos7nd7bcmymng2nybpbdzsdljvpo64uo3vyx4kq.arweave.net/2Io9roswswm6X2j-ETMMabTcBeEeZDWmr3e5R264vxU/wasm/wasm.js:2:1169976)  
    at <anonymous> (<anonymous>:0:638559)
    at <anonymous> (<anonymous>:0:791204)
    at <anonymous> (<anonymous>:0:673555)
    at <anonymous> (<anonymous>:0:770656)
    at <anonymous> (<anonymous>:0:778289)
    at <anonymous> (<anonymous>:0:742880)
    at tree (<anonymous>:0:558415)
    at tree (https://3cfd3lulgczqtos7nd7bcmymng2nybpbdzsdljvpo64uo3vyx4kq.arweave.net/2Io9roswswm6X2j-ETMMabTcBeEeZDWmr3e5R264vxU/wasm/wasm.js:2:1168676)
    at graph.ts:137:3


RuntimeError: unreachable
    at <anonymous> (<anonymous>:0:673586)
    at <anonymous> (<anonymous>:0:770656)
    at <anonymous> (<anonymous>:0:778289)
    at <anonymous> (<anonymous>:0:742880)
    at tree (<anonymous>:0:558415)
    at tree (https://3cfd3lulgczqtos7nd7bcmymng2nybpbdzsdljvpo64uo3vyx4kq.arweave.net/2Io9roswswm6X2j-ETMMabTcBeEeZDWmr3e5R264vxU/wasm/wasm.js:2:1168676)
    at graph.ts:137:3
panicked at 'cannot modify the panic hook from a panicking thread', src/libstd/panicking.rs:106:9

Stack:

Error
    at Y.g.wbg.__wbg_new_59cb74e423758ede (https://3cfd3lulgczqtos7nd7bcmymng2nybpbdzsdljvpo64uo3vyx4kq.arweave.net/2Io9roswswm6X2j-ETMMabTcBeEeZDWmr3e5R264vxU/wasm/wasm.js:2:1169976)  
    at <anonymous> (<anonymous>:0:638559)
    at <anonymous> (<anonymous>:0:791204)
    at <anonymous> (<anonymous>:0:673555)
    at <anonymous> (<anonymous>:0:778894)
    at tree (<anonymous>:0:558349)
    at tree (https://3cfd3lulgczqtos7nd7bcmymng2nybpbdzsdljvpo64uo3vyx4kq.arweave.net/2Io9roswswm6X2j-ETMMabTcBeEeZDWmr3e5R264vxU/wasm/wasm.js:2:1168676)
    at graph.ts:143:3


RuntimeError: unreachable
    at <anonymous> (<anonymous>:0:673584)
    at <anonymous> (<anonymous>:0:778894)
    at tree (<anonymous>:0:558349)
    at tree (https://3cfd3lulgczqtos7nd7bcmymng2nybpbdzsdljvpo64uo3vyx4kq.arweave.net/2Io9roswswm6X2j-ETMMabTcBeEeZDWmr3e5R264vxU/wasm/wasm.js:2:1168676)
    at graph.ts:143:3

I really don't have any rust skills, I'd like to fix this bug, but I can't 😅
I've looked for other AST parsers but yours is really the most suitable.

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