Skip to content

Fix: default rest argument array elements as undefined#14032

Merged
nicolo-ribaudo merged 5 commits intobabel:mainfrom
The-x-Theorist:rest-parameters-bug
Dec 13, 2021
Merged

Fix: default rest argument array elements as undefined#14032
nicolo-ribaudo merged 5 commits intobabel:mainfrom
The-x-Theorist:rest-parameters-bug

Conversation

@The-x-Theorist
Copy link
Copy Markdown
Contributor

@The-x-Theorist The-x-Theorist commented Dec 7, 2021

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

Default rest argument array elements won't be undefined anymore, It will give the correct output as required from the arguments with rest, Because now we first memoize the arguments and then bind the arguments to some other array.

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Dec 7, 2021

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

@nicolo-ribaudo nicolo-ribaudo added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Dec 7, 2021
nicolo-ribaudo
nicolo-ribaudo previously approved these changes Dec 10, 2021
Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@lightmare
Copy link
Copy Markdown
Contributor

IMO this should not change any of the existing fixtures that don't name their rest element ...arguments

@nicolo-ribaudo nicolo-ribaudo dismissed their stale review December 10, 2021 11:24

Actually, could you call path.scope.rename("arguments") if the rest binding is arguments, rather than updating the template? (#13992 (comment))

Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be released before #14036, since until #14036 is merged renaming arguents is not fully working.

@nicolo-ribaudo nicolo-ribaudo merged commit a7acde3 into babel:main Dec 13, 2021
@The-x-Theorist The-x-Theorist deleted the rest-parameters-bug branch December 14, 2021 05:39
@github-actions github-actions Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Mar 16, 2022
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 16, 2022
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.

[Bug]: The Extension Operator in the Function Argument Failed to Resolve

5 participants