Skip to content

Conversation

bnoordhuis
Copy link
Contributor

It's still not infallible (I don't think it can ever be, the whole premise is wrong) but hopefully it's a little less fallible now.

Fixes: #606

It's still not infallible (I don't think it can ever be, the whole
premise is wrong) but hopefully it's a little less fallible now.

Fixes: quickjs-ng#606
@bnoordhuis
Copy link
Contributor Author

examples/function_source.js and examples/hello.js are detected as modules now, which is not wrong but neither is it particularly right (can be parsed either way.)

I guess I could make js_parse_program and everything it calls track whether it saw syntax that is definitely ESM-only but that's:

  1. a lot of effort, and

  2. not really better, merely backwards compatible; it just flips the problem around of classic scripts getting classified as modules, now it's modules without definite ESM syntax getting misidentified (problematic when run in sloppy/non-strict mode)

@saghul
Copy link
Contributor

saghul commented Oct 20, 2024

I love me a beautiful hack!

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

Successfully merging this pull request may close these issues.

JS_DetectModule does not (always) detect TLA
2 participants