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

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/tree/nodes.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 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after
3005 if (isComplex && getter == null && !inInstanceContext) { 3005 if (isComplex && getter == null && !inInstanceContext) {
3006 getter = reportAndCreateErroneousElement(node.selector, field.name, 3006 getter = reportAndCreateErroneousElement(node.selector, field.name,
3007 MessageKind.CANNOT_RESOLVE_GETTER, const {}); 3007 MessageKind.CANNOT_RESOLVE_GETTER, const {});
3008 registry.registerThrowNoSuchMethod(); 3008 registry.registerThrowNoSuchMethod();
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 node.isSuperCall || node.isThisCall) {
Johnni Winther 2015/04/17 12:17:37 Remove `node.isThisCall`. It is not a statically k
Siggi Cherem (dart-lang) 2015/04/17 16:38:24 Good call. Done.
3016 setter = reportAndCreateErroneousElement( 3017 setter = reportAndCreateErroneousElement(
3017 node.selector, target.name, MessageKind.CANNOT_RESOLVE_SETTER, 3018 node.selector, target.name, MessageKind.CANNOT_RESOLVE_SETTER,
3018 const {}); 3019 const {});
3019 } else { 3020 } else {
3020 // For instance fields we don't report a warning here because the type 3021 // For implicit instance fields we don't report a warning here because
3021 // checker will detect this as well and report a better error message 3022 // the type checker will detect this as well and report a better error
3022 // with the context of the containing class. 3023 // message with the context of the containing class.
3023 } 3024 }
3024 registry.registerThrowNoSuchMethod(); 3025 registry.registerThrowNoSuchMethod();
3025 if (node.isSuperCall) registry.registerSuperNoSuchMethod(); 3026 if (node.isSuperCall) registry.registerSuperNoSuchMethod();
Johnni Winther 2015/04/17 12:17:37 I would special case super calls here, creating an
Siggi Cherem (dart-lang) 2015/04/17 16:38:24 Not sure I completely followed - when you say a sp
Johnni Winther 2015/04/17 17:56:09 'method' -> 'message' !
3026 } else if (target.isFunction && target.name != '[]=') { 3027 } else if (target.isFunction && target.name != '[]=') {
3027 assert(!target.isSetter); 3028 assert(!target.isSetter);
3028 if (Elements.isStaticOrTopLevelFunction(target) || target.isLocal) { 3029 if (Elements.isStaticOrTopLevelFunction(target) || target.isLocal ||
3030 node.isSuperCall || node.isThisCall) {
Johnni Winther 2015/04/17 12:17:37 Similarly regarding `node.isThisCall`. The class c
Siggi Cherem (dart-lang) 2015/04/17 16:38:23 Done.
3029 setter = reportAndCreateErroneousElement( 3031 setter = reportAndCreateErroneousElement(
3030 node.selector, target.name, MessageKind.ASSIGNING_METHOD, 3032 node.selector, target.name, MessageKind.ASSIGNING_METHOD,
3031 const {}); 3033 const {});
3032 } else { 3034 } else {
3033 // For instance methods we don't report a warning here because the 3035 // For implicit instance methods we don't report a warning here
3034 // type checker will detect this as well and report a better error 3036 // because the type checker will detect this as well and report a
3035 // message with the context of the containing class. 3037 // better error message with the context of the containing class.
3036 } 3038 }
3037 registry.registerThrowNoSuchMethod(); 3039 registry.registerThrowNoSuchMethod();
3038 if (node.isSuperCall) registry.registerSuperNoSuchMethod(); 3040 if (node.isSuperCall) registry.registerSuperNoSuchMethod();
Johnni Winther 2015/04/17 12:17:37 I would special case super calls here, creating an
Siggi Cherem (dart-lang) 2015/04/17 16:38:24 Done.
3039 } 3041 }
3040 if (isPotentiallyMutableTarget(target)) { 3042 if (isPotentiallyMutableTarget(target)) {
3041 registry.registerPotentialMutation(target, node); 3043 registry.registerPotentialMutation(target, node);
3042 if (enclosingElement != target.enclosingElement) { 3044 if (enclosingElement != target.enclosingElement) {
3043 registry.registerPotentialMutationInClosure(target, node); 3045 registry.registerPotentialMutationInClosure(target, node);
3044 } 3046 }
3045 for (Node scope in promotionScope) { 3047 for (Node scope in promotionScope) {
3046 registry.registerPotentialMutationIn(scope, target, node); 3048 registry.registerPotentialMutationIn(scope, target, node);
3047 } 3049 }
3048 } 3050 }
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after
5125 } 5127 }
5126 5128
5127 /// The result for the resolution of the `assert` method. 5129 /// The result for the resolution of the `assert` method.
5128 class AssertResult implements ResolutionResult { 5130 class AssertResult implements ResolutionResult {
5129 const AssertResult(); 5131 const AssertResult();
5130 5132
5131 Element get element => null; 5133 Element get element => null;
5132 5134
5133 String toString() => 'AssertResult()'; 5135 String toString() => 'AssertResult()';
5134 } 5136 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698