Index: src/preparser.h |
diff --git a/src/preparser.h b/src/preparser.h |
index f67c7563d04099b0f080e9b1995abb4c07631074..09f6b1dc3d51c26b9cc1b7badc3b11a9139bf78a 100644 |
--- a/src/preparser.h |
+++ b/src/preparser.h |
@@ -2942,11 +2942,17 @@ ParserBase<Traits>::ParseTemplateLiteral(ExpressionT tag, int start, bool* ok) { |
do { |
CheckTemplateOctalLiteral(pos, peek_position(), CHECK_OK); |
next = peek(); |
- if (!next) { |
+ if (next == Token::EOS) { |
ReportMessageAt(Scanner::Location(start, peek_position()), |
"unterminated_template"); |
*ok = false; |
return Traits::EmptyExpression(); |
+ } else if (next == Token::ILLEGAL) { |
+ Traits::ReportMessageAt( |
+ Scanner::Location(position() + 1, peek_position()), |
+ "unexpected_token", "ILLEGAL", false); |
+ *ok = false; |
+ return Traits::EmptyExpression(); |
} |
int expr_pos = peek_position(); |
@@ -2966,10 +2972,16 @@ ParserBase<Traits>::ParseTemplateLiteral(ExpressionT tag, int start, bool* ok) { |
Next(); |
pos = position(); |
- if (!next) { |
+ if (next == Token::EOS) { |
ReportMessageAt(Scanner::Location(start, pos), "unterminated_template"); |
*ok = false; |
return Traits::EmptyExpression(); |
+ } else if (next == Token::ILLEGAL) { |
arv (Not doing code reviews)
2015/01/19 17:24:32
Can this code duplication be prevented?
caitp (gmail)
2015/01/19 17:27:04
The first `else if (next == Token::ILLEGAL)` block
|
+ Traits::ReportMessageAt( |
+ Scanner::Location(position() + 1, peek_position()), |
+ "unexpected_token", "ILLEGAL", false); |
+ *ok = false; |
+ return Traits::EmptyExpression(); |
} |
Traits::AddTemplateSpan(&ts, next == Token::TEMPLATE_TAIL); |