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 |