Chromium Code Reviews| Index: src/ast-expression-visitor.cc |
| diff --git a/src/ast-expression-visitor.cc b/src/ast-expression-visitor.cc |
| index 08f29501940a33642bb82bce62c3cc39a4ee5c7f..6a92fcf34032bda63fe5b4ccf7f12219a00819d2 100644 |
| --- a/src/ast-expression-visitor.cc |
| +++ b/src/ast-expression-visitor.cc |
| @@ -111,8 +111,11 @@ 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(); |
| + VisitExpression(label); |
|
rossberg
2015/08/25 06:33:33
Why is the label visited twice?
bradn
2015/08/25 07:40:19
oops, mistake.
Fixed.
|
| + RECURSE(Visit(label)); |
| + } |
| ZoneList<Statement*>* stmts = clause->statements(); |
| RECURSE(VisitStatements(stmts)); |
| } |
| @@ -137,9 +140,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())); |
| } |