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

Unified Diff: src/ast/ast.cc

Issue 1587543003: Adding AstNode::PrettyPrint and AstNode::PrintAst (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: don't generate methods in release Created 4 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/ast/ast.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.cc
diff --git a/src/ast/ast.cc b/src/ast/ast.cc
index 69e7351a7d3d9cb1e7626058bd8f97e91ad5c193..30fcf9905379db9df15c6deea980cf651546b846 100644
--- a/src/ast/ast.cc
+++ b/src/ast/ast.cc
@@ -5,6 +5,8 @@
#include "src/ast/ast.h"
#include <cmath> // For isfinite.
+
+#include "src/ast/prettyprinter.h"
#include "src/ast/scopes.h"
#include "src/builtins.h"
#include "src/code-stubs.h"
@@ -32,6 +34,25 @@ AST_NODE_LIST(DECL_ACCEPT)
// ----------------------------------------------------------------------------
// Implementation of other node functionality.
+#ifdef DEBUG
+
+void AstNode::PrintAst() { PrintAst(Isolate::Current()); }
+
+
+void AstNode::PrintAst(Isolate* isolate) {
+ AstPrinter::PrintOut(isolate, this);
+}
+
+
+void AstNode::PrettyPrint() { PrettyPrint(Isolate::Current()); }
+
+
+void AstNode::PrettyPrint(Isolate* isolate) {
+ PrettyPrinter::PrintOut(isolate, this);
+}
+
+#endif // DEBUG
+
bool Expression::IsSmiLiteral() const {
return IsLiteral() && AsLiteral()->value()->IsSmi();
« no previous file with comments | « src/ast/ast.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698