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

Unified Diff: src/ast-expression-visitor.cc

Issue 1316633002: Fix AstExpressionVisitor to correctly handle switch + for. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-ast-expression-visitor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast-expression-visitor.cc
diff --git a/src/ast-expression-visitor.cc b/src/ast-expression-visitor.cc
index 08f29501940a33642bb82bce62c3cc39a4ee5c7f..aa37f263450ccb06e076178c2fa3f2b42e4e3a06 100644
--- a/src/ast-expression-visitor.cc
+++ b/src/ast-expression-visitor.cc
@@ -111,8 +111,10 @@ void AstExpressionVisitor::VisitSwitchStatement(SwitchStatement* stmt) {
for (int i = 0; i < clauses->length(); ++i) {
CaseClause* clause = clauses->at(i);
- Expression* label = clause->label();
- RECURSE(Visit(label));
+ if (!clause->is_default()) {
+ Expression* label = clause->label();
+ RECURSE(Visit(label));
+ }
ZoneList<Statement*>* stmts = clause->statements();
RECURSE(VisitStatements(stmts));
}
@@ -137,9 +139,15 @@ void AstExpressionVisitor::VisitWhileStatement(WhileStatement* stmt) {
void AstExpressionVisitor::VisitForStatement(ForStatement* stmt) {
- RECURSE(Visit(stmt->init()));
- RECURSE(Visit(stmt->cond()));
- RECURSE(Visit(stmt->next()));
+ if (stmt->init() != NULL) {
+ RECURSE(Visit(stmt->init()));
+ }
+ if (stmt->cond() != NULL) {
+ RECURSE(Visit(stmt->cond()));
+ }
+ if (stmt->next() != NULL) {
+ RECURSE(Visit(stmt->next()));
+ }
RECURSE(Visit(stmt->body()));
}
« no previous file with comments | « no previous file | test/cctest/test-ast-expression-visitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698