Skip to content
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

Fix destructuring assignment in arrow functions without block #8916

Merged
merged 1 commit into from Nov 25, 2018
Merged

Fix destructuring assignment in arrow functions without block #8916

merged 1 commit into from Nov 25, 2018

Conversation

RubenVerborgh
Copy link
Contributor

@RubenVerborgh RubenVerborgh commented Oct 23, 2018

Q                       A
Fixed Issues? Fixes #8912
Patch: Bug Fix? 👍
Major: Breaking Change? 👎
Minor: New Feature? 👎
Tests Added + Pass? 👍
Documentation PR Link n/a
Any Dependency Changes? 👎
License MIT

@babel-bot
Copy link
Collaborator

babel-bot commented Oct 23, 2018

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/9280/

@RubenVerborgh
Copy link
Contributor Author

RubenVerborgh commented Oct 23, 2018

@loganfsmyth Wrapping the body means making the return statement explicit, and detecting this case would be more complex in path.ensureBlock() than it is at the point of generation. I'm therefore proposing a more simple change that fixes the problem directly in the destructuring plugin, where we can easily insert a return statement.

@RubenVerborgh RubenVerborgh changed the title Do not consider arrow functions without a block to be block parents Fix destructuring assignment in arrow functions without body Oct 23, 2018
@RubenVerborgh RubenVerborgh changed the title Fix destructuring assignment in arrow functions without body Fix destructuring assignment in arrow functions without block Oct 23, 2018
@existentialism existentialism added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Nov 5, 2018
@nicolo-ribaudo nicolo-ribaudo merged commit 9308c87 into babel:master Nov 25, 2018
@nicolo-ribaudo
Copy link
Member

Thank you!

NMinhNguyen pushed a commit to NMinhNguyen/babel-plugin-transform-destructuring that referenced this pull request Aug 9, 2019
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Destructuring array assignment fails in arrow functions without block
6 participants