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

Unified Diff: pkg/front_end/lib/compiler_options.dart

Issue 2982093003: Unifying compiler context (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 side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/compiler_options.dart
diff --git a/pkg/front_end/lib/compiler_options.dart b/pkg/front_end/lib/compiler_options.dart
index 3b46067f333a7355b349a2bf7de5461a50939fd3..f67d9f0c3ca35f02d659b80ff40658e2ec148eee 100644
--- a/pkg/front_end/lib/compiler_options.dart
+++ b/pkg/front_end/lib/compiler_options.dart
@@ -8,15 +8,12 @@ import 'package:front_end/src/base/performace_logger.dart';
import 'package:front_end/src/incremental/byte_store.dart';
import 'package:kernel/target/targets.dart' show Target;
-import 'compilation_error.dart';
+import 'compilation_message.dart';
import 'file_system.dart';
import 'physical_file_system.dart';
-/// Default error handler used by [CompilerOptions.onError].
-void defaultErrorHandler(CompilationError error) => throw error;
-
/// Callback used to report errors encountered during compilation.
-typedef void ErrorHandler(CompilationError error);
+typedef void ErrorHandler(CompilationMessage error);
/// Front-end options relevant to compiler back ends.
///
@@ -43,9 +40,18 @@ class CompilerOptions {
/// Callback to which compilation errors should be delivered.
///
- /// By default, the first error will be reported by throwing an exception of
- /// type [CompilationError].
- ErrorHandler onError = defaultErrorHandler;
+ /// By default, when no callback is provided, the compiler will report
+ /// messages on the console and will throw when fatal errors are discovered.
+ ErrorHandler onError;
+
+ /// Whether messages should be reported using the compiler's internal
+ /// reporting mechanism.
+ ///
+ /// If no [onError] handler is provided, the default is true. If an [onError]
+ /// handler is provided, the default is false. Setting this to true will
+ /// ensure that error messages are printed in the console and that fatal
+ /// errors cause an exception.
+ bool reportMessages;
Siggi Cherem (dart-lang) 2017/07/18 00:11:07 Paul & Peter - there are many ways to address what
ahe 2017/07/18 16:54:36 As we discussed in our 1:1, I'd like to make forma
Paul Berry 2017/07/18 18:36:21 I'm fine with the code as is for now. IMHO we can
ahe 2017/07/18 21:07:26 Agreed. If it wasn't clear when we discussed it, a
Siggi Cherem (dart-lang) 2017/07/18 22:50:43 Sounds good, thanks both, added TODO.
/// URI of the ".packages" file (typically a "file:" URI).
///
@@ -197,4 +203,19 @@ class CompilerOptions {
/// Whether to set the exit code to non-zero if any problem (including
/// warning, etc.) is encountered during compilation.
bool setExitCodeOnProblem = false;
+
+ /// Whether to generate kernel that excludes source informaton.
+ ///
+ /// When false, APIs that return a kernel `Program` include a
+ /// `uriToSource` map.
+ bool excludeSourceInformation = false;
+
+ /// Whether errors are considered fatal and should stop the compiler.
+ bool errorsAreFatal = false;
Siggi Cherem (dart-lang) 2017/07/18 00:11:07 should this default to true?
ahe 2017/07/18 16:54:36 I don't think so. For both hot reloading and the a
Paul Berry 2017/07/18 18:36:21 Normally I agree with the notion of having the def
ahe 2017/07/18 21:07:26 As long as we make sure to set this to false for a
Siggi Cherem (dart-lang) 2017/07/18 22:50:43 OK - a few updates. I changed the default as foll
+
+ /// Whether warnings are considered fatal and should stop the compiler.
+ bool warningsAreFatal = false;
+
+ /// Whether errors are considered fatal and should stop the compiler.
+ bool nitsAreFatal = false;
ahe 2017/07/18 16:54:36 Note: all these "AreFatal" options are mostly used
Siggi Cherem (dart-lang) 2017/07/18 22:50:43 Done. Renamed to `throwOnX`
}

Powered by Google App Engine
This is Rietveld 408576698