fix corner case in hoist_props (#3022)

fixes #3021
This commit is contained in:
Alex Lam S.L
2018-03-23 07:27:35 +08:00
committed by GitHub
parent 49bfc6b555
commit 12985d86c2
2 changed files with 32 additions and 1 deletions

View File

@@ -686,3 +686,33 @@ undefined_key: {
}
expect_stdout: "3"
}
issue_3021: {
options = {
hoist_props: true,
reduce_vars: true,
}
input: {
var a = 1, b = 2;
(function() {
b = a;
if (a++ + b--)
return 1;
return;
var b = {};
})();
console.log(a, b);
}
expect: {
var a = 1, b = 2;
(function() {
b = a;
if (a++ + b--)
return 1;
return;
var b = {};
})();
console.log(a, b);
}
expect_stdout: "2 2"
}