-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Don't extract rest elements from nested expressions #7364
Don't extract rest elements from nested expressions #7364
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/6902/ |
}); | ||
return foundRestElement; | ||
} | ||
|
||
function visitRestElements(path, visitor) { |
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.
I realize that this is probably more performant solution, but the code itself is imho a little bit convoluted, hard to read and to reason about. It has a lot of indirection in it. Would it be possible to rephrase it into a simpler implementation?
const stop = visitor(path); | ||
if (stop) return; | ||
path.traverse({ | ||
Expression(path) { |
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.
this is way easier to track! ❤️
@nicolo-ribaudo I think this caused the merge conflict now for you - #7388 |
d4d39c2
to
35032f6
Compare
* Don't extract rest elements from nested expressions * Node 4
The problem was that the plugin didn't only traverse the destructuring pattern when searching for rest elements, but also default values.
I suggest to review this PR ignoring whitespaces (https://github.com/babel/babel/pull/7364/files?w=1)