-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[WASM] Enabled strict mode on all JS files #54011
Conversation
Tagging subscribers to this area: @CoffeeFlux Issue DetailsThis PR adds the Why is this needed?This annotation signals to the JS engine that the file should be run in strict mode which throws errors/exceptions when some looser features of JS are used (for example using undeclared variables). This is also required to ease the eventual NodeJS support that I am working on adding to wasm. What's changedBasically every file ending with Other minor changes
|
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsThis PR adds the Why is this needed?This annotation signals to the JS engine that the file should be run in strict mode which throws errors/exceptions when some looser features of JS are used (for example using undeclared variables). This is also required to ease the eventual NodeJS support that I am working on adding to wasm. What's changedBasically every file ending with Other minor changes
|
Could you please change |
Good idea! However it is kind of parallel to this PR, so I'll make a new PR for this after this one is completed. |
This generally seems fine, but I think mixing all these whitespace changes in might be a mistake. It clutters the git blame and makes it unclear what this PR actually did or didn't do. |
@kg Should they be removed? I just converted all the files in runtime to use tabs instead of spaces for consistency since I was already making such syntax changes (see the other minor changes section in the description). Before this, some files had a mix of spaces and tabs. |
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.
@kg Should they be removed? I just converted all the files in runtime to use tabs instead of spaces for consistency since I was already making such syntax changes (see the other minor changes section in the description). Before this, some files had a mix of spaces and tabs.
I don't know if we have a policy for that in /runtime. It usually makes diffs and blame harder to review, but github has a 'hide whitespace changes' option so maybe it's fine.
Other than my previous comments I'm happy with this PR, thanks for doing it. I can't give it a green check yet though because if it landed it would block the marshaler PR, so I want to make sure that gets in first unless we decide not to land it at all |
Ok. Thanks for your review. That makes sense. Do you think the marshaler PR will be done sometime soon? |
I'm working on figuring that out as we speak. Sorry for delaying your work with this |
Haha ok sounds good. I'll work on some other tasks for now then. Thanks again |
I don't see any dotnet_support.js changes? |
I didn't see anything that wasn't compliant with strict mode. Do you see something? Primarily, I was looking for undeclared variables or other strict mode related errors. |
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.
Looking good, a couple of comments and one issue.
What is the plan with this PR? |
If we land it all the marshaler and invoke stuff will probably have to be rewritten to rebase it. Otherwise the PR looks great |
Yes I left this pending while Katelyn works on the marshaler one. It has not been forgotten :) |
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.
LGTM, what do you think @kg ?
My previous opinion (it's great) holds, but we should come to a firm decision w/Larry or other involved decision-makers that we're going to abandon the invoke and/or marshaler PRs before we land it, since that's what landing it implies. |
I understood Larry said that we are not going to land it in 6.0 |
b309147
to
9f165d1
Compare
29d79bb
to
822f1e2
Compare
author: Daniel Genkin squashed, rebased
822f1e2
to
3c8187f
Compare
Failure is #58812 and other wasm unrelated failures |
This PR adds the
"use strict"
annotation to all JS files (including dotnet.js via the emccSTRICT_JS
flag).Why is this needed?
This annotation signals to the JS engine that the file should be run in strict mode which throws errors/exceptions when some looser features of JS are used (for example using undeclared variables). This is also required to ease the eventual NodeJS support that I am working on adding to wasm.
What's changed
Basically every file ending with
.js
will have the"use strict"
annotation on the first line. This is mostly done manually with the only exception being the dotnet.js file as it is automatically generated. For that I used theSTRICT_JS
emcc flag.Other minor changes