Index: pkg/compiler/lib/src/warnings.dart |
diff --git a/pkg/compiler/lib/src/warnings.dart b/pkg/compiler/lib/src/warnings.dart |
index 2c8a7f7e6a80e6875a46e3e93901d7df4b6b6e70..1b1272eea532b0145dad665414ee08fd67b79c72 100644 |
--- a/pkg/compiler/lib/src/warnings.dart |
+++ b/pkg/compiler/lib/src/warnings.dart |
@@ -121,6 +121,28 @@ class MessageKind { |
static const MessageKind MEMBER_NOT_FOUND = const MessageKind( |
"No member named '#{memberName}' in class '#{className}'."); |
+ static const MessageKind AWAIT_MEMBER_NOT_FOUND = const MessageKind( |
+ "No member named 'await' in class '#{className}'.", |
+ howToFix: "Did you mean to add the 'async' marker " |
+ "to '#{functionName}'?", |
+ examples: const [""" |
+class A { |
+ m() => await -3; |
+} |
+main() => new A().m(); |
+"""]); |
+ |
+ static const MessageKind AWAIT_MEMBER_NOT_FOUND_IN_CLOSURE = |
+ const MessageKind("No member named 'await' in class '#{className}'.", |
+ howToFix: "Did you mean to add the 'async' marker " |
+ "to the enclosing function?", |
+ examples: const [""" |
+class A { |
+ m() => () => await -3; |
+} |
+main() => new A().m(); |
+"""]); |
+ |
static const MessageKind METHOD_NOT_FOUND = const MessageKind( |
"No method named '#{memberName}' in class '#{className}'."); |
@@ -158,6 +180,23 @@ class MessageKind { |
static const MessageKind CANNOT_RESOLVE = const MessageKind( |
"Cannot resolve '#{name}'."); |
+ static const MessageKind CANNOT_RESOLVE_AWAIT = const MessageKind( |
+ "Cannot resolve '#{name}'.", |
+ howToFix: "Did you mean to add the 'async' marker " |
+ "to '#{functionName}'?", |
+ examples: const [ |
+ "main() => await -3;", |
+ "foo() => await -3; main() => foo();" |
+ ]); |
+ |
+ static const MessageKind CANNOT_RESOLVE_AWAIT_IN_CLOSURE = const MessageKind( |
+ "Cannot resolve '#{name}'.", |
+ howToFix: "Did you mean to add the 'async' marker " |
+ "to the enclosing function?", |
+ examples: const [ |
+ "main() { (() => await -3)(); }", |
+ ]); |
+ |
static const MessageKind CANNOT_RESOLVE_IN_INITIALIZER = const MessageKind( |
"Cannot resolve '#{name}'. It would be implicitly looked up on this " |
"instance, but instances are not available in initializers.", |