mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Fix CheckDestructuring to reject array comprehensions (which start out as array initialisers) right away (350279, r=mrbkap).
This commit is contained in:
parent
de61177a24
commit
1a11edec95
@ -295,3 +295,4 @@ MSG_DEF(JSMSG_BAD_ITERATOR_RETURN, 212, 2, JSEXN_TYPEERR, "{0}.{1} returned a
|
||||
MSG_DEF(JSMSG_KEYWORD_NOT_NS, 213, 0, JSEXN_SYNTAXERR, "keyword is used as namespace")
|
||||
MSG_DEF(JSMSG_BAD_GENERATOR_YIELD, 214, 1, JSEXN_TYPEERR, "yield from closing generator {0}")
|
||||
MSG_DEF(JSMSG_BAD_YIELD_SYNTAX, 215, 0, JSEXN_SYNTAXERR, "yield expression must be parenthesized")
|
||||
MSG_DEF(JSMSG_ARRAY_COMP_LEFTSIDE, 216, 0, JSEXN_SYNTAXERR, "invalid array comprehension left-hand side")
|
||||
|
@ -2082,6 +2082,12 @@ CheckDestructuring(JSContext *cx, BindData *data,
|
||||
JSParseNode *lhs, *rhs, *pn, *pn2;
|
||||
uint32 count;
|
||||
|
||||
if (left->pn_type == TOK_ARRAYCOMP) {
|
||||
js_ReportCompileErrorNumber(cx, left, JSREPORT_PN | JSREPORT_ERROR,
|
||||
JSMSG_ARRAY_COMP_LEFTSIDE);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
ok = JS_TRUE;
|
||||
fpvd.table.ops = NULL;
|
||||
lhs = left->pn_head;
|
||||
|
Loading…
Reference in New Issue
Block a user