Relaxd ES4-like yield parsing for JS1.8 (384991, r=mrbkap).

This commit is contained in:
brendan@mozilla.org 2008-02-18 20:49:02 -08:00
Родитель d994b6a900
Коммит c15fb874b1
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -2224,7 +2224,8 @@ ReturnOrYield(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc,
if (tt2 != TOK_EOF && tt2 != TOK_EOL && tt2 != TOK_SEMI && tt2 != TOK_RC if (tt2 != TOK_EOF && tt2 != TOK_EOL && tt2 != TOK_SEMI && tt2 != TOK_RC
#if JS_HAS_GENERATORS #if JS_HAS_GENERATORS
&& (tt != TOK_YIELD || && (tt != TOK_YIELD ||
(tt2 != tt && tt2 != TOK_RB && tt2 != TOK_RP && tt2 != TOK_COLON)) (tt2 != tt && tt2 != TOK_RB && tt2 != TOK_RP &&
tt2 != TOK_COLON && tt2 != TOK_COMMA))
#endif #endif
) { ) {
pn2 = operandParser(cx, ts, tc); pn2 = operandParser(cx, ts, tc);
@ -4339,7 +4340,8 @@ ArgumentList(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc,
if (!argNode) if (!argNode)
return JS_FALSE; return JS_FALSE;
#if JS_HAS_GENERATORS #if JS_HAS_GENERATORS
if (argNode->pn_type == TOK_YIELD) { if (argNode->pn_type == TOK_YIELD &&
js_PeekToken(cx, ts) == TOK_COMMA) {
js_ReportCompileErrorNumber(cx, ts, argNode, JSREPORT_ERROR, js_ReportCompileErrorNumber(cx, ts, argNode, JSREPORT_ERROR,
JSMSG_BAD_GENERATOR_SYNTAX, JSMSG_BAD_GENERATOR_SYNTAX,
js_yield_str); js_yield_str);