aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/compress.js b/lib/compress.js
index e85cf5d3..801cbaea 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1691,13 +1691,17 @@ merge(Compressor.prototype, {
if (expr instanceof AST_Unary) return false;
if (side_effects) return false;
if (value_def) return true;
- if (lhs instanceof AST_SymbolRef) {
- var def = lhs.definition();
- if (def.references.length - def.replaced == (candidate instanceof AST_VarDef ? 1 : 2)) {
- return true;
- }
+ if (!(lhs instanceof AST_SymbolRef)) return false;
+ var referenced;
+ if (expr instanceof AST_VarDef) {
+ referenced = 1;
+ } else if (expr.operator == "=") {
+ referenced = 2;
+ } else {
+ return false;
}
- return false;
+ var def = lhs.definition();
+ return def.references.length - def.replaced == referenced;
}
function symbol_in_lvalues(sym, parent) {