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

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

Issue 2976753002: Remove deprecated_addNit. (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'
14 show
15 Message,
16 templateDuplicatedExport,
17 templateDuplicatedImport,
18 templateExportHidesExport,
19 templateImportHidesImport,
20 templateLocalDefinitionHidesExport,
21 templateLocalDefinitionHidesImport;
22
13 import '../loader.dart' show Loader; 23 import '../loader.dart' show Loader;
14 24
15 import '../modifier.dart' 25 import '../modifier.dart'
16 show abstractMask, namedMixinApplicationMask, staticMask; 26 show abstractMask, namedMixinApplicationMask, staticMask;
17 27
18 import '../problems.dart' show unhandled; 28 import '../problems.dart' show unhandled;
19 29
20 import '../source/source_class_builder.dart' show SourceClassBuilder; 30 import '../source/source_class_builder.dart' show SourceClassBuilder;
21 31
22 import '../source/source_library_builder.dart' 32 import '../source/source_library_builder.dart'
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 preferredUri = uri; 732 preferredUri = uri;
723 hiddenUri = otherUri; 733 hiddenUri = otherUri;
724 } else if (uri?.scheme == "dart" && otherUri?.scheme != "dart") { 734 } else if (uri?.scheme == "dart" && otherUri?.scheme != "dart") {
725 preferred = other; 735 preferred = other;
726 preferredUri = otherUri; 736 preferredUri = otherUri;
727 hiddenUri = uri; 737 hiddenUri = uri;
728 } 738 }
729 } 739 }
730 if (preferred != null) { 740 if (preferred != null) {
731 if (isLocal) { 741 if (isLocal) {
732 if (isExport) { 742 var template = isExport
733 deprecated_addNit(charOffset, 743 ? templateLocalDefinitionHidesExport
734 "Local definition of '$name' hides export from '${hiddenUri}'."); 744 : templateLocalDefinitionHidesImport;
735 } else { 745 addNit(template.withArguments(name, hiddenUri), charOffset, fileUri);
736 deprecated_addNit(charOffset,
737 "Local definition of '$name' hides import from '${hiddenUri}'.");
738 }
739 } else { 746 } else {
740 if (isExport) { 747 var template =
741 deprecated_addNit( 748 isExport ? templateExportHidesExport : templateImportHidesImport;
742 charOffset, 749 addNit(template.withArguments(name, preferredUri, hiddenUri),
743 "Export of '$name' (from '${preferredUri}') hides export from " 750 charOffset, fileUri);
744 "'${hiddenUri}'.");
745 } else {
746 deprecated_addNit(
747 charOffset,
748 "Import of '$name' (from '${preferredUri}') hides import from "
749 "'${hiddenUri}'.");
750 }
751 } 751 }
752 return preferred; 752 return preferred;
753 } 753 }
754 if (builder.next == null && other.next == null) { 754 if (builder.next == null && other.next == null) {
755 if (isImport && builder is PrefixBuilder && other is PrefixBuilder) { 755 if (isImport && builder is PrefixBuilder && other is PrefixBuilder) {
756 // Handles the case where the same prefix is used for different 756 // Handles the case where the same prefix is used for different
757 // imports. 757 // imports.
758 return builder 758 return builder
759 ..exports.merge(other.exports, 759 ..exports.merge(other.exports,
760 (String name, Builder existing, Builder member) { 760 (String name, Builder existing, Builder member) {
761 return buildAmbiguousBuilder(name, existing, member, charOffset, 761 return buildAmbiguousBuilder(name, existing, member, charOffset,
762 isExport: isExport, isImport: isImport); 762 isExport: isExport, isImport: isImport);
763 }); 763 });
764 } 764 }
765 } 765 }
766 String message = isExport 766 var template =
767 ? "'$name' is exported from both '${uri}' and '${otherUri}'." 767 isExport ? templateDuplicatedExport : templateDuplicatedImport;
768 : "'$name' is imported from both '${uri}' and '${otherUri}'."; 768 Message message = template.withArguments(name, uri, otherUri);
769 deprecated_addNit(charOffset, message); 769 addNit(message, charOffset, fileUri);
770 return new KernelInvalidTypeBuilder(name, charOffset, fileUri, message); 770 return new KernelInvalidTypeBuilder(name, charOffset, fileUri, message);
771 } 771 }
772 772
773 int finishStaticInvocations() { 773 int finishStaticInvocations() {
774 CloneVisitor cloner; 774 CloneVisitor cloner;
775 for (var list in argumentsWithMissingDefaultValues) { 775 for (var list in argumentsWithMissingDefaultValues) {
776 final Arguments arguments = list[0]; 776 final Arguments arguments = list[0];
777 final FunctionNode function = list[1]; 777 final FunctionNode function = list[1];
778 778
779 Expression defaultArgumentFrom(Expression expression) { 779 Expression defaultArgumentFrom(Expression expression) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 mixinApplicationClasses.putIfAbsent(name, () => builder); 859 mixinApplicationClasses.putIfAbsent(name, () => builder);
860 if (existing != builder) { 860 if (existing != builder) {
861 part.scope.local.remove(name); 861 part.scope.local.remove(name);
862 } 862 }
863 }); 863 });
864 super.includePart(part); 864 super.includePart(part);
865 nativeMethods.addAll(part.nativeMethods); 865 nativeMethods.addAll(part.nativeMethods);
866 boundlessTypeVariables.addAll(part.boundlessTypeVariables); 866 boundlessTypeVariables.addAll(part.boundlessTypeVariables);
867 } 867 }
868 } 868 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698