This repository has been archived by the owner on May 19, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 257
Add parser support for Flow shorthand import type #267
Merged
Conversation
This file contains 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
jeffmo
changed the title
Add support for Flow shorthand import type
Add parser support for Flow shorthand import type
Dec 24, 2016
jeffmo
commented
Dec 24, 2016
if (specifier_type_kind !== null && !this.match(tt.name)) { | ||
// `import {type as ,` or `import {type as }` | ||
specifier.imported = as_ident; | ||
specifier.kind = specifier_type_kind; |
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.
Oops, this should be s/kind/importKind/
, update coming...
loganfsmyth
suggested changes
Dec 24, 2016
const firstIdentLoc = this.state.start; | ||
const firstIdent = this.parseIdentifier(true); | ||
|
||
let specifier_type_kind = null; |
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.
Can we stick with camelCase to be consistent with the rest of the codebase?
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.
Oops... Coming right up
jeffmo
force-pushed
the
import_type_shorthand
branch
from
December 25, 2016 00:01
1cb8b2a
to
7a86a70
Compare
danez
approved these changes
Jan 2, 2017
loganfsmyth
approved these changes
Jan 3, 2017
Thanks! Once this is published, I can update the relevant package.json over in babel/babel#5035 to point to this update |
danharper
added a commit
to danharper/prettier
that referenced
this pull request
Jan 10, 2017
babel/babylon#267 not merged (or, enabled) in Flow yet. But it's in the latest Babylon
christophehurpeau
added a commit
to christophehurpeau/flow-runtime
that referenced
this pull request
Feb 27, 2017
christophehurpeau
added a commit
to christophehurpeau/flow-runtime
that referenced
this pull request
Feb 27, 2017
christophehurpeau
added a commit
to christophehurpeau/flow-runtime
that referenced
this pull request
Feb 27, 2017
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.
In a coming version of Flow we'll be adding a new short-hand form of
import type
syntax. Here's the PR to add it to Flow proper with more details in the summary.This just adds parsing support to Babylon for the new syntax in the Flow parser plugin. I'll still need to go through and update the Babel Flow-transform omit
"type"
and"typeof"
specifiers from printed output.