fix corner case in inline & reduce_vars (#5579)

This commit is contained in:
Alex Lam S.L
2022-07-28 16:53:11 +01:00
committed by GitHub
parent db6fd6db3e
commit 513995f57d
4 changed files with 58 additions and 8 deletions

View File

@@ -8646,3 +8646,42 @@ module_inline: {
}
expect_stdout: "true"
}
single_use_inline_collision: {
options = {
inline: true,
reduce_funcs: true,
reduce_vars: true,
unused: true,
}
input: {
var a = "PASS";
(function() {
var f = function() {
while (console.log(a));
};
(function() {
(function() {
f();
})();
(function(a) {
a || a("FAIL");
})(console.log);
})();
})();
}
expect: {
var a = "PASS";
(function() {
(function() {
while (console.log(a));
return;
})();
(function(a) {
a || a("FAIL");
})(console.log);
return;
})();
}
expect_stdout: "PASS"
}