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

Unified Diff: pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart

Issue 1859543002: Revert "Introduces `ParserOptions`." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/mirrors/analyze.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
diff --git a/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart b/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
index bd5750651d25f7d7a89643e8d9195becc526c9b3..8d5baac87977b58bf04af861f6d68421626e58bb 100644
--- a/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
+++ b/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
@@ -4,8 +4,6 @@
library dart2js.diagnostic_listener;
-import '../options.dart' show
- DiagnosticOptions;
import 'source_span.dart' show
SourceSpan;
import 'spannable.dart' show
@@ -14,9 +12,57 @@ import '../elements/elements.dart' show
Element;
import 'messages.dart';
+class DiagnosticOptions {
+ /// Emit terse diagnostics without howToFix.
+ final bool terseDiagnostics;
+
+ /// List of packages for which warnings and hints are reported. If `null`,
+ /// no package warnings or hints are reported. If empty, all warnings and
+ /// hints are reported.
+ final List<String> _shownPackageWarnings;
+
+ /// If `true`, warnings are not reported.
+ final bool suppressWarnings;
+
+ /// If `true`, warnings cause the compilation to fail.
+ final bool fatalWarnings;
+
+ /// If `true`, hints are not reported.
+ final bool suppressHints;
+
+ const DiagnosticOptions({
+ this.suppressWarnings: false,
+ this.fatalWarnings: false,
+ this.suppressHints: false,
+ this.terseDiagnostics: false,
+ List<String> shownPackageWarnings: null})
+ : _shownPackageWarnings = shownPackageWarnings;
+
+
+ /// Returns `true` if warnings and hints are shown for all packages.
+ bool get showAllPackageWarnings {
+ return _shownPackageWarnings != null && _shownPackageWarnings.isEmpty;
+ }
+
+ /// Returns `true` if warnings and hints are hidden for all packages.
+ bool get hidePackageWarnings => _shownPackageWarnings == null;
+
+ /// Returns `true` if warnings should be should for [uri].
+ bool showPackageWarningsFor(Uri uri) {
+ if (showAllPackageWarnings) {
+ return true;
+ }
+ if (_shownPackageWarnings != null) {
+ return uri.scheme == 'package' &&
+ _shownPackageWarnings.contains(uri.pathSegments.first);
+ }
+ return false;
+ }
+}
+
// TODO(johnniwinther): Rename and cleanup this interface. Add severity enum.
abstract class DiagnosticReporter {
- DiagnosticOptions get options;
+ DiagnosticOptions get options => const DiagnosticOptions();
// TODO(karlklose): rename log to something like reportInfo.
void log(message);
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/mirrors/analyze.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698