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

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

Issue 2938423003: Implement override-based inference of instance fields. (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'
8 show KernelField;
9
7 import 'package:kernel/ast.dart' 10 import 'package:kernel/ast.dart'
8 show 11 show
9 Class, 12 Class,
10 Constructor, 13 Constructor,
11 DartType, 14 DartType,
12 Expression, 15 Expression,
13 Field, 16 Field,
14 FunctionNode, 17 FunctionNode,
15 InterfaceType, 18 InterfaceType,
16 ListLiteral, 19 ListLiteral,
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 "Constructor in override check.", fileUri, declaredMember.fileOffset); 191 "Constructor in override check.", fileUri, declaredMember.fileOffset);
189 } 192 }
190 if (declaredMember is Procedure && interfaceMember is Procedure) { 193 if (declaredMember is Procedure && interfaceMember is Procedure) {
191 if (declaredMember.kind == ProcedureKind.Method && 194 if (declaredMember.kind == ProcedureKind.Method &&
192 interfaceMember.kind == ProcedureKind.Method) { 195 interfaceMember.kind == ProcedureKind.Method) {
193 checkMethodOverride(declaredMember, interfaceMember); 196 checkMethodOverride(declaredMember, interfaceMember);
194 return; 197 return;
195 } 198 }
196 } 199 }
197 // TODO(ahe): Handle other cases: accessors, operators, and fields. 200 // TODO(ahe): Handle other cases: accessors, operators, and fields.
201
202 // Also record any cases where a field overrides something in a superclass,
203 // since this information will be needed for type inference.
204 if (declaredMember is KernelField &&
205 identical(declaredMember.enclosingClass, cls)) {
206 KernelField.recordOverride(declaredMember, interfaceMember, isSetter);
207 }
198 } 208 }
199 209
200 void checkMethodOverride( 210 void checkMethodOverride(
201 Procedure declaredMember, Procedure interfaceMember) { 211 Procedure declaredMember, Procedure interfaceMember) {
202 if (declaredMember.enclosingClass != cls) { 212 if (declaredMember.enclosingClass != cls) {
203 // TODO(ahe): Include these checks as well, but the message needs to 213 // TODO(ahe): Include these checks as well, but the message needs to
204 // explain that [declaredMember] is inherited. 214 // explain that [declaredMember] is inherited.
205 return; 215 return;
206 } 216 }
207 assert(declaredMember.kind == ProcedureKind.Method); 217 assert(declaredMember.kind == ProcedureKind.Method);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 281 }
272 } 282 }
273 } 283 }
274 284
275 String get fullNameForErrors { 285 String get fullNameForErrors {
276 return isMixinApplication 286 return isMixinApplication
277 ? "${supertype.fullNameForErrors} with ${mixedInType.fullNameForErrors}" 287 ? "${supertype.fullNameForErrors} with ${mixedInType.fullNameForErrors}"
278 : name; 288 : name;
279 } 289 }
280 } 290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698