[Pkg-javascript-commits] [uglifyjs] 21/49: Fix negate_iife regression #1254

Jonas Smedegaard dr at jones.dk
Fri Dec 9 11:43:26 UTC 2016


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

js pushed a commit to branch master
in repository uglifyjs.

commit d854523783b4a73d1dd734605f1c41fcae86e932
Author: kzc <zaxxon2011 at gmail.com>
Date:   Tue Aug 16 21:54:54 2016 -0400

    Fix negate_iife regression #1254
---
 lib/output.js                |  2 ++
 test/compress/negate-iife.js | 28 ++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/lib/output.js b/lib/output.js
index 801f751..f1e0c2f 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -531,6 +531,8 @@ function OutputStream(options) {
     });
 
     PARENS([ AST_Unary, AST_Undefined ], function(output){
+        if (this.expression instanceof AST_Call)
+            return false;
         var p = output.parent();
         return p instanceof AST_PropAccess && p.expression === this
             || p instanceof AST_Call && p.expression === this;
diff --git a/test/compress/negate-iife.js b/test/compress/negate-iife.js
index b73ff54..aa95d95 100644
--- a/test/compress/negate-iife.js
+++ b/test/compress/negate-iife.js
@@ -130,3 +130,31 @@ negate_iife_issue_1073: {
         }(7))();
     }
 }
+
+issue_1254_negate_iife_false: {
+    options = {
+        negate_iife: false,
+    }
+    input: {
+        (function() {
+            return function() {
+                console.log('test')
+            };
+        })()();
+    }
+    expect_exact: '(function(){return function(){console.log("test")}})()();'
+}
+
+issue_1254_negate_iife_true: {
+    options = {
+        negate_iife: true,
+    }
+    input: {
+        (function() {
+            return function() {
+                console.log('test')
+            };
+        })()();
+    }
+    expect_exact: '!function(){return function(){console.log("test")}}()();'
+}

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