aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-01-07 07:05:48 +0000
committerGitHub <noreply@github.com>2021-01-07 15:05:48 +0800
commitcf1b0165af4a181e8af6365eddbb144ce0d45da3 (patch)
tree6c3a8613990feef0f84e68bfa42216f734bedc3f /lib
parentc3d358a5b8e00c51ba7a2e9d8c25b7771f5f5a46 (diff)
downloadtracifyjs-cf1b0165af4a181e8af6365eddbb144ce0d45da3.tar.gz
tracifyjs-cf1b0165af4a181e8af6365eddbb144ce0d45da3.zip
fix corner case in `hoist_vars` (#4518)
fixes #4517
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 4bc57012..fd0564cb 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -7700,6 +7700,7 @@ merge(Compressor.prototype, {
def.references.push(name);
}
def.eliminated++;
+ def.single_use = false;
return a;
}, []);
if (assignments.length == 0) return null;
@@ -9702,7 +9703,8 @@ merge(Compressor.prototype, {
}
}));
} else {
- value = fixed.optimize(compressor).transform(new TreeTransformer(function(node, descend) {
+ value = fixed.optimize(compressor);
+ if (value === fixed) value = value.transform(new TreeTransformer(function(node, descend) {
if (node instanceof AST_Scope) return node;
node = node.clone();
descend(node, this);