[Pkg-javascript-commits] [uglifyjs] 379/491: fix `inline` on duplicate argument names (#2698)
Jonas Smedegaard
dr at jones.dk
Wed Feb 14 19:51:54 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 da82fa59a723b22ad5d8dec42cd2ca0d070f2359
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date: Sun Dec 31 20:59:58 2017 +0800
fix `inline` on duplicate argument names (#2698)
---
lib/compress.js | 2 +-
test/compress/functions.js | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/lib/compress.js b/lib/compress.js
index 604371f..56176e5 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -4012,7 +4012,7 @@ merge(Compressor.prototype, {
for (var len = fn.argnames.length, i = len; --i >= 0;) {
var name = fn.argnames[i];
var value = self.args[i];
- if (name.__unused) {
+ if (name.__unused || scope.var_names()[name.name]) {
if (value) {
expressions.unshift(value);
}
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 888c6e3..e6c4301 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -1646,3 +1646,28 @@ issue_2663_3: {
"reset",
]
}
+
+duplicate_argnames: {
+ options = {
+ inline: true,
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var a = "PASS";
+ function f(b, b, b) {
+ b && (a = "FAIL");
+ }
+ f(0, console);
+ console.log(a);
+ }
+ expect: {
+ var a = "PASS";
+ console, b && (a = "FAIL");
+ var b;
+ console.log(a);
+ }
+ expect_stdout: "PASS"
+}
--
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