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

Side by Side Diff: src/prettyprinter.cc

Issue 67124: A few small changes to --print-ast behavior:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 8 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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 639
640 640
641 AstPrinter::~AstPrinter() { 641 AstPrinter::~AstPrinter() {
642 ASSERT(indent_ == 0); 642 ASSERT(indent_ == 0);
643 IndentedScope::SetAstPrinter(NULL); 643 IndentedScope::SetAstPrinter(NULL);
644 } 644 }
645 645
646 646
647 void AstPrinter::PrintIndented(const char* txt) { 647 void AstPrinter::PrintIndented(const char* txt) {
648 for (int i = 0; i < indent_; i++) { 648 for (int i = 0; i < indent_; i++) {
649 Print(". "); 649 Print(". ");
650 } 650 }
651 Print(txt); 651 Print(txt);
652 } 652 }
653 653
654 654
655 void AstPrinter::PrintLiteralIndented(const char* info, 655 void AstPrinter::PrintLiteralIndented(const char* info,
656 Handle<Object> value, 656 Handle<Object> value,
657 bool quote) { 657 bool quote) {
658 PrintIndented(info); 658 PrintIndented(info);
659 Print(" "); 659 Print(" ");
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 Visit(declarations->at(i)); 725 Visit(declarations->at(i));
726 } 726 }
727 } 727 }
728 } 728 }
729 729
730 730
731 void AstPrinter::PrintParameters(Scope* scope) { 731 void AstPrinter::PrintParameters(Scope* scope) {
732 if (scope->num_parameters() > 0) { 732 if (scope->num_parameters() > 0) {
733 IndentedScope indent("PARAMS"); 733 IndentedScope indent("PARAMS");
734 for (int i = 0; i < scope->num_parameters(); i++) { 734 for (int i = 0; i < scope->num_parameters(); i++) {
735 PrintLiteralWithModeIndented("VAR ", scope->parameter(i), 735 PrintLiteralWithModeIndented("VAR", scope->parameter(i),
736 scope->parameter(i)->name(), 736 scope->parameter(i)->name(),
737 scope->parameter(i)->type()); 737 scope->parameter(i)->type());
738 } 738 }
739 } 739 }
740 } 740 }
741 741
742 742
743 void AstPrinter::PrintStatements(ZoneList<Statement*>* statements) { 743 void AstPrinter::PrintStatements(ZoneList<Statement*>* statements) {
744 for (int i = 0; i < statements->length(); i++) { 744 for (int i = 0; i < statements->length(); i++) {
745 Visit(statements->at(i)); 745 Visit(statements->at(i));
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 void AstPrinter::VisitThrow(Throw* node) { 1017 void AstPrinter::VisitThrow(Throw* node) {
1018 PrintIndentedVisit("THROW", node->exception()); 1018 PrintIndentedVisit("THROW", node->exception());
1019 } 1019 }
1020 1020
1021 1021
1022 void AstPrinter::VisitProperty(Property* node) { 1022 void AstPrinter::VisitProperty(Property* node) {
1023 IndentedScope indent("PROPERTY"); 1023 IndentedScope indent("PROPERTY");
1024 Visit(node->obj()); 1024 Visit(node->obj());
1025 Literal* literal = node->key()->AsLiteral(); 1025 Literal* literal = node->key()->AsLiteral();
1026 if (literal != NULL && literal->handle()->IsSymbol()) { 1026 if (literal != NULL && literal->handle()->IsSymbol()) {
1027 PrintLiteralIndented("LITERAL", literal->handle(), false); 1027 PrintLiteralIndented("NAME", literal->handle(), false);
1028 } else { 1028 } else {
1029 PrintIndentedVisit("KEY", node->key()); 1029 PrintIndentedVisit("KEY", node->key());
1030 } 1030 }
1031 } 1031 }
1032 1032
1033 1033
1034 void AstPrinter::VisitCall(Call* node) { 1034 void AstPrinter::VisitCall(Call* node) {
1035 IndentedScope indent("CALL"); 1035 IndentedScope indent("CALL");
1036 Visit(node->expression()); 1036 Visit(node->expression());
1037 PrintArguments(node->arguments()); 1037 PrintArguments(node->arguments());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 1093
1094 void AstPrinter::VisitThisFunction(ThisFunction* node) { 1094 void AstPrinter::VisitThisFunction(ThisFunction* node) {
1095 IndentedScope indent("THIS-FUNCTION"); 1095 IndentedScope indent("THIS-FUNCTION");
1096 } 1096 }
1097 1097
1098 1098
1099 1099
1100 #endif // DEBUG 1100 #endif // DEBUG
1101 1101
1102 } } // 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