Parse import Thing ... in the same way as import {default as Thing} ....

Adjusts with Reflect.parse output and simplifies handling of "default" case
in external tools by providing regular named ImportSpecifier.
This commit is contained in:
Ingvar Stepanyan
2014-11-23 14:06:13 +02:00
parent 51bc64a558
commit 33d5082043
3 changed files with 31 additions and 15 deletions

View File

@@ -5153,6 +5153,14 @@ test("import $ from \"jquery\"", {
specifiers: [{
type: "ImportSpecifier",
id: {
type: "Identifier",
name: "default",
loc: {
start: {line: 1, column: 7},
end: {line: 1, column: 8}
}
},
name: {
type: "Identifier",
name: "$",
loc: {
@@ -5160,7 +5168,6 @@ test("import $ from \"jquery\"", {
end: {line: 1, column: 8}
}
},
name: null,
loc: {
start: {line: 1, column: 7},
end: {line: 1, column: 8}
@@ -5328,10 +5335,16 @@ test("import crypto, { decrypt, encrypt as enc } from \"crypto\"", {
start: {line: 1, column: 7},
end: {line: 1, column: 13}
},
name: "crypto"
name: "default"
},
name: null,
default: true
name: {
type: "Identifier",
loc: {
start: {line: 1, column: 7},
end: {line: 1, column: 13}
},
name: "crypto"
}
},
{
type: "ImportSpecifier",
@@ -14171,10 +14184,12 @@ test("import foo, * as bar from 'baz';", {
type: "ImportSpecifier",
id: {
type: "Identifier",
name: "foo"
name: "default"
},
name: null,
default: true
name: {
type: "Identifier",
name: "foo"
}
},
{
type: "ImportBatchSpecifier",