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

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 6eb0899741e0e7f389f945ec517ec342fadd095a..8cff018af038f0b2f4f28339c675b297dbdc4b82 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -2318,11 +2318,23 @@ 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') {
+ var functionName = enclosingElement.name;
+ if (functionName == '') {
+ kind = MessageKind.CANNOT_RESOLVE_AWAIT_IN_CLOSURE;
+ } else {
+ kind = MessageKind.CANNOT_RESOLVE_AWAIT;
+ arguments['functionName'] = functionName;
+ }
+ } 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