[Pkg-javascript-commits] [uglifyjs] 01/02: Add patch cherry-picked upstream to avoid negating non-boolean AST_Binary.

Jonas Smedegaard dr at jones.dk
Wed Aug 26 09:34:54 UTC 2015


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

js pushed a commit to branch master
in repository uglifyjs.

commit f58d3ff381e8cbc9ca7f19e9c159ccf231e2cb97
Author: Jonas Smedegaard <dr at jones.dk>
Date:   Wed Aug 26 11:08:24 2015 +0200

    Add patch cherry-picked upstream to avoid negating non-boolean AST_Binary.
---
 debian/patches/020150722~905b601.patch | 50 ++++++++++++++++++++++++++++++++++
 debian/patches/series                  |  1 +
 2 files changed, 51 insertions(+)

diff --git a/debian/patches/020150722~905b601.patch b/debian/patches/020150722~905b601.patch
new file mode 100644
index 0000000..f6cc0ef
--- /dev/null
+++ b/debian/patches/020150722~905b601.patch
@@ -0,0 +1,50 @@
+Description: Don't attempt to negate non-boolean AST_Binary
+Origin: upstream, https://github.com/mishoo/UglifyJS2/commit/905b601
+Author: Mihai Bazon <mihai.bazon at gmail.com>
+Forwarded: yes
+Bug: https://github.com/mishoo/UglifyJS2/issues/751
+Last-Update: 2015-08-26
+
+--- a/lib/compress.js
++++ b/lib/compress.js
+@@ -2099,7 +2099,7 @@
+             }
+             break;
+         }
+-        if (compressor.option("comparisons")) {
++        if (compressor.option("comparisons") && self.is_boolean()) {
+             if (!(compressor.parent() instanceof AST_Binary)
+                 || compressor.parent() instanceof AST_Assign) {
+                 var negated = make_node(AST_UnaryPrefix, self, {
+--- /dev/null
++++ b/test/compress/issue-751.js
+@@ -0,0 +1,29 @@
++negate_booleans_1: {
++    options = {
++        comparisons: true
++    };
++    input: {
++        var a = !a || !b || !c || !d || !e || !f;
++    }
++    expect: {
++        var a = !(a && b && c && d && e && f);
++    }
++}
++
++negate_booleans_2: {
++    options = {
++        comparisons: true
++    };
++    input: {
++        var match = !x &&       // should not touch this one
++            (!z || c) &&
++            (!k || d) &&
++            the_stuff();
++    }
++    expect: {
++        var match = !x &&
++            (!z || c) &&
++            (!k || d) &&
++            the_stuff();
++    }
++}
diff --git a/debian/patches/series b/debian/patches/series
index bc69ea9..8215b27 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
+020150722~905b601.patch
 1001_break_dep_loop.patch
 2002_node_conflict.patch

-- 
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