fix corner case in hoist_props (#3452)

fixes #3440
This commit is contained in:
Alex Lam S.L
2019-10-06 10:29:13 +08:00
committed by GitHub
parent 35338a100f
commit 931ac66638
2 changed files with 73 additions and 41 deletions

View File

@@ -886,3 +886,31 @@ issue_3411: {
}
expect_stdout: "PASS"
}
issue_3440: {
options = {
hoist_props: true,
reduce_vars: true,
unused: true,
}
input: {
(function() {
function f() {
console.log(o.p);
}
var o = {
p: "PASS",
};
return f;
})()();
}
expect: {
(function() {
var o_p = "PASS";
return function() {
console.log(o_p);
};
})()();
}
expect_stdout: "PASS"
}