[Pkg-javascript-commits] [uglifyjs] 71/228: disallow collapse_vars constant replacement in for-in statements (#1543)

Jonas Smedegaard dr at jones.dk
Sat Apr 15 14:25:18 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 ce54c9cceef68b78be7cc429988df26add904d9b
Author: kzc <kzc at users.noreply.github.com>
Date:   Fri Mar 3 13:39:54 2017 -0500

    disallow collapse_vars constant replacement in for-in statements (#1543)
---
 lib/compress.js | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/compress.js b/lib/compress.js
index 2cd7912..3545900 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -525,11 +525,9 @@ merge(Compressor.prototype, {
                     // Constant single use vars can be replaced in any scope.
                     if (var_decl.value.is_constant()) {
                         var ctt = new TreeTransformer(function(node) {
-                            if (node === ref) {
-                                var parent = ctt.parent();
-                                if (!(parent instanceof AST_ForIn && parent.init === node)) {
-                                    return replace_var(node, parent, true);
-                                }
+                            if (node === ref
+                                && !ctt.find_parent(AST_ForIn)) {
+                                return replace_var(node, ctt.parent(), true);
                             }
                         });
                         stat.transform(ctt);

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