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

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

Issue 1363993004: Report info messages together with their error, warning, or hint. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment. Created 5 years, 3 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/deferred_load.dart ('k') | pkg/compiler/lib/src/elements/elements.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 c6bb9f5b97a4615b8f11c54423311718de65f99c..e2e4d1a4a7fb952ba67fe8e0728272eaf91d471a 100644
--- a/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
+++ b/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
@@ -12,23 +12,50 @@ import '../elements/elements.dart' show
Element;
import 'messages.dart';
+// TODO(johnniwinther): Rename and cleanup this interface. Add severity enum.
abstract class DiagnosticListener {
// TODO(karlklose): rename log to something like reportInfo.
void log(message);
- void internalError(Spannable spannable, message);
+ internalError(Spannable spannable, message);
SourceSpan spanFromSpannable(Spannable node);
- void reportError(Spannable node, MessageKind errorCode,
- [Map arguments = const {}]);
+ void reportErrorMessage(
+ Spannable spannable,
+ MessageKind messageKind,
+ [Map arguments = const {}]) {
+ reportError(createMessage(spannable, messageKind, arguments));
+ }
- void reportWarning(Spannable node, MessageKind errorCode,
- [Map arguments = const {}]);
+ void reportError(
+ DiagnosticMessage message,
+ [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]);
- void reportHint(Spannable node, MessageKind errorCode,
- [Map arguments = const {}]);
+ void reportWarningMessage(
+ Spannable spannable,
+ MessageKind messageKind,
+ [Map arguments = const {}]) {
+ reportWarning(createMessage(spannable, messageKind, arguments));
+ }
+
+ void reportWarning(
+ DiagnosticMessage message,
+ [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]);
+
+ void reportHintMessage(
+ Spannable spannable,
+ MessageKind messageKind,
+ [Map arguments = const {}]) {
+ reportHint(createMessage(spannable, messageKind, arguments));
+ }
+
+ void reportHint(
+ DiagnosticMessage message,
+ [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]);
+
+ @deprecated
void reportInfo(Spannable node, MessageKind errorCode,
[Map arguments = const {}]);
@@ -37,4 +64,17 @@ abstract class DiagnosticListener {
// way to construct a [SourceSpan] from a [Spannable] and an
// [Element].
withCurrentElement(Element element, f());
+
+ DiagnosticMessage createMessage(
+ Spannable spannable,
+ MessageKind messageKind,
+ [Map arguments = const {}]);
}
+
+class DiagnosticMessage {
+ final SourceSpan sourceSpan;
+ final Spannable spannable;
+ final Message message;
+
+ DiagnosticMessage(this.sourceSpan, this.spannable, this.message);
+}
« no previous file with comments | « pkg/compiler/lib/src/deferred_load.dart ('k') | pkg/compiler/lib/src/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698