var argname = fn.argnames[index];
if (def.deleted && def.deleted[index]) {
argname = null;
- } else if (argname && compressor.has_directive("use strict")) {
+ } else if (argname && (compressor.has_directive("use strict")
+ || !(fn_parent instanceof AST_Call && index < fn_parent.args.length))) {
var arg_def = argname.definition();
if (!compressor.option("reduce_vars")
|| def.reassigned
arguments: true,
}
input: {
- function f(a) {
+ (function(a) {
console.log(arguments[0], a);
arguments[0]++;
console.log(arguments[0], a);
- }
- f(0);
+ })(0);
}
expect: {
- function f(a) {
+ (function(a) {
console.log(a, a);
a++;
console.log(a, a);
- }
- f(0);
+ })(0);
}
expect_stdout: [
"0 0",
]
}
+issue_3273_no_call_arg: {
+ options = {
+ arguments: true,
+ }
+ input: {
+ (function(a) {
+ arguments[0] = "FAIL";
+ console.log(a);
+ })();
+ }
+ expect: {
+ (function(a) {
+ arguments[0] = "FAIL";
+ console.log(a);
+ })();
+ }
+ expect_stdout: "undefined"
+}
+
issue_3273_reduce_vars: {
options = {
arguments: true,
reduce_vars: true,
}
input: {
- function f(a) {
+ (function(a) {
console.log(arguments[0], a);
arguments[0]++;
console.log(arguments[0], a);
- }
- f(0);
+ })(0);
}
expect: {
- function f(a) {
+ (function(a) {
console.log(a, a);
a++;
console.log(a, a);
- }
- f(0);
+ })(0);
}
expect_stdout: [
"0 0",
arguments: true,
}
input: {
- function f(a) {
+ (function(a) {
"use strict";
console.log(arguments[0], a);
arguments[0]++;
console.log(arguments[0], a);
- }
- f(0);
+ })(0);
}
expect: {
- function f(a) {
+ (function(a) {
"use strict";
console.log(arguments[0], a);
arguments[0]++;
console.log(arguments[0], a);
- }
- f(0);
+ })(0);
}
expect_stdout: [
"0 0",
reduce_vars: true,
}
input: {
- function f(a) {
+ (function(a) {
"use strict";
console.log(arguments[0], a);
arguments[0]++;
console.log(arguments[0], a);
- }
- f(0);
+ })(0);
}
expect: {
- function f(a) {
+ (function(a) {
"use strict";
console.log(arguments[0], a);
arguments[0]++;
console.log(arguments[0], a);
- }
- f(0);
+ })(0);
}
expect_stdout: [
"0 0",
}
input: {
"use strict";
- function f(a) {
+ (function(a) {
console.log(arguments[0], a);
arguments[0]++;
console.log(arguments[0], a);
- }
- f(0);
+ })(0);
}
expect: {
"use strict";
- function f(a) {
+ (function(a) {
console.log(arguments[0], a);
arguments[0]++;
console.log(arguments[0], a);
- }
- f(0);
+ })(0);
}
expect_stdout: [
"0 0",
}
input: {
"use strict";
- function f(a) {
+ (function(a) {
console.log(arguments[0], a);
arguments[0]++;
console.log(arguments[0], a);
- }
- f(0);
+ })(0);
}
expect: {
"use strict";
- function f(a) {
+ (function(a) {
console.log(arguments[0], a);
arguments[0]++;
console.log(arguments[0], a);
- }
- f(0);
+ })(0);
}
expect_stdout: [
"0 0",