Fixed pretty printing of typeof/delete/void expressions. Put spaces around binary operations and comparisons to improve readability.
Review URL: http://codereview.chromium.org/7055008 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7976 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
fe6bdabc07
commit
8ea947e64b
@ -370,7 +370,10 @@ void PrettyPrinter::VisitCallRuntime(CallRuntime* node) {
|
|||||||
|
|
||||||
|
|
||||||
void PrettyPrinter::VisitUnaryOperation(UnaryOperation* node) {
|
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());
|
Visit(node->expression());
|
||||||
Print(")");
|
Print(")");
|
||||||
}
|
}
|
||||||
@ -388,7 +391,7 @@ void PrettyPrinter::VisitCountOperation(CountOperation* node) {
|
|||||||
void PrettyPrinter::VisitBinaryOperation(BinaryOperation* node) {
|
void PrettyPrinter::VisitBinaryOperation(BinaryOperation* node) {
|
||||||
Print("(");
|
Print("(");
|
||||||
Visit(node->left());
|
Visit(node->left());
|
||||||
Print("%s", Token::String(node->op()));
|
Print(" %s ", Token::String(node->op()));
|
||||||
Visit(node->right());
|
Visit(node->right());
|
||||||
Print(")");
|
Print(")");
|
||||||
}
|
}
|
||||||
@ -397,7 +400,7 @@ void PrettyPrinter::VisitBinaryOperation(BinaryOperation* node) {
|
|||||||
void PrettyPrinter::VisitCompareOperation(CompareOperation* node) {
|
void PrettyPrinter::VisitCompareOperation(CompareOperation* node) {
|
||||||
Print("(");
|
Print("(");
|
||||||
Visit(node->left());
|
Visit(node->left());
|
||||||
Print("%s", Token::String(node->op()));
|
Print(" %s ", Token::String(node->op()));
|
||||||
Visit(node->right());
|
Visit(node->right());
|
||||||
Print(")");
|
Print(")");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user