@@ -686,6 +686,7 @@ merge(Compressor.prototype, {
|
||||
d.escaped = true;
|
||||
return;
|
||||
} else if (parent instanceof AST_Array
|
||||
|| parent instanceof AST_Await
|
||||
|| parent instanceof AST_Conditional && node !== parent.condition
|
||||
|| parent instanceof AST_Sequence && node === parent.tail_node()) {
|
||||
mark_escaped(d, scope, parent, parent, level + 1);
|
||||
|
||||
@@ -5187,3 +5187,49 @@ escape_yield: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
escape_await: {
|
||||
options = {
|
||||
reduce_funcs: true,
|
||||
reduce_vars: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
function main() {
|
||||
var thing;
|
||||
baz().then(x => {
|
||||
thing = x;
|
||||
});
|
||||
baz().then(x => {
|
||||
if (thing !== (thing = x))
|
||||
console.log("FAIL");
|
||||
else
|
||||
console.log("PASS");
|
||||
});
|
||||
}
|
||||
function foo() {}
|
||||
async function baz() {
|
||||
return await foo;
|
||||
}
|
||||
main();
|
||||
}
|
||||
expect: {
|
||||
function foo() {}
|
||||
async function baz() {
|
||||
return await foo;
|
||||
}
|
||||
(function() {
|
||||
var thing;
|
||||
baz().then(x => {
|
||||
thing = x;
|
||||
});
|
||||
baz().then(x => {
|
||||
if (thing !== (thing = x))
|
||||
console.log("FAIL");
|
||||
else
|
||||
console.log("PASS");
|
||||
});
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user