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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of resolution; 5 part of resolution;
6 6
7 abstract class TreeElements { 7 abstract class TreeElements {
8 AnalyzableElement get analyzedElement; 8 AnalyzableElement get analyzedElement;
9 Iterable<Node> get superUses; 9 Iterable<Node> get superUses;
10 10
(...skipping 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after
3005 Element setter = target; 3005 Element setter = target;
3006 Element getter = target; 3006 Element getter = target;
3007 String operatorName = node.assignmentOperator.source; 3007 String operatorName = node.assignmentOperator.source;
3008 String source = operatorName; 3008 String source = operatorName;
3009 bool isComplex = !identical(source, '='); 3009 bool isComplex = !identical(source, '=');
3010 if (!(result is AssertResult || Elements.isUnresolved(target))) { 3010 if (!(result is AssertResult || Elements.isUnresolved(target))) {
3011 if (target.isAbstractField) { 3011 if (target.isAbstractField) {
3012 AbstractFieldElement field = target; 3012 AbstractFieldElement field = target;
3013 setter = field.setter; 3013 setter = field.setter;
3014 getter = field.getter; 3014 getter = field.getter;
3015 if (setter == null && !inInstanceContext) { 3015 if (setter == null) {
3016 setter = reportAndCreateErroneousElement(node.selector, field.name, 3016 if (!inInstanceContext || getter.isTopLevel || getter.isStatic) {
3017 MessageKind.CANNOT_RESOLVE_SETTER, const {}); 3017 setter = reportAndCreateErroneousElement(node.selector, field.name,
3018 registry.registerThrowNoSuchMethod(); 3018 MessageKind.CANNOT_RESOLVE_SETTER, const {});
3019 registry.registerThrowNoSuchMethod();
3020 }
3019 } 3021 }
3020 if (isComplex && getter == null && !inInstanceContext) { 3022 if (isComplex && getter == null && !inInstanceContext) {
3021 getter = reportAndCreateErroneousElement(node.selector, field.name, 3023 getter = reportAndCreateErroneousElement(node.selector, field.name,
3022 MessageKind.CANNOT_RESOLVE_GETTER, const {}); 3024 MessageKind.CANNOT_RESOLVE_GETTER, const {});
3023 registry.registerThrowNoSuchMethod(); 3025 registry.registerThrowNoSuchMethod();
3024 } 3026 }
3025 } else if (target.impliesType) { 3027 } else if (target.impliesType) {
3026 setter = reportAndCreateErroneousElement(node.selector, target.name, 3028 setter = reportAndCreateErroneousElement(node.selector, target.name,
3027 MessageKind.ASSIGNING_TYPE, const {}); 3029 MessageKind.ASSIGNING_TYPE, const {});
3028 registry.registerThrowNoSuchMethod(); 3030 registry.registerThrowNoSuchMethod();
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after
5159 } 5161 }
5160 5162
5161 /// The result for the resolution of the `assert` method. 5163 /// The result for the resolution of the `assert` method.
5162 class AssertResult implements ResolutionResult { 5164 class AssertResult implements ResolutionResult {
5163 const AssertResult(); 5165 const AssertResult();
5164 5166
5165 Element get element => null; 5167 Element get element => null;
5166 5168
5167 String toString() => 'AssertResult()'; 5169 String toString() => 'AssertResult()';
5168 } 5170 }
OLDNEW
« 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