Skip to content

Fixes setter paratemer default value#8479

Merged
jridgewell merged 2 commits intobabel:masterfrom
nikolayemrikh:fix-default-setter-parameter
Aug 16, 2018
Merged

Fixes setter paratemer default value#8479
jridgewell merged 2 commits intobabel:masterfrom
nikolayemrikh:fix-default-setter-parameter

Conversation

@nikolayemrikh
Copy link
Copy Markdown
Contributor

@nikolayemrikh nikolayemrikh commented Aug 15, 2018

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

Forces setter's default parameter to use loose transform

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Aug 15, 2018

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


if (param.isAssignmentPattern() && loose) {
const paramIsAssignmentPattern = param.isAssignmentPattern();
if (paramIsAssignmentPattern && loose) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of setting loose to true for setters, could you update this check to (loose || node.kind === "set")?
It would be a little more descriptive and, if we use loose for other parts of the transform on the future, they won't be automatically enabled for setters since they might not be needed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yep I was thinking that as well!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In the beginning i did so. But later..

@existentialism existentialism added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Aug 15, 2018
@jridgewell jridgewell merged commit 5043ec7 into babel:master Aug 16, 2018
@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.

Setter default value

6 participants