diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js index 872e2bbf..9504241b 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1264,6 +1264,7 @@ merge(Compressor.prototype, { if (stat_index == 0 && compressor.option("unused")) extract_args(); // Find collapsible assignments var hit_stack = []; + var declare_only = Object.create(null); extract_candidates(statements[stat_index]); while (candidates.length > 0) { hit_stack = candidates.pop(); @@ -1574,6 +1575,8 @@ merge(Compressor.prototype, { candidates.push(hit_stack.slice()); } extract_candidates(expr.value); + } else { + declare_only[expr.name.name] = (declare_only[expr.name.name] || 0) + 1; } } hit_stack.pop(); @@ -1739,6 +1742,7 @@ merge(Compressor.prototype, { if (!member(expr.name, def.orig)) return; var referenced = def.references.length - def.replaced; var declared = def.orig.length - def.eliminated; + declared -= declare_only[def.name] || 0; if (declared > 1 && !(expr.name instanceof AST_SymbolFunarg)) { mangleable_var(expr.value); return make_node(AST_SymbolRef, expr.name, expr.name); |