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
Fixes setter paratemer default value #8479
Fixes setter paratemer default value #8479
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/8824/ |
@@ -60,7 +60,8 @@ export default function convertFunctionParams(path, loose) { | |||
for (let i = 0; i < params.length; i++) { | |||
const param = params[i]; | |||
|
|||
if (param.isAssignmentPattern() && loose) { | |||
const paramIsAssignmentPattern = param.isAssignmentPattern(); | |||
if (paramIsAssignmentPattern && loose) { |
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.
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.
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.
Yep I was thinking that as well!
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.
In the beginning i did so. But later..
Forces setter's default parameter to use loose transform