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

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: Merge RewriteExpression and ValidateExpression 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 12ea1e285ee1ac70dc8fe2291039c897fa5d8732..09c9be4b41c2903c1584b5f44bb975fad177d822 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -4750,8 +4750,7 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
block_scope->set_start_position(scanner()->location().end_pos);
ExpressionClassifier classifier;
extends = ParseLeftHandSideExpression(&classifier, CHECK_OK);
- ValidateExpression(&classifier, CHECK_OK);
- extends = ParserTraits::RewriteExpression(extends);
+ extends = ParserTraits::RewriteExpression(extends, &classifier, CHECK_OK);
} else {
block_scope->set_start_position(scanner()->location().end_pos);
}
@@ -4777,8 +4776,8 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
ObjectLiteral::Property* property = ParsePropertyDefinition(
&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);
+ property = ParserTraits::RewriteObjectLiteralProperty(property, &classifier,
+ CHECK_OK);
if (has_seen_constructor && constructor == NULL) {
constructor = GetPropertyValue(property)->AsFunctionLiteral();
@@ -5393,29 +5392,35 @@ void ParserTraits::RewriteDestructuringAssignments() {
}
-Expression* ParserTraits::RewriteExpression(Expression* expr) {
- return parser_->RewriteExpression(expr);
+Expression* ParserTraits::RewriteExpression(
+ Expression* expr, const ExpressionClassifier* classifier, bool* ok) {
+ return parser_->RewriteExpression(expr, classifier, ok);
}
ObjectLiteralProperty* ParserTraits::RewriteObjectLiteralProperty(
- ObjectLiteralProperty* property) {
- return parser_->RewriteObjectLiteralProperty(property);
+ ObjectLiteralProperty* property, const ExpressionClassifier* classifier,
+ bool* ok) {
+ return parser_->RewriteObjectLiteralProperty(property, classifier, ok);
}
-Expression* Parser::RewriteExpression(Expression* expr) {
- // TODO(nikolaos): For the time being, this does no rewriting at all.
+Expression* Parser::RewriteExpression(Expression* expr,
+ const ExpressionClassifier* classifier,
+ bool* ok) {
+ // For the time being, this does no rewriting at all.
+ ValidateExpression(classifier, ok);
return expr;
}
ObjectLiteralProperty* Parser::RewriteObjectLiteralProperty(
- ObjectLiteralProperty* property) {
+ ObjectLiteralProperty* property, const ExpressionClassifier* classifier,
+ bool* ok) {
if (property != nullptr) {
- Expression* key = RewriteExpression(property->key());
+ Expression* key = RewriteExpression(property->key(), classifier, ok);
property->set_key(key);
- Expression* value = RewriteExpression(property->value());
+ Expression* value = RewriteExpression(property->value(), classifier, ok);
property->set_value(value);
}
return property;

Powered by Google App Engine
This is Rietveld 408576698