This repository has been archived by the owner. It is now read-only.

Add parser support for Flow shorthand import type #267

Merged
merged 1 commit into from Jan 3, 2017

Conversation

Projects
None yet
3 participants
@jeffmo
Copy link
Contributor

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;

This comment has been minimized.

@jeffmo

jeffmo Dec 24, 2016

Author Contributor

Oops, this should be s/kind/importKind/, update coming...

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

let specifier_type_kind = null;

This comment has been minimized.

@loganfsmyth

loganfsmyth Dec 24, 2016

Member

Can we stick with camelCase to be consistent with the rest of the codebase?

This comment has been minimized.

@jeffmo

jeffmo Dec 25, 2016

Author Contributor

Oops... Coming right up

@jeffmo jeffmo force-pushed the jeffmo:import_type_shorthand branch from 1cb8b2a to 7a86a70 Dec 25, 2016

@danez

danez approved these changes Jan 2, 2017

@danez danez merged commit 9ea4e9d into babel:master Jan 3, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jeffmo jeffmo deleted the jeffmo:import_type_shorthand branch Jan 4, 2017

@jeffmo

This comment has been minimized.

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

support Flow shorthand import type (WILL FAIL RIGHT NOW)
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.