Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: src/prettyprinter.h

Issue 7824038: Remove variable rewrites and the unneccesary Slot class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // The result string is alive as long as the PrettyPrinter is alive. 45 // The result string is alive as long as the PrettyPrinter is alive.
46 const char* Print(AstNode* node); 46 const char* Print(AstNode* node);
47 const char* PrintExpression(FunctionLiteral* program); 47 const char* PrintExpression(FunctionLiteral* program);
48 const char* PrintProgram(FunctionLiteral* program); 48 const char* PrintProgram(FunctionLiteral* program);
49 49
50 void Print(const char* format, ...); 50 void Print(const char* format, ...);
51 51
52 // Print a node to stdout. 52 // Print a node to stdout.
53 static void PrintOut(AstNode* node); 53 static void PrintOut(AstNode* node);
54 54
55 virtual void VisitSlot(Slot* node);
56 // Individual nodes 55 // Individual nodes
57 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); 56 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
58 AST_NODE_LIST(DECLARE_VISIT) 57 AST_NODE_LIST(DECLARE_VISIT)
59 #undef DECLARE_VISIT 58 #undef DECLARE_VISIT
60 59
61 private: 60 private:
62 char* output_; // output string buffer 61 char* output_; // output string buffer
63 int size_; // output_ size 62 int size_; // output_ size
64 int pos_; // current printing position 63 int pos_; // current printing position
65 64
(...skipping 14 matching lines...) Expand all
80 79
81 // Prints the AST structure 80 // Prints the AST structure
82 class AstPrinter: public PrettyPrinter { 81 class AstPrinter: public PrettyPrinter {
83 public: 82 public:
84 AstPrinter(); 83 AstPrinter();
85 virtual ~AstPrinter(); 84 virtual ~AstPrinter();
86 85
87 const char* PrintProgram(FunctionLiteral* program); 86 const char* PrintProgram(FunctionLiteral* program);
88 87
89 // Individual nodes 88 // Individual nodes
90 virtual void VisitSlot(Slot* node);
91 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); 89 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
92 AST_NODE_LIST(DECLARE_VISIT) 90 AST_NODE_LIST(DECLARE_VISIT)
93 #undef DECLARE_VISIT 91 #undef DECLARE_VISIT
94 92
95 private: 93 private:
96 friend class IndentedScope; 94 friend class IndentedScope;
97 void PrintIndented(const char* txt); 95 void PrintIndented(const char* txt);
98 void PrintIndentedVisit(const char* s, AstNode* node); 96 void PrintIndentedVisit(const char* s, AstNode* node);
99 97
100 void PrintStatements(ZoneList<Statement*>* statements); 98 void PrintStatements(ZoneList<Statement*>* statements);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 AttributesScope* attributes() { return attributes_scope_; } 154 AttributesScope* attributes() { return attributes_scope_; }
157 void set_attributes(AttributesScope* scope) { attributes_scope_ = scope; } 155 void set_attributes(AttributesScope* scope) { attributes_scope_ = scope; }
158 156
159 // Add an attribute to the currently opened attributes. 157 // Add an attribute to the currently opened attributes.
160 void AddAttribute(const char* name, Handle<String> value); 158 void AddAttribute(const char* name, Handle<String> value);
161 void AddAttribute(const char* name, const char* value); 159 void AddAttribute(const char* name, const char* value);
162 void AddAttribute(const char* name, int value); 160 void AddAttribute(const char* name, int value);
163 void AddAttribute(const char* name, bool value); 161 void AddAttribute(const char* name, bool value);
164 162
165 // AST node visit functions. 163 // AST node visit functions.
166 virtual void VisitSlot(Slot* node);
167 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); 164 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
168 AST_NODE_LIST(DECLARE_VISIT) 165 AST_NODE_LIST(DECLARE_VISIT)
169 #undef DECLARE_VISIT 166 #undef DECLARE_VISIT
170 167
171 private: 168 private:
172 int indent_; 169 int indent_;
173 TagScope* top_tag_scope_; 170 TagScope* top_tag_scope_;
174 AttributesScope* attributes_scope_; 171 AttributesScope* attributes_scope_;
175 172
176 // Utility function used by AddAttribute implementations. 173 // Utility function used by AddAttribute implementations.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 private: 211 private:
215 JsonAstBuilder* builder_; 212 JsonAstBuilder* builder_;
216 int attribute_count_; 213 int attribute_count_;
217 }; 214 };
218 215
219 #endif // DEBUG 216 #endif // DEBUG
220 217
221 } } // namespace v8::internal 218 } } // namespace v8::internal
222 219
223 #endif // V8_PRETTYPRINTER_H_ 220 #endif // V8_PRETTYPRINTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698