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

@@ -1054,12 +1054,10 @@ function parse($TEXT, options) {
};
function for_in(init) {
var lhs = init instanceof AST_Var ? init.definitions[0].name : null;
var obj = expression(true);
expect(")");
return new AST_ForIn({
init : init,
name : lhs,
object : obj,
body : in_loop(statement)
});