enhance side_effects (#4675)
This commit is contained in:
@@ -8516,6 +8516,8 @@ merge(Compressor.prototype, {
|
||||
}
|
||||
});
|
||||
return node;
|
||||
} else if (!node.has_side_effects(compressor)) {
|
||||
self.drop_side_effect_free = return_null;
|
||||
}
|
||||
}
|
||||
var arg_used, insert, in_loop, scope;
|
||||
|
||||
@@ -348,8 +348,6 @@ issue_3983_1: {
|
||||
}
|
||||
expect: {
|
||||
var a = "PASS";
|
||||
g();
|
||||
function g() {}
|
||||
console.log(a);
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
@@ -537,3 +535,26 @@ issue_4668: {
|
||||
}
|
||||
expect_stdout: "undefined"
|
||||
}
|
||||
|
||||
drop_side_effect_free_call: {
|
||||
options = {
|
||||
inline: true,
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
function f(a) {
|
||||
return "PA" + a;
|
||||
}
|
||||
f(42);
|
||||
console.log(f("SS"));
|
||||
}
|
||||
expect: {
|
||||
function f(a) {
|
||||
return "PA" + a;
|
||||
}
|
||||
console.log(f("SS"));
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user