Skip to content

Instantly share code, notes, and snippets.

@cpojer
Created July 11, 2015 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpojer/d011b030ec880f0df881 to your computer and use it in GitHub Desktop.
Save cpojer/d011b030ec880f0df881 to your computer and use it in GitHub Desktop.
instance.extend("parseImportSpecifiers", function (inner) {
return function (node) {
node.importKind = "value"
if (this.isContextual("type") || this.type === tt._typeof) {
if (this.type === tt._typeof) {
node.importKind = "typeof"
this.eat(tt._typeof)
}
var start = this.markPosition()
var typeId = this.parseIdent()
if ((this.type === tt.name && this.value !== "from") || this.type === tt.braceL || this.type === tt.star) {
node.importKind = "type"
} else {
node.specifiers.push(this.parseImportSpecifierDefault(typeId, start))
if (this.isContextual("from")) return
this.eat(tt.comma)
}
}
inner.call(this, node)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment