diff --git a/acorn/src/statement.js b/acorn/src/statement.js index 632048449..23a903840 100644 --- a/acorn/src/statement.js +++ b/acorn/src/statement.js @@ -637,7 +637,7 @@ pp.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) pp.parseClassId = function(node, isStatement) { if (this.type === tt.name) { node.id = this.parseIdent() - if (isStatement === true) + if (isStatement) this.checkLVal(node.id, BIND_LEXICAL, false) } else { if (isStatement === true) diff --git a/test/tests-harmony.js b/test/tests-harmony.js index 249a708b7..e37047489 100644 --- a/test/tests-harmony.js +++ b/test/tests-harmony.js @@ -4688,6 +4688,16 @@ testFail("export { encrypt }", "Export 'encrypt' is not defined (1:9)", { sourceType: "module" }); +testFail("class Test {}; export default class Test {}", "Identifier 'Test' has already been declared (1:36)", { + ecmaVersion: 6, + sourceType: "module" +}); + +test("export default class Test {}; export { Test }", {}, { + ecmaVersion: 6, + sourceType: "module" +}); + testFail("export { encrypt, encrypt }", "Duplicate export 'encrypt' (1:18)", { ecmaVersion: 6, sourceType: "module"