[Pkg-javascript-commits] [uglifyjs] 325/491: minor clean-up for IIFE (#2582)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:49 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 e008dc1bde1455eaafe04061412b0b9524212d99
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Wed Dec 13 01:27:26 2017 +0800

    minor clean-up for IIFE (#2582)
    
    - faster exact type match
    - aggressively convert to `!`
---
 lib/compress.js | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/lib/compress.js b/lib/compress.js
index 14e8361..00d03fd 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -808,10 +808,8 @@ merge(Compressor.prototype, {
     };
 
     function is_iife_call(node) {
-        if (node instanceof AST_Call && !(node instanceof AST_New)) {
-            return node.expression instanceof AST_Function || is_iife_call(node.expression);
-        }
-        return false;
+        if (node.TYPE != "Call") return false;
+        return node.expression instanceof AST_Function || is_iife_call(node.expression);
     }
 
     function is_undeclared_ref(node) {
@@ -3099,14 +3097,9 @@ merge(Compressor.prototype, {
             }
             if (this.operator == "typeof" && this.expression instanceof AST_SymbolRef) return null;
             var expression = this.expression.drop_side_effect_free(compressor, first_in_statement);
-            if (first_in_statement
-                && this instanceof AST_UnaryPrefix
-                && is_iife_call(expression)) {
-                if (expression === this.expression && this.operator.length === 1) return this;
-                return make_node(AST_UnaryPrefix, this, {
-                    operator: this.operator.length === 1 ? this.operator : "!",
-                    expression: expression
-                });
+            if (first_in_statement && expression && is_iife_call(expression)) {
+                if (expression === this.expression && this.operator == "!") return this;
+                return expression.negate(compressor, first_in_statement);
             }
             return expression;
         });

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