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

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

Issue 2977693002: Remove deprecated methods from ClassBuilder. (Closed)
Patch Set: Spelling of unnamed. Created 3 years, 5 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:kernel/ast.dart' 7 import 'package:kernel/ast.dart'
8 show 8 show
9 Class, 9 Class,
10 Constructor, 10 Constructor,
11 DartType, 11 DartType,
12 Expression, 12 Expression,
13 Field, 13 Field,
14 FunctionNode, 14 FunctionNode,
15 InterfaceType, 15 InterfaceType,
16 ListLiteral, 16 ListLiteral,
17 Member, 17 Member,
18 Name, 18 Name,
19 Procedure, 19 Procedure,
20 ProcedureKind, 20 ProcedureKind,
21 StaticGet, 21 StaticGet,
22 Supertype, 22 Supertype,
23 VariableDeclaration; 23 VariableDeclaration;
24 24
25 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; 25 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
26 26
27 import '../dill/dill_member_builder.dart' show DillMemberBuilder; 27 import '../dill/dill_member_builder.dart' show DillMemberBuilder;
28 28
29 import '../fasta_codes.dart' show templateRedirectionTargetNotFound; 29 import '../fasta_codes.dart'
30 show
31 templateOverrideFewerNamedArguments,
32 templateOverrideFewerPositionalArguments,
33 templateOverrideMismatchNamedParameter,
34 templateOverrideMoreRequiredArguments,
35 templateOverrideTypeVariablesMismatch,
36 templateRedirectionTargetNotFound;
30 37
31 import '../problems.dart' show unhandled, unimplemented; 38 import '../problems.dart' show unhandled, unimplemented;
32 39
33 import 'kernel_builder.dart' 40 import 'kernel_builder.dart'
34 show 41 show
35 Builder, 42 Builder,
36 ClassBuilder, 43 ClassBuilder,
37 ConstructorReferenceBuilder, 44 ConstructorReferenceBuilder,
38 KernelLibraryBuilder, 45 KernelLibraryBuilder,
39 KernelProcedureBuilder, 46 KernelProcedureBuilder,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // TODO(ahe): Include these checks as well, but the message needs to 233 // TODO(ahe): Include these checks as well, but the message needs to
227 // explain that [declaredMember] is inherited. 234 // explain that [declaredMember] is inherited.
228 return; 235 return;
229 } 236 }
230 assert(declaredMember.kind == ProcedureKind.Method); 237 assert(declaredMember.kind == ProcedureKind.Method);
231 assert(interfaceMember.kind == ProcedureKind.Method); 238 assert(interfaceMember.kind == ProcedureKind.Method);
232 FunctionNode declaredFunction = declaredMember.function; 239 FunctionNode declaredFunction = declaredMember.function;
233 FunctionNode interfaceFunction = interfaceMember.function; 240 FunctionNode interfaceFunction = interfaceMember.function;
234 if (declaredFunction.typeParameters?.length != 241 if (declaredFunction.typeParameters?.length !=
235 interfaceFunction.typeParameters?.length) { 242 interfaceFunction.typeParameters?.length) {
236 deprecated_addWarning( 243 addWarning(
237 declaredMember.fileOffset, 244 templateOverrideTypeVariablesMismatch.withArguments(
238 "Declared type variables of '$name::${declaredMember.name.name}' " 245 "$name::${declaredMember.name.name}",
239 "doesn't match those on overridden method " 246 "${interfaceMember.enclosingClass.name}::"
240 "'${interfaceMember.enclosingClass.name}::" 247 "${interfaceMember.name.name}"),
241 "${interfaceMember.name.name}'."); 248 declaredMember.fileOffset);
242 } 249 }
243 if (declaredFunction.positionalParameters.length < 250 if (declaredFunction.positionalParameters.length <
244 interfaceFunction.requiredParameterCount || 251 interfaceFunction.requiredParameterCount ||
245 declaredFunction.positionalParameters.length < 252 declaredFunction.positionalParameters.length <
246 interfaceFunction.positionalParameters.length) { 253 interfaceFunction.positionalParameters.length) {
247 deprecated_addWarning( 254 addWarning(
248 declaredMember.fileOffset, 255 templateOverrideFewerPositionalArguments.withArguments(
249 "The method '$name::${declaredMember.name.name}' has fewer " 256 "$name::${declaredMember.name.name}",
250 "positional arguments than those of overridden method " 257 "${interfaceMember.enclosingClass.name}::"
251 "'${interfaceMember.enclosingClass.name}::" 258 "${interfaceMember.name.name}"),
252 "${interfaceMember.name.name}'."); 259 declaredMember.fileOffset);
253 } 260 }
254 if (interfaceFunction.requiredParameterCount < 261 if (interfaceFunction.requiredParameterCount <
255 declaredFunction.requiredParameterCount) { 262 declaredFunction.requiredParameterCount) {
256 deprecated_addWarning( 263 addWarning(
257 declaredMember.fileOffset, 264 templateOverrideMoreRequiredArguments.withArguments(
258 "The method '$name::${declaredMember.name.name}' has more " 265 "$name::${declaredMember.name.name}",
259 "required arguments than those of overridden method " 266 "${interfaceMember.enclosingClass.name}::"
260 "'${interfaceMember.enclosingClass.name}::" 267 "${interfaceMember.name.name}"),
261 "${interfaceMember.name.name}'."); 268 declaredMember.fileOffset);
262 } 269 }
263 if (declaredFunction.namedParameters.isEmpty && 270 if (declaredFunction.namedParameters.isEmpty &&
264 interfaceFunction.namedParameters.isEmpty) { 271 interfaceFunction.namedParameters.isEmpty) {
265 return; 272 return;
266 } 273 }
267 if (declaredFunction.namedParameters.length < 274 if (declaredFunction.namedParameters.length <
268 interfaceFunction.namedParameters.length) { 275 interfaceFunction.namedParameters.length) {
269 deprecated_addWarning( 276 addWarning(
270 declaredMember.fileOffset, 277 templateOverrideFewerNamedArguments.withArguments(
271 "The method '$name::${declaredMember.name.name}' has fewer named " 278 "$name::${declaredMember.name.name}",
272 "arguments than those of overridden method " 279 "${interfaceMember.enclosingClass.name}::"
273 "'${interfaceMember.enclosingClass.name}::" 280 "${interfaceMember.name.name}"),
274 "${interfaceMember.name.name}'."); 281 declaredMember.fileOffset);
275 } 282 }
276 Iterator<VariableDeclaration> declaredNamedParameters = 283 Iterator<VariableDeclaration> declaredNamedParameters =
277 declaredFunction.namedParameters.iterator; 284 declaredFunction.namedParameters.iterator;
278 Iterator<VariableDeclaration> interfaceNamedParameters = 285 Iterator<VariableDeclaration> interfaceNamedParameters =
279 interfaceFunction.namedParameters.iterator; 286 interfaceFunction.namedParameters.iterator;
280 outer: 287 outer:
281 while (declaredNamedParameters.moveNext() && 288 while (declaredNamedParameters.moveNext() &&
282 interfaceNamedParameters.moveNext()) { 289 interfaceNamedParameters.moveNext()) {
283 while (declaredNamedParameters.current.name != 290 while (declaredNamedParameters.current.name !=
284 interfaceNamedParameters.current.name) { 291 interfaceNamedParameters.current.name) {
285 if (!declaredNamedParameters.moveNext()) { 292 if (!declaredNamedParameters.moveNext()) {
286 deprecated_addWarning( 293 addWarning(
287 declaredMember.fileOffset, 294 templateOverrideMismatchNamedParameter.withArguments(
288 "The method '$name::${declaredMember.name.name}' doesn't have " 295 "$name::${declaredMember.name.name}",
289 "the named parameter '${interfaceNamedParameters.current.name}' " 296 interfaceNamedParameters.current.name,
290 "of overriden method '${interfaceMember.enclosingClass.name}::" 297 "${interfaceMember.enclosingClass.name}::"
291 "${interfaceMember.name.name}'."); 298 "${interfaceMember.name.name}"),
299 declaredMember.fileOffset);
292 break outer; 300 break outer;
293 } 301 }
294 } 302 }
295 } 303 }
296 } 304 }
297 305
298 String get fullNameForErrors { 306 String get fullNameForErrors {
299 return isMixinApplication 307 return isMixinApplication
300 ? "${supertype.fullNameForErrors} with ${mixedInType.fullNameForErrors}" 308 ? "${supertype.fullNameForErrors} with ${mixedInType.fullNameForErrors}"
301 : name; 309 : name;
302 } 310 }
303 } 311 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta_codes_generated.dart ('k') | pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698