aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-04-15 12:38:31 +0800
committerGitHub <noreply@github.com>2018-04-15 12:38:31 +0800
commit7362f579666194aed000005c956f2e0e83c9a87d (patch)
tree21f618b15e13232bca4da008039f05f7e5b06c9b /lib
parenteaa2c1f6af10e08c9ece097bfb8c1f15a74ffa28 (diff)
downloadtracifyjs-7362f579666194aed000005c956f2e0e83c9a87d.tar.gz
tracifyjs-7362f579666194aed000005c956f2e0e83c9a87d.zip
improve performance when handling unused variables in `collapse_vars` (#3084)
fixes #3082
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 999e03c4..f82d99ef 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1348,8 +1348,9 @@ merge(Compressor.prototype, {
if (expr instanceof AST_VarDef) {
var def = expr.name.definition();
if (!member(expr.name, def.orig)) return;
- var declared = def.orig.length - def.eliminated;
var referenced = def.references.length - def.replaced;
+ if (!referenced) return;
+ var declared = def.orig.length - def.eliminated;
if (declared > 1 && !(expr.name instanceof AST_SymbolFunarg)
|| (referenced > 1 ? mangleable_var(expr) : !compressor.exposed(def))) {
return make_node(AST_SymbolRef, expr.name, expr.name);
-files?id=c088aa2988ef82289c87ebfd6d07d8f1464dd8f0'>pack: "fakechroot" engine always creates its store....Ludovic Courtès 2020-07-28pack: "fakechroot" execution engine can load its audit module....Ludovic Courtès