Chromium Code Reviews| 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(); |
| } |