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

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

Issue 2905463003: Use failedAt in more places (Closed)
Patch Set: Created 3 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 dart2js.resolution.compute_members; 5 part of dart2js.resolution.compute_members;
6 6
7 class DeclaredMember implements Member { 7 class DeclaredMember implements Member {
8 final Name name; 8 final Name name;
9 final Element element; 9 final Element element;
10 final ResolutionInterfaceType declarer; 10 final ResolutionInterfaceType declarer;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 Member get implementation => this; 137 Member get implementation => this;
138 138
139 ResolutionDartType get type => declaration.type.substByContext(instance); 139 ResolutionDartType get type => declaration.type.substByContext(instance);
140 140
141 ResolutionFunctionType get functionType { 141 ResolutionFunctionType get functionType {
142 return declaration.functionType.substByContext(instance); 142 return declaration.functionType.substByContext(instance);
143 } 143 }
144 144
145 DeclaredMember inheritFrom(ResolutionInterfaceType newInstance) { 145 DeclaredMember inheritFrom(ResolutionInterfaceType newInstance) {
146 assert(invariant(declaration.element, () { 146 assert(() {
147 // Assert that if [instance] contains type variables, then these are 147 // Assert that if [instance] contains type variables, then these are
148 // defined in the declaration of [newInstance] and will therefore be 148 // defined in the declaration of [newInstance] and will therefore be
149 // substituted into the context of [newInstance] in the created member. 149 // substituted into the context of [newInstance] in the created member.
150 ClassElement contextClass = Types.getClassContext(instance); 150 ClassElement contextClass = Types.getClassContext(instance);
151 return contextClass == null || contextClass == newInstance.element; 151 return contextClass == null || contextClass == newInstance.element;
152 }, message: () { 152 },
153 return "Context mismatch: Context class " 153 failedAt(
154 "${Types.getClassContext(instance)} from $instance does match " 154 declaration.element,
155 "the new instance $newInstance."; 155 "Context mismatch: Context class "
156 })); 156 "${Types.getClassContext(instance)} from $instance does match "
157 "the new instance $newInstance."));
157 return _newInheritedMember(newInstance); 158 return _newInheritedMember(newInstance);
158 } 159 }
159 160
160 InheritedMember _newInheritedMember(ResolutionInterfaceType newInstance) { 161 InheritedMember _newInheritedMember(ResolutionInterfaceType newInstance) {
161 return new InheritedMember( 162 return new InheritedMember(
162 declaration, instance.substByContext(newInstance)); 163 declaration, instance.substByContext(newInstance));
163 } 164 }
164 165
165 Iterable<Member> get declarations => <Member>[this]; 166 Iterable<Member> get declarations => <Member>[this];
166 167
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 247
247 bool get isGetter => false; 248 bool get isGetter => false;
248 249
249 bool get isMethod => false; 250 bool get isMethod => false;
250 251
251 bool get isMalformed => true; 252 bool get isMalformed => true;
252 253
253 String toString() => "erroneous member '$name' synthesized " 254 String toString() => "erroneous member '$name' synthesized "
254 "from ${inheritedMembers}"; 255 "from ${inheritedMembers}";
255 } 256 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/constructors.dart ('k') | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698