[Pkg-javascript-commits] [uglifyjs] 408/491: improve `rename` reproducibility (#2754)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:58 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 2e22d38a02c2e56666fcc0992e346dd5de97c6ec
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Tue Jan 9 13:53:05 2018 +0800

    improve `rename` reproducibility (#2754)
    
    fixes #2752
---
 lib/minify.js        |  1 +
 test/mocha/minify.js | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/lib/minify.js b/lib/minify.js
index a68cbf3..aad7d22 100644
--- a/lib/minify.js
+++ b/lib/minify.js
@@ -141,6 +141,7 @@ function minify(files, options) {
         }
         if (timings) timings.rename = Date.now();
         if (options.rename) {
+            SymbolDef.next_id = 1;
             toplevel.figure_out_scope(options.mangle);
             toplevel.expand_names(options.mangle);
         }
diff --git a/test/mocha/minify.js b/test/mocha/minify.js
index a304c5b..d696a25 100644
--- a/test/mocha/minify.js
+++ b/test/mocha/minify.js
@@ -373,4 +373,18 @@ describe("minify", function() {
             assert.strictEqual(stat.print_to_string(), "a=x()");
         });
     });
+
+    describe("rename", function() {
+        it("Should be repeatable", function() {
+            var code = "!function(x){return x(x)}(y);";
+            for (var i = 0; i < 2; i++) {
+                assert.strictEqual(Uglify.minify(code, {
+                    compress: {
+                        toplevel: true,
+                    },
+                    rename: true,
+                }).code, "var a2;(a2=y)(a2);");
+            }
+        });
+    });
 });

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