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

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

Issue 2977713002: Remove deprecated api from LibraryBuilder. (Closed)
Patch Set: 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_library_builder; 5 library fasta.kernel_library_builder;
6 6
7 import 'package:kernel/ast.dart'; 7 import 'package:kernel/ast.dart';
8 8
9 import 'package:kernel/clone.dart' show CloneVisitor; 9 import 'package:kernel/clone.dart' show CloneVisitor;
10 10
11 import '../../scanner/token.dart' show Token; 11 import '../../scanner/token.dart' show Token;
12 12
13 import '../fasta_codes.dart' 13 import '../fasta_codes.dart'
14 show 14 show
15 Message, 15 Message,
16 messageConflictsWithTypeVariableCause, 16 messageConflictsWithTypeVariableCause,
17 messageTypeVariableDuplicatedName,
18 messageTypeVariableSameNameAsEnclosing,
17 templateConflictsWithTypeVariable, 19 templateConflictsWithTypeVariable,
18 templateDuplicatedExport, 20 templateDuplicatedExport,
19 templateDuplicatedImport, 21 templateDuplicatedImport,
20 templateExportHidesExport, 22 templateExportHidesExport,
23 templateIllegalMethodName,
21 templateImportHidesImport, 24 templateImportHidesImport,
22 templateLocalDefinitionHidesExport, 25 templateLocalDefinitionHidesExport,
23 templateLocalDefinitionHidesImport; 26 templateLocalDefinitionHidesImport,
27 templateTypeVariableDuplicatedNameCause;
24 28
25 import '../loader.dart' show Loader; 29 import '../loader.dart' show Loader;
26 30
27 import '../modifier.dart' 31 import '../modifier.dart'
28 show abstractMask, namedMixinApplicationMask, staticMask; 32 show abstractMask, namedMixinApplicationMask, staticMask;
29 33
30 import '../problems.dart' show unhandled; 34 import '../problems.dart' show unhandled;
31 35
32 import '../source/source_class_builder.dart' show SourceClassBuilder; 36 import '../source/source_class_builder.dart' show SourceClassBuilder;
33 37
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 183 }
180 184
181 Map<String, TypeVariableBuilder> checkTypeVariables( 185 Map<String, TypeVariableBuilder> checkTypeVariables(
182 List<TypeVariableBuilder> typeVariables, Builder owner) { 186 List<TypeVariableBuilder> typeVariables, Builder owner) {
183 if (typeVariables?.isEmpty ?? true) return null; 187 if (typeVariables?.isEmpty ?? true) return null;
184 Map<String, TypeVariableBuilder> typeVariablesByName = 188 Map<String, TypeVariableBuilder> typeVariablesByName =
185 <String, TypeVariableBuilder>{}; 189 <String, TypeVariableBuilder>{};
186 for (TypeVariableBuilder tv in typeVariables) { 190 for (TypeVariableBuilder tv in typeVariables) {
187 TypeVariableBuilder existing = typeVariablesByName[tv.name]; 191 TypeVariableBuilder existing = typeVariablesByName[tv.name];
188 if (existing != null) { 192 if (existing != null) {
189 deprecated_addCompileTimeError(tv.charOffset, 193 addCompileTimeError(
190 "A type variable can't have the same name as another."); 194 messageTypeVariableDuplicatedName, tv.charOffset, fileUri);
191 deprecated_addCompileTimeError( 195 addCompileTimeError(
192 existing.charOffset, "The other type variable named '${tv.name}'."); 196 templateTypeVariableDuplicatedNameCause.withArguments(tv.name),
197 existing.charOffset,
198 fileUri);
193 } else { 199 } else {
194 typeVariablesByName[tv.name] = tv; 200 typeVariablesByName[tv.name] = tv;
195 if (owner is ClassBuilder) { 201 if (owner is ClassBuilder) {
196 // Only classes and type variables can't have the same name. See 202 // Only classes and type variables can't have the same name. See
197 // [#29555](https://github.com/dart-lang/sdk/issues/29555). 203 // [#29555](https://github.com/dart-lang/sdk/issues/29555).
198 if (tv.name == owner.name) { 204 if (tv.name == owner.name) {
199 deprecated_addCompileTimeError( 205 addCompileTimeError(
200 tv.charOffset, 206 messageTypeVariableSameNameAsEnclosing, tv.charOffset, fileUri);
201 "A type variable can't have the same name as its enclosing "
202 "declaration.");
203 } 207 }
204 } 208 }
205 } 209 }
206 } 210 }
207 return typeVariablesByName; 211 return typeVariablesByName;
208 } 212 }
209 213
210 KernelTypeBuilder applyMixin( 214 KernelTypeBuilder applyMixin(
211 KernelTypeBuilder supertype, KernelTypeBuilder mixin, String signature, 215 KernelTypeBuilder supertype, KernelTypeBuilder mixin, String signature,
212 {List<MetadataBuilder> metadata, 216 {List<MetadataBuilder> metadata,
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 int index = name.indexOf("."); 507 int index = name.indexOf(".");
504 if (startsWithClassName && index == className.length) { 508 if (startsWithClassName && index == className.length) {
505 // Named constructor or factory. 509 // Named constructor or factory.
506 return name.substring(index + 1); 510 return name.substring(index + 1);
507 } 511 }
508 if (index == -1) { 512 if (index == -1) {
509 // A legal name for a regular method, but not for a constructor. 513 // A legal name for a regular method, but not for a constructor.
510 return null; 514 return null;
511 } 515 }
512 String suffix = name.substring(index + 1); 516 String suffix = name.substring(index + 1);
513 deprecated_addCompileTimeError( 517 addCompileTimeError(
518 templateIllegalMethodName.withArguments(name, "$className.$suffix"),
514 charOffset, 519 charOffset,
515 "'$name' isn't a legal method name.\n" 520 fileUri);
516 "Did you mean '$className.$suffix'?");
517 return suffix; 521 return suffix;
518 } 522 }
519 523
520 void addProcedure( 524 void addProcedure(
521 List<MetadataBuilder> metadata, 525 List<MetadataBuilder> metadata,
522 int modifiers, 526 int modifiers,
523 KernelTypeBuilder returnType, 527 KernelTypeBuilder returnType,
524 String name, 528 String name,
525 List<TypeVariableBuilder> typeVariables, 529 List<TypeVariableBuilder> typeVariables,
526 List<FormalParameterBuilder> formals, 530 List<FormalParameterBuilder> formals,
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 mixinApplicationClasses.putIfAbsent(name, () => builder); 866 mixinApplicationClasses.putIfAbsent(name, () => builder);
863 if (existing != builder) { 867 if (existing != builder) {
864 part.scope.local.remove(name); 868 part.scope.local.remove(name);
865 } 869 }
866 }); 870 });
867 super.includePart(part); 871 super.includePart(part);
868 nativeMethods.addAll(part.nativeMethods); 872 nativeMethods.addAll(part.nativeMethods);
869 boundlessTypeVariables.addAll(part.boundlessTypeVariables); 873 boundlessTypeVariables.addAll(part.boundlessTypeVariables);
870 } 874 }
871 } 875 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698