if (compressor.option("side_effects")
&& can_drop
&& all(fn.body, is_empty)
- && (fn !== exp || fn_name_unused(fn, compressor))
+ && (fn === exp ? fn_name_unused(fn, compressor) : !has_default && !has_destructured)
&& !(is_arrow(fn) && fn.value)) {
return make_sequence(self, convert_args()).optimize(compressor);
}
expect_stdout: "PASS"
node_version: ">=6"
}
+
+issue_4540: {
+ options = {
+ reduce_vars: true,
+ side_effects: true,
+ }
+ input: {
+ console.log(function() {
+ function f([ a = 0 ]) {}
+ f([]);
+ }());
+ }
+ expect: {
+ console.log(function() {
+ function f([ a = 0 ]) {}
+ f([]);
+ }());
+ }
+ expect_stdout: "undefined"
+ node_version: ">=6"
+}