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

Unified Diff: src/prettyprinter.cc

Issue 7866041: Improved pretty printing of VAR PROXY and some control flow AST nodes. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/prettyprinter.cc
===================================================================
--- src/prettyprinter.cc (revision 9224)
+++ src/prettyprinter.cc (working copy)
@@ -633,17 +633,14 @@
void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) {
if (labels != NULL && labels->length() > 0) {
- if (info == NULL) {
- PrintIndented("LABELS ");
- } else {
- PrintIndented(info);
- Print(" ");
- }
+ PrintIndented(info == NULL ? "LABELS" : info);
+ Print(" ");
PrintLabels(labels);
+ Print("\n");
} else if (info != NULL) {
PrintIndented(info);
+ Print("\n");
}
- Print("\n");
}
@@ -929,25 +926,25 @@
void AstPrinter::VisitVariableProxy(VariableProxy* node) {
Variable* var = node->var();
- PrintLiteralWithModeIndented("VAR PROXY", var, node->name());
- { IndentedScope indent(this);
- switch (var->location()) {
- case Variable::UNALLOCATED:
- break;
- case Variable::PARAMETER:
- Print("parameter[%d]", var->index());
- break;
- case Variable::LOCAL:
- Print("local[%d]", var->index());
- break;
- case Variable::CONTEXT:
- Print("context[%d]", var->index());
- break;
- case Variable::LOOKUP:
- Print("lookup");
- break;
- }
+ EmbeddedVector<char, 128> buf;
+ int pos = OS::SNPrintF(buf, "VAR PROXY");
+ switch (var->location()) {
+ case Variable::UNALLOCATED:
+ break;
+ case Variable::PARAMETER:
+ OS::SNPrintF(buf + pos, " parameter[%d]", var->index());
+ break;
+ case Variable::LOCAL:
+ OS::SNPrintF(buf + pos, " local[%d]", var->index());
+ break;
+ case Variable::CONTEXT:
+ OS::SNPrintF(buf + pos, " context[%d]", var->index());
+ break;
+ case Variable::LOOKUP:
+ OS::SNPrintF(buf + pos, " lookup");
+ break;
}
+ PrintLiteralWithModeIndented(buf.start(), var, node->name());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698