| Index: src/parsing/parser.cc
|
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
|
| index efb76fd5d8ac0eccf8b14e223ab4e3b0bae84ae1..746e3bef3914d84c6d4240e381fdb16eeb8597dd 100644
|
| --- a/src/parsing/parser.cc
|
| +++ b/src/parsing/parser.cc
|
| @@ -554,6 +554,7 @@ Parser::Parser(ParseInfo* info)
|
| set_allow_harmony_class_fields(FLAG_harmony_class_fields);
|
| set_allow_harmony_object_rest_spread(FLAG_harmony_object_rest_spread);
|
| set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import);
|
| + set_allow_harmony_template_escapes(FLAG_harmony_template_escapes);
|
| for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount;
|
| ++feature) {
|
| use_counts_[feature] = 0;
|
| @@ -3473,15 +3474,20 @@ Parser::TemplateLiteralState Parser::OpenTemplateLiteral(int pos) {
|
| return new (zone()) TemplateLiteral(zone(), pos);
|
| }
|
|
|
| -
|
| -void Parser::AddTemplateSpan(TemplateLiteralState* state, bool tail) {
|
| +void Parser::AddTemplateSpan(TemplateLiteralState* state, bool should_cook,
|
| + bool tail) {
|
| + DCHECK(should_cook || allow_harmony_template_escapes());
|
| int pos = scanner()->location().beg_pos;
|
| int end = scanner()->location().end_pos - (tail ? 1 : 2);
|
| - const AstRawString* tv = scanner()->CurrentSymbol(ast_value_factory());
|
| const AstRawString* trv = scanner()->CurrentRawSymbol(ast_value_factory());
|
| - Literal* cooked = factory()->NewStringLiteral(tv, pos);
|
| Literal* raw = factory()->NewStringLiteral(trv, pos);
|
| - (*state)->AddTemplateSpan(cooked, raw, end, zone());
|
| + if (should_cook) {
|
| + const AstRawString* tv = scanner()->CurrentSymbol(ast_value_factory());
|
| + Literal* cooked = factory()->NewStringLiteral(tv, pos);
|
| + (*state)->AddTemplateSpan(cooked, raw, end, zone());
|
| + } else {
|
| + (*state)->AddTemplateSpan(GetLiteralUndefined(pos), raw, end, zone());
|
| + }
|
| }
|
|
|
|
|
|
|