mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
Fix to require parentheses around yield expression in argument list (351514, r=mrbkap).
This commit is contained in:
parent
fcecd128c6
commit
626f012531
@ -294,3 +294,4 @@ MSG_DEF(JSMSG_IN_AFTER_FOR_NAME, 211, 0, JSEXN_SYNTAXERR, "missing in after
|
||||
MSG_DEF(JSMSG_BAD_ITERATOR_RETURN, 212, 2, JSEXN_TYPEERR, "{0}.{1} returned a primitive value")
|
||||
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")
|
||||
|
@ -3640,10 +3640,11 @@ Expr(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
pn = pn2;
|
||||
do {
|
||||
#if JS_HAS_GENERATORS
|
||||
if (PN_LAST(pn)->pn_type == TOK_YIELD) {
|
||||
js_ReportCompileErrorNumber(cx, ts,
|
||||
JSREPORT_TS | JSREPORT_ERROR,
|
||||
JSMSG_SYNTAX_ERROR);
|
||||
pn2 = PN_LAST(pn);
|
||||
if (pn2->pn_type == TOK_YIELD) {
|
||||
js_ReportCompileErrorNumber(cx, pn2,
|
||||
JSREPORT_PN | JSREPORT_ERROR,
|
||||
JSMSG_BAD_YIELD_SYNTAX);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
@ -4121,6 +4122,14 @@ ArgumentList(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc,
|
||||
JSParseNode *argNode = AssignExpr(cx, ts, tc);
|
||||
if (!argNode)
|
||||
return JS_FALSE;
|
||||
#if JS_HAS_GENERATORS
|
||||
if (argNode->pn_type == TOK_YIELD) {
|
||||
js_ReportCompileErrorNumber(cx, argNode,
|
||||
JSREPORT_PN | JSREPORT_ERROR,
|
||||
JSMSG_BAD_YIELD_SYNTAX);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
PN_APPEND(listNode, argNode);
|
||||
} while (js_MatchToken(cx, ts, TOK_COMMA));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user