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

Unified Diff: src/prettyprinter.cc

Issue 7055008: Fixed pretty printing of typeof/delete/void expressions. Put spaces around binary operations and ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 7 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 7967)
+++ src/prettyprinter.cc (working copy)
@@ -370,7 +370,10 @@
void PrettyPrinter::VisitUnaryOperation(UnaryOperation* node) {
- Print("(%s", Token::String(node->op()));
+ Token::Value op = node->op();
+ bool needsSpace =
+ op == Token::DELETE || op == Token::TYPEOF || op == Token::VOID;
+ Print("(%s%s", Token::String(op), needsSpace ? " " : "");
Visit(node->expression());
Print(")");
}
@@ -388,7 +391,7 @@
void PrettyPrinter::VisitBinaryOperation(BinaryOperation* node) {
Print("(");
Visit(node->left());
- Print("%s", Token::String(node->op()));
+ Print(" %s ", Token::String(node->op()));
Visit(node->right());
Print(")");
}
@@ -397,7 +400,7 @@
void PrettyPrinter::VisitCompareOperation(CompareOperation* node) {
Print("(");
Visit(node->left());
- Print("%s", Token::String(node->op()));
+ Print(" %s ", Token::String(node->op()));
Visit(node->right());
Print(")");
}
« 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