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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 } | 1429 } |
1420 } | 1430 } |
1421 | 1431 |
1422 | 1432 |
1423 void AstPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) { | 1433 void AstPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) { |
1424 IndentedScope indent(this, "NATIVE FUNC LITERAL", node->position()); | 1434 IndentedScope indent(this, "NATIVE FUNC LITERAL", node->position()); |
1425 PrintLiteralIndented("NAME", node->name(), false); | 1435 PrintLiteralIndented("NAME", node->name(), false); |
1426 } | 1436 } |
1427 | 1437 |
1428 | 1438 |
| 1439 void AstPrinter::VisitDoExpression(DoExpression* node) { |
| 1440 IndentedScope indent(this, "DO EXPRESSION", node->position()); |
| 1441 PrintStatements(node->block()->statements()); |
| 1442 } |
| 1443 |
| 1444 |
1429 void AstPrinter::VisitConditional(Conditional* node) { | 1445 void AstPrinter::VisitConditional(Conditional* node) { |
1430 IndentedScope indent(this, "CONDITIONAL", node->position()); | 1446 IndentedScope indent(this, "CONDITIONAL", node->position()); |
1431 PrintIndentedVisit("CONDITION", node->condition()); | 1447 PrintIndentedVisit("CONDITION", node->condition()); |
1432 PrintIndentedVisit("THEN", node->then_expression()); | 1448 PrintIndentedVisit("THEN", node->then_expression()); |
1433 PrintIndentedVisit("ELSE", node->else_expression()); | 1449 PrintIndentedVisit("ELSE", node->else_expression()); |
1434 } | 1450 } |
1435 | 1451 |
1436 | 1452 |
1437 // TODO(svenpanne) Start with IndentedScope. | 1453 // TODO(svenpanne) Start with IndentedScope. |
1438 void AstPrinter::VisitLiteral(Literal* node) { | 1454 void AstPrinter::VisitLiteral(Literal* node) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 | 1630 |
1615 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { | 1631 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { |
1616 IndentedScope indent(this, "SUPER-CALL-REFERENCE", node->position()); | 1632 IndentedScope indent(this, "SUPER-CALL-REFERENCE", node->position()); |
1617 } | 1633 } |
1618 | 1634 |
1619 | 1635 |
1620 #endif // DEBUG | 1636 #endif // DEBUG |
1621 | 1637 |
1622 } // namespace internal | 1638 } // namespace internal |
1623 } // namespace v8 | 1639 } // namespace v8 |
OLD | NEW |