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

Side by Side Diff: src/ast/prettyprinter.h

Issue 2265073002: Handle unicode correctly in CallPrinter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | src/ast/prettyprinter.cc » ('j') | src/ast/prettyprinter.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "src/string-builder.h"
11 12
12 namespace v8 { 13 namespace v8 {
13 namespace internal { 14 namespace internal {
14 15
15 class CallPrinter final : public AstVisitor<CallPrinter> { 16 class CallPrinter final : public AstVisitor<CallPrinter> {
16 public: 17 public:
17 explicit CallPrinter(Isolate* isolate, bool is_builtin); 18 explicit CallPrinter(Isolate* isolate, bool is_builtin);
18 ~CallPrinter();
19 19
20 // The following routine prints the node with position |position| into a 20 // The following routine prints the node with position |position| into a
21 // string. The result string is alive as long as the CallPrinter is alive. 21 // string.
22 const char* Print(FunctionLiteral* program, int position); 22 Handle<String> Print(FunctionLiteral* program, int position);
23
24 void PRINTF_FORMAT(2, 3) Print(const char* format, ...);
25
26 void Find(AstNode* node, bool print = false);
27 23
28 // Individual nodes 24 // Individual nodes
29 #define DECLARE_VISIT(type) void Visit##type(type* node); 25 #define DECLARE_VISIT(type) void Visit##type(type* node);
30 AST_NODE_LIST(DECLARE_VISIT) 26 AST_NODE_LIST(DECLARE_VISIT)
31 #undef DECLARE_VISIT 27 #undef DECLARE_VISIT
32 28
33 private: 29 private:
34 void Init(); 30 // void PRINTF_FORMAT(2, 3) Print(const char* format, ...);
31 void Print(const char* str);
32 void Print(Handle<String> str);
33
34 void Find(AstNode* node, bool print = false);
35
35 Isolate* isolate_; 36 Isolate* isolate_;
36 char* output_; // output string buffer 37 int num_prints_;
37 int size_; // output_ size 38 IncrementalStringBuilder builder_;
38 int pos_; // current printing position
39 int position_; // position of ast node to print 39 int position_; // position of ast node to print
40 bool found_; 40 bool found_;
41 bool done_; 41 bool done_;
42 bool is_builtin_; 42 bool is_builtin_;
43 43
44 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 44 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
45 45
46 protected: 46 protected:
47 void PrintLiteral(Object* value, bool quote); 47 void PrintLiteral(Object* value, bool quote);
48 void PrintLiteral(const AstRawString* value, bool quote); 48 void PrintLiteral(const AstRawString* value, bool quote);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 int pos_; // current printing position 108 int pos_; // current printing position
109 int indent_; 109 int indent_;
110 }; 110 };
111 111
112 #endif // DEBUG 112 #endif // DEBUG
113 113
114 } // namespace internal 114 } // namespace internal
115 } // namespace v8 115 } // namespace v8
116 116
117 #endif // V8_AST_PRETTYPRINTER_H_ 117 #endif // V8_AST_PRETTYPRINTER_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast/prettyprinter.cc » ('j') | src/ast/prettyprinter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698