general improvements around AST_ForIn (#2796)

- compress using `collapse_vars`
- remove unused `name`
- simplify `loop_body`
This commit is contained in:
Alex Lam S.L
2018-01-16 17:03:12 +08:00
committed by GitHub
parent 424173d311
commit b4aef753e7
4 changed files with 35 additions and 7 deletions

View File

@@ -4062,3 +4062,30 @@ cascade_statement: {
}
}
}
cascade_forin: {
options = {
collapse_vars: true,
}
input: {
var a;
function f(b) {
return [ b, b, b ];
}
for (var c in a = console, f(a))
console.log(c);
}
expect: {
var a;
function f(b) {
return [ b, b, b ];
}
for (var c in f(a = console))
console.log(c);
}
expect_stdout: [
"0",
"1",
"2",
]
}