Commit 785b466a authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Remove explicit EOS/ILLEGAL handling from template literal parsing

We'll automatically figure out that we can't parse an expression at the EOS
anyway.

Change-Id: I663e3b9d030ee048b28472710071778bfc511747
Reviewed-on: https://chromium-review.googlesource.com/c/1286681Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56755}
parent 2cde0eff
......@@ -4560,18 +4560,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseTemplateLiteral(
do {
next = peek();
if (next == Token::EOS) {
impl()->ReportMessageAt(Scanner::Location(start, peek_position()),
MessageTemplate::kUnterminatedTemplate);
*ok = false;
return impl()->NullExpression();
} else if (next == Token::ILLEGAL) {
impl()->ReportMessageAt(
Scanner::Location(position() + 1, peek_position()),
MessageTemplate::kUnexpectedToken, "ILLEGAL", kSyntaxError);
*ok = false;
return impl()->NullExpression();
}
int expr_pos = peek_position();
ExpressionT expression = ParseExpressionCoverGrammar(true, CHECK_OK);
......@@ -4591,19 +4579,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseTemplateLiteral(
Next();
pos = position();
if (next == Token::EOS) {
impl()->ReportMessageAt(Scanner::Location(start, pos),
MessageTemplate::kUnterminatedTemplate);
*ok = false;
return impl()->NullExpression();
} else if (next == Token::ILLEGAL) {
impl()->ReportMessageAt(
Scanner::Location(position() + 1, peek_position()),
MessageTemplate::kUnexpectedToken, "ILLEGAL", kSyntaxError);
*ok = false;
return impl()->NullExpression();
}
bool is_valid = CheckTemplateEscapes(forbid_illegal_escapes, CHECK_OK);
impl()->AddTemplateSpan(&ts, is_valid, next == Token::TEMPLATE_TAIL);
} while (next == Token::TEMPLATE_SPAN);
......
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