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

Unified 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: Address comments Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ast/prettyprinter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/prettyprinter.h
diff --git a/src/ast/prettyprinter.h b/src/ast/prettyprinter.h
index 61a118d13644c1a3b2f19e3a8ceb01d2ebd7c4c3..9b0e22abc2470634f264d22cfee7da77560c3426 100644
--- a/src/ast/prettyprinter.h
+++ b/src/ast/prettyprinter.h
@@ -8,6 +8,7 @@
#include "src/allocation.h"
#include "src/ast/ast.h"
#include "src/base/compiler-specific.h"
+#include "src/string-builder.h"
namespace v8 {
namespace internal {
@@ -15,15 +16,10 @@ namespace internal {
class CallPrinter final : public AstVisitor<CallPrinter> {
public:
explicit CallPrinter(Isolate* isolate, bool is_builtin);
- ~CallPrinter();
// The following routine prints the node with position |position| into a
- // string. The result string is alive as long as the CallPrinter is alive.
- const char* Print(FunctionLiteral* program, int position);
-
- void PRINTF_FORMAT(2, 3) Print(const char* format, ...);
-
- void Find(AstNode* node, bool print = false);
+ // string.
+ Handle<String> Print(FunctionLiteral* program, int position);
// Individual nodes
#define DECLARE_VISIT(type) void Visit##type(type* node);
@@ -31,11 +27,14 @@ class CallPrinter final : public AstVisitor<CallPrinter> {
#undef DECLARE_VISIT
private:
- void Init();
+ void Print(const char* str);
+ void Print(Handle<String> str);
+
+ void Find(AstNode* node, bool print = false);
+
Isolate* isolate_;
- char* output_; // output string buffer
- int size_; // output_ size
- int pos_; // current printing position
+ int num_prints_;
+ IncrementalStringBuilder builder_;
int position_; // position of ast node to print
bool found_;
bool done_;
@@ -44,7 +43,7 @@ class CallPrinter final : public AstVisitor<CallPrinter> {
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
protected:
- void PrintLiteral(Object* value, bool quote);
+ void PrintLiteral(Handle<Object> value, bool quote);
void PrintLiteral(const AstRawString* value, bool quote);
void FindStatements(ZoneList<Statement*>* statements);
void FindArguments(ZoneList<Expression*>* arguments);
« no previous file with comments | « no previous file | src/ast/prettyprinter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698