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

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

Issue 1142933003: Ensure ErroneousElement for static getter with no setter. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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
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 6973a477e982d36bd6796e8fea754c304aba7fb8..f2ea645eb06e0da7776e33ac1a64a8112822b415 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -3012,10 +3012,12 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
AbstractFieldElement field = target;
setter = field.setter;
getter = field.getter;
- if (setter == null && !inInstanceContext) {
- setter = reportAndCreateErroneousElement(node.selector, field.name,
- MessageKind.CANNOT_RESOLVE_SETTER, const {});
- registry.registerThrowNoSuchMethod();
+ if (setter == null) {
+ if (!inInstanceContext || getter.isTopLevel || getter.isStatic) {
+ setter = reportAndCreateErroneousElement(node.selector, field.name,
+ MessageKind.CANNOT_RESOLVE_SETTER, const {});
+ registry.registerThrowNoSuchMethod();
+ }
}
if (isComplex && getter == null && !inInstanceContext) {
getter = reportAndCreateErroneousElement(node.selector, field.name,
« no previous file with comments | « no previous file | tests/language/static_getter_no_setter1_test.dart » ('j') | tests/language/static_getter_no_setter3_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698