-
Notifications
You must be signed in to change notification settings - Fork 450
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
Back-end: emit let
instead of var
.
#6102
Conversation
You can then remove the previous fix (using IIFE) used to capture mutable variable |
The scope of `var` is per-function, requiring a transformation for closures inside loops when capturing loop variables. This PR turns off the transformation. This PR should go after #6102
I wonder how much it'll affect performance. But probably it won't be a big difference. |
@DZakh did you see this: #856 (comment) ? |
Wow, cool |
The scope of `var` is per-function, requiring a transformation for closures inside loops when capturing loop variables. This PR turns off the transformation. This PR should go after #6102
@cristianoc Could you rebase this? Now that 11.1 is out and development focus is shifting to v12, it would be great to get this merged. |
d9a369b
to
698fbf5
Compare
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.
Thanks a lot!
Let's remove "Test" from the commit message and PR title before merging though.
Sorry, I'm afraid you'll also need to rebase again. |
let
instead of var
.
let
instead of var
.let
instead of var
.
@cknitt ready to go |
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.
Great, thanks!
The scope of `var` is per-function, requiring a transformation for closures inside loops when capturing loop variables. This PR turns off the transformation. This PR should go after #6102
Just want to make a quick note that this is improvement is a requirement for the React Compiler it seems to analyze the rules of React. Changing |
Fixes #856
Need to check that no cases are missed where this could introduce regressions even if the tests appear to be passing
This will generate a huge amount of noise in the diff w.r.t. other versions of the compiler. It might not be ideal to have this change in an initial version of compiler v11 if other changes are important as they would get lost in the noise
Note that the transformation creating problems in Fix issue with generating async functions inside loops. #6479 can be removed