[Pkg-javascript-commits] [uglifyjs] 72/77: Fix compressing `![foo()]; ` as a statement

Jonas Smedegaard dr at jones.dk
Tue May 19 00:02:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag v2.4.18
in repository uglifyjs.

commit 276b9a31cda2a2ef93e7af4e966baae91a434361
Author: Mihai Bazon <mihai.bazon at gmail.com>
Date:   Mon Mar 23 23:27:00 2015 +0200

    Fix compressing `![foo()];` as a statement
    
    need to check whether the literal has any side effects before replacing that
    with `false`.
---
 lib/compress.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/compress.js b/lib/compress.js
index a9e1da3..41e4f17 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -2480,7 +2480,7 @@ merge(Compressor.prototype, {
     });
 
     function literals_in_boolean_context(self, compressor) {
-        if (compressor.option("booleans") && compressor.in_boolean_context()) {
+        if (compressor.option("booleans") && compressor.in_boolean_context() && !self.has_side_effects(compressor)) {
             return make_node(AST_True, self);
         }
         return self;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list