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

Side by Side Diff: src/prettyprinter.cc

Issue 15300018: Add initial parser support for harmony iteration (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase onto current master Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/preparser.cc ('k') | src/rewriter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 PrintLabels(node->labels()); 248 PrintLabels(node->labels());
249 Print("for ("); 249 Print("for (");
250 Visit(node->each()); 250 Visit(node->each());
251 Print(" in "); 251 Print(" in ");
252 Visit(node->enumerable()); 252 Visit(node->enumerable());
253 Print(") "); 253 Print(") ");
254 Visit(node->body()); 254 Visit(node->body());
255 } 255 }
256 256
257 257
258 void PrettyPrinter::VisitForOfStatement(ForOfStatement* node) {
259 PrintLabels(node->labels());
260 Print("for (");
261 Visit(node->each());
262 Print(" of ");
263 Visit(node->iterable());
264 Print(") ");
265 Visit(node->body());
266 }
267
268
258 void PrettyPrinter::VisitTryCatchStatement(TryCatchStatement* node) { 269 void PrettyPrinter::VisitTryCatchStatement(TryCatchStatement* node) {
259 Print("try "); 270 Print("try ");
260 Visit(node->try_block()); 271 Visit(node->try_block());
261 Print(" catch ("); 272 Print(" catch (");
262 const bool quote = false; 273 const bool quote = false;
263 PrintLiteral(node->variable()->name(), quote); 274 PrintLiteral(node->variable()->name(), quote);
264 Print(") "); 275 Print(") ");
265 Visit(node->catch_block()); 276 Visit(node->catch_block());
266 } 277 }
267 278
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 933
923 934
924 void AstPrinter::VisitForInStatement(ForInStatement* node) { 935 void AstPrinter::VisitForInStatement(ForInStatement* node) {
925 IndentedScope indent(this, "FOR IN"); 936 IndentedScope indent(this, "FOR IN");
926 PrintIndentedVisit("FOR", node->each()); 937 PrintIndentedVisit("FOR", node->each());
927 PrintIndentedVisit("IN", node->enumerable()); 938 PrintIndentedVisit("IN", node->enumerable());
928 PrintIndentedVisit("BODY", node->body()); 939 PrintIndentedVisit("BODY", node->body());
929 } 940 }
930 941
931 942
943 void AstPrinter::VisitForOfStatement(ForOfStatement* node) {
944 IndentedScope indent(this, "FOR OF");
945 PrintIndentedVisit("FOR", node->each());
946 PrintIndentedVisit("OF", node->iterable());
947 PrintIndentedVisit("BODY", node->body());
948 }
949
950
932 void AstPrinter::VisitTryCatchStatement(TryCatchStatement* node) { 951 void AstPrinter::VisitTryCatchStatement(TryCatchStatement* node) {
933 IndentedScope indent(this, "TRY CATCH"); 952 IndentedScope indent(this, "TRY CATCH");
934 PrintIndentedVisit("TRY", node->try_block()); 953 PrintIndentedVisit("TRY", node->try_block());
935 PrintLiteralWithModeIndented("CATCHVAR", 954 PrintLiteralWithModeIndented("CATCHVAR",
936 node->variable(), 955 node->variable(),
937 node->variable()->name()); 956 node->variable()->name());
938 PrintIndentedVisit("CATCH", node->catch_block()); 957 PrintIndentedVisit("CATCH", node->catch_block());
939 } 958 }
940 959
941 960
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 } 1160 }
1142 1161
1143 1162
1144 void AstPrinter::VisitThisFunction(ThisFunction* node) { 1163 void AstPrinter::VisitThisFunction(ThisFunction* node) {
1145 IndentedScope indent(this, "THIS-FUNCTION"); 1164 IndentedScope indent(this, "THIS-FUNCTION");
1146 } 1165 }
1147 1166
1148 #endif // DEBUG 1167 #endif // DEBUG
1149 1168
1150 } } // namespace v8::internal 1169 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/preparser.cc ('k') | src/rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698