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

Side by Side Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 1090923004: Make super.foo= erroneous if they are not assignable. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/compiler/lib/src/warnings.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2998 matching lines...) Expand 10 before | Expand all | Expand 10 after
3009 } 3009 }
3010 } else if (target.impliesType) { 3010 } else if (target.impliesType) {
3011 setter = reportAndCreateErroneousElement(node.selector, target.name, 3011 setter = reportAndCreateErroneousElement(node.selector, target.name,
3012 MessageKind.ASSIGNING_TYPE, const {}); 3012 MessageKind.ASSIGNING_TYPE, const {});
3013 registry.registerThrowNoSuchMethod(); 3013 registry.registerThrowNoSuchMethod();
3014 } else if (target.isFinal || target.isConst) { 3014 } else if (target.isFinal || target.isConst) {
3015 if (Elements.isStaticOrTopLevelField(target) || target.isLocal) { 3015 if (Elements.isStaticOrTopLevelField(target) || target.isLocal) {
3016 setter = reportAndCreateErroneousElement( 3016 setter = reportAndCreateErroneousElement(
3017 node.selector, target.name, MessageKind.CANNOT_RESOLVE_SETTER, 3017 node.selector, target.name, MessageKind.CANNOT_RESOLVE_SETTER,
3018 const {}); 3018 const {});
3019 } else if (node.isSuperCall) {
3020 setter = reportAndCreateErroneousElement(
3021 node.selector, target.name, MessageKind.SETTER_NOT_FOUND_IN_SUPER,
3022 {'name': target.name, 'className': currentClass.name});
3023 registry.registerSuperNoSuchMethod();
3019 } else { 3024 } else {
3020 // For instance fields we don't report a warning here because the type 3025 // For instance fields we don't report a warning here because the type
3021 // checker will detect this as well and report a better error message 3026 // checker will detect this as well and report a better error message
3022 // with the context of the containing class. 3027 // with the context of the containing class.
3023 } 3028 }
3024 registry.registerThrowNoSuchMethod(); 3029 registry.registerThrowNoSuchMethod();
3025 if (node.isSuperCall) registry.registerSuperNoSuchMethod();
3026 } else if (target.isFunction && target.name != '[]=') { 3030 } else if (target.isFunction && target.name != '[]=') {
3027 assert(!target.isSetter); 3031 assert(!target.isSetter);
3028 if (Elements.isStaticOrTopLevelFunction(target) || target.isLocal) { 3032 if (Elements.isStaticOrTopLevelFunction(target) || target.isLocal) {
3029 setter = reportAndCreateErroneousElement( 3033 setter = reportAndCreateErroneousElement(
3030 node.selector, target.name, MessageKind.ASSIGNING_METHOD, 3034 node.selector, target.name, MessageKind.ASSIGNING_METHOD,
3031 const {}); 3035 const {});
3036 } else if (node.isSuperCall) {
3037 setter = reportAndCreateErroneousElement(
3038 node.selector, target.name, MessageKind.ASSIGNING_METHOD_IN_SUPER,
3039 {'name': target.name,
3040 'superclassName': target.enclosingElement.name});
3041 registry.registerSuperNoSuchMethod();
3032 } else { 3042 } else {
3033 // For instance methods we don't report a warning here because the 3043 // For instance methods we don't report a warning here because the
3034 // type checker will detect this as well and report a better error 3044 // type checker will detect this as well and report a better error
3035 // message with the context of the containing class. 3045 // message with the context of the containing class.
3036 } 3046 }
3037 registry.registerThrowNoSuchMethod(); 3047 registry.registerThrowNoSuchMethod();
3038 if (node.isSuperCall) registry.registerSuperNoSuchMethod();
3039 } 3048 }
3040 if (isPotentiallyMutableTarget(target)) { 3049 if (isPotentiallyMutableTarget(target)) {
3041 registry.registerPotentialMutation(target, node); 3050 registry.registerPotentialMutation(target, node);
3042 if (enclosingElement != target.enclosingElement) { 3051 if (enclosingElement != target.enclosingElement) {
3043 registry.registerPotentialMutationInClosure(target, node); 3052 registry.registerPotentialMutationInClosure(target, node);
3044 } 3053 }
3045 for (Node scope in promotionScope) { 3054 for (Node scope in promotionScope) {
3046 registry.registerPotentialMutationIn(scope, target, node); 3055 registry.registerPotentialMutationIn(scope, target, node);
3047 } 3056 }
3048 } 3057 }
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after
5125 } 5134 }
5126 5135
5127 /// The result for the resolution of the `assert` method. 5136 /// The result for the resolution of the `assert` method.
5128 class AssertResult implements ResolutionResult { 5137 class AssertResult implements ResolutionResult {
5129 const AssertResult(); 5138 const AssertResult();
5130 5139
5131 Element get element => null; 5140 Element get element => null;
5132 5141
5133 String toString() => 'AssertResult()'; 5142 String toString() => 'AssertResult()';
5134 } 5143 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698