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

Side by Side Diff: src/prettyprinter.cc

Issue 7618007: Simplify handling of exits from with and catch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporate review comments Created 9 years, 4 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/parser.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 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 118
119 void PrettyPrinter::VisitReturnStatement(ReturnStatement* node) { 119 void PrettyPrinter::VisitReturnStatement(ReturnStatement* node) {
120 Print("return "); 120 Print("return ");
121 Visit(node->expression()); 121 Visit(node->expression());
122 Print(";"); 122 Print(";");
123 } 123 }
124 124
125 125
126 void PrettyPrinter::VisitEnterWithContextStatement( 126 void PrettyPrinter::VisitWithStatement(WithStatement* node) {
127 EnterWithContextStatement* node) { 127 Print("with (");
128 Print("<enter with context> (");
129 Visit(node->expression()); 128 Visit(node->expression());
130 Print(") "); 129 Print(") ");
130 Visit(node->statement());
131 } 131 }
132 132
133 133
134 void PrettyPrinter::VisitExitContextStatement(ExitContextStatement* node) { 134 void PrettyPrinter::VisitExitContextStatement(ExitContextStatement* node) {
135 Print("<exit context>"); 135 Print("<exit context>");
136 } 136 }
137 137
138 138
139 void PrettyPrinter::VisitSwitchStatement(SwitchStatement* node) { 139 void PrettyPrinter::VisitSwitchStatement(SwitchStatement* node) {
140 PrintLabels(node->labels()); 140 PrintLabels(node->labels());
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 void AstPrinter::VisitBreakStatement(BreakStatement* node) { 791 void AstPrinter::VisitBreakStatement(BreakStatement* node) {
792 PrintLabelsIndented("BREAK", node->target()->labels()); 792 PrintLabelsIndented("BREAK", node->target()->labels());
793 } 793 }
794 794
795 795
796 void AstPrinter::VisitReturnStatement(ReturnStatement* node) { 796 void AstPrinter::VisitReturnStatement(ReturnStatement* node) {
797 PrintIndentedVisit("RETURN", node->expression()); 797 PrintIndentedVisit("RETURN", node->expression());
798 } 798 }
799 799
800 800
801 void AstPrinter::VisitEnterWithContextStatement( 801 void AstPrinter::VisitWithStatement(WithStatement* node) {
802 EnterWithContextStatement* node) { 802 IndentedScope indent(this, "WITH");
803 PrintIndentedVisit("ENTER WITH CONTEXT", node->expression()); 803 PrintIndentedVisit("OBJECT", node->expression());
804 PrintIndentedVisit("BODY", node->statement());
804 } 805 }
805 806
806 807
807 void AstPrinter::VisitExitContextStatement(ExitContextStatement* node) { 808 void AstPrinter::VisitExitContextStatement(ExitContextStatement* node) {
808 PrintIndented("EXIT CONTEXT\n"); 809 PrintIndented("EXIT CONTEXT\n");
809 } 810 }
810 811
811 812
812 void AstPrinter::VisitSwitchStatement(SwitchStatement* node) { 813 void AstPrinter::VisitSwitchStatement(SwitchStatement* node) {
813 IndentedScope indent(this, "SWITCH"); 814 IndentedScope indent(this, "SWITCH");
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 TagScope tag(this, "BreakStatement"); 1188 TagScope tag(this, "BreakStatement");
1188 } 1189 }
1189 1190
1190 1191
1191 void JsonAstBuilder::VisitReturnStatement(ReturnStatement* stmt) { 1192 void JsonAstBuilder::VisitReturnStatement(ReturnStatement* stmt) {
1192 TagScope tag(this, "ReturnStatement"); 1193 TagScope tag(this, "ReturnStatement");
1193 Visit(stmt->expression()); 1194 Visit(stmt->expression());
1194 } 1195 }
1195 1196
1196 1197
1197 void JsonAstBuilder::VisitEnterWithContextStatement( 1198 void JsonAstBuilder::VisitWithStatement(WithStatement* stmt) {
1198 EnterWithContextStatement* stmt) { 1199 TagScope tag(this, "WithStatement");
1199 TagScope tag(this, "EnterWithContextStatement");
1200 Visit(stmt->expression()); 1200 Visit(stmt->expression());
1201 Visit(stmt->statement());
1201 } 1202 }
1202 1203
1203 1204
1204 void JsonAstBuilder::VisitExitContextStatement(ExitContextStatement* stmt) { 1205 void JsonAstBuilder::VisitExitContextStatement(ExitContextStatement* stmt) {
1205 TagScope tag(this, "ExitContextStatement"); 1206 TagScope tag(this, "ExitContextStatement");
1206 } 1207 }
1207 1208
1208 1209
1209 void JsonAstBuilder::VisitSwitchStatement(SwitchStatement* stmt) { 1210 void JsonAstBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
1210 TagScope tag(this, "SwitchStatement"); 1211 TagScope tag(this, "SwitchStatement");
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 AddAttribute("mode", Variable::Mode2String(decl->mode())); 1466 AddAttribute("mode", Variable::Mode2String(decl->mode()));
1466 } 1467 }
1467 Visit(decl->proxy()); 1468 Visit(decl->proxy());
1468 if (decl->fun() != NULL) Visit(decl->fun()); 1469 if (decl->fun() != NULL) Visit(decl->fun());
1469 } 1470 }
1470 1471
1471 1472
1472 #endif // DEBUG 1473 #endif // DEBUG
1473 1474
1474 } } // namespace v8::internal 1475 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698