enhance reduce_vars (#5171)

This commit is contained in:
Alex Lam S.L
2021-11-13 14:18:56 +00:00
committed by GitHub
parent e9932e1314
commit f97e107c09
4 changed files with 74 additions and 7 deletions

View File

@@ -135,7 +135,7 @@ issue_2295: {
}
}
issue_4487: {
issue_4487_1: {
options = {
functions: true,
hoist_vars: true,
@@ -152,14 +152,37 @@ issue_4487: {
}
expect: {
function a() {
var f;
console.log(typeof f);
var f = console.log(typeof f);
}
a();
}
expect_stdout: "undefined"
}
issue_4487_2: {
options = {
functions: true,
hoist_vars: true,
keep_fnames: true,
passes: 2,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
var a = function f() {
var f = console.log(typeof f);
};
var b = a();
}
expect: {
(function a() {
console.log(typeof void 0);
})();
}
expect_stdout: "undefined"
}
issue_4489: {
options = {
collapse_vars: true,