OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/ast-expression-visitor.h" | 9 #include "src/ast/ast-expression-visitor.h" |
10 #include "src/ast/ast-literal-reindexer.h" | 10 #include "src/ast/ast-literal-reindexer.h" |
(...skipping 5435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5446 DCHECK(value->IsClassLiteral()); | 5446 DCHECK(value->IsClassLiteral()); |
5447 DCHECK_EQ(ObjectLiteralProperty::COMPUTED, property->kind()); | 5447 DCHECK_EQ(ObjectLiteralProperty::COMPUTED, property->kind()); |
5448 auto class_literal = value->AsClassLiteral(); | 5448 auto class_literal = value->AsClassLiteral(); |
5449 if (class_literal->raw_name() == nullptr) { | 5449 if (class_literal->raw_name() == nullptr) { |
5450 class_literal->set_raw_name(name); | 5450 class_literal->set_raw_name(name); |
5451 } | 5451 } |
5452 } | 5452 } |
5453 } | 5453 } |
5454 | 5454 |
5455 | 5455 |
| 5456 void ParserTraits::SetFunctionNameFromIdentifierRef(Expression* value, |
| 5457 Expression* identifier) { |
| 5458 if (!value->IsFunctionLiteral() && !value->IsClassLiteral()) return; |
| 5459 if (!identifier->IsVariableProxy()) return; |
| 5460 |
| 5461 auto name = identifier->AsVariableProxy()->raw_name(); |
| 5462 DCHECK_NOT_NULL(name); |
| 5463 |
| 5464 if (value->IsFunctionLiteral()) { |
| 5465 auto function = value->AsFunctionLiteral(); |
| 5466 if (function->is_anonymous()) { |
| 5467 function->set_raw_name(name); |
| 5468 } |
| 5469 } else { |
| 5470 DCHECK(value->IsClassLiteral()); |
| 5471 auto class_literal = value->AsClassLiteral(); |
| 5472 if (class_literal->raw_name() == nullptr) { |
| 5473 class_literal->set_raw_name(name); |
| 5474 } |
| 5475 } |
| 5476 } |
| 5477 |
| 5478 |
5456 } // namespace internal | 5479 } // namespace internal |
5457 } // namespace v8 | 5480 } // namespace v8 |
OLD | NEW |