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

Side by Side Diff: src/prettyprinter.cc

Issue 14864008: Refactoring only: Removed unused argument from IndentedScope constructor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 625
626 626
627 //----------------------------------------------------------------------------- 627 //-----------------------------------------------------------------------------
628 628
629 class IndentedScope BASE_EMBEDDED { 629 class IndentedScope BASE_EMBEDDED {
630 public: 630 public:
631 explicit IndentedScope(AstPrinter* printer) : ast_printer_(printer) { 631 explicit IndentedScope(AstPrinter* printer) : ast_printer_(printer) {
632 ast_printer_->inc_indent(); 632 ast_printer_->inc_indent();
633 } 633 }
634 634
635 IndentedScope(AstPrinter* printer, const char* txt, AstNode* node = NULL) 635 IndentedScope(AstPrinter* printer, const char* txt)
636 : ast_printer_(printer) { 636 : ast_printer_(printer) {
637 ast_printer_->PrintIndented(txt); 637 ast_printer_->PrintIndented(txt);
638 ast_printer_->Print("\n"); 638 ast_printer_->Print("\n");
639 ast_printer_->inc_indent(); 639 ast_printer_->inc_indent();
640 } 640 }
641 641
642 virtual ~IndentedScope() { 642 virtual ~IndentedScope() {
643 ast_printer_->dec_indent(); 643 ast_printer_->dec_indent();
644 } 644 }
645 645
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 PrintLabels(labels); 700 PrintLabels(labels);
701 Print("\n"); 701 Print("\n");
702 } else if (info != NULL) { 702 } else if (info != NULL) {
703 PrintIndented(info); 703 PrintIndented(info);
704 Print("\n"); 704 Print("\n");
705 } 705 }
706 } 706 }
707 707
708 708
709 void AstPrinter::PrintIndentedVisit(const char* s, AstNode* node) { 709 void AstPrinter::PrintIndentedVisit(const char* s, AstNode* node) {
710 IndentedScope indent(this, s, node); 710 IndentedScope indent(this, s);
711 Visit(node); 711 Visit(node);
712 } 712 }
713 713
714 714
715 const char* AstPrinter::PrintProgram(FunctionLiteral* program) { 715 const char* AstPrinter::PrintProgram(FunctionLiteral* program) {
716 Init(); 716 Init();
717 { IndentedScope indent(this, "FUNC"); 717 { IndentedScope indent(this, "FUNC");
718 PrintLiteralIndented("NAME", program->name(), true); 718 PrintLiteralIndented("NAME", program->name(), true);
719 PrintLiteralIndented("INFERRED NAME", program->inferred_name(), true); 719 PrintLiteralIndented("INFERRED NAME", program->inferred_name(), true);
720 PrintParameters(program->scope()); 720 PrintParameters(program->scope());
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 break; 1052 break;
1053 case Variable::LOOKUP: 1053 case Variable::LOOKUP:
1054 OS::SNPrintF(buf + pos, " lookup"); 1054 OS::SNPrintF(buf + pos, " lookup");
1055 break; 1055 break;
1056 } 1056 }
1057 PrintLiteralWithModeIndented(buf.start(), var, node->name()); 1057 PrintLiteralWithModeIndented(buf.start(), var, node->name());
1058 } 1058 }
1059 1059
1060 1060
1061 void AstPrinter::VisitAssignment(Assignment* node) { 1061 void AstPrinter::VisitAssignment(Assignment* node) {
1062 IndentedScope indent(this, Token::Name(node->op()), node); 1062 IndentedScope indent(this, Token::Name(node->op()));
1063 Visit(node->target()); 1063 Visit(node->target());
1064 Visit(node->value()); 1064 Visit(node->value());
1065 } 1065 }
1066 1066
1067 1067
1068 void AstPrinter::VisitYield(Yield* node) { 1068 void AstPrinter::VisitYield(Yield* node) {
1069 PrintIndentedVisit("YIELD", node->expression()); 1069 PrintIndentedVisit("YIELD", node->expression());
1070 } 1070 }
1071 1071
1072 1072
1073 void AstPrinter::VisitThrow(Throw* node) { 1073 void AstPrinter::VisitThrow(Throw* node) {
1074 PrintIndentedVisit("THROW", node->exception()); 1074 PrintIndentedVisit("THROW", node->exception());
1075 } 1075 }
1076 1076
1077 1077
1078 void AstPrinter::VisitProperty(Property* node) { 1078 void AstPrinter::VisitProperty(Property* node) {
1079 IndentedScope indent(this, "PROPERTY", node); 1079 IndentedScope indent(this, "PROPERTY");
1080 Visit(node->obj()); 1080 Visit(node->obj());
1081 Literal* literal = node->key()->AsLiteral(); 1081 Literal* literal = node->key()->AsLiteral();
1082 if (literal != NULL && literal->handle()->IsInternalizedString()) { 1082 if (literal != NULL && literal->handle()->IsInternalizedString()) {
1083 PrintLiteralIndented("NAME", literal->handle(), false); 1083 PrintLiteralIndented("NAME", literal->handle(), false);
1084 } else { 1084 } else {
1085 PrintIndentedVisit("KEY", node->key()); 1085 PrintIndentedVisit("KEY", node->key());
1086 } 1086 }
1087 } 1087 }
1088 1088
1089 1089
(...skipping 25 matching lines...) Expand all
1115 1115
1116 void AstPrinter::VisitCountOperation(CountOperation* node) { 1116 void AstPrinter::VisitCountOperation(CountOperation* node) {
1117 EmbeddedVector<char, 128> buf; 1117 EmbeddedVector<char, 128> buf;
1118 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"), 1118 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"),
1119 Token::Name(node->op())); 1119 Token::Name(node->op()));
1120 PrintIndentedVisit(buf.start(), node->expression()); 1120 PrintIndentedVisit(buf.start(), node->expression());
1121 } 1121 }
1122 1122
1123 1123
1124 void AstPrinter::VisitBinaryOperation(BinaryOperation* node) { 1124 void AstPrinter::VisitBinaryOperation(BinaryOperation* node) {
1125 IndentedScope indent(this, Token::Name(node->op()), node); 1125 IndentedScope indent(this, Token::Name(node->op()));
1126 Visit(node->left()); 1126 Visit(node->left());
1127 Visit(node->right()); 1127 Visit(node->right());
1128 } 1128 }
1129 1129
1130 1130
1131 void AstPrinter::VisitCompareOperation(CompareOperation* node) { 1131 void AstPrinter::VisitCompareOperation(CompareOperation* node) {
1132 IndentedScope indent(this, Token::Name(node->op()), node); 1132 IndentedScope indent(this, Token::Name(node->op()));
1133 Visit(node->left()); 1133 Visit(node->left());
1134 Visit(node->right()); 1134 Visit(node->right());
1135 } 1135 }
1136 1136
1137 1137
1138 void AstPrinter::VisitThisFunction(ThisFunction* node) { 1138 void AstPrinter::VisitThisFunction(ThisFunction* node) {
1139 IndentedScope indent(this, "THIS-FUNCTION"); 1139 IndentedScope indent(this, "THIS-FUNCTION");
1140 } 1140 }
1141 1141
1142 #endif // DEBUG 1142 #endif // DEBUG
1143 1143
1144 } } // namespace v8::internal 1144 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698