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

Unified Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 12298029: Turn error into warning for non-static member access through the class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix co19 status. Created 7 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 | « sdk/lib/_internal/compiler/implementation/elements/modelx.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index c72715dc5c64c77fe6da1b7da43385c96e820679..212a5b2f7753e6af492901a7397f79749fe40f0b 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -1953,7 +1953,7 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
return null;
}
target = receiverClass.lookupLocalMember(name);
- if (target == null) {
+ if (target == null || target.isInstanceMember()) {
compiler.backend.registerThrowNoSuchMethod();
// TODO(johnniwinther): With the simplified [TreeElements] invariant,
// try to resolve injected elements if [currentClass] is in the patch
@@ -1962,14 +1962,12 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
// TODO(karlklose): this should be reported by the caller of
// [resolveSend] to select better warning messages for getters and
// setters.
- return warnAndCreateErroneousElement(node, name,
- MessageKind.METHOD_NOT_FOUND,
+ MessageKind kind = (target == null)
+ ? MessageKind.METHOD_NOT_FOUND
+ : MessageKind.MEMBER_NOT_STATIC;
+ return warnAndCreateErroneousElement(node, name, kind,
{'className': receiverClass.name,
'methodName': name});
- } else if (target.isInstanceMember()) {
- error(node, MessageKind.MEMBER_NOT_STATIC,
- {'className': receiverClass.name,
- 'memberName': name});
}
} else if (identical(resolvedReceiver.kind, ElementKind.PREFIX)) {
PrefixElement prefix = resolvedReceiver;
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/elements/modelx.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698