OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/prettyprinter.h" | 5 #include "src/prettyprinter.h" |
6 | 6 |
7 #include <stdarg.h> | 7 #include <stdarg.h> |
8 | 8 |
9 #include "src/ast-value-factory.h" | 9 #include "src/ast-value-factory.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 if (node->extends()) Find(node->extends()); | 221 if (node->extends()) Find(node->extends()); |
222 for (int i = 0; i < node->properties()->length(); i++) { | 222 for (int i = 0; i < node->properties()->length(); i++) { |
223 Find(node->properties()->at(i)->value()); | 223 Find(node->properties()->at(i)->value()); |
224 } | 224 } |
225 } | 225 } |
226 | 226 |
227 | 227 |
228 void CallPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) {} | 228 void CallPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) {} |
229 | 229 |
230 | 230 |
| 231 void CallPrinter::VisitDoExpression(DoExpression* node) { Find(node->block()); } |
| 232 |
| 233 |
231 void CallPrinter::VisitConditional(Conditional* node) { | 234 void CallPrinter::VisitConditional(Conditional* node) { |
232 Find(node->condition()); | 235 Find(node->condition()); |
233 Find(node->then_expression()); | 236 Find(node->then_expression()); |
234 Find(node->else_expression()); | 237 Find(node->else_expression()); |
235 } | 238 } |
236 | 239 |
237 | 240 |
238 void CallPrinter::VisitLiteral(Literal* node) { | 241 void CallPrinter::VisitLiteral(Literal* node) { |
239 PrintLiteral(node->value(), true); | 242 PrintLiteral(node->value(), true); |
240 } | 243 } |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 } | 697 } |
695 | 698 |
696 | 699 |
697 void PrettyPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) { | 700 void PrettyPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) { |
698 Print("("); | 701 Print("("); |
699 PrintLiteral(node->name(), false); | 702 PrintLiteral(node->name(), false); |
700 Print(")"); | 703 Print(")"); |
701 } | 704 } |
702 | 705 |
703 | 706 |
| 707 void PrettyPrinter::VisitDoExpression(DoExpression* node) { |
| 708 Print("(do {"); |
| 709 PrintStatements(node->block()->statements()); |
| 710 Print("})"); |
| 711 } |
| 712 |
| 713 |
704 void PrettyPrinter::VisitConditional(Conditional* node) { | 714 void PrettyPrinter::VisitConditional(Conditional* node) { |
705 Visit(node->condition()); | 715 Visit(node->condition()); |
706 Print(" ? "); | 716 Print(" ? "); |
707 Visit(node->then_expression()); | 717 Visit(node->then_expression()); |
708 Print(" : "); | 718 Print(" : "); |
709 Visit(node->else_expression()); | 719 Visit(node->else_expression()); |
710 } | 720 } |
711 | 721 |
712 | 722 |
713 void PrettyPrinter::VisitLiteral(Literal* node) { | 723 void PrettyPrinter::VisitLiteral(Literal* node) { |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 } | 1428 } |
1419 } | 1429 } |
1420 | 1430 |
1421 | 1431 |
1422 void AstPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) { | 1432 void AstPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) { |
1423 IndentedScope indent(this, "NATIVE FUNC LITERAL", node->position()); | 1433 IndentedScope indent(this, "NATIVE FUNC LITERAL", node->position()); |
1424 PrintLiteralIndented("NAME", node->name(), false); | 1434 PrintLiteralIndented("NAME", node->name(), false); |
1425 } | 1435 } |
1426 | 1436 |
1427 | 1437 |
| 1438 void AstPrinter::VisitDoExpression(DoExpression* node) { |
| 1439 IndentedScope indent(this, "DO EXPRESSION", node->position()); |
| 1440 PrintStatements(node->block()->statements()); |
| 1441 } |
| 1442 |
| 1443 |
1428 void AstPrinter::VisitConditional(Conditional* node) { | 1444 void AstPrinter::VisitConditional(Conditional* node) { |
1429 IndentedScope indent(this, "CONDITIONAL", node->position()); | 1445 IndentedScope indent(this, "CONDITIONAL", node->position()); |
1430 PrintIndentedVisit("CONDITION", node->condition()); | 1446 PrintIndentedVisit("CONDITION", node->condition()); |
1431 PrintIndentedVisit("THEN", node->then_expression()); | 1447 PrintIndentedVisit("THEN", node->then_expression()); |
1432 PrintIndentedVisit("ELSE", node->else_expression()); | 1448 PrintIndentedVisit("ELSE", node->else_expression()); |
1433 } | 1449 } |
1434 | 1450 |
1435 | 1451 |
1436 // TODO(svenpanne) Start with IndentedScope. | 1452 // TODO(svenpanne) Start with IndentedScope. |
1437 void AstPrinter::VisitLiteral(Literal* node) { | 1453 void AstPrinter::VisitLiteral(Literal* node) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 | 1629 |
1614 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { | 1630 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { |
1615 IndentedScope indent(this, "SUPER-CALL-REFERENCE", node->position()); | 1631 IndentedScope indent(this, "SUPER-CALL-REFERENCE", node->position()); |
1616 } | 1632 } |
1617 | 1633 |
1618 | 1634 |
1619 #endif // DEBUG | 1635 #endif // DEBUG |
1620 | 1636 |
1621 } // namespace internal | 1637 } // namespace internal |
1622 } // namespace v8 | 1638 } // namespace v8 |
OLD | NEW |