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

Side by Side Diff: src/prettyprinter.cc

Issue 1309813007: [es6] implement destructuring assignment (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: An implementation Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 245
246 void CallPrinter::VisitRegExpLiteral(RegExpLiteral* node) { 246 void CallPrinter::VisitRegExpLiteral(RegExpLiteral* node) {
247 Print("/"); 247 Print("/");
248 PrintLiteral(node->pattern(), false); 248 PrintLiteral(node->pattern(), false);
249 Print("/"); 249 Print("/");
250 PrintLiteral(node->flags(), false); 250 PrintLiteral(node->flags(), false);
251 } 251 }
252 252
253 253
254 void CallPrinter::VisitAssignmentPattern(AssignmentPattern* node) {
255 Visit(node->pattern());
256 }
257
258
254 void CallPrinter::VisitObjectLiteral(ObjectLiteral* node) { 259 void CallPrinter::VisitObjectLiteral(ObjectLiteral* node) {
255 for (int i = 0; i < node->properties()->length(); i++) { 260 for (int i = 0; i < node->properties()->length(); i++) {
256 Find(node->properties()->at(i)->value()); 261 Find(node->properties()->at(i)->value());
257 } 262 }
258 } 263 }
259 264
260 265
261 void CallPrinter::VisitArrayLiteral(ArrayLiteral* node) { 266 void CallPrinter::VisitArrayLiteral(ArrayLiteral* node) {
262 Print("["); 267 Print("[");
263 for (int i = 0; i < node->values()->length(); i++) { 268 for (int i = 0; i < node->values()->length(); i++) {
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 732
728 void PrettyPrinter::VisitRegExpLiteral(RegExpLiteral* node) { 733 void PrettyPrinter::VisitRegExpLiteral(RegExpLiteral* node) {
729 Print(" RegExp("); 734 Print(" RegExp(");
730 PrintLiteral(node->pattern(), false); 735 PrintLiteral(node->pattern(), false);
731 Print(","); 736 Print(",");
732 PrintLiteral(node->flags(), false); 737 PrintLiteral(node->flags(), false);
733 Print(") "); 738 Print(") ");
734 } 739 }
735 740
736 741
742 void PrettyPrinter::VisitAssignmentPattern(AssignmentPattern* node) {
743 Visit(node->pattern());
744 }
745
746
737 void PrettyPrinter::VisitObjectLiteral(ObjectLiteral* node) { 747 void PrettyPrinter::VisitObjectLiteral(ObjectLiteral* node) {
738 Print("{ "); 748 Print("{ ");
739 for (int i = 0; i < node->properties()->length(); i++) { 749 for (int i = 0; i < node->properties()->length(); i++) {
740 if (i != 0) Print(","); 750 if (i != 0) Print(",");
741 PrintObjectLiteralProperty(node->properties()->at(i)); 751 PrintObjectLiteralProperty(node->properties()->at(i));
742 } 752 }
743 Print(" }"); 753 Print(" }");
744 } 754 }
745 755
746 756
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) { 1468 void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) {
1459 IndentedScope indent(this, "REGEXP LITERAL", node->position()); 1469 IndentedScope indent(this, "REGEXP LITERAL", node->position());
1460 EmbeddedVector<char, 128> buf; 1470 EmbeddedVector<char, 128> buf;
1461 SNPrintF(buf, "literal_index = %d\n", node->literal_index()); 1471 SNPrintF(buf, "literal_index = %d\n", node->literal_index());
1462 PrintIndented(buf.start()); 1472 PrintIndented(buf.start());
1463 PrintLiteralIndented("PATTERN", node->pattern(), false); 1473 PrintLiteralIndented("PATTERN", node->pattern(), false);
1464 PrintLiteralIndented("FLAGS", node->flags(), false); 1474 PrintLiteralIndented("FLAGS", node->flags(), false);
1465 } 1475 }
1466 1476
1467 1477
1478 void AstPrinter::VisitAssignmentPattern(AssignmentPattern* node) {
1479 IndentedScope indent(this, "ASSIGNMENT PATTERN", node->position());
1480 Visit(node->pattern());
1481 }
1482
1483
1468 void AstPrinter::VisitObjectLiteral(ObjectLiteral* node) { 1484 void AstPrinter::VisitObjectLiteral(ObjectLiteral* node) {
1469 IndentedScope indent(this, "OBJ LITERAL", node->position()); 1485 IndentedScope indent(this, "OBJ LITERAL", node->position());
1470 EmbeddedVector<char, 128> buf; 1486 EmbeddedVector<char, 128> buf;
1471 SNPrintF(buf, "literal_index = %d\n", node->literal_index()); 1487 SNPrintF(buf, "literal_index = %d\n", node->literal_index());
1472 PrintIndented(buf.start()); 1488 PrintIndented(buf.start());
1473 PrintProperties(node->properties()); 1489 PrintProperties(node->properties());
1474 } 1490 }
1475 1491
1476 1492
1477 void AstPrinter::VisitArrayLiteral(ArrayLiteral* node) { 1493 void AstPrinter::VisitArrayLiteral(ArrayLiteral* node) {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 1645
1630 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { 1646 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) {
1631 IndentedScope indent(this, "SUPER-CALL-REFERENCE", node->position()); 1647 IndentedScope indent(this, "SUPER-CALL-REFERENCE", node->position());
1632 } 1648 }
1633 1649
1634 1650
1635 #endif // DEBUG 1651 #endif // DEBUG
1636 1652
1637 } // namespace internal 1653 } // namespace internal
1638 } // namespace v8 1654 } // namespace v8
OLDNEW
« src/preparser.h ('K') | « src/preparser.h ('k') | src/typing-asm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698