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

Unified Diff: src/prettyprinter.h

Issue 861623002: Add a pretty printer to improve the error message non-function calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment Created 5 years, 11 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 | « src/messages.h ('k') | src/prettyprinter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/prettyprinter.h
diff --git a/src/prettyprinter.h b/src/prettyprinter.h
index bf015204c9bf9ee990ac3843b5dd2919b6d0d8ac..c07421a05ad94a1932460c3e8140b2fb26a67749 100644
--- a/src/prettyprinter.h
+++ b/src/prettyprinter.h
@@ -11,6 +11,43 @@
namespace v8 {
namespace internal {
+class CallPrinter : public AstVisitor {
+ public:
+ explicit CallPrinter(Zone* zone);
+ virtual ~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 Print(const char* format, ...);
+
+ void Find(AstNode* node, bool print = false);
+
+// Individual nodes
+#define DECLARE_VISIT(type) void Visit##type(type* node) OVERRIDE;
+ AST_NODE_LIST(DECLARE_VISIT)
+#undef DECLARE_VISIT
+
+ private:
+ void Init();
+ char* output_; // output string buffer
+ int size_; // output_ size
+ int pos_; // current printing position
+ int position_; // position of ast node to print
+ bool found_;
+ bool done_;
+
+ DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
+
+ protected:
+ void PrintLiteral(Handle<Object> value, bool quote);
+ void PrintLiteral(const AstRawString* value, bool quote);
+ void FindStatements(ZoneList<Statement*>* statements);
+ void FindArguments(ZoneList<Expression*>* arguments);
+};
+
+
#ifdef DEBUG
class PrettyPrinter: public AstVisitor {
« no previous file with comments | « src/messages.h ('k') | src/prettyprinter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698