@@ -8486,9 +8486,18 @@ Compressor.prototype.compress = function(node) {
|
||||
return make_sequence(node, assignments);
|
||||
}
|
||||
if (node instanceof AST_Scope) {
|
||||
if (node === self) return;
|
||||
var parent = tt.parent();
|
||||
if (parent.TYPE == "Call" && parent.expression === node) return;
|
||||
var parent;
|
||||
if (node === self || (parent = tt.parent()).TYPE == "Call" && parent.expression === node) {
|
||||
if (!(is_arrow(node) && node.value)) return;
|
||||
var stat = node.first_statement();
|
||||
node.body = [ stat ];
|
||||
node.value = null;
|
||||
descend(node, tt);
|
||||
if (node.body.length == 1 && node.body[0] === stat) {
|
||||
node.body.length = 0;
|
||||
node.value = stat.value;
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
if (node instanceof AST_VarDef) {
|
||||
|
||||
@@ -1212,3 +1212,28 @@ issue_5495: {
|
||||
expect_stdout: "undefined"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
issue_5653: {
|
||||
options = {
|
||||
arrows: true,
|
||||
hoist_props: true,
|
||||
passes: 2,
|
||||
reduce_vars: true,
|
||||
sequences: true,
|
||||
side_effects: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
console.log((a => {
|
||||
a = { p: console };
|
||||
return a++;
|
||||
})());
|
||||
}
|
||||
expect: {
|
||||
console.log((a => {
|
||||
return console, +{};
|
||||
})());
|
||||
}
|
||||
expect_stdout: "NaN"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user