if (expr.operator == "="
&& lhs instanceof AST_SymbolRef
&& (def = lhs.definition()).references[0] === lhs
+ && !(scope.uses_arguments && is_funarg(def))
&& !compressor.exposed(def)) {
var referenced = def.references.length - def.replaced;
if (referenced > 1) mangleable_var(expr.right);
var def = expr.name.definition();
if (def.const_redefs) return;
if (!member(expr.name, def.orig)) return;
+ if (scope.uses_arguments && is_funarg(def)) return;
var declared = def.orig.length - def.eliminated - (declare_only[def.name] || 0);
var referenced = def.references.length - def.replaced - (assignments[def.name] || 0);
if (declared > 1 && !(expr.name instanceof AST_SymbolFunarg)) {
}
expect_stdout: "PASS"
}
+
+issue_4586_1: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ var a = 42;
+ (function f(b) {
+ var b = a;
+ if (b === arguments[0])
+ console.log("PASS");
+ })(console);
+ }
+ expect: {
+ var a = 42;
+ (function f(b) {
+ var b = a;
+ if (b === arguments[0])
+ console.log("PASS");
+ })(console);
+ }
+ expect_stdout: "PASS"
+}
+
+issue_4586_2: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ var a = 42;
+ (function f(b) {
+ b = a;
+ if (b === arguments[0])
+ console.log("PASS");
+ })(console);
+ }
+ expect: {
+ var a = 42;
+ (function f(b) {
+ if ((b = a) === arguments[0])
+ console.log("PASS");
+ })(console);
+ }
+ expect_stdout: "PASS"
+}