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

Unified Diff: pkg/front_end/lib/src/fasta/builder/library_builder.dart

Issue 2938573002: Improve recovery from compile-time errors. (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/builder/library_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/builder/library_builder.dart b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
index 8442213be8b387e52c783da10a870eebda9c3f81..598f5e7d570cf55de3a8bd4d0d8f41a026962324 100644
--- a/pkg/front_end/lib/src/fasta/builder/library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
@@ -6,7 +6,7 @@ library fasta.library_builder;
import '../combinator.dart' show Combinator;
-import '../errors.dart' show InputError, internalError, printUnexpected;
+import '../errors.dart' show internalError;
import '../export.dart' show Export;
@@ -38,14 +38,15 @@ abstract class LibraryBuilder<T extends TypeBuilder, R> extends Builder {
final List<Export> exporters = <Export>[];
- final List<InputError> compileTimeErrors = <InputError>[];
-
final Uri fileUri;
final String relativeFileUri;
LibraryBuilder partOfLibrary;
+ /// True if a compile-time error has been reported in this library.
+ bool hasCompileTimeErrors = false;
+
LibraryBuilder(Uri fileUri, this.scope, this.exports)
: fileUri = fileUri,
relativeFileUri = relativizeUri(fileUri),
@@ -64,13 +65,15 @@ abstract class LibraryBuilder<T extends TypeBuilder, R> extends Builder {
exporters.add(new Export(exporter, this, combinators, charOffset));
}
+ /// See `Loader.addCompileTimeError` for an explanation of the arguments
+ /// passed to this method.
+ ///
+ /// If [fileUri] is null, it defaults to `this.fileUri`.
void addCompileTimeError(int charOffset, Object message,
- {Uri fileUri, bool silent: false}) {
- fileUri ??= this.fileUri;
- if (!silent) {
- printUnexpected(fileUri, charOffset, message);
- }
- compileTimeErrors.add(new InputError(fileUri, charOffset, message));
+ {Uri fileUri, bool silent: false, bool wasHandled: false}) {
+ hasCompileTimeErrors = true;
+ loader.addCompileTimeError(fileUri ?? this.fileUri, charOffset, message,
+ silent: silent, wasHandled: wasHandled);
}
void addWarning(int charOffset, Object message,
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | pkg/front_end/lib/src/fasta/kernel/body_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698