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

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

Issue 962603002: Typecheck return with respect to async. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated and tested. Created 5 years, 10 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 | « pkg/compiler/lib/src/typechecker.dart ('k') | tests/compiler/dart2js/mock_libraries.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/warnings.dart
diff --git a/pkg/compiler/lib/src/warnings.dart b/pkg/compiler/lib/src/warnings.dart
index 6a78b8adff1a26d5283a59e0f4e2252c52ed21cf..e00c01d41d6e0cd14587b85569b9c6b27a764884 100644
--- a/pkg/compiler/lib/src/warnings.dart
+++ b/pkg/compiler/lib/src/warnings.dart
@@ -2132,7 +2132,7 @@ main() => new A();""",
"""
class A {
A();
- factory A.a() async* => new A();
+ factory A.a() async* {}
}
main() => new A.a();"""]);
@@ -2176,6 +2176,23 @@ main() sync* {
var yield;
}"""]);
+ static const MessageKind RETURN_IN_GENERATOR =
+ const MessageKind(
+ "'return' with a value is not allowed in a method body using the "
+ "'#{modifier}' modifier.",
+ howToFix: "Try removing the value, replacing 'return' with 'yield' "
+ "or changing the method body modifier.",
+ examples: const [
+"""
+foo() async* { return 0; }
+main() => foo();
+""",
+
+"""
+foo() sync* { return 0; }
+main() => foo();
+"""]);
+
static const MessageKind NATIVE_NOT_SUPPORTED = const MessageKind(
"'native' modifier is not supported.",
howToFix: "Try removing the 'native' implementation or analyzing the "
« no previous file with comments | « pkg/compiler/lib/src/typechecker.dart ('k') | tests/compiler/dart2js/mock_libraries.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698