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

Unified Diff: pkg/compiler/lib/src/io/source_file.dart

Issue 2788373002: Add Source.getTextLine and use it to display source snippets in error messages. (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | pkg/front_end/lib/src/fasta/messages.dart » ('j') | pkg/kernel/lib/ast.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/io/source_file.dart
diff --git a/pkg/compiler/lib/src/io/source_file.dart b/pkg/compiler/lib/src/io/source_file.dart
index 8b137c0610919f8c4345b7cec46939ed371d9c5c..cce45563dd8d1eca33dde939e04d5af951f3f4c2 100644
--- a/pkg/compiler/lib/src/io/source_file.dart
+++ b/pkg/compiler/lib/src/io/source_file.dart
@@ -193,6 +193,9 @@ abstract class SourceFile implements LineColumnProvider {
/// Returns the text of line at the 0-based [index] within this source file.
String getLineText(int index) {
+ // TODO(ahe): This functionality can be replaced by `Source.getTextLine` in
+ // [package:kernel/ast.dart](../../../../kernel/lib/ast.dart).
asgerf 2017/04/03 08:34:55 Any reason not to resolve this now?
ahe 2017/04/03 09:26:39 I hadn't realized how easy that was before you ask
+
// +1 for 0-indexing, +1 again to avoid the last line of the file
if ((index + 2) < lineStarts.length) {
return slowSubstring(lineStarts[index], lineStarts[index + 1]);
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/messages.dart » ('j') | pkg/kernel/lib/ast.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698