reject invalid for...of syntax (#4632)
This commit is contained in:
@@ -1067,6 +1067,9 @@ function parse($TEXT, options) {
|
||||
if (init.definitions.length > 1) {
|
||||
token_error(init.start, "Only one variable declaration allowed in for..in/of loop");
|
||||
}
|
||||
if (ctor !== AST_ForIn && init.definitions[0].value) {
|
||||
token_error(init.definitions[0].value.start, "No initializers allowed in for..of loop");
|
||||
}
|
||||
} else if (!(is_assignable(init) || (init = to_destructured(init)) instanceof AST_Destructured)) {
|
||||
token_error(init.start, "Invalid left-hand side in for..in/of loop");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user