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

Unified Diff: src/parser.cc

Issue 1169853002: [es6] Parsing of new.target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add constant Created 5 years, 6 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 | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 75bfbe25ab84611b2a14a95be4f098cd17073728..fc73a3e3a97c3a38aa6b43fd98b754cb93b732b2 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,16 @@ Expression* ParserTraits::SuperCallReference(Scope* scope,
}
+Expression* ParserTraits::NewTargetExpression(Scope* scope,
+ AstNodeFactory* factory,
+ int pos) {
+ static const int kNewTargetStringLength = 10;
+ return scope->NewUnresolved(
+ factory, parser_->ast_value_factory()->new_target_string(),
+ Variable::NORMAL, pos, pos + kNewTargetStringLength);
+}
+
+
Expression* ParserTraits::DefaultConstructor(bool call_super, Scope* scope,
int pos, int end_pos) {
return parser_->DefaultConstructor(call_super, scope, pos, end_pos);
@@ -910,6 +921,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 +4298,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);
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698