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

Unified Diff: pkg/front_end/lib/src/fasta/fasta_codes.dart

Issue 2979623002: Use messages for (some) public API errors (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/src/fasta/fasta_codes.dart
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes.dart b/pkg/front_end/lib/src/fasta/fasta_codes.dart
index 67631e6aca2ec22dede2c0f5d669fdf7c84c8f63..86483550b4fd13521883efb065b9a445f7642e1a 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes.dart
@@ -6,6 +6,10 @@ library fasta.codes;
import 'package:front_end/src/scanner/token.dart' show Token;
+import 'package:front_end/compilation_error.dart' show CompilationError;
+
+import 'package:source_span/source_span.dart' show SourceSpan, SourceLocation;
+
part 'fasta_codes_generated.dart';
class Code<T> {
@@ -66,7 +70,7 @@ class Template<T> {
const Template({this.messageTemplate, this.tipTemplate, this.withArguments});
}
-class LocatedMessage {
+class LocatedMessage implements CompilationError {
Siggi Cherem (dart-lang) 2017/07/11 03:57:13 Peter/Paul: a few questions for you here: 1- I wo
Paul Berry 2017/07/11 16:00:59 Wrapping LocationMessage sounds reasonable to me.
ahe 2017/07/12 13:14:43 I agree. In fact, I just sent out CL 2974203002 wh
final Uri uri;
final int charOffset;
@@ -81,5 +85,8 @@ class LocatedMessage {
String get tip => messageObject.tip;
+ SourceSpan get span =>
+ new SourceLocation(charOffset, sourceUrl: uri).pointSpan();
+
Map<String, dynamic> get arguments => messageObject.arguments;
}

Powered by Google App Engine
This is Rietveld 408576698