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

Side by Side Diff: src/typing-asm.cc

Issue 1453343003: Fix multiple return statements in typing-asm, cleanup. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | test/cctest/test-asm-validator.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 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/typing-asm.h" 7 #include "src/typing-asm.h"
8 8
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 FAIL(stmt, "continue statement inside module body"); 305 FAIL(stmt, "continue statement inside module body");
306 } 306 }
307 } 307 }
308 308
309 309
310 void AsmTyper::VisitReturnStatement(ReturnStatement* stmt) { 310 void AsmTyper::VisitReturnStatement(ReturnStatement* stmt) {
311 // Handle module return statement in VisitAsmModule. 311 // Handle module return statement in VisitAsmModule.
312 if (!in_function_) { 312 if (!in_function_) {
313 return; 313 return;
314 } 314 }
315 // Returning literals handled in annotations. 315 Literal* literal = stmt->expression()->AsLiteral();
316 if (stmt->expression()->IsLiteral()) { 316 if (literal) {
317 return; 317 VisitLiteral(literal, true);
318 } else {
319 RECURSE(
320 VisitWithExpectation(stmt->expression(), Type::Any(),
321 "return expression expected to have return type"));
318 } 322 }
319 RECURSE( 323 if (!computed_type_->Is(return_type_) || !return_type_->Is(computed_type_)) {
320 VisitWithExpectation(stmt->expression(), return_type_, 324 FAIL(stmt->expression(), "return type does not match function signature");
321 "return expression expected to have return type")); 325 }
322 } 326 }
323 327
324 328
325 void AsmTyper::VisitWithStatement(WithStatement* stmt) { 329 void AsmTyper::VisitWithStatement(WithStatement* stmt) {
326 FAIL(stmt, "bad with statement"); 330 FAIL(stmt, "bad with statement");
327 } 331 }
328 332
329 333
330 void AsmTyper::VisitSwitchStatement(SwitchStatement* stmt) { 334 void AsmTyper::VisitSwitchStatement(SwitchStatement* stmt) {
331 if (!in_function_) { 335 if (!in_function_) {
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 computed_type_->Print(); 1206 computed_type_->Print();
1203 PrintF("Expected type: "); 1207 PrintF("Expected type: ");
1204 expected_type_->Print(); 1208 expected_type_->Print();
1205 #endif 1209 #endif
1206 FAIL(expr, msg); 1210 FAIL(expr, msg);
1207 } 1211 }
1208 expected_type_ = save; 1212 expected_type_ = save;
1209 } 1213 }
1210 } // namespace internal 1214 } // namespace internal
1211 } // namespace v8 1215 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-asm-validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698