it's safe to negate expression in !EXP only in boolean context
authorMihai Bazon <mihai@bazon.net>
Thu, 1 Nov 2012 13:49:05 +0000 (15:49 +0200)
committerMihai Bazon <mihai@bazon.net>
Thu, 1 Nov 2012 13:49:05 +0000 (15:49 +0200)
#kendo

lib/compress.js

index 04fb785..5ceef20 100644 (file)
@@ -1446,9 +1446,9 @@ merge(Compressor.prototype, {
                 compressor.warn("Boolean expression always true [{file}:{line},{col}]", self.start);
                 return make_node(AST_True, self);
             }
-        }
-        if (e instanceof AST_Binary && self.operator == "!") {
-            self = best_of(self, e.negate(compressor));
+            if (e instanceof AST_Binary && self.operator == "!") {
+                self = best_of(self, e.negate(compressor));
+            }
         }
         return self.evaluate(compressor)[0];
     });