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
Fix _objectSpread2 for real #10188
Conversation
Object.defineProperty( | ||
target, | ||
key, | ||
Object.getOwnPropertyDescriptor(arguments[i], key) | ||
Object.getOwnPropertyDescriptor(source, key) |
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.
This was the bug 🪲 🪲🪲🪲🪲🪲
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.
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, ...{} }); |
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.
This updated test failed before the fix.
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, 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)
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/11084/ |
Confirmed that this fixes the problem -- thanks so much @nicolo-ribaudo! |
Also confired by @belemaire #10166 (comment) |
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 yournode_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 😆