Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Add parser support for Flow shorthand import type #267

Merged
merged 1 commit into from
Jan 3, 2017

Conversation

jeffmo
Copy link
Contributor

@jeffmo jeffmo commented Dec 24, 2016

Q A
Bug fix? no
Breaking change? no
New feature? yes
Deprecations? no
Spec compliancy? yes
Tests added/pass? yes
Fixed tickets comma-separated list of tickets fixed by the PR, if any
License MIT

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.

@jeffmo jeffmo changed the title Add support for Flow shorthand import type Add parser support for Flow shorthand import type 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;
Copy link
Contributor Author

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...

const firstIdentLoc = this.state.start;
const firstIdent = this.parseIdentifier(true);

let specifier_type_kind = null;
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops... Coming right up

@danez danez merged commit 9ea4e9d into babel:master Jan 3, 2017
@jeffmo jeffmo deleted the import_type_shorthand branch January 4, 2017 11:46
@jeffmo
Copy link
Contributor Author

jeffmo commented Jan 4, 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants