Index: src/preparser.h |
diff --git a/src/preparser.h b/src/preparser.h |
index a17296349b362df6afefbb5b8538d7c030915270..80f269f6bd0f7cef5c0568b01f4797ded8e0de6a 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(); |
@@ -2725,6 +2708,10 @@ ParserBase<Traits>::ParseMemberWithNewPrefixesExpression(bool* ok) { |
// The expression can still continue with . or [ after the arguments. |
result = this->ParseMemberExpressionContinuation(result, CHECK_OK); |
return result; |
+ } else if (peek() == Token::TEMPLATE_SPAN || |
+ peek() == Token::TEMPLATE_TAIL) { |
+ // new tag`a` -> new(tag`a`) |
marja
2015/03/12 11:43:35
Pls move this comment up in the comment block, it'
caitp (gmail)
2015/03/12 13:34:15
this whole block seems to be unneeded, since Parse
|
+ result = this->ParseMemberExpressionContinuation(result, CHECK_OK); |
} |
// NewExpression without arguments. |
return factory()->NewCallNew(result, this->NewExpressionList(0, zone_), |
@@ -2817,7 +2804,7 @@ typename ParserBase<Traits>::ExpressionT |
ParserBase<Traits>::ParseMemberExpressionContinuation(ExpressionT expression, |
bool* ok) { |
// Parses this part of MemberExpression: |
marja
2015/03/12 11:43:35
You probably need to change the comment in ParseMe
|
- // ('[' Expression ']' | '.' Identifier)* |
+ // ('[' Expression ']' | '.' Identifier | TemplateLiteral)* |
while (true) { |
switch (peek()) { |
case Token::LBRACK: { |
@@ -2842,6 +2829,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; |
} |