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

Unified Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 1094903002: Better hints for await in non-async functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | pkg/compiler/lib/src/typechecker.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/resolution/members.dart
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart
index 837fb401e856eac7faa3df939601f43bd8be2c8a..4fae13c1eb30e384b5db923b9dbd89d73a4dd3e6 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -2318,11 +2318,20 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
// is equivalent to `this.id(a1 , ...)`.
bool inInitializer = enclosingElement.isGenerativeConstructor ||
(enclosingElement.isInstanceMember && enclosingElement.isField);
- MessageKind kind = inInitializer
- ? MessageKind.CANNOT_RESOLVE_IN_INITIALIZER
- : MessageKind.CANNOT_RESOLVE;
- element = reportAndCreateErroneousElement(node, node.source, kind,
- {'name': node.source}, isError: inInitializer);
+ MessageKind kind;
+ Map arguments = {'name': name};
+ if (inInitializer) {
+ kind = MessageKind.CANNOT_RESOLVE_IN_INITIALIZER;
+ } else if (name == 'await') {
+ kind = MessageKind.CANNOT_RESOLVE_AWAIT;
Johnni Winther 2015/04/17 18:01:31 Due to localization (if ever needed) we try not to
Siggi Cherem (dart-lang) 2015/04/17 20:58:51 Ah, I see. I went ahead and divided the message in
+ arguments['enclosingFunctionText'] = enclosingElement.name == ''
+ ? 'the enclosing function'
+ : "'${enclosingElement.name}'";
+ } else {
+ kind = MessageKind.CANNOT_RESOLVE;
+ }
+ element = reportAndCreateErroneousElement(node, name, kind,
+ arguments, isError: inInitializer);
registry.registerThrowNoSuchMethod();
}
} else if (element.isErroneous) {
« no previous file with comments | « no previous file | pkg/compiler/lib/src/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698