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 #ifndef V8_AST_PRETTYPRINTER_H_ | 5 #ifndef V8_AST_PRETTYPRINTER_H_ |
6 #define V8_AST_PRETTYPRINTER_H_ | 6 #define V8_AST_PRETTYPRINTER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 | 10 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 | 98 |
99 // Prints the AST structure | 99 // Prints the AST structure |
100 class AstPrinter: public PrettyPrinter { | 100 class AstPrinter: public PrettyPrinter { |
101 public: | 101 public: |
102 explicit AstPrinter(Isolate* isolate); | 102 explicit AstPrinter(Isolate* isolate); |
103 virtual ~AstPrinter(); | 103 virtual ~AstPrinter(); |
104 | 104 |
105 const char* PrintProgram(FunctionLiteral* program); | 105 const char* PrintProgram(FunctionLiteral* program); |
106 | 106 |
| 107 // Print a node to stdout. |
| 108 static void PrintOut(Isolate* isolate, AstNode* node); |
| 109 |
107 // Individual nodes | 110 // Individual nodes |
108 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 111 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
109 AST_NODE_LIST(DECLARE_VISIT) | 112 AST_NODE_LIST(DECLARE_VISIT) |
110 #undef DECLARE_VISIT | 113 #undef DECLARE_VISIT |
111 | 114 |
112 private: | 115 private: |
113 friend class IndentedScope; | 116 friend class IndentedScope; |
114 void PrintIndented(const char* txt); | 117 void PrintIndented(const char* txt); |
115 void PrintIndentedVisit(const char* s, AstNode* node); | 118 void PrintIndentedVisit(const char* s, AstNode* node); |
116 | 119 |
(...skipping 14 matching lines...) Expand all Loading... |
131 | 134 |
132 int indent_; | 135 int indent_; |
133 }; | 136 }; |
134 | 137 |
135 #endif // DEBUG | 138 #endif // DEBUG |
136 | 139 |
137 } // namespace internal | 140 } // namespace internal |
138 } // namespace v8 | 141 } // namespace v8 |
139 | 142 |
140 #endif // V8_AST_PRETTYPRINTER_H_ | 143 #endif // V8_AST_PRETTYPRINTER_H_ |
OLD | NEW |