diff options
Diffstat (limited to 'lib/parse.js')
-rw-r--r-- | lib/parse.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/parse.js b/lib/parse.js index 553568e1..e2dd04b6 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -1010,8 +1010,12 @@ function parse($TEXT, options) { ? (next(), var_(true)) : expression(true, true); if (is("operator", "in")) { - if (init instanceof AST_Var && init.definitions.length > 1) - croak("Only one variable declaration allowed in for..in loop"); + if (init instanceof AST_Var) { + 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)) { + croak("Invalid left-hand side in for..in loop", init.start.line, init.start.col, init.start.pos); + } next(); return for_in(init); } |