[Pkg-javascript-commits] [uglifyjs] 366/491: suppress `inline` within substituted `AST_Scope` (#2658)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:53 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 7f342cb3e3abd3e39b18e62a2e9d6b8020d82773
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Tue Dec 26 18:56:59 2017 +0800

    suppress `inline` within substituted `AST_Scope` (#2658)
    
    fixes #2657
---
 lib/compress.js            |  2 +-
 test/compress/functions.js | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/lib/compress.js b/lib/compress.js
index 8df6bbd..bb35542 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -3982,7 +3982,7 @@ merge(Compressor.prototype, {
             do {
                 scope = compressor.parent(++level);
                 if (scope instanceof AST_SymbolRef) {
-                    scope = scope.fixed_value();
+                    if (scope.fixed_value() instanceof AST_Scope) return false;
                 } else if (scope instanceof AST_Catch) {
                     catches[scope.argname.name] = true;
                 }
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 02b4ab3..7f35de7 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -1447,3 +1447,33 @@ recursive_inline: {
     }
     expect: {}
 }
+
+issue_2657: {
+    options = {
+        inline: true,
+        reduce_vars: true,
+        sequences: true,
+        unused: true,
+    }
+    input: {
+        "use strict";
+        console.log(function f() {
+            return h;
+            function g(b) {
+                return b || b();
+            }
+            function h(a) {
+                g(a);
+                return a;
+            }
+        }()(42));
+    }
+    expect: {
+        "use strict";
+        console.log(function(a) {
+            return b = a, b || b(), a;
+            var b;
+        }(42));
+    }
+    expect_stdout: "42"
+}

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