aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-01-12 01:12:43 +0000
committerGitHub <noreply@github.com>2021-01-12 09:12:43 +0800
commit1e831df1f6a39ccc043384f04863aea58dbd7d9c (patch)
treecd589d14a749e260b518deac6dd5fbd8c804bd5a /lib/compress.js
parentc12486bab4e445144968635e16b96943ed98b8c1 (diff)
downloadtracifyjs-1e831df1f6a39ccc043384f04863aea58dbd7d9c.tar.gz
tracifyjs-1e831df1f6a39ccc043384f04863aea58dbd7d9c.zip
fix corner case in `side_effects` (#4541)
fixes #4540
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index e9985540..578e73cc 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -8226,7 +8226,7 @@ merge(Compressor.prototype, {
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);
}