fix reduce_vars on single AST_Defun reference across loop (#2593)

This commit is contained in:
Alex Lam S.L
2017-12-14 18:47:05 +08:00
committed by GitHub
parent 02a6ce07eb
commit 3f18a61532
2 changed files with 34 additions and 1 deletions

View File

@@ -4838,3 +4838,31 @@ inverted_var: {
}
expect_stdout: true
}
defun_single_use_loop: {
options = {
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
for (var x, i = 2; --i >= 0; ) {
var y = x;
x = f;
console.log(x === y);
}
function f() {};
}
expect: {
for (var x, i = 2; --i >= 0; ) {
var y = x;
x = f;
console.log(x === y);
}
function f() {};
}
expect_stdout: [
"false",
"true",
]
}