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

Unified Diff: src/parsing/parser.cc

Issue 1582783004: [es6] add SetFunctionName() behaviour to AssignmentExpression (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add a bunch more tests 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 fd403040c6e05d5201144e183479da8f78a789c5..b5637aa5b2dbb8b3e06cc04b86d3504ca8fd8fbd 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -5453,5 +5453,28 @@ void ParserTraits::SetFunctionNameFromPropertyName(
}
+void ParserTraits::SetFunctionNameFromIdentifierRef(Expression* value,
+ Expression* identifier) {
+ if (!value->IsFunctionLiteral() && !value->IsClassLiteral()) return;
+ if (!identifier->IsVariableProxy()) return;
+
+ auto name = identifier->AsVariableProxy()->raw_name();
+ DCHECK_NOT_NULL(name);
+
+ if (value->IsFunctionLiteral()) {
+ auto function = value->AsFunctionLiteral();
+ if (function->is_anonymous()) {
+ function->set_raw_name(name);
+ }
+ } else {
+ DCHECK(value->IsClassLiteral());
+ auto class_literal = value->AsClassLiteral();
+ if (class_literal->raw_name() == nullptr) {
+ class_literal->set_raw_name(name);
+ }
+ }
+}
+
+
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698