This repository was archived by the owner on May 19, 2018. It is now read-only.
Fix flow plugin when flow+arrow+spread used together#6
Closed
danez wants to merge 8 commits intobabel:masterfrom
danez:fix-flow-arrow-spread
Closed
Fix flow plugin when flow+arrow+spread used together#6danez wants to merge 8 commits intobabel:masterfrom danez:fix-flow-arrow-spread
danez wants to merge 8 commits intobabel:masterfrom
danez:fix-flow-arrow-spread
Conversation
don't ignore compiled files
Add travis badge
The fix includes creating a new method on the parser called `parseArrow`. This new function by default only checks if current position matches an arrow. If it does returns the `node` otherwise `undefined`. The flow plugin can then extend this function and correctly parse the typeAnnotation and add it to the node. With this change, in the flow plugin there is no need anymore to extend `parseParenAndDistinguishExpression` and the arrow handling in `parseParenItem` could also be removed, because it is all handled now in `parseArrow`. Some existing tests were failing, because `extra->parentesized` is now missing, but this is correct as it is now inline with parsing without flow annotation. No extra is added for arrow function without type annotations. In the expression-parser `this.next()` was replaced by a more specific `this.expect(tt.parenL)`.
Member
|
This was auto-closed because this repo has been updated to include the Git history from the main Babel repo. I can't speak to the validity of this PR, but it appears you'll need to rebase and open a new one. The new force-pused master branch should be identical to the old one, so you should be able to use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fix for
The fix creates a new method on the parser called
parseArrow.This new function by default only checks if current position matches an
arrow. If it does returns the
nodeotherwiseundefined.The flow plugin can then extend this function and correctly parse the typeAnnotation
and add it to the node.
With this change, in the flow plugin there is no need anymore to extend
parseParenAndDistinguishExpressionand the arrow handling inparseParenItemcould also be removed, because it is all handled now in
parseArrow.Some existing tests were failing, because
extra->parentesizedis now missing,but this should be correct as it is now inline with the parsing without flow annotations. No
extrais added for arrow function without type annotations.
Also, in the expression-parser
this.next()was replaced by a more specificthis.expect(tt.parenL)insideparseParenAndDistinguishExpression.And I reverted the fix from babel/babel#3305 as it is not necessary anymore.
Fixes babel/T2612