Commit b0119907 authored by cbruni's avatar cbruni Committed by Commit bot

Adding AstNode::PrettyPrint and AstNode::PrintAst

BUG=

Review URL: https://codereview.chromium.org/1587543003

Cr-Commit-Position: refs/heads/master@{#33323}
parent be2210bc
......@@ -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();
......
......@@ -196,6 +196,13 @@ class AstNode: public ZoneObject {
virtual NodeType node_type() const = 0;
int position() const { return position_; }
#ifdef DEBUG
void PrettyPrint(Isolate* isolate);
void PrettyPrint();
void PrintAst(Isolate* isolate);
void PrintAst();
#endif // DEBUG
// Type testing & conversion functions overridden by concrete subclasses.
#define DECLARE_NODE_FUNCTIONS(type) \
bool Is##type() const { return node_type() == AstNode::k##type; } \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment