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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } | 257 } |
258 Print("]"); | 258 Print("]"); |
259 } | 259 } |
260 | 260 |
261 | 261 |
262 void CallPrinter::VisitVariableProxy(VariableProxy* node) { | 262 void CallPrinter::VisitVariableProxy(VariableProxy* node) { |
263 PrintLiteral(node->name(), false); | 263 PrintLiteral(node->name(), false); |
264 } | 264 } |
265 | 265 |
266 | 266 |
| 267 void CallPrinter::VisitRestParameter(RestParameter* node) { |
| 268 Print("..."); |
| 269 PrintLiteral(node->parameter()->name(), false); |
| 270 } |
| 271 |
| 272 |
267 void CallPrinter::VisitAssignment(Assignment* node) { | 273 void CallPrinter::VisitAssignment(Assignment* node) { |
268 Find(node->target()); | 274 Find(node->target()); |
269 Find(node->value()); | 275 Find(node->value()); |
270 } | 276 } |
271 | 277 |
272 | 278 |
273 void CallPrinter::VisitYield(Yield* node) { Find(node->expression()); } | 279 void CallPrinter::VisitYield(Yield* node) { Find(node->expression()); } |
274 | 280 |
275 | 281 |
276 void CallPrinter::VisitThrow(Throw* node) { Find(node->exception()); } | 282 void CallPrinter::VisitThrow(Throw* node) { Find(node->exception()); } |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 } | 748 } |
743 Print(" ]"); | 749 Print(" ]"); |
744 } | 750 } |
745 | 751 |
746 | 752 |
747 void PrettyPrinter::VisitVariableProxy(VariableProxy* node) { | 753 void PrettyPrinter::VisitVariableProxy(VariableProxy* node) { |
748 PrintLiteral(node->name(), false); | 754 PrintLiteral(node->name(), false); |
749 } | 755 } |
750 | 756 |
751 | 757 |
| 758 void PrettyPrinter::VisitRestParameter(RestParameter* node) { |
| 759 Print("..."); |
| 760 PrintLiteral(node->parameter()->name(), false); |
| 761 } |
| 762 |
| 763 |
752 void PrettyPrinter::VisitAssignment(Assignment* node) { | 764 void PrettyPrinter::VisitAssignment(Assignment* node) { |
753 Visit(node->target()); | 765 Visit(node->target()); |
754 Print(" %s ", Token::String(node->op())); | 766 Print(" %s ", Token::String(node->op())); |
755 Visit(node->value()); | 767 Visit(node->value()); |
756 } | 768 } |
757 | 769 |
758 | 770 |
759 void PrettyPrinter::VisitYield(Yield* node) { | 771 void PrettyPrinter::VisitYield(Yield* node) { |
760 Print("yield "); | 772 Print("yield "); |
761 Visit(node->expression()); | 773 Visit(node->expression()); |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 SNPrintF(buf + pos, " global[%d]", var->index()); | 1484 SNPrintF(buf + pos, " global[%d]", var->index()); |
1473 break; | 1485 break; |
1474 case VariableLocation::LOOKUP: | 1486 case VariableLocation::LOOKUP: |
1475 SNPrintF(buf + pos, " lookup"); | 1487 SNPrintF(buf + pos, " lookup"); |
1476 break; | 1488 break; |
1477 } | 1489 } |
1478 PrintLiteralWithModeIndented(buf.start(), var, node->name()); | 1490 PrintLiteralWithModeIndented(buf.start(), var, node->name()); |
1479 } | 1491 } |
1480 | 1492 |
1481 | 1493 |
| 1494 void AstPrinter::VisitRestParameter(RestParameter* node) { |
| 1495 Visit(node->parameter()); |
| 1496 } |
| 1497 |
| 1498 |
1482 void AstPrinter::VisitAssignment(Assignment* node) { | 1499 void AstPrinter::VisitAssignment(Assignment* node) { |
1483 IndentedScope indent(this, Token::Name(node->op())); | 1500 IndentedScope indent(this, Token::Name(node->op())); |
1484 Visit(node->target()); | 1501 Visit(node->target()); |
1485 Visit(node->value()); | 1502 Visit(node->value()); |
1486 } | 1503 } |
1487 | 1504 |
1488 | 1505 |
1489 void AstPrinter::VisitYield(Yield* node) { | 1506 void AstPrinter::VisitYield(Yield* node) { |
1490 IndentedScope indent(this, "YIELD"); | 1507 IndentedScope indent(this, "YIELD"); |
1491 Visit(node->expression()); | 1508 Visit(node->expression()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 | 1607 |
1591 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { | 1608 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { |
1592 IndentedScope indent(this, "SUPER-CALL-REFERENCE"); | 1609 IndentedScope indent(this, "SUPER-CALL-REFERENCE"); |
1593 } | 1610 } |
1594 | 1611 |
1595 | 1612 |
1596 #endif // DEBUG | 1613 #endif // DEBUG |
1597 | 1614 |
1598 } // namespace internal | 1615 } // namespace internal |
1599 } // namespace v8 | 1616 } // namespace v8 |
OLD | NEW |