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

Side by Side Diff: pkg/front_end/lib/src/fasta/loader.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.loader; 5 library fasta.loader;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:collection' show Queue; 9 import 'dart:collection' show Queue;
10 10
11 import 'builder/builder.dart' show Builder, LibraryBuilder; 11 import 'builder/builder.dart' show Builder, LibraryBuilder;
12 12
13 import 'errors.dart' show InputError, firstSourceUri, printUnexpected; 13 import 'deprecated_problems.dart'
14 show deprecated_InputError, firstSourceUri, deprecated_printUnexpected;
14 15
15 import 'target_implementation.dart' show TargetImplementation; 16 import 'target_implementation.dart' show TargetImplementation;
16 17
17 import 'ticker.dart' show Ticker; 18 import 'ticker.dart' show Ticker;
18 19
19 abstract class Loader<L> { 20 abstract class Loader<L> {
20 final Map<Uri, LibraryBuilder> builders = <Uri, LibraryBuilder>{}; 21 final Map<Uri, LibraryBuilder> builders = <Uri, LibraryBuilder>{};
21 22
22 final Queue<LibraryBuilder> unparsedLibraries = new Queue<LibraryBuilder>(); 23 final Queue<LibraryBuilder> unparsedLibraries = new Queue<LibraryBuilder>();
23 24
24 final List<L> libraries = <L>[]; 25 final List<L> libraries = <L>[];
25 26
26 final TargetImplementation target; 27 final TargetImplementation target;
27 28
28 /// List of all handled compile-time errors seen so far by libraries loaded 29 /// List of all handled compile-time errors seen so far by libraries loaded
29 /// by this loader. 30 /// by this loader.
30 /// 31 ///
31 /// A handled error is an error that has been added to the generated AST 32 /// A handled error is an error that has been added to the generated AST
32 /// already, for example, as a throw expression. 33 /// already, for example, as a throw expression.
33 final List<InputError> handledErrors = <InputError>[]; 34 final List<deprecated_InputError> handledErrors = <deprecated_InputError>[];
34 35
35 /// List of all unhandled compile-time errors seen so far by libraries loaded 36 /// List of all unhandled compile-time errors seen so far by libraries loaded
36 /// by this loader. 37 /// by this loader.
37 /// 38 ///
38 /// An unhandled error is an error that hasn't been handled, see 39 /// An unhandled error is an error that hasn't been handled, see
39 /// [handledErrors]. 40 /// [handledErrors].
40 final List<InputError> unhandledErrors = <InputError>[]; 41 final List<deprecated_InputError> unhandledErrors = <deprecated_InputError>[];
41 42
42 LibraryBuilder coreLibrary; 43 LibraryBuilder coreLibrary;
43 44
44 LibraryBuilder first; 45 LibraryBuilder first;
45 46
46 int byteCount = 0; 47 int byteCount = 0;
47 48
48 Uri currentUriForCrashReporting; 49 Uri currentUriForCrashReporting;
49 50
50 Loader(this.target); 51 Loader(this.target);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 first ??= library; 94 first ??= library;
94 if (library.loader == this) { 95 if (library.loader == this) {
95 unparsedLibraries.addLast(library); 96 unparsedLibraries.addLast(library);
96 } 97 }
97 return library; 98 return library;
98 }); 99 });
99 if (accessor != null && 100 if (accessor != null &&
100 uri.scheme == "dart" && 101 uri.scheme == "dart" &&
101 uri.path.startsWith("_") && 102 uri.path.startsWith("_") &&
102 accessor.uri.scheme != "dart") { 103 accessor.uri.scheme != "dart") {
103 accessor.addCompileTimeError( 104 accessor.deprecated_addCompileTimeError(
104 charOffset, "Can't access platform private library."); 105 charOffset, "Can't access platform private library.");
105 } 106 }
106 return builder; 107 return builder;
107 } 108 }
108 109
109 void ensureCoreLibrary() { 110 void ensureCoreLibrary() {
110 if (coreLibrary == null) { 111 if (coreLibrary == null) {
111 read(Uri.parse("dart:core"), -1); 112 read(Uri.parse("dart:core"), -1);
112 assert(coreLibrary != null); 113 assert(coreLibrary != null);
113 } 114 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 /// Builds all the method bodies found in the given [library]. 161 /// Builds all the method bodies found in the given [library].
161 Future<Null> buildBody(covariant LibraryBuilder library); 162 Future<Null> buildBody(covariant LibraryBuilder library);
162 163
163 /// Register [message] as a compile-time error. 164 /// Register [message] as a compile-time error.
164 /// 165 ///
165 /// If [silent] is true, no error is printed as it is assumed the error has 166 /// If [silent] is true, no error is printed as it is assumed the error has
166 /// been previously reported. 167 /// been previously reported.
167 /// 168 ///
168 /// If [wasHandled] is true, this error is added to [handledErrors], 169 /// If [wasHandled] is true, this error is added to [handledErrors],
169 /// otherwise it is added to [unhandledErrors]. 170 /// otherwise it is added to [unhandledErrors].
170 void addCompileTimeError(Uri fileUri, int charOffset, Object message, 171 void deprecated_addCompileTimeError(
172 Uri fileUri, int charOffset, Object message,
171 {bool silent: false, bool wasHandled: false}) { 173 {bool silent: false, bool wasHandled: false}) {
172 if (!silent) { 174 if (!silent) {
173 printUnexpected(fileUri, charOffset, message); 175 deprecated_printUnexpected(fileUri, charOffset, message);
174 } 176 }
175 (wasHandled ? handledErrors : unhandledErrors) 177 (wasHandled ? handledErrors : unhandledErrors)
176 .add(new InputError(fileUri, charOffset, message)); 178 .add(new deprecated_InputError(fileUri, charOffset, message));
177 } 179 }
178 180
179 Builder getAbstractClassInstantiationError() { 181 Builder getAbstractClassInstantiationError() {
180 return target.getAbstractClassInstantiationError(this); 182 return target.getAbstractClassInstantiationError(this);
181 } 183 }
182 184
183 Builder getCompileTimeError() => target.getCompileTimeError(this); 185 Builder getCompileTimeError() => target.getCompileTimeError(this);
184 186
185 Builder getDuplicatedFieldInitializerError() { 187 Builder getDuplicatedFieldInitializerError() {
186 return target.getDuplicatedFieldInitializerError(this); 188 return target.getDuplicatedFieldInitializerError(this);
187 } 189 }
188 190
189 Builder getNativeAnnotation() => target.getNativeAnnotation(this); 191 Builder getNativeAnnotation() => target.getNativeAnnotation(this);
190 } 192 }
191 193
192 String format(double d, int fractionDigits, int width) { 194 String format(double d, int fractionDigits, int width) {
193 return d.toStringAsFixed(fractionDigits).padLeft(width); 195 return d.toStringAsFixed(fractionDigits).padLeft(width);
194 } 196 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/verifier.dart ('k') | pkg/front_end/lib/src/fasta/messages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698