| 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 | 11 | 
| 11 namespace v8 { | 12 namespace v8 { | 
| 12 namespace internal { | 13 namespace internal { | 
| 13 | 14 | 
| 14 class CallPrinter : public AstVisitor { | 15 class CallPrinter : public AstVisitor { | 
| 15  public: | 16  public: | 
| 16   explicit CallPrinter(Isolate* isolate, bool is_builtin); | 17   explicit CallPrinter(Isolate* isolate, bool is_builtin); | 
| 17   virtual ~CallPrinter(); | 18   virtual ~CallPrinter(); | 
| 18 | 19 | 
| 19   // The following routine prints the node with position |position| into a | 20   // The following routine prints the node with position |position| into a | 
| 20   // string. The result string is alive as long as the CallPrinter is alive. | 21   // string. The result string is alive as long as the CallPrinter is alive. | 
| 21   const char* Print(FunctionLiteral* program, int position); | 22   const char* Print(FunctionLiteral* program, int position); | 
| 22 | 23 | 
| 23   void Print(const char* format, ...); | 24   void PRINTF_FORMAT(2, 3) Print(const char* format, ...); | 
| 24 | 25 | 
| 25   void Find(AstNode* node, bool print = false); | 26   void Find(AstNode* node, bool print = false); | 
| 26 | 27 | 
| 27 // Individual nodes | 28 // Individual nodes | 
| 28 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 29 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 
| 29   AST_NODE_LIST(DECLARE_VISIT) | 30   AST_NODE_LIST(DECLARE_VISIT) | 
| 30 #undef DECLARE_VISIT | 31 #undef DECLARE_VISIT | 
| 31 | 32 | 
| 32  private: | 33  private: | 
| 33   void Init(); | 34   void Init(); | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 55  public: | 56  public: | 
| 56   explicit PrettyPrinter(Isolate* isolate); | 57   explicit PrettyPrinter(Isolate* isolate); | 
| 57   virtual ~PrettyPrinter(); | 58   virtual ~PrettyPrinter(); | 
| 58 | 59 | 
| 59   // The following routines print a node into a string. | 60   // The following routines print a node into a string. | 
| 60   // The result string is alive as long as the PrettyPrinter is alive. | 61   // The result string is alive as long as the PrettyPrinter is alive. | 
| 61   const char* Print(AstNode* node); | 62   const char* Print(AstNode* node); | 
| 62   const char* PrintExpression(FunctionLiteral* program); | 63   const char* PrintExpression(FunctionLiteral* program); | 
| 63   const char* PrintProgram(FunctionLiteral* program); | 64   const char* PrintProgram(FunctionLiteral* program); | 
| 64 | 65 | 
| 65   void Print(const char* format, ...); | 66   void PRINTF_FORMAT(2, 3) Print(const char* format, ...); | 
| 66 | 67 | 
| 67   // Print a node to stdout. | 68   // Print a node to stdout. | 
| 68   static void PrintOut(Isolate* isolate, AstNode* node); | 69   static void PrintOut(Isolate* isolate, AstNode* node); | 
| 69 | 70 | 
| 70   // Individual nodes | 71   // Individual nodes | 
| 71 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 72 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 
| 72   AST_NODE_LIST(DECLARE_VISIT) | 73   AST_NODE_LIST(DECLARE_VISIT) | 
| 73 #undef DECLARE_VISIT | 74 #undef DECLARE_VISIT | 
| 74 | 75 | 
| 75  private: | 76  private: | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 134 | 135 | 
| 135   int indent_; | 136   int indent_; | 
| 136 }; | 137 }; | 
| 137 | 138 | 
| 138 #endif  // DEBUG | 139 #endif  // DEBUG | 
| 139 | 140 | 
| 140 }  // namespace internal | 141 }  // namespace internal | 
| 141 }  // namespace v8 | 142 }  // namespace v8 | 
| 142 | 143 | 
| 143 #endif  // V8_AST_PRETTYPRINTER_H_ | 144 #endif  // V8_AST_PRETTYPRINTER_H_ | 
| OLD | NEW | 
|---|