X Tutup
Skip to content

fixed default binding pattern parameters#589

Merged
Perryvw merged 2 commits intomasterfrom
default-binding-function-parameter
May 23, 2019
Merged

fixed default binding pattern parameters#589
Perryvw merged 2 commits intomasterfrom
default-binding-function-parameter

Conversation

@tomblind
Copy link
Collaborator

fixes #530

));
if (binding.initializer !== undefined) {
const declaration = this.transformParameterDefaultValueDeclaration(identifier, binding.initializer);
defaultValueDeclarations.splice(i, 0, declaration);
Copy link
Member

Choose a reason for hiding this comment

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

I think this is is unnecessarily complex, it seems to me this is is a hack so you can keep the map at 1359. In this case it might be simpler to just replace that map with a for ... of or forEach and push the declaration plus an additional optional push for the value to some predefined list.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I won't deny it was a bit of a hack. I've refactored this into something a bit more sensible.

@Perryvw Perryvw merged commit 3d63277 into master May 23, 2019
@Perryvw Perryvw deleted the default-binding-function-parameter branch May 23, 2019 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default function parameter doesn't work with destructuring

2 participants

X Tutup