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
Use the correct this
in __self
for JSX elements in arrows
#11288
Use the correct this
in __self
for JSX elements in arrows
#11288
Conversation
@@ -1,31 +0,0 @@ | |||
var actual = transform( |
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.
I merged this test to the one that runs on linux. Also, I made it input/output rather than calling transform
in exec.js
.
packages/babel-helper-builder-react-jsx-experimental/src/index.js
Outdated
Show resolved
Hide resolved
This fixes an issue where `this` was not correct inside arrow functions, similar to https://astexplorer.net/#/gist/86638d64cd21c496e7fecaea46313d95/906f8be24d7d99f3f5cd5a956a48355e1864f4b1
28515ce
to
61c1e5b
Compare
Should we also fix the |
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.
awesome, so we are deprecating the standalone plugins now? (although also true it has been that way since the beginning)
edit: yeah was going to ask the same as @lunaruan
I can prepare another PR for the standalone plugins, but given that they have been proven for years and that they shouldn't be used anymore I don't think that it's worth it 🤷♀️ |
Thanks again for doing this! |
The problem was that we were injecting
__self
after transpiling arrow functions, and thus it didn't receive the outerthis
but the one of the new function expression.This PR fixes the problem by injecting
__self
and__source
inProgram:enter
.Probably windows tests will fail because I tried to manually edit them, I'll fix them after CI tells me the necessary updated.