diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 29a231ddfdbf..22bf5663243d 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -6303,29 +6303,29 @@ Parser::expr(InHandling inHandling, YieldHandling yieldHandling, bool matched; if (!tokenStream.matchToken(&matched, TOK_COMMA)) return null(); - if (matched) { - Node seq = handler.newCommaExpressionList(pn); - if (!seq) + if (!matched) + return pn; + + Node seq = handler.newCommaExpressionList(pn); + if (!seq) + return null(); + while (true) { + if (handler.isUnparenthesizedYieldExpression(pn)) { + report(ParseError, false, pn, JSMSG_BAD_GENERATOR_SYNTAX, js_yield_str); return null(); - while (true) { - if (handler.isUnparenthesizedYieldExpression(pn)) { - report(ParseError, false, pn, JSMSG_BAD_GENERATOR_SYNTAX, js_yield_str); - return null(); - } - - pn = assignExpr(inHandling, yieldHandling); - if (!pn) - return null(); - handler.addList(seq, pn); - - if (!tokenStream.matchToken(&matched, TOK_COMMA)) - return null(); - if (!matched) - break; } - return seq; + + pn = assignExpr(inHandling, yieldHandling); + if (!pn) + return null(); + handler.addList(seq, pn); + + if (!tokenStream.matchToken(&matched, TOK_COMMA)) + return null(); + if (!matched) + break; } - return pn; + return seq; } static const JSOp ParseNodeKindToJSOp[] = {