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

Unified Diff: pkg/compiler/lib/src/typechecker.dart

Issue 1158453002: Allow `return;` in async method. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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 | tests/compiler/dart2js/type_checker_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/typechecker.dart
diff --git a/pkg/compiler/lib/src/typechecker.dart b/pkg/compiler/lib/src/typechecker.dart
index 82d829164ac9c90eddf7add4120202bd9f628c5c..3ad77a2f01f465ff83a4e1f70bcb0a0bd541c9c5 100644
--- a/pkg/compiler/lib/src/typechecker.dart
+++ b/pkg/compiler/lib/src/typechecker.dart
@@ -1610,7 +1610,8 @@ class TypeCheckerVisitor extends Visitor<DartType> {
checkAssignable(expression, expressionType, expectedReturnType);
}
}
-
+ } else if (currentAsyncMarker == AsyncMarker.ASYNC) {
+ // `return;` is allowed.
} else if (!types.isAssignable(expectedReturnType, const VoidType())) {
// Let f be the function immediately enclosing a return statement of the
// form 'return;' It is a static warning if both of the following
« no previous file with comments | « no previous file | tests/compiler/dart2js/type_checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698