This commit is contained in:
Fábio Santos 2018-03-09 21:37:34 +00:00 committed by GitHub
commit fe11191808
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -773,6 +773,7 @@ function OutputStream(options) {
|| p instanceof AST_Expansion // [...(a, b)]
|| p instanceof AST_ForOf && this === p.object // for (e of (foo, bar)) {}
|| p instanceof AST_Yield // yield (foo, bar)
|| p instanceof AST_Export // export default (foo, bar)
;
});
@ -844,7 +845,8 @@ function OutputStream(options) {
PARENS(AST_Call, function(output){
var p = output.parent(), p1;
if (p instanceof AST_New && p.expression === this)
if (p instanceof AST_New && p.expression === this
|| p instanceof AST_Export && p.is_default && this.expression instanceof AST_Function)
return true;
// workaround for Safari bug.

View File

@ -280,6 +280,13 @@ export_default_anonymous_function: {
expect_exact: "export default function(){foo()};"
}
export_default_seq: {
input: {
export default (1, 2)
}
expect_exact: "export default(1,2);"
}
export_default_arrow: {
options = {
reduce_vars: true,
@ -410,7 +417,7 @@ export_default_anonymous_function_not_call: {
export default function(){}(foo);
}
// FIXME: should be `export default function(){};foo;`
expect_exact: "export default function(){}(foo);"
expect_exact: "export default(function(){}(foo));"
}
export_default_anonymous_generator_not_call: {
@ -444,3 +451,10 @@ export_default_anonymous_async_function_not_call: {
// agrees with `acorn` and `babylon 7`
expect_exact: "export default async function(){};foo;"
}
issue_2977: {
input: {
export default (function () {})();
}
expect_exact: "export default(function(){}());"
}