Index: src/prettyprinter.cc |
=================================================================== |
--- src/prettyprinter.cc (revision 4955) |
+++ src/prettyprinter.cc (working copy) |
@@ -590,7 +590,7 @@ |
class IndentedScope BASE_EMBEDDED { |
public: |
- IndentedScope() { |
+ explicit IndentedScope(AstPrinter* printer) : ast_printer_(printer) { |
ast_printer_->inc_indent(); |
} |
@@ -619,30 +619,20 @@ |
ast_printer_->dec_indent(); |
} |
- static void SetAstPrinter(AstPrinter* a) { ast_printer_ = a; } |
- |
private: |
- static AstPrinter* ast_printer_; |
+ AstPrinter* ast_printer_; |
}; |
-AstPrinter* IndentedScope::ast_printer_ = NULL; |
- |
- |
//----------------------------------------------------------------------------- |
-int AstPrinter::indent_ = 0; |
- |
-AstPrinter::AstPrinter() { |
- ASSERT(indent_ == 0); |
- IndentedScope::SetAstPrinter(this); |
+AstPrinter::AstPrinter() : indent_(0) { |
} |
AstPrinter::~AstPrinter() { |
ASSERT(indent_ == 0); |
- IndentedScope::SetAstPrinter(NULL); |
} |
@@ -1030,7 +1020,7 @@ |
node->type(), node->num(), node->IsPrimitive()); |
Variable* var = node->var(); |
if (var != NULL && var->rewrite() != NULL) { |
- IndentedScope indent; |
+ IndentedScope indent(this); |
Visit(var->rewrite()); |
} |
} |
@@ -1076,7 +1066,7 @@ |
void AstPrinter::VisitCallRuntime(CallRuntime* node) { |
PrintLiteralIndented("CALL RUNTIME ", node->name(), false); |
- IndentedScope indent; |
+ IndentedScope indent(this); |
PrintArguments(node->arguments()); |
} |