@@ -3268,9 +3268,14 @@ merge(Compressor.prototype, {
|
|||||||
});
|
});
|
||||||
def(AST_Sequence, function(compressor, ignore_side_effects, cached, depth) {
|
def(AST_Sequence, function(compressor, ignore_side_effects, cached, depth) {
|
||||||
if (!ignore_side_effects) return this;
|
if (!ignore_side_effects) return this;
|
||||||
var node = this.tail_node();
|
var tail = this.tail_node();
|
||||||
var value = node._eval(compressor, ignore_side_effects, cached, depth);
|
this.walk(new TreeWalker(function(node) {
|
||||||
return value === node ? this : value;
|
if (node === tail) return true;
|
||||||
|
if (node instanceof AST_Assign) modified(node.left);
|
||||||
|
if (node instanceof AST_Unary && unary_arithmetic[node.operator]) modified(node.expression);
|
||||||
|
}));
|
||||||
|
var value = tail._eval(compressor, ignore_side_effects, cached, depth);
|
||||||
|
return value === tail ? this : value;
|
||||||
});
|
});
|
||||||
def(AST_Lambda, function(compressor) {
|
def(AST_Lambda, function(compressor) {
|
||||||
if (compressor.option("unsafe")) {
|
if (compressor.option("unsafe")) {
|
||||||
|
|||||||
@@ -2369,3 +2369,29 @@ issue_3878_2: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "NaN"
|
expect_stdout: "NaN"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_3882: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function f(a) {
|
||||||
|
return console.log(a++), a && this;
|
||||||
|
}
|
||||||
|
var b = f();
|
||||||
|
console.log(b);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var b = function(a) {
|
||||||
|
return console.log(a++), a && this;
|
||||||
|
}();
|
||||||
|
console.log(b);
|
||||||
|
}
|
||||||
|
expect_stdout: [
|
||||||
|
"NaN",
|
||||||
|
"NaN",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user