diff --git a/acorn.js b/acorn.js index ca5e8eb731..526c3a4f35 100644 --- a/acorn.js +++ b/acorn.js @@ -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); diff --git a/test/tests-harmony.js b/test/tests-harmony.js index 00149c1ee7..f5064c8a94 100644 --- a/test/tests-harmony.js +++ b/test/tests-harmony.js @@ -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: [{