diff --git a/acorn.js b/acorn.js index a783a530fc..f5656d254e 100644 --- a/acorn.js +++ b/acorn.js @@ -3183,10 +3183,13 @@ } else // export default ...; if (eat(_default)) { - if (tokType === _function || tokType === _class) { - node.declaration = parseStatement(); - } else { - node.declaration = parseExpression(true); + var declar = node.declaration = parseExpression(true); + if (declar.id) { + if (declar.type === "FunctionExpression") { + declar.type = "FunctionDeclaration"; + } else if (declar.type === "ClassExpression") { + declar.type = "ClassDeclaration"; + } } node['default'] = true; node.specifiers = null; diff --git a/package.json b/package.json index 8f916d26c3..7003a8f05d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "acorn-6to5", "description": "Acorn fork used by 6to5", "main": "acorn.js", - "version": "0.9.1-15", + "version": "0.9.1-16", "maintainers": [ { "name": "Marijn Haverbeke",