arrows fix for object literal methods containing arguments

This commit is contained in:
kzc 2017-12-20 23:32:08 -05:00
parent 85bfa17139
commit aa3b028997
2 changed files with 38 additions and 0 deletions

View File

@ -5414,6 +5414,7 @@ merge(Compressor.prototype, {
// p(){return x;} ---> p:()=>x
if (compressor.option("arrows")
&& compressor.parent() instanceof AST_Object
&& !self.value.uses_arguments
&& self.value.body.length == 1
&& self.value.body[0] instanceof AST_Return
&& self.value.body[0].value

View File

@ -1153,3 +1153,40 @@ array_literal_with_spread_4: {
]
node_version: ">=6"
}
methods_using_arguments: {
options = {
arrows: true,
}
input: {
console.log(({
m() {
return arguments[0];
}
}).m("PASS"));
console.log(new class {
m() {
return arguments[0];
}
}().m("PASS"));
}
expect: {
console.log(({
m() {
return arguments[0];
}
}).m("PASS"));
console.log(new class {
m() {
return arguments[0];
}
}().m("PASS"));
}
expect_stdout: [
"PASS",
"PASS",
]
node_version: ">=6"
}