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

Unified Diff: lib/src/file.dart

Issue 1039603004: Fix FileSpan.context to include FileSpan.text. (Closed) Base URL: git@github.com:dart-lang/source_span.git@master
Patch Set: Created 5 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
Index: lib/src/file.dart
diff --git a/lib/src/file.dart b/lib/src/file.dart
index c7e58982fe06efc2f6a6a6bcc1f818aabe4d25f3..4b4e026cbd4013ea33da63dc93446f07499cf963 100644
--- a/lib/src/file.dart
+++ b/lib/src/file.dart
@@ -205,12 +205,8 @@ class FileSpan extends SourceSpanMixin implements SourceSpanWithContext {
FileLocation get start => new FileLocation._(file, _start);
FileLocation get end => new FileLocation._(file, _end);
String get text => file.getText(_start, _end);
-
- String get context {
- var line = start.line;
- return file.getText(file.getOffset(line),
- line == file.lines - 1 ? null : file.getOffset(line + 1));
- }
+ String get context => file.getText(file.getOffset(start.line),
+ end.line == file.lines - 1 ? null : file.getOffset(end.line + 1));
FileSpan._(this.file, this._start, this._end) {
if (_end < _start) {

Powered by Google App Engine
This is Rietveld 408576698