enhance if_return & inline (#5538)

This commit is contained in:
Alex Lam S.L
2022-07-06 04:40:07 +01:00
committed by GitHub
parent aa2a9fbedb
commit 0207b46d70
6 changed files with 536 additions and 30 deletions

View File

@@ -1073,7 +1073,7 @@ issue_5414_2: {
node_version: ">=4"
}
issue_5416: {
issue_5416_1: {
options = {
dead_code: true,
evaluate: true,
@@ -1095,10 +1095,11 @@ issue_5416: {
expect: {
var f = () => {
{
arguments = void 0;
console;
arguments = void 0,
console.log(arguments);
var arguments;
return;
}
};
f();
@@ -1107,6 +1108,97 @@ issue_5416: {
node_version: ">=4"
}
issue_5416_2: {
options = {
dead_code: true,
evaluate: true,
inline: true,
loops: true,
unused: true,
}
input: {
var f = () => {
while ((() => {
console;
var a = function g(arguments) {
while (console.log(arguments));
}();
})());
};
f();
}
expect: {
var f = () => {
{
console;
var arguments = void 0;
for (; console.log(arguments););
return;
}
};
f();
}
expect_stdout: "undefined"
node_version: ">=4"
}
issue_5416_3: {
options = {
inline: true,
side_effects: true,
unused: true,
}
input: {
var f = () => {
(() => {
var a = function g(arguments) {
console.log(arguments);
}();
})();
};
f();
}
expect: {
var f = () => {
arguments = void 0,
console.log(arguments);
var arguments;
};
f();
}
expect_stdout: "undefined"
node_version: ">=4"
}
issue_5416_4: {
options = {
arrows: true,
inline: true,
side_effects: true,
unused: true,
}
input: {
var f = () => {
(() => {
var a = function g(arguments) {
while (console.log(arguments));
}();
})();
};
f();
}
expect: {
var f = () => {
var arguments = void 0;
while (console.log(arguments));
return;
};
f();
}
expect_stdout: "undefined"
node_version: ">=4"
}
issue_5495: {
input: {
console.log((() => {