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 _objectSpread2 for real #10188

Merged
merged 3 commits into from Jul 9, 2019
Merged

Fix _objectSpread2 for real #10188

merged 3 commits into from Jul 9, 2019

Conversation

@nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Jul 9, 2019

Q                       A
Fixed Issues? Fixes #10166 for real maybe I hope
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

I can't use arguments from an outer function inside an inner function.
I can't use arguments from an outer function inside an inner function.
I can't use arguments from an outer function inside an inner function.
I can't use arguments from an outer function inside an inner function.

(Thanks @hzoo for helping me finding the bug)

@maxmodel or @pwnreza Could you try to update the code in @babel/helpers inside your node_modules like I did in this PR and confirm that it works?

I'll now go hiding myself somewhere and I won't touch an helper for a few months 😆

Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(arguments[i], key)
Object.getOwnPropertyDescriptor(source, key)

This comment has been minimized.

@nicolo-ribaudo

nicolo-ribaudo Jul 9, 2019
Author Member

This was the bug 🐞 🐞🐞🐞🐞🐞

This comment has been minimized.

@hzoo

hzoo Jul 9, 2019
Member

Right! the forEach on line 433 (ownKeys(source).forEach(function (key) {) is it's own function scope so the arguments[i] usage here is the issue. Solution is to save it as a variable up top and reuse it everywhere.

@@ -1,6 +1,6 @@
const oldGOPDs = Object.getOwnPropertyDescriptors;
Object.getOwnPropertyDescriptors = null;

({ ...{ a: 1 }, ...{} });
({ ...{ a: 1 }, b: 1, ...{} });

This comment has been minimized.

@nicolo-ribaudo

nicolo-ribaudo Jul 9, 2019
Author Member

This updated test failed before the fix.

@nicolo-ribaudo nicolo-ribaudo requested review from hzoo and existentialism Jul 9, 2019
@hzoo
hzoo approved these changes Jul 9, 2019
Copy link
Member

@hzoo hzoo left a comment

👍 thanks, and it's totally cool, we all make mistakes and it's a good learning opportunity! (yes it's unfortunate it happens to be on something a lot of people use but you've been doing such a great job)

@babel-bot
Copy link
Collaborator

@babel-bot babel-bot commented Jul 9, 2019

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

@maxmodel
Copy link

@maxmodel maxmodel commented Jul 9, 2019

Confirmed that this fixes the problem -- thanks so much @nicolo-ribaudo!

@nicolo-ribaudo
Copy link
Member Author

@nicolo-ribaudo nicolo-ribaudo commented Jul 9, 2019

Also confired by @belemaire #10166 (comment)

@nicolo-ribaudo nicolo-ribaudo merged commit fa5ec75 into babel:master Jul 9, 2019
4 checks passed
4 checks passed
@babel-bot
babel/repl REPL preview is available
Details
ci/circleci Your tests passed on CircleCI!
Details
@codecov
codecov/project 87.57% (target 80%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@nicolo-ribaudo nicolo-ribaudo deleted the nicolo-ribaudo:lololol branch Jul 9, 2019
@lock lock bot added the outdated label Oct 8, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants