Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/ast-expression-visitor.h" | 7 #include "src/ast-expression-visitor.h" |
| 8 | 8 |
| 9 #include "src/ast.h" | 9 #include "src/ast.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 } | 104 } |
| 105 | 105 |
| 106 | 106 |
| 107 void AstExpressionVisitor::VisitSwitchStatement(SwitchStatement* stmt) { | 107 void AstExpressionVisitor::VisitSwitchStatement(SwitchStatement* stmt) { |
| 108 RECURSE(Visit(stmt->tag())); | 108 RECURSE(Visit(stmt->tag())); |
| 109 | 109 |
| 110 ZoneList<CaseClause*>* clauses = stmt->cases(); | 110 ZoneList<CaseClause*>* clauses = stmt->cases(); |
| 111 | 111 |
| 112 for (int i = 0; i < clauses->length(); ++i) { | 112 for (int i = 0; i < clauses->length(); ++i) { |
| 113 CaseClause* clause = clauses->at(i); | 113 CaseClause* clause = clauses->at(i); |
| 114 Expression* label = clause->label(); | 114 if (!clause->is_default()) { |
| 115 RECURSE(Visit(label)); | 115 Expression* label = clause->label(); |
| 116 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.
| |
| 117 RECURSE(Visit(label)); | |
| 118 } | |
| 116 ZoneList<Statement*>* stmts = clause->statements(); | 119 ZoneList<Statement*>* stmts = clause->statements(); |
| 117 RECURSE(VisitStatements(stmts)); | 120 RECURSE(VisitStatements(stmts)); |
| 118 } | 121 } |
| 119 } | 122 } |
| 120 | 123 |
| 121 | 124 |
| 122 void AstExpressionVisitor::VisitCaseClause(CaseClause* clause) { | 125 void AstExpressionVisitor::VisitCaseClause(CaseClause* clause) { |
| 123 UNREACHABLE(); | 126 UNREACHABLE(); |
| 124 } | 127 } |
| 125 | 128 |
| 126 | 129 |
| 127 void AstExpressionVisitor::VisitDoWhileStatement(DoWhileStatement* stmt) { | 130 void AstExpressionVisitor::VisitDoWhileStatement(DoWhileStatement* stmt) { |
| 128 RECURSE(Visit(stmt->body())); | 131 RECURSE(Visit(stmt->body())); |
| 129 RECURSE(Visit(stmt->cond())); | 132 RECURSE(Visit(stmt->cond())); |
| 130 } | 133 } |
| 131 | 134 |
| 132 | 135 |
| 133 void AstExpressionVisitor::VisitWhileStatement(WhileStatement* stmt) { | 136 void AstExpressionVisitor::VisitWhileStatement(WhileStatement* stmt) { |
| 134 RECURSE(Visit(stmt->cond())); | 137 RECURSE(Visit(stmt->cond())); |
| 135 RECURSE(Visit(stmt->body())); | 138 RECURSE(Visit(stmt->body())); |
| 136 } | 139 } |
| 137 | 140 |
| 138 | 141 |
| 139 void AstExpressionVisitor::VisitForStatement(ForStatement* stmt) { | 142 void AstExpressionVisitor::VisitForStatement(ForStatement* stmt) { |
| 140 RECURSE(Visit(stmt->init())); | 143 if (stmt->init() != NULL) { |
| 141 RECURSE(Visit(stmt->cond())); | 144 RECURSE(Visit(stmt->init())); |
| 142 RECURSE(Visit(stmt->next())); | 145 } |
| 146 if (stmt->cond() != NULL) { | |
| 147 RECURSE(Visit(stmt->cond())); | |
| 148 } | |
| 149 if (stmt->next() != NULL) { | |
| 150 RECURSE(Visit(stmt->next())); | |
| 151 } | |
| 143 RECURSE(Visit(stmt->body())); | 152 RECURSE(Visit(stmt->body())); |
| 144 } | 153 } |
| 145 | 154 |
| 146 | 155 |
| 147 void AstExpressionVisitor::VisitForInStatement(ForInStatement* stmt) { | 156 void AstExpressionVisitor::VisitForInStatement(ForInStatement* stmt) { |
| 148 RECURSE(Visit(stmt->enumerable())); | 157 RECURSE(Visit(stmt->enumerable())); |
| 149 RECURSE(Visit(stmt->body())); | 158 RECURSE(Visit(stmt->body())); |
| 150 } | 159 } |
| 151 | 160 |
| 152 | 161 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 | 337 |
| 329 void AstExpressionVisitor::VisitSuperPropertyReference( | 338 void AstExpressionVisitor::VisitSuperPropertyReference( |
| 330 SuperPropertyReference* expr) {} | 339 SuperPropertyReference* expr) {} |
| 331 | 340 |
| 332 | 341 |
| 333 void AstExpressionVisitor::VisitSuperCallReference(SuperCallReference* expr) {} | 342 void AstExpressionVisitor::VisitSuperCallReference(SuperCallReference* expr) {} |
| 334 } | 343 } |
| 335 | 344 |
| 336 | 345 |
| 337 } // namespace v8::internal | 346 } // namespace v8::internal |
| OLD | NEW |