Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1362)

Unified Diff: src/preparser.h

Issue 996223003: [es6] support template literals after MemberExpression (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: New tests, delete unneeded code, some comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/scanner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index a17296349b362df6afefbb5b8538d7c030915270..6e2a9de575bf3d8c4b086a82829e3fb094733495 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -2653,23 +2653,6 @@ ParserBase<Traits>::ParseLeftHandSideExpression(bool* ok) {
break;
}
- case Token::TEMPLATE_SPAN:
- case Token::TEMPLATE_TAIL: {
- int pos;
- if (scanner()->current_token() == Token::IDENTIFIER) {
- pos = position();
- } else {
- pos = peek_position();
- if (result->IsFunctionLiteral() && mode() == PARSE_EAGERLY) {
- // If the tag function looks like an IIFE, set_parenthesized() to
- // force eager compilation.
- result->AsFunctionLiteral()->set_parenthesized();
- }
- }
- result = ParseTemplateLiteral(result, pos, CHECK_OK);
- break;
- }
-
case Token::PERIOD: {
Consume(Token::PERIOD);
int pos = position();
@@ -2740,7 +2723,7 @@ typename ParserBase<Traits>::ExpressionT
ParserBase<Traits>::ParseMemberExpression(bool* ok) {
// MemberExpression ::
// (PrimaryExpression | FunctionLiteral | ClassLiteral)
- // ('[' Expression ']' | '.' Identifier | Arguments)*
+ // ('[' Expression ']' | '.' Identifier | Arguments | TemplateLiteral)*
// The '[' Expression ']' and '.' Identifier parts are parsed by
// ParseMemberExpressionContinuation, and the Arguments part is parsed by the
@@ -2817,7 +2800,7 @@ typename ParserBase<Traits>::ExpressionT
ParserBase<Traits>::ParseMemberExpressionContinuation(ExpressionT expression,
bool* ok) {
// Parses this part of MemberExpression:
- // ('[' Expression ']' | '.' Identifier)*
+ // ('[' Expression ']' | '.' Identifier | TemplateLiteral)*
while (true) {
switch (peek()) {
case Token::LBRACK: {
@@ -2842,6 +2825,22 @@ ParserBase<Traits>::ParseMemberExpressionContinuation(ExpressionT expression,
}
break;
}
+ case Token::TEMPLATE_SPAN:
+ case Token::TEMPLATE_TAIL: {
+ int pos;
+ if (scanner()->current_token() == Token::IDENTIFIER) {
+ pos = position();
+ } else {
+ pos = peek_position();
+ if (expression->IsFunctionLiteral() && mode() == PARSE_EAGERLY) {
+ // If the tag function looks like an IIFE, set_parenthesized() to
+ // force eager compilation.
+ expression->AsFunctionLiteral()->set_parenthesized();
+ }
+ }
+ expression = ParseTemplateLiteral(expression, pos, CHECK_OK);
+ break;
+ }
default:
return expression;
}
« no previous file with comments | « no previous file | src/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698