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

Side by Side Diff: src/prettyprinter.cc

Issue 1189743003: [destructuring] Implement parameter pattern matching. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months 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 <stdarg.h> 5 #include <stdarg.h>
6 6
7 #include "src/v8.h" 7 #include "src/v8.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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 986
987 void PrettyPrinter::PrintLiteral(const AstRawString* value, bool quote) { 987 void PrettyPrinter::PrintLiteral(const AstRawString* value, bool quote) {
988 PrintLiteral(value->string(), quote); 988 PrintLiteral(value->string(), quote);
989 } 989 }
990 990
991 991
992 void PrettyPrinter::PrintParameters(Scope* scope) { 992 void PrettyPrinter::PrintParameters(Scope* scope) {
993 Print("("); 993 Print("(");
994 for (int i = 0; i < scope->num_parameters(); i++) { 994 for (int i = 0; i < scope->num_parameters(); i++) {
995 if (i > 0) Print(", "); 995 if (i > 0) Print(", ");
996 PrintLiteral(scope->parameter(i)->name(), false); 996 PrintLiteral(scope->parameter_var(i)->name(), false);
997 } 997 }
998 Print(")"); 998 Print(")");
999 } 999 }
1000 1000
1001 1001
1002 void PrettyPrinter::PrintDeclarations(ZoneList<Declaration*>* declarations) { 1002 void PrettyPrinter::PrintDeclarations(ZoneList<Declaration*>* declarations) {
1003 for (int i = 0; i < declarations->length(); i++) { 1003 for (int i = 0; i < declarations->length(); i++) {
1004 if (i > 0) Print(" "); 1004 if (i > 0) Print(" ");
1005 Visit(declarations->at(i)); 1005 Visit(declarations->at(i));
1006 } 1006 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 Visit(declarations->at(i)); 1117 Visit(declarations->at(i));
1118 } 1118 }
1119 } 1119 }
1120 } 1120 }
1121 1121
1122 1122
1123 void AstPrinter::PrintParameters(Scope* scope) { 1123 void AstPrinter::PrintParameters(Scope* scope) {
1124 if (scope->num_parameters() > 0) { 1124 if (scope->num_parameters() > 0) {
1125 IndentedScope indent(this, "PARAMS"); 1125 IndentedScope indent(this, "PARAMS");
1126 for (int i = 0; i < scope->num_parameters(); i++) { 1126 for (int i = 0; i < scope->num_parameters(); i++) {
1127 PrintLiteralWithModeIndented("VAR", scope->parameter(i), 1127 PrintLiteralWithModeIndented("VAR", scope->parameter_var(i),
1128 scope->parameter(i)->name()); 1128 scope->parameter_var(i)->name());
1129 } 1129 }
1130 } 1130 }
1131 } 1131 }
1132 1132
1133 1133
1134 void AstPrinter::PrintStatements(ZoneList<Statement*>* statements) { 1134 void AstPrinter::PrintStatements(ZoneList<Statement*>* statements) {
1135 for (int i = 0; i < statements->length(); i++) { 1135 for (int i = 0; i < statements->length(); i++) {
1136 Visit(statements->at(i)); 1136 Visit(statements->at(i));
1137 } 1137 }
1138 } 1138 }
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 1542
1543 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { 1543 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) {
1544 IndentedScope indent(this, "SUPER-CALL-REFERENCE"); 1544 IndentedScope indent(this, "SUPER-CALL-REFERENCE");
1545 } 1545 }
1546 1546
1547 1547
1548 #endif // DEBUG 1548 #endif // DEBUG
1549 1549
1550 } // namespace internal 1550 } // namespace internal
1551 } // namespace v8 1551 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698