diff --git a/lib/output.js b/lib/output.js index 649a3307..5b7aa7ea 100644 --- a/lib/output.js +++ b/lib/output.js @@ -68,6 +68,7 @@ function OutputStream(options) { preserve_line : false, quote_keys : false, quote_style : 0, + safari10 : false, semicolons : true, shebang : true, shorthand : undefined, @@ -677,7 +678,8 @@ function OutputStream(options) { PARENS(AST_Await, function(output){ var p = output.parent(); return p instanceof AST_PropAccess && p.expression === this - || p instanceof AST_Call && p.expression === this; + || p instanceof AST_Call && p.expression === this + || output.option("safari10") && p instanceof AST_UnaryPrefix; }); PARENS(AST_Sequence, function(output){ diff --git a/test/compress/async.js b/test/compress/async.js index f000ba8d..a9e743f3 100644 --- a/test/compress/async.js +++ b/test/compress/async.js @@ -293,3 +293,31 @@ async_arrow_iife_negate_iife: { } expect_exact: "(async()=>{await fetch()})();(()=>{plain()})();" } + +issue_2344_1: { + beautify = { + safari10: false, + } + input: { + async () => { + +await x; + await y; + return await z; + }; + } + expect_exact: "async()=>{+await x;await y;return await z};" +} + +issue_2344_2: { + beautify = { + safari10: true, + } + input: { + async () => { + +await x; + await y; + return await z; + }; + } + expect_exact: "async()=>{+(await x);await y;return await z};" +}