Commit ab101d05 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Immediately throw if () isn't followed by =>

Change-Id: Iefea33f47ee4492c9c4d4e105e30f7e2d9128bc7
Reviewed-on: https://chromium-review.googlesource.com/c/1319576Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57268}
parent 32224e4a
......@@ -1772,11 +1772,9 @@ ParserBase<Impl>::ParsePrimaryExpression() {
if (pattern_error) ArrowFormalParametersUnexpectedToken();
Consume(Token::LPAREN);
if (Check(Token::RPAREN)) {
// ()=>x. The continuation that looks for the => is in
// ()=>x. The continuation that consumes the => is in
// ParseAssignmentExpression.
classifier()->RecordExpressionError(scanner()->location(),
MessageTemplate::kUnexpectedToken,
Token::String(Token::RPAREN));
if (peek() != Token::ARROW) ReportUnexpectedToken(Token::RPAREN);
return factory()->NewEmptyParentheses(beg_pos);
}
// Heuristically try to detect immediately called functions before
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment