first cut of async/await (#2098)

- async arrow functions not yet supported


fixes #1789
This commit is contained in:
kzc
2017-06-14 18:15:48 -04:00
committed by Alex Lam S.L
parent 7cc03d4d40
commit 100e18305d
7 changed files with 310 additions and 18 deletions

View File

@@ -751,6 +751,7 @@ merge(Compressor.prototype, {
// Stop immediately if these node types are encountered
var parent = tt.parent();
if (node instanceof AST_Assign && node.operator != "=" && lhs.equivalent_to(node.left)
|| node instanceof AST_Await
|| node instanceof AST_Debugger
|| node instanceof AST_Destructuring
|| node instanceof AST_IterationStatement && !(node instanceof AST_For)
@@ -3329,7 +3330,7 @@ merge(Compressor.prototype, {
}
}
}
if (exp instanceof AST_Function && !self.expression.is_generator) {
if (exp instanceof AST_Function && !self.expression.is_generator && !self.expression.async) {
var stat = exp.body[0];
if (compressor.option("inline") && stat instanceof AST_Return) {
var value = stat && stat.value;