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

Unified Diff: src/parsing/parser.cc

Issue 1567603005: Set up rewriting triggers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index ee2a696d458b2441135e61a88fcb25f748e7db68..a11a5d390e5eb6543892f61566dacb0e08639797 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -4906,6 +4906,7 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
ExpressionClassifier classifier;
extends = ParseLeftHandSideExpression(&classifier, CHECK_OK);
ValidateExpression(&classifier, CHECK_OK);
+ extends = ParserTraits::RewriteExpression(extends);
} else {
block_scope->set_start_position(scanner()->location().end_pos);
}
@@ -4932,6 +4933,7 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
&checker, in_class, has_extends, is_static, &is_computed_name,
&has_seen_constructor, &classifier, &name, CHECK_OK);
ValidateExpression(&classifier, CHECK_OK);
+ property = ParserTraits::RewriteObjectLiteralProperty(property);
if (has_seen_constructor && constructor == NULL) {
constructor = GetPropertyValue(property)->AsFunctionLiteral();
@@ -6500,6 +6502,35 @@ void ParserTraits::RewriteDestructuringAssignments() {
}
+Expression* ParserTraits::RewriteExpression(Expression* expr) {
+ return parser_->RewriteExpression(expr);
+}
+
+
+ObjectLiteralProperty* ParserTraits::RewriteObjectLiteralProperty(
+ ObjectLiteralProperty* property) {
+ return parser_->RewriteObjectLiteralProperty(property);
+}
+
+
+Expression* Parser::RewriteExpression(Expression* expr) {
+ // TODO(nikolaos): For the time being, this does no rewriting at all.
+ return expr;
+}
+
+
+ObjectLiteralProperty* Parser::RewriteObjectLiteralProperty(
+ ObjectLiteralProperty* property) {
+ if (property != nullptr) {
+ Expression* key = RewriteExpression(property->key());
+ property->set_key(key);
+ Expression* value = RewriteExpression(property->value());
+ property->set_value(value);
+ }
+ return property;
+}
+
+
void Parser::RewriteDestructuringAssignments() {
FunctionState* func = function_state_;
if (!allow_harmony_destructuring_assignment()) return;
« no previous file with comments | « src/parsing/parser.h ('k') | src/parsing/parser-base.h » ('j') | src/parsing/parser-base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698