fix corner case with arguments (#5417)

fixes #5416
This commit is contained in:
Alex Lam S.L
2022-04-14 23:52:10 +01:00
committed by GitHub
parent 950609f578
commit 5ebfa78f56
2 changed files with 35 additions and 0 deletions

View File

@@ -469,6 +469,7 @@ AST_Lambda.DEFMETHOD("init_vars", function(parent_scope) {
this.uses_arguments = false;
this.def_variable(new AST_SymbolFunarg({
name: "arguments",
scope: this,
start: this.start,
end: this.end,
}));

View File

@@ -1072,3 +1072,37 @@ issue_5414_2: {
expect_stdout: true
node_version: ">=4"
}
issue_5416: {
options = {
dead_code: true,
evaluate: true,
inline: true,
loops: true,
unused: true,
}
input: {
var f = () => {
while ((() => {
console;
var a = function g(arguments) {
console.log(arguments);
}();
})());
};
f();
}
expect: {
var f = () => {
{
arguments = void 0;
console;
console.log(arguments);
var arguments;
}
};
f();
}
expect_stdout: "undefined"
node_version: ">=4"
}