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
Always transform for-await in async functions[rebase of #6953]. #7446
Conversation
for-await was transformed in @babel/helper-remap-async-to-generator, which was called by @babel/plugin-transform-async-to-generator and @babel/plugin-proposal-async-generator-functions. This prevented for-await statements in async functions to be transpiled if the transform-async-to-generator plugin was't enabled.
@nicolo-ribaudo I've rebase your fix. |
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/6979/ |
Thank you! 🙂 |
Do I understand this correctly: To get the same result as before you need to have |
Before:
After:
So to fully transpile this code yes, you need both the plugins: async function fn() {
for await (const x of gen()) {}
} But it makes sense, because On the other hand, without this PR it is impossible to only transpile the |
Thanks for the clarification. |
I don't know if I should label this PR as a bug fix or as a breaking change 🤔 |
Is there any hint when this will go into |
for-await was transformed in @babel/helper-remap-async-to-generator, which was called by @babel/plugin-transform-async-to-generator and @babel/plugin-proposal-async-generator-functions. This prevented for-await statements in async functions to be transpiled if the transform-async-to-generator plugin was't enabled.
This PR is rebase(and fix merge conflicts) of #6953 on actual master