aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-11-19 04:26:41 +0800
committerGitHub <noreply@github.com>2019-11-19 04:26:41 +0800
commit67278e76c8777d57d40b42151be28b527e692ba2 (patch)
tree225683cffe6311734150f1a67f52cddf1af4e4e7 /lib
parentc289ba1139781f5619ec92136c2ceaac7d745ba7 (diff)
downloadtracifyjs-67278e76c8777d57d40b42151be28b527e692ba2.tar.gz
tracifyjs-67278e76c8777d57d40b42151be28b527e692ba2.zip
fix corner case in `unused` (#3599)
fixes #3598
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index aec31a48..8c1ed5b3 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -455,7 +455,7 @@ merge(Compressor.prototype, {
if (def.fixed == null) {
if (is_arguments(def)) return false;
if (def.global && def.name == "arguments") return false;
- def.fixed = make_node(AST_Undefined, def.orig);
+ def.fixed = make_node(AST_Undefined, def.orig[0]);
}
return true;
}
@@ -3870,7 +3870,7 @@ merge(Compressor.prototype, {
def.value = null;
head.push(def);
} else {
- var value = def.value && def.value.drop_side_effect_free(compressor);
+ var value = def.value && !def.value.single_use && def.value.drop_side_effect_free(compressor);
if (value) {
AST_Node.warn("Side effects in initialization of unused variable {name} [{file}:{line},{col}]", template(def.name));
side_effects.push(value);