[Pkg-javascript-commits] [uglifyjs] 13/491: extend `cascade` into `a.b` (#1829)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:17 UTC 2018


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

js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.

commit 28cfb65c47e7a2adeec35d8a78dd8bb0cf06af12
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Wed Apr 19 04:17:15 2017 +0800

    extend `cascade` into `a.b` (#1829)
    
    fixes #27
---
 lib/compress.js            |  1 +
 test/compress/sequences.js | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/lib/compress.js b/lib/compress.js
index a364157..eb54f75 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -3132,6 +3132,7 @@ merge(Compressor.prototype, {
                             field = "left";
                         }
                     } else if (cdr instanceof AST_Call
+                        || cdr instanceof AST_PropAccess
                         || cdr instanceof AST_Unary && !unary_side_effects(cdr.operator)) {
                         field = "expression";
                     } else {
diff --git a/test/compress/sequences.js b/test/compress/sequences.js
index 3fb2627..1049256 100644
--- a/test/compress/sequences.js
+++ b/test/compress/sequences.js
@@ -688,3 +688,25 @@ side_effects_cascade_3: {
         }
     }
 }
+
+issue_27: {
+    options = {
+        cascade: true,
+        passes: 2,
+        sequences: true,
+        side_effects: true,
+        unused: true,
+    }
+    input: {
+        (function(jQuery) {
+            var $;
+            $ = jQuery;
+            $("body").addClass("foo");
+        })(jQuery);
+    }
+    expect: {
+        (function(jQuery) {
+            jQuery("body").addClass("foo");
+        })(jQuery);
+    }
+}

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