| Index: src/preparser.h
|
| diff --git a/src/preparser.h b/src/preparser.h
|
| index 847f994efe750fce20afa057c86878c46538f9e2..5d2d7865b0fac2802d555f8c44a8913088e41c7c 100644
|
| --- a/src/preparser.h
|
| +++ b/src/preparser.h
|
| @@ -756,6 +756,12 @@ class PreParserExpression {
|
| ExpressionTypeField::encode(kCallExpression));
|
| }
|
|
|
| + static PreParserExpression NoTemplateTag() {
|
| + return PreParserExpression(TypeField::encode(kExpression) |
|
| + ExpressionTypeField::encode(
|
| + kNoTemplateTagExpression));
|
| + }
|
| +
|
| bool IsIdentifier() const {
|
| return TypeField::decode(code_) == kIdentifierExpression;
|
| }
|
| @@ -809,6 +815,11 @@ class PreParserExpression {
|
| bool IsFunctionLiteral() const { return false; }
|
| bool IsCallNew() const { return false; }
|
|
|
| + bool IsNoTemplateTag() const {
|
| + return TypeField::decode(code_) == kExpression &&
|
| + ExpressionTypeField::decode(code_) == kNoTemplateTagExpression;
|
| + }
|
| +
|
| PreParserExpression AsFunctionLiteral() { return *this; }
|
|
|
| bool IsBinaryOperation() const {
|
| @@ -855,7 +866,8 @@ class PreParserExpression {
|
| kThisPropertyExpression,
|
| kPropertyExpression,
|
| kCallExpression,
|
| - kSuperExpression
|
| + kSuperExpression,
|
| + kNoTemplateTagExpression
|
| };
|
|
|
| explicit PreParserExpression(uint32_t expression_code)
|
| @@ -1398,10 +1410,21 @@ class PreParserTraits {
|
| void AddTemplateSpan(TemplateLiteralState*, bool) {}
|
| void AddTemplateExpression(TemplateLiteralState*, PreParserExpression) {}
|
| PreParserExpression CloseTemplateLiteral(TemplateLiteralState*, int,
|
| - PreParserExpression) {
|
| + PreParserExpression tag) {
|
| + if (IsTaggedTemplate(tag)) {
|
| + // Emulate generation of array literals for tag callsite
|
| + // 1st is array of cooked strings, second is array of raw strings
|
| + MaterializeTemplateCallsiteLiterals();
|
| + }
|
| return EmptyExpression();
|
| }
|
| - PreParserExpression NoTemplateTag() { return PreParserExpression::Default(); }
|
| + inline void MaterializeTemplateCallsiteLiterals();
|
| + PreParserExpression NoTemplateTag() {
|
| + return PreParserExpression::NoTemplateTag();
|
| + }
|
| + static bool IsTaggedTemplate(const PreParserExpression tag) {
|
| + return !tag.IsNoTemplateTag();
|
| + }
|
| static AstValueFactory* ast_value_factory() { return NULL; }
|
|
|
| void CheckConflictingVarDeclarations(PreParserScope scope, bool* ok) {}
|
| @@ -1565,6 +1588,12 @@ class PreParser : public ParserBase<PreParserTraits> {
|
| };
|
|
|
|
|
| +void PreParserTraits::MaterializeTemplateCallsiteLiterals() {
|
| + pre_parser_->function_state_->NextMaterializedLiteralIndex();
|
| + pre_parser_->function_state_->NextMaterializedLiteralIndex();
|
| +}
|
| +
|
| +
|
| PreParserStatementList PreParser::ParseEagerFunctionBody(
|
| PreParserIdentifier function_name, int pos, Variable* fvar,
|
| Token::Value fvar_init_op, bool is_generator, bool* ok) {
|
|
|