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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-asm-validator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/typing-asm.cc
diff --git a/src/typing-asm.cc b/src/typing-asm.cc
index b47e88be7f2b498a24126de0257de912ae06127e..da752418a63ba63e53b3c9e781c86817be7d60f0 100644
--- a/src/typing-asm.cc
+++ b/src/typing-asm.cc
@@ -312,13 +312,17 @@ void AsmTyper::VisitReturnStatement(ReturnStatement* stmt) {
if (!in_function_) {
return;
}
- // Returning literals handled in annotations.
- if (stmt->expression()->IsLiteral()) {
- return;
+ Literal* literal = stmt->expression()->AsLiteral();
+ if (literal) {
+ VisitLiteral(literal, true);
+ } else {
+ RECURSE(
+ VisitWithExpectation(stmt->expression(), Type::Any(),
+ "return expression expected to have return type"));
+ }
+ if (!computed_type_->Is(return_type_) || !return_type_->Is(computed_type_)) {
+ FAIL(stmt->expression(), "return type does not match function signature");
}
- RECURSE(
- VisitWithExpectation(stmt->expression(), return_type_,
- "return expression expected to have return type"));
}
« 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