 Chromium Code Reviews
 Chromium Code Reviews Issue 1169853002:
  [es6] Parsing of new.target  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 1169853002:
  [es6] Parsing of new.target  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| Index: src/parser.cc | 
| diff --git a/src/parser.cc b/src/parser.cc | 
| index 75bfbe25ab84611b2a14a95be4f098cd17073728..8c19548240a23b137e19ee25d2b6615ef5b61ea7 100644 | 
| --- a/src/parser.cc | 
| +++ b/src/parser.cc | 
| @@ -756,6 +756,7 @@ Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory, | 
| Variable::THIS, pos, pos + 4); | 
| } | 
| + | 
| Expression* ParserTraits::SuperPropertyReference(Scope* scope, | 
| AstNodeFactory* factory, | 
| int pos) { | 
| @@ -786,6 +787,15 @@ Expression* ParserTraits::SuperCallReference(Scope* scope, | 
| } | 
| +Expression* ParserTraits::NewTargetExpression(Scope* scope, | 
| + AstNodeFactory* factory, | 
| + int pos) { | 
| + return scope->NewUnresolved(factory, | 
| + parser_->ast_value_factory()->new_target_string(), | 
| + Variable::NORMAL, pos, pos + 10); | 
| 
arv (Not doing code reviews)
2015/06/08 19:56:44
Is there a way to get the length of "new.target" a
 
Dmitry Lomov (no reviews)
2015/06/09 09:57:23
Maybe add a constant?
 | 
| +} | 
| + | 
| + | 
| Expression* ParserTraits::DefaultConstructor(bool call_super, Scope* scope, | 
| int pos, int end_pos) { | 
| return parser_->DefaultConstructor(call_super, scope, pos, end_pos); | 
| @@ -910,6 +920,7 @@ Parser::Parser(ParseInfo* info) | 
| set_allow_harmony_spreadcalls(FLAG_harmony_spreadcalls); | 
| set_allow_harmony_destructuring(FLAG_harmony_destructuring); | 
| set_allow_harmony_spread_arrays(FLAG_harmony_spread_arrays); | 
| + set_allow_harmony_new_target(FLAG_harmony_new_target); | 
| set_allow_strong_mode(FLAG_strong_mode); | 
| for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; | 
| ++feature) { | 
| @@ -4286,26 +4297,22 @@ PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser( | 
| reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), | 
| NULL, stack_limit_); | 
| reusable_preparser_->set_allow_lazy(true); | 
| - reusable_preparser_->set_allow_natives(allow_natives()); | 
| - reusable_preparser_->set_allow_harmony_modules(allow_harmony_modules()); | 
| - reusable_preparser_->set_allow_harmony_arrow_functions( | 
| - allow_harmony_arrow_functions()); | 
| - reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes()); | 
| - reusable_preparser_->set_allow_harmony_object_literals( | 
| - allow_harmony_object_literals()); | 
| - reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); | 
| - reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode()); | 
| - reusable_preparser_->set_allow_harmony_computed_property_names( | 
| - allow_harmony_computed_property_names()); | 
| - reusable_preparser_->set_allow_harmony_rest_params( | 
| - allow_harmony_rest_params()); | 
| - reusable_preparser_->set_allow_harmony_spreadcalls( | 
| - allow_harmony_spreadcalls()); | 
| - reusable_preparser_->set_allow_harmony_destructuring( | 
| - allow_harmony_destructuring()); | 
| - reusable_preparser_->set_allow_harmony_spread_arrays( | 
| - allow_harmony_spread_arrays()); | 
| - reusable_preparser_->set_allow_strong_mode(allow_strong_mode()); | 
| +#define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); | 
| + SET_ALLOW(natives); | 
| + SET_ALLOW(harmony_modules); | 
| + SET_ALLOW(harmony_arrow_functions); | 
| + SET_ALLOW(harmony_classes); | 
| + SET_ALLOW(harmony_object_literals); | 
| + SET_ALLOW(harmony_sloppy); | 
| + SET_ALLOW(harmony_unicode); | 
| + SET_ALLOW(harmony_computed_property_names); | 
| + SET_ALLOW(harmony_rest_params); | 
| + SET_ALLOW(harmony_spreadcalls); | 
| + SET_ALLOW(harmony_destructuring); | 
| + SET_ALLOW(harmony_spread_arrays); | 
| + SET_ALLOW(harmony_new_target); | 
| + SET_ALLOW(strong_mode); | 
| +#undef SET_ALLOW | 
| } | 
| PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( | 
| language_mode(), function_state_->kind(), logger, bookmark); |