Merge branch 'master' into harmony-v3.0.20

This commit is contained in:
alexlamsl
2017-06-25 16:02:46 +08:00
25 changed files with 472 additions and 257 deletions

View File

@@ -1230,9 +1230,12 @@ function parse($TEXT, options) {
var is_in = is("operator", "in");
var is_of = is("name", "of");
if (is_in || is_of) {
if ((init instanceof AST_Definitions) &&
init.definitions.length > 1)
croak("Only one variable declaration allowed in for..in loop");
if (init instanceof AST_Definitions) {
if (init.definitions.length > 1)
croak("Only one variable declaration allowed in for..in loop", init.start.line, init.start.col, init.start.pos);
} else if (!(is_assignable(init) || (init = to_destructuring(init)) instanceof AST_Destructuring)) {
croak("Invalid left-hand side in for..in loop", init.start.line, init.start.col, init.start.pos);
}
next();
if (is_in) {
return for_in(init);