Index: src/ast/prettyprinter.h |
diff --git a/src/ast/prettyprinter.h b/src/ast/prettyprinter.h |
index bb36c2bd90828d214896f43093c15a0baf619155..de1bbf614ecd0a664fd388b54f2669aff630a042 100644 |
--- a/src/ast/prettyprinter.h |
+++ b/src/ast/prettyprinter.h |
@@ -53,15 +53,15 @@ class CallPrinter : public AstVisitor { |
#ifdef DEBUG |
-class PrettyPrinter: public AstVisitor { |
+// Prints the AST structure |
+class AstPrinter : public AstVisitor { |
public: |
- explicit PrettyPrinter(Isolate* isolate); |
- virtual ~PrettyPrinter(); |
+ explicit AstPrinter(Isolate* isolate); |
+ virtual ~AstPrinter(); |
// The following routines print a node into a string. |
// The result string is alive as long as the PrettyPrinter is alive. |
const char* Print(AstNode* node); |
- const char* PrintExpression(FunctionLiteral* program); |
const char* PrintProgram(FunctionLiteral* program); |
void PRINTF_FORMAT(2, 3) Print(const char* format, ...); |
@@ -75,48 +75,13 @@ class PrettyPrinter: public AstVisitor { |
#undef DECLARE_VISIT |
private: |
- Isolate* isolate_; |
- char* output_; // output string buffer |
- int size_; // output_ size |
- int pos_; // current printing position |
+ friend class IndentedScope; |
- protected: |
void Init(); |
- const char* Output() const { return output_; } |
- virtual void PrintStatements(ZoneList<Statement*>* statements); |
void PrintLabels(ZoneList<const AstRawString*>* labels); |
- virtual void PrintArguments(ZoneList<Expression*>* arguments); |
- void PrintLiteral(Handle<Object> value, bool quote); |
void PrintLiteral(const AstRawString* value, bool quote); |
- void PrintParameters(Scope* scope); |
- void PrintDeclarations(ZoneList<Declaration*>* declarations); |
- void PrintFunctionLiteral(FunctionLiteral* function); |
- void PrintCaseClause(CaseClause* clause); |
- void PrintObjectLiteralProperty(ObjectLiteralProperty* property); |
- |
- DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
-}; |
- |
- |
-// Prints the AST structure |
-class AstPrinter: public PrettyPrinter { |
- public: |
- explicit AstPrinter(Isolate* isolate); |
- virtual ~AstPrinter(); |
- |
- const char* PrintProgram(FunctionLiteral* program); |
- |
- // Print a node to stdout. |
- static void PrintOut(Isolate* isolate, AstNode* node); |
- |
- // Individual nodes |
-#define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
- AST_NODE_LIST(DECLARE_VISIT) |
-#undef DECLARE_VISIT |
- |
- private: |
- friend class IndentedScope; |
+ void PrintLiteral(Handle<Object> value, bool quote); |
void PrintIndented(const char* txt); |
void PrintIndentedVisit(const char* s, AstNode* node); |
@@ -135,6 +100,12 @@ class AstPrinter: public PrettyPrinter { |
void inc_indent() { indent_++; } |
void dec_indent() { indent_--; } |
+ DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
+ |
+ Isolate* isolate_; |
+ char* output_; // output string buffer |
+ int size_; // output_ size |
+ int pos_; // current printing position |
int indent_; |
}; |