allow export { default } from "foo"

This commit is contained in:
Rich Harris 2014-11-05 12:02:47 -05:00 committed by Marijn Haverbeke
parent 98691e5b80
commit f48a921e24
2 changed files with 54 additions and 1 deletions

View File

@ -2524,7 +2524,7 @@
} else first = false;
var node = startNode();
node.id = parseIdent();
node.id = parseIdent(tokType === _default);
if (tokType === _name && tokVal === "as") {
next();
node.name = parseIdent(true);

View File

@ -5064,6 +5064,59 @@ test("export { encrypt, decrypt as dec }", {
locations: true
});
test("export { default } from \"other\"", {
type: "Program",
body: [{
type: "ExportDeclaration",
declaration: null,
specifiers: [
{
type: "ExportSpecifier",
id: {
type: "Identifier",
name: "default",
loc: {
start: {line: 1, column: 9},
end: {line: 1, column: 16}
}
},
name: null,
loc: {
start: {line: 1, column: 9},
end: {line: 1, column: 16}
}
}
],
source: {
type: "Literal",
loc: {
start: {
line: 1,
column: 24
},
end: {
line: 1,
column: 31
}
},
value: "other",
raw: "\"other\""
},
loc: {
start: {line: 1, column: 0},
end: {line: 1, column: 31}
}
}],
loc: {
start: {line: 1, column: 0},
end: {line: 1, column: 31}
}
}, {
ecmaVersion: 6,
ranges: true,
locations: true
});
test("import \"jquery\"", {
type: "Program",
body: [{