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

Side by Side Diff: src/ast/prettyprinter.cc

Issue 1647213002: Remove unnecessary ClassLiteral name member and simplify Function.name handling (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Slightly shorter Created 4 years, 10 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
« no previous file with comments | « src/ast/ast.h ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ast/prettyprinter.h" 5 #include "src/ast/prettyprinter.h"
6 6
7 #include <stdarg.h> 7 #include <stdarg.h>
8 8
9 #include "src/ast/ast-value-factory.h" 9 #include "src/ast/ast-value-factory.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 712
713 void PrettyPrinter::VisitFunctionLiteral(FunctionLiteral* node) { 713 void PrettyPrinter::VisitFunctionLiteral(FunctionLiteral* node) {
714 Print("("); 714 Print("(");
715 PrintFunctionLiteral(node); 715 PrintFunctionLiteral(node);
716 Print(")"); 716 Print(")");
717 } 717 }
718 718
719 719
720 void PrettyPrinter::VisitClassLiteral(ClassLiteral* node) { 720 void PrettyPrinter::VisitClassLiteral(ClassLiteral* node) {
721 Print("(class "); 721 Print("(class ");
722 PrintLiteral(node->name(), false); 722 PrintLiteral(node->constructor()->name(), false);
723 if (node->extends()) { 723 if (node->extends()) {
724 Print(" extends "); 724 Print(" extends ");
725 Visit(node->extends()); 725 Visit(node->extends());
726 } 726 }
727 Print(" { "); 727 Print(" { ");
728 for (int i = 0; i < node->properties()->length(); i++) { 728 for (int i = 0; i < node->properties()->length(); i++) {
729 PrintObjectLiteralProperty(node->properties()->at(i)); 729 PrintObjectLiteralProperty(node->properties()->at(i));
730 } 730 }
731 Print(" })"); 731 Print(" })");
732 } 732 }
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 PrintParameters(node->scope()); 1422 PrintParameters(node->scope());
1423 // We don't want to see the function literal in this case: it 1423 // We don't want to see the function literal in this case: it
1424 // will be printed via PrintProgram when the code for it is 1424 // will be printed via PrintProgram when the code for it is
1425 // generated. 1425 // generated.
1426 // PrintStatements(node->body()); 1426 // PrintStatements(node->body());
1427 } 1427 }
1428 1428
1429 1429
1430 void AstPrinter::VisitClassLiteral(ClassLiteral* node) { 1430 void AstPrinter::VisitClassLiteral(ClassLiteral* node) {
1431 IndentedScope indent(this, "CLASS LITERAL", node->position()); 1431 IndentedScope indent(this, "CLASS LITERAL", node->position());
1432 if (node->raw_name() != nullptr) { 1432 PrintLiteralIndented("NAME", node->constructor()->name(), false);
1433 PrintLiteralIndented("NAME", node->name(), false);
1434 }
1435 if (node->extends() != nullptr) { 1433 if (node->extends() != nullptr) {
1436 PrintIndentedVisit("EXTENDS", node->extends()); 1434 PrintIndentedVisit("EXTENDS", node->extends());
1437 } 1435 }
1438 PrintProperties(node->properties()); 1436 PrintProperties(node->properties());
1439 } 1437 }
1440 1438
1441 1439
1442 void AstPrinter::PrintProperties( 1440 void AstPrinter::PrintProperties(
1443 ZoneList<ObjectLiteral::Property*>* properties) { 1441 ZoneList<ObjectLiteral::Property*>* properties) {
1444 for (int i = 0; i < properties->length(); i++) { 1442 for (int i = 0; i < properties->length(); i++) {
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 void AstPrinter::VisitRewritableAssignmentExpression( 1687 void AstPrinter::VisitRewritableAssignmentExpression(
1690 RewritableAssignmentExpression* node) { 1688 RewritableAssignmentExpression* node) {
1691 Visit(node->expression()); 1689 Visit(node->expression());
1692 } 1690 }
1693 1691
1694 1692
1695 #endif // DEBUG 1693 #endif // DEBUG
1696 1694
1697 } // namespace internal 1695 } // namespace internal
1698 } // namespace v8 1696 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698