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

Side by Side Diff: src/prettyprinter.cc

Issue 118234: Clean up the AST pretty printer by adding some missing newlines and... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 686
687 void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) { 687 void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) {
688 if (labels != NULL && labels->length() > 0) { 688 if (labels != NULL && labels->length() > 0) {
689 if (info == NULL) { 689 if (info == NULL) {
690 PrintIndented("LABELS "); 690 PrintIndented("LABELS ");
691 } else { 691 } else {
692 PrintIndented(info); 692 PrintIndented(info);
693 Print(" "); 693 Print(" ");
694 } 694 }
695 PrintLabels(labels); 695 PrintLabels(labels);
696 Print("\n");
697 } else if (info != NULL) { 696 } else if (info != NULL) {
698 PrintIndented(info); 697 PrintIndented(info);
699 } 698 }
699 Print("\n");
700 } 700 }
701 701
702 702
703 void AstPrinter::PrintIndentedVisit(const char* s, Node* node) { 703 void AstPrinter::PrintIndentedVisit(const char* s, Node* node) {
704 IndentedScope indent(s); 704 IndentedScope indent(s);
705 Visit(node); 705 Visit(node);
706 } 706 }
707 707
708 708
709 const char* AstPrinter::PrintProgram(FunctionLiteral* program) { 709 const char* AstPrinter::PrintProgram(FunctionLiteral* program) {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 } 911 }
912 912
913 913
914 void AstPrinter::VisitLiteral(Literal* node) { 914 void AstPrinter::VisitLiteral(Literal* node) {
915 PrintLiteralIndented("LITERAL", node->handle(), true); 915 PrintLiteralIndented("LITERAL", node->handle(), true);
916 } 916 }
917 917
918 918
919 void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) { 919 void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) {
920 IndentedScope indent("REGEXP LITERAL"); 920 IndentedScope indent("REGEXP LITERAL");
921 PrintLiteral(node->pattern(), false); 921 PrintLiteralIndented("PATTERN", node->pattern(), false);
922 Print(","); 922 PrintLiteralIndented("FLAGS", node->flags(), false);
923 PrintLiteral(node->flags(), false);
924 } 923 }
925 924
926 925
927 void AstPrinter::VisitObjectLiteral(ObjectLiteral* node) { 926 void AstPrinter::VisitObjectLiteral(ObjectLiteral* node) {
928 IndentedScope indent("OBJ LITERAL"); 927 IndentedScope indent("OBJ LITERAL");
929 for (int i = 0; i < node->properties()->length(); i++) { 928 for (int i = 0; i < node->properties()->length(); i++) {
930 const char* prop_kind = NULL; 929 const char* prop_kind = NULL;
931 switch (node->properties()->at(i)->kind()) { 930 switch (node->properties()->at(i)->kind()) {
932 case ObjectLiteral::Property::CONSTANT: 931 case ObjectLiteral::Property::CONSTANT:
933 prop_kind = "PROPERTY - CONSTANT"; 932 prop_kind = "PROPERTY - CONSTANT";
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 1093
1095 void AstPrinter::VisitThisFunction(ThisFunction* node) { 1094 void AstPrinter::VisitThisFunction(ThisFunction* node) {
1096 IndentedScope indent("THIS-FUNCTION"); 1095 IndentedScope indent("THIS-FUNCTION");
1097 } 1096 }
1098 1097
1099 1098
1100 1099
1101 #endif // DEBUG 1100 #endif // DEBUG
1102 1101
1103 } } // namespace v8::internal 1102 } } // 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