-
Notifications
You must be signed in to change notification settings - Fork 740
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
Support empty export names in wasm2js and JS mangling in general #2290
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I did not know that.
Actually this PR was totally wrong - empty exports are valid in wasm. They are just empty strings in JS, which is a valid identifier on the exports object... the spec and impls support that. The proper fix here is then to just properly mangle such a name into something valid in JS, which I did as |
I feel like if a user is crazy enough to have an empty string import then they might also be crazy enough to have a dollar sign import. Should there be some sort of error or fallback if "$" is already present? |
There is a runtime error for the user when they try to run the code ;) I didn't see a nice way to add an error here - asmangle has to do something for such a string, and to detect the possible problem we'd need to introduce another layer of checks on top of all the callers to it. |
We were missing this silly validation rule, which explains the non-crash in #2288