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

Side by Side Diff: src/prettyprinter.cc

Issue 7280012: Introduce scopes to keep track of catch blocks at compile time. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update to HEAD. Created 9 years, 5 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 Print(") "); 196 Print(") ");
197 Visit(node->body()); 197 Visit(node->body());
198 } 198 }
199 199
200 200
201 void PrettyPrinter::VisitTryCatchStatement(TryCatchStatement* node) { 201 void PrettyPrinter::VisitTryCatchStatement(TryCatchStatement* node) {
202 Print("try "); 202 Print("try ");
203 Visit(node->try_block()); 203 Visit(node->try_block());
204 Print(" catch ("); 204 Print(" catch (");
205 const bool quote = false; 205 const bool quote = false;
206 PrintLiteral(node->name(), quote); 206 PrintLiteral(node->variable()->name(), quote);
207 Print(") "); 207 Print(") ");
208 Visit(node->catch_block()); 208 Visit(node->catch_block());
209 } 209 }
210 210
211 211
212 void PrettyPrinter::VisitTryFinallyStatement(TryFinallyStatement* node) { 212 void PrettyPrinter::VisitTryFinallyStatement(TryFinallyStatement* node) {
213 Print("try "); 213 Print("try ");
214 Visit(node->try_block()); 214 Visit(node->try_block());
215 Print(" finally "); 215 Print(" finally ");
216 Visit(node->finally_block()); 216 Visit(node->finally_block());
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 IndentedScope indent(this, "FOR IN"); 849 IndentedScope indent(this, "FOR IN");
850 PrintIndentedVisit("FOR", node->each()); 850 PrintIndentedVisit("FOR", node->each());
851 PrintIndentedVisit("IN", node->enumerable()); 851 PrintIndentedVisit("IN", node->enumerable());
852 PrintIndentedVisit("BODY", node->body()); 852 PrintIndentedVisit("BODY", node->body());
853 } 853 }
854 854
855 855
856 void AstPrinter::VisitTryCatchStatement(TryCatchStatement* node) { 856 void AstPrinter::VisitTryCatchStatement(TryCatchStatement* node) {
857 IndentedScope indent(this, "TRY CATCH"); 857 IndentedScope indent(this, "TRY CATCH");
858 PrintIndentedVisit("TRY", node->try_block()); 858 PrintIndentedVisit("TRY", node->try_block());
859 const bool quote = false; 859 PrintLiteralWithModeIndented("CATCHVAR",
860 PrintLiteralIndented("CATCHVAR", node->name(), quote); 860 node->variable(),
861 node->variable()->name());
861 PrintIndentedVisit("CATCH", node->catch_block()); 862 PrintIndentedVisit("CATCH", node->catch_block());
862 } 863 }
863 864
864 865
865 void AstPrinter::VisitTryFinallyStatement(TryFinallyStatement* node) { 866 void AstPrinter::VisitTryFinallyStatement(TryFinallyStatement* node) {
866 IndentedScope indent(this, "TRY FINALLY"); 867 IndentedScope indent(this, "TRY FINALLY");
867 PrintIndentedVisit("TRY", node->try_block()); 868 PrintIndentedVisit("TRY", node->try_block());
868 PrintIndentedVisit("FINALLY", node->finally_block()); 869 PrintIndentedVisit("FINALLY", node->finally_block());
869 } 870 }
870 871
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 TagScope tag(this, "ForInStatement"); 1238 TagScope tag(this, "ForInStatement");
1238 Visit(stmt->each()); 1239 Visit(stmt->each());
1239 Visit(stmt->enumerable()); 1240 Visit(stmt->enumerable());
1240 Visit(stmt->body()); 1241 Visit(stmt->body());
1241 } 1242 }
1242 1243
1243 1244
1244 void JsonAstBuilder::VisitTryCatchStatement(TryCatchStatement* stmt) { 1245 void JsonAstBuilder::VisitTryCatchStatement(TryCatchStatement* stmt) {
1245 TagScope tag(this, "TryCatchStatement"); 1246 TagScope tag(this, "TryCatchStatement");
1246 { AttributesScope attributes(this); 1247 { AttributesScope attributes(this);
1247 AddAttribute("variable", stmt->name()); 1248 AddAttribute("variable", stmt->variable()->name());
1248 } 1249 }
1249 Visit(stmt->try_block()); 1250 Visit(stmt->try_block());
1250 Visit(stmt->catch_block()); 1251 Visit(stmt->catch_block());
1251 } 1252 }
1252 1253
1253 1254
1254 void JsonAstBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) { 1255 void JsonAstBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) {
1255 TagScope tag(this, "TryFinallyStatement"); 1256 TagScope tag(this, "TryFinallyStatement");
1256 Visit(stmt->try_block()); 1257 Visit(stmt->try_block());
1257 Visit(stmt->finally_block()); 1258 Visit(stmt->finally_block());
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 AddAttribute("mode", Variable::Mode2String(decl->mode())); 1465 AddAttribute("mode", Variable::Mode2String(decl->mode()));
1465 } 1466 }
1466 Visit(decl->proxy()); 1467 Visit(decl->proxy());
1467 if (decl->fun() != NULL) Visit(decl->fun()); 1468 if (decl->fun() != NULL) Visit(decl->fun());
1468 } 1469 }
1469 1470
1470 1471
1471 #endif // DEBUG 1472 #endif // DEBUG
1472 1473
1473 } } // namespace v8::internal 1474 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698