Allow patterns as argument of RestElement #8414
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Patterns as arguments to
RestElement
s were apparently removed back in 9a97d92 when, as mentioned there, they were not part of es6. They're part of the standard now, so this PR adds them back in.will now get converted to:
letting the destructuring plugin handle it from there (
[a] = _ref
=>a = _ref[0]
).Note that this does not make any of the optimizations that are otherwise made when the argument is an identifier - e.g. even though
a
is not referenced inside the function it will still be made available. If any optimizations are possible I think they can be added in other PRs?I'll try to make a backport for v6 as well.EDIT: Don't think it's possible to change babylon 6.x anymore.