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

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

Issue 1089463003: Do not use erroneouselement unless the member is static (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 | tests/co19/co19-dart2js.status » ('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 b9d2abda17880060291d3a1056589c1ec3bd85af..1b41327d1622f57a20ed1ce41e5c5fe7119fa08b 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -3012,14 +3012,28 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
MessageKind.ASSIGNING_TYPE, const {});
registry.registerThrowNoSuchMethod();
} else if (target.isFinal || target.isConst) {
- setter = reportAndCreateErroneousElement(
+ if (Elements.isStaticOrTopLevelField(target) || target.isLocal) {
+ setter = reportAndCreateErroneousElement(
node.selector, target.name, MessageKind.CANNOT_RESOLVE_SETTER,
const {});
+ } else {
+ // For instance fields we don't report a warning here because the type
+ // checker will detect this as well and report a better error message
+ // with the context of the containing class.
+ }
registry.registerThrowNoSuchMethod();
+ if (node.isSuperCall) registry.registerSuperNoSuchMethod();
Johnni Winther 2015/04/16 07:41:05 This case should create an ErrenousElement since t
Siggi Cherem (dart-lang) 2015/04/16 15:49:44 Interesting - I'll create a follow up CL with this
Siggi Cherem (dart-lang) 2015/04/16 19:58:15 I tried this out, but I think this makes the errro
} else if (target.isFunction && target.name != '[]=') {
assert(!target.isSetter);
- setter = reportAndCreateErroneousElement(
- node.selector, target.name, MessageKind.ASSIGNING_METHOD, const {});
+ if (Elements.isStaticOrTopLevelFunction(target) || target.isLocal) {
+ setter = reportAndCreateErroneousElement(
+ node.selector, target.name, MessageKind.ASSIGNING_METHOD,
+ const {});
+ } else {
+ // For instance methods we don't report a warning here because the
+ // type checker will detect this as well and report a better error
+ // message with the context of the containing class.
+ }
registry.registerThrowNoSuchMethod();
if (node.isSuperCall) registry.registerSuperNoSuchMethod();
}
« no previous file with comments | « no previous file | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698