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 #include "src/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 void Find(AstNode* node, bool print = false); | 26 void Find(AstNode* node, bool print = false); |
27 | 27 |
28 // Individual nodes | 28 // Individual nodes |
29 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 29 #define DECLARE_VISIT(type) void Visit##type(type* node) override; |
30 AST_NODE_LIST(DECLARE_VISIT) | 30 AST_NODE_LIST(DECLARE_VISIT) |
31 #undef DECLARE_VISIT | 31 #undef DECLARE_VISIT |
32 | 32 |
33 private: | 33 private: |
34 void Init(); | 34 void Init(); |
| 35 Isolate* isolate_; |
35 char* output_; // output string buffer | 36 char* output_; // output string buffer |
36 int size_; // output_ size | 37 int size_; // output_ size |
37 int pos_; // current printing position | 38 int pos_; // current printing position |
38 int position_; // position of ast node to print | 39 int position_; // position of ast node to print |
39 bool found_; | 40 bool found_; |
40 bool done_; | 41 bool done_; |
41 bool is_builtin_; | 42 bool is_builtin_; |
42 | 43 |
43 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 44 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
44 | 45 |
(...skipping 22 matching lines...) Expand all Loading... |
67 | 68 |
68 // Print a node to stdout. | 69 // Print a node to stdout. |
69 static void PrintOut(Isolate* isolate, AstNode* node); | 70 static void PrintOut(Isolate* isolate, AstNode* node); |
70 | 71 |
71 // Individual nodes | 72 // Individual nodes |
72 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 73 #define DECLARE_VISIT(type) void Visit##type(type* node) override; |
73 AST_NODE_LIST(DECLARE_VISIT) | 74 AST_NODE_LIST(DECLARE_VISIT) |
74 #undef DECLARE_VISIT | 75 #undef DECLARE_VISIT |
75 | 76 |
76 private: | 77 private: |
| 78 Isolate* isolate_; |
77 char* output_; // output string buffer | 79 char* output_; // output string buffer |
78 int size_; // output_ size | 80 int size_; // output_ size |
79 int pos_; // current printing position | 81 int pos_; // current printing position |
80 | 82 |
81 protected: | 83 protected: |
82 void Init(); | 84 void Init(); |
83 const char* Output() const { return output_; } | 85 const char* Output() const { return output_; } |
84 | 86 |
85 virtual void PrintStatements(ZoneList<Statement*>* statements); | 87 virtual void PrintStatements(ZoneList<Statement*>* statements); |
86 void PrintLabels(ZoneList<const AstRawString*>* labels); | 88 void PrintLabels(ZoneList<const AstRawString*>* labels); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 137 |
136 int indent_; | 138 int indent_; |
137 }; | 139 }; |
138 | 140 |
139 #endif // DEBUG | 141 #endif // DEBUG |
140 | 142 |
141 } // namespace internal | 143 } // namespace internal |
142 } // namespace v8 | 144 } // namespace v8 |
143 | 145 |
144 #endif // V8_AST_PRETTYPRINTER_H_ | 146 #endif // V8_AST_PRETTYPRINTER_H_ |
OLD | NEW |