| OLD | NEW |
| 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/prettyprinter.h" | 5 #include "src/prettyprinter.h" |
| 6 | 6 |
| 7 #include <stdarg.h> | 7 #include <stdarg.h> |
| 8 | 8 |
| 9 #include "src/ast-value-factory.h" | 9 #include "src/ast-value-factory.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 const char* PrettyPrinter::PrintProgram(FunctionLiteral* program) { | 900 const char* PrettyPrinter::PrintProgram(FunctionLiteral* program) { |
| 901 Init(); | 901 Init(); |
| 902 PrintStatements(program->body()); | 902 PrintStatements(program->body()); |
| 903 Print("\n"); | 903 Print("\n"); |
| 904 return output_; | 904 return output_; |
| 905 } | 905 } |
| 906 | 906 |
| 907 | 907 |
| 908 void PrettyPrinter::PrintOut(Isolate* isolate, Zone* zone, AstNode* node) { | 908 void PrettyPrinter::PrintOut(Isolate* isolate, Zone* zone, AstNode* node) { |
| 909 PrettyPrinter printer(isolate, zone); | 909 PrettyPrinter printer(isolate, zone); |
| 910 PrintF("%s", printer.Print(node)); | 910 PrintF("%s\n", printer.Print(node)); |
| 911 } | 911 } |
| 912 | 912 |
| 913 | 913 |
| 914 void PrettyPrinter::Init() { | 914 void PrettyPrinter::Init() { |
| 915 if (size_ == 0) { | 915 if (size_ == 0) { |
| 916 DCHECK(output_ == NULL); | 916 DCHECK(output_ == NULL); |
| 917 const int initial_size = 256; | 917 const int initial_size = 256; |
| 918 output_ = NewArray<char>(initial_size); | 918 output_ = NewArray<char>(initial_size); |
| 919 size_ = initial_size; | 919 size_ = initial_size; |
| 920 } | 920 } |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1608 | 1608 |
| 1609 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { | 1609 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { |
| 1610 IndentedScope indent(this, "SUPER-CALL-REFERENCE"); | 1610 IndentedScope indent(this, "SUPER-CALL-REFERENCE"); |
| 1611 } | 1611 } |
| 1612 | 1612 |
| 1613 | 1613 |
| 1614 #endif // DEBUG | 1614 #endif // DEBUG |
| 1615 | 1615 |
| 1616 } // namespace internal | 1616 } // namespace internal |
| 1617 } // namespace v8 | 1617 } // namespace v8 |
| OLD | NEW |