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

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

Issue 2970273004: Deprecate all diagnostics methods that use strings. (Closed)
Patch Set: Merged with 4df146dd9a465d63344330bf3e45524b927c92ec 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_builder; 5 library fasta.kernel_builder;
6 6
7 export 'kernel_class_builder.dart' show KernelClassBuilder; 7 export 'kernel_class_builder.dart' show KernelClassBuilder;
8 8
9 export 'kernel_enum_builder.dart' show KernelEnumBuilder; 9 export 'kernel_enum_builder.dart' show KernelEnumBuilder;
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 DartType, 49 DartType,
50 DynamicType, 50 DynamicType,
51 Field, 51 Field,
52 Initializer, 52 Initializer,
53 Library, 53 Library,
54 Member, 54 Member,
55 Procedure, 55 Procedure,
56 RedirectingInitializer, 56 RedirectingInitializer,
57 TypeParameter; 57 TypeParameter;
58 58
59 import '../errors.dart' show inputError; 59 import '../deprecated_problems.dart' show deprecated_inputError;
60 60
61 import '../builder/builder.dart' show LibraryBuilder; 61 import '../builder/builder.dart' show LibraryBuilder;
62 62
63 List<DartType> computeDefaultTypeArguments(LibraryBuilder library, 63 List<DartType> computeDefaultTypeArguments(LibraryBuilder library,
64 List<TypeParameter> typeParameters, List<DartType> arguments) { 64 List<TypeParameter> typeParameters, List<DartType> arguments) {
65 // TODO(ahe): Not sure what to do if `arguments.length != 65 // TODO(ahe): Not sure what to do if `arguments.length !=
66 // cls.typeParameters.length`. 66 // cls.typeParameters.length`.
67 if (arguments == null) { 67 if (arguments == null) {
68 return new List<DartType>.filled( 68 return new List<DartType>.filled(
69 typeParameters.length, const DynamicType()); 69 typeParameters.length, const DynamicType());
70 } 70 }
71 if (arguments.length < typeParameters.length) { 71 if (arguments.length < typeParameters.length) {
72 arguments = new List<DartType>.from(arguments); 72 arguments = new List<DartType>.from(arguments);
73 for (int i = arguments.length; i < typeParameters.length; i++) { 73 for (int i = arguments.length; i < typeParameters.length; i++) {
74 arguments.add(const DynamicType()); 74 arguments.add(const DynamicType());
75 } 75 }
76 } else if (arguments.length > typeParameters.length) { 76 } else if (arguments.length > typeParameters.length) {
77 return arguments.sublist(0, typeParameters.length); 77 return arguments.sublist(0, typeParameters.length);
78 } 78 }
79 return arguments; 79 return arguments;
80 } 80 }
81 81
82 dynamic memberError(Member member, Object error, [int charOffset]) { 82 dynamic deprecated_memberError(Member member, Object error, [int charOffset]) {
83 String name = member.name?.name; 83 String name = member.name?.name;
84 if (name == "") { 84 if (name == "") {
85 name = Printer.emptyNameString; 85 name = Printer.emptyNameString;
86 } else if (name == null) { 86 } else if (name == null) {
87 name = "<anon>"; 87 name = "<anon>";
88 } 88 }
89 Library library = member.enclosingLibrary; 89 Library library = member.enclosingLibrary;
90 Class cls = member.enclosingClass; 90 Class cls = member.enclosingClass;
91 String fileUri; 91 String fileUri;
92 if (member is Procedure) { 92 if (member is Procedure) {
93 fileUri = member.fileUri; 93 fileUri = member.fileUri;
94 } else if (member is Field) { 94 } else if (member is Field) {
95 fileUri = member.fileUri; 95 fileUri = member.fileUri;
96 } 96 }
97 fileUri ??= cls?.fileUri ?? library.fileUri; 97 fileUri ??= cls?.fileUri ?? library.fileUri;
98 Uri uri = fileUri == null ? library.importUri : Uri.base.resolve(fileUri); 98 Uri uri = fileUri == null ? library.importUri : Uri.base.resolve(fileUri);
99 charOffset ??= -1; 99 charOffset ??= -1;
100 if (charOffset == -1) { 100 if (charOffset == -1) {
101 charOffset = member.fileOffset ?? -1; 101 charOffset = member.fileOffset ?? -1;
102 } 102 }
103 if (charOffset == -1) { 103 if (charOffset == -1) {
104 charOffset = cls?.fileOffset ?? -1; 104 charOffset = cls?.fileOffset ?? -1;
105 } 105 }
106 name = (cls == null ? "" : "${cls.name}::") + name; 106 name = (cls == null ? "" : "${cls.name}::") + name;
107 return inputError(uri, charOffset, "Error in $name: $error"); 107 return deprecated_inputError(uri, charOffset, "Error in $name: $error");
108 } 108 }
109 109
110 int compareProcedures(Procedure a, Procedure b) { 110 int compareProcedures(Procedure a, Procedure b) {
111 int i = a.fileUri.compareTo(b.fileUri); 111 int i = a.fileUri.compareTo(b.fileUri);
112 if (i != 0) return i; 112 if (i != 0) return i;
113 return a.fileOffset.compareTo(b.fileOffset); 113 return a.fileOffset.compareTo(b.fileOffset);
114 } 114 }
115 115
116 bool isRedirectingGenerativeConstructorImplementation(Constructor constructor) { 116 bool isRedirectingGenerativeConstructorImplementation(Constructor constructor) {
117 List<Initializer> initializers = constructor.initializers; 117 List<Initializer> initializers = constructor.initializers;
118 return initializers.length == 1 && 118 return initializers.length == 1 &&
119 initializers.single is RedirectingInitializer; 119 initializers.single is RedirectingInitializer;
120 } 120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698