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

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

Issue 1520293002: Add token invariant to DiagnosticReporter (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Rebase + status update Created 5 years 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/diagnostics/invariant.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 6a156ae42566f1f634b35ababa5782ab5350c026..8d5baac87977b58bf04af861f6d68421626e58bb 100644
--- a/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
+++ b/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
@@ -69,6 +69,11 @@ abstract class DiagnosticReporter {
internalError(Spannable spannable, message);
+ /// Creates a [SourceSpan] for [node] in scope of the current element.
+ ///
+ /// If [node] is a [Node] or [Token] we assert in checked mode that the
+ /// corresponding tokens can be found within the tokens of the current
+ /// element.
SourceSpan spanFromSpannable(Spannable node);
void reportErrorMessage(
@@ -109,10 +114,8 @@ abstract class DiagnosticReporter {
void reportInfo(Spannable node, MessageKind errorCode,
[Map arguments = const {}]);
- // TODO(ahe): We should not expose this here. Perhaps a
- // [SourceSpan] should implement [Spannable], and we should have a
- // way to construct a [SourceSpan] from a [Spannable] and an
- // [Element].
+ /// Set current element of this reporter to [element]. This is used for
+ /// creating [SourceSpan] in [spanFromSpannable].
withCurrentElement(Element element, f());
DiagnosticMessage createMessage(
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/diagnostics/invariant.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698