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

Unified Diff: src/parsing/parser.cc

Issue 1645023002: Avoid multiple rewriting of object key expressions (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 1b5b7e6779be608e70c4fdc487871cc94bce30fd..009f36d136d80c01b678a9d85ad21adf6aa900b8 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -5561,6 +5561,12 @@ class NonPatternRewriter : public AstExpressionRewriter {
return false;
}
+ void VisitObjectLiteralProperty(ObjectLiteralProperty* property) override {
+ if (property == nullptr) return;
+ // Do not rewrite (computed) key expressions
+ AST_REWRITE_PROPERTY(Expression, property, value);
+ }
+
Parser* parser_;
};
@@ -5581,8 +5587,7 @@ ObjectLiteralProperty* Parser::RewriteNonPatternObjectLiteralProperty(
ObjectLiteralProperty* property, const ExpressionClassifier* classifier,
bool* ok) {
if (property != nullptr) {
- Expression* key = RewriteNonPattern(property->key(), classifier, ok);
- property->set_key(key);
+ // Do not rewrite (computed) key expressions
Expression* value = RewriteNonPattern(property->value(), classifier, ok);
property->set_value(value);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698