aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/minify.js1
-rw-r--r--test/mocha/minify.js14
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/minify.js b/lib/minify.js
index a68cbf3a..aad7d226 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 a304c5b5..d696a25f 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);");
+ }
+ });
+ });
});
#f)))) new)) (noteworthy (filter (match-lambda ((package . version) (member package important))) upgraded))) (with-atomic-file-replacement news-file (lambda (input output) (rewrite-org-section input output (make-regexp "^(\\*+).*package updates") (lambda (match port) (let ((stars (match:substring match 1)) (lst (map (match-lambda ((package . version) (string-append package " " version))) noteworthy))) (format port "~a ~a package updates~%~%Noteworthy updates:~%~a~%~%" stars (length upgraded) (enumeration->paragraph lst))))))))) (define (main . args) (match args ((news-file data-directory) ;; Don't browse things listed in the user's $GUIX_PACKAGE_PATH and ;; in external channels. (parameterize ((%package-module-path %default-package-module-path)) (define (package-file version) (string-append data-directory "/packages-" version ".txt")) (define (package<? p1 p2) (string<? (package-full-name p1) (package-full-name p2))) (let-values (((previous-version new-version) (call-with-input-file news-file NEWS->versions))) (format (current-error-port) "Updating NEWS for ~a to ~a...~%" previous-version new-version) (let* ((old (call-with-input-file (package-file previous-version) read)) (all-packages/sorted (sort (fold-packages (lambda (p r) (cons p r)) '()) package<?)) (new (map (lambda (p) (cons (package-name p) (package-version p))) all-packages/sorted))) (call-with-output-file (package-file new-version) (lambda (port) (pretty-print new port))) (write-packages-added news-file old new) (write-packages-updates news-file old new))))) (x (format (current-error-port) "Usage: update-NEWS NEWS-FILE DATA-DIRECTORY Update the list of new and updated packages in NEWS-FILE using the previous-version package list from DATA-DIRECTORY.\n") (exit 1)))) (apply main (cdr (command-line)))