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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart

Issue 2943273002: Implement type inference of getters/setters based on inheritance. (Closed)
Patch Set: Created 3 years, 6 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library fasta.kernel_class_builder; 5 library fasta.kernel_class_builder;
6 6
7 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' 7 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart'
8 show KernelField; 8 show KernelMember;
9 9
10 import 'package:kernel/ast.dart' 10 import 'package:kernel/ast.dart'
11 show 11 show
12 Class, 12 Class,
13 Constructor, 13 Constructor,
14 DartType, 14 DartType,
15 Expression, 15 Expression,
16 Field, 16 Field,
17 FunctionNode, 17 FunctionNode,
18 InterfaceType, 18 InterfaceType,
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 if (declaredMember is Procedure && interfaceMember is Procedure) { 193 if (declaredMember is Procedure && interfaceMember is Procedure) {
194 if (declaredMember.kind == ProcedureKind.Method && 194 if (declaredMember.kind == ProcedureKind.Method &&
195 interfaceMember.kind == ProcedureKind.Method) { 195 interfaceMember.kind == ProcedureKind.Method) {
196 checkMethodOverride(declaredMember, interfaceMember); 196 checkMethodOverride(declaredMember, interfaceMember);
197 return; 197 return;
198 } 198 }
199 } 199 }
200 // TODO(ahe): Handle other cases: accessors, operators, and fields. 200 // TODO(ahe): Handle other cases: accessors, operators, and fields.
201 201
202 // Also record any cases where a field overrides something in a superclass, 202 // Also record any cases where a field or getter/setter overrides something
203 // since this information will be needed for type inference. 203 // in a superclass, since this information will be needed for type
204 if (declaredMember is KernelField && 204 // inference.
205 if (declaredMember is KernelMember &&
205 identical(declaredMember.enclosingClass, cls)) { 206 identical(declaredMember.enclosingClass, cls)) {
206 KernelField.recordOverride(declaredMember, interfaceMember, isSetter); 207 KernelMember.recordOverride(declaredMember, interfaceMember);
207 } 208 }
208 } 209 }
209 210
210 void checkMethodOverride( 211 void checkMethodOverride(
211 Procedure declaredMember, Procedure interfaceMember) { 212 Procedure declaredMember, Procedure interfaceMember) {
212 if (declaredMember.enclosingClass != cls) { 213 if (declaredMember.enclosingClass != cls) {
213 // TODO(ahe): Include these checks as well, but the message needs to 214 // TODO(ahe): Include these checks as well, but the message needs to
214 // explain that [declaredMember] is inherited. 215 // explain that [declaredMember] is inherited.
215 return; 216 return;
216 } 217 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 282 }
282 } 283 }
283 } 284 }
284 285
285 String get fullNameForErrors { 286 String get fullNameForErrors {
286 return isMixinApplication 287 return isMixinApplication
287 ? "${supertype.fullNameForErrors} with ${mixedInType.fullNameForErrors}" 288 ? "${supertype.fullNameForErrors} with ${mixedInType.fullNameForErrors}"
288 : name; 289 : name;
289 } 290 }
290 } 291 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698