fix corner case in hoist_vars (#4739)

fixes #4736
This commit is contained in:
Alex Lam S.L
2021-03-05 20:25:32 +00:00
committed by GitHub
parent 2db1a141ab
commit fa09f87589
2 changed files with 41 additions and 12 deletions

View File

@@ -140,6 +140,7 @@ issue_4487: {
functions: true,
hoist_vars: true,
keep_fnames: true,
passes: 2,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -207,3 +208,35 @@ issue_4517: {
}
expect_stdout: "2boolean"
}
issue_4736: {
options = {
collapse_vars: true,
evaluate: true,
hoist_vars: true,
merge_vars: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
var a;
function f() {
(function g() {
var b = (a = 0, 1 << 30);
var c = (a = 0, console.log(b));
var d = c;
})(f);
}
f();
}
expect: {
(function() {
(function() {
0,
console.log(1073741824);
})();
})();
}
expect_stdout: "1073741824"
}