[Pkg-javascript-commits] [uglifyjs] 68/228: facilitate fix for #1531 (#1542)

Jonas Smedegaard dr at jones.dk
Sat Apr 15 14:25:17 UTC 2017


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

js pushed a commit to branch master
in repository uglifyjs.

commit b5e0e8c2038c7c0ea13771891eb84f6e6f7bcbc3
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Fri Mar 3 07:12:24 2017 +0800

    facilitate fix for #1531 (#1542)
---
 lib/compress.js | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/compress.js b/lib/compress.js
index 0cc9c51..38ebbf4 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -181,6 +181,13 @@ merge(Compressor.prototype, {
         var reduce_vars = rescan && compressor.option("reduce_vars");
         var safe_ids = [];
         push();
+        var suppressor = new TreeWalker(function(node) {
+            if (node instanceof AST_Symbol) {
+                var d = node.definition();
+                if (node instanceof AST_SymbolRef) d.references.push(node);
+                d.fixed = false;
+            }
+        });
         var tw = new TreeWalker(function(node){
             if (!(node instanceof AST_Directive || node instanceof AST_Constant)) {
                 node._squeezed = false;
@@ -243,13 +250,7 @@ merge(Compressor.prototype, {
                     return true;
                 }
                 if (node instanceof AST_ForIn) {
-                    var sym = node.init;
-                    if (sym instanceof AST_Var) {
-                        sym = sym.definitions[0].name;
-                    }
-                    var d = sym.definition();
-                    d.references.push(sym);
-                    d.fixed = false;
+                    node.init.walk(suppressor);
                     node.object.walk(tw);
                     push();
                     node.body.walk(tw);

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