fix tree traversal on AST_Do (#3047)

fixes #3046
This commit is contained in:
Alex Lam S.L
2018-04-02 22:31:23 +08:00
committed by GitHub
parent fcf542f262
commit e67553fa55
3 changed files with 34 additions and 14 deletions

View File

@@ -716,3 +716,29 @@ issue_3021: {
}
expect_stdout: "2 2"
}
issue_3046: {
options = {
hoist_props: true,
reduce_vars: true,
}
input: {
console.log(function(a) {
do {
var b = {
c: a++
};
} while (b.c && a);
return a;
}(0));
}
expect: {
console.log(function(a) {
do {
var b_c = a++;
} while (b_c && a);
return a;
}(0));
}
expect_stdout: "1"
}