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

Side by Side 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 unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698