Fix _objectSpread2 for real#10188
Conversation
| target, | ||
| key, | ||
| Object.getOwnPropertyDescriptor(arguments[i], key) | ||
| Object.getOwnPropertyDescriptor(source, key) |
There was a problem hiding this comment.
This was the bug 🪲 🪲🪲🪲🪲🪲
There was a problem hiding this comment.
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.
| Object.getOwnPropertyDescriptors = null; | ||
|
|
||
| ({ ...{ a: 1 }, ...{} }); | ||
| ({ ...{ a: 1 }, b: 1, ...{} }); |
There was a problem hiding this comment.
This updated test failed before the fix.
hzoo
left a comment
There was a problem hiding this 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)
|
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
argumentsfrom an outer function inside an inner function.I can't use
argumentsfrom an outer function inside an inner function.I can't use
argumentsfrom an outer function inside an inner function.I can't use
argumentsfrom 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/helpersinside yournode_moduleslike 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 😆