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

Unified Diff: lib/src/span_with_context.dart

Issue 1728113002: Allow some fields to be overridden in strong mode. (Closed) Base URL: git@github.com:dart-lang/source_span@master
Patch Set: Make more fields virtual Created 4 years, 10 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/span_with_context.dart
diff --git a/lib/src/span_with_context.dart b/lib/src/span_with_context.dart
index 1336b1225e31ea5dbcf3bb3e488c8e91080b03e6..a02d78047575e2b85f697ba38d45248817e639be 100644
--- a/lib/src/span_with_context.dart
+++ b/lib/src/span_with_context.dart
@@ -8,8 +8,10 @@ import 'utils.dart';
/// A class that describes a segment of source text with additional context.
class SourceSpanWithContext extends SourceSpanBase {
+ // This is a getter so that subclasses can override it.
/// Text around the span, which includes the line containing this span.
- final String context;
+ String get context => _context;
+ final String _context;
/// Creates a new span from [start] to [end] (exclusive) containing [text], in
/// the given [context].
@@ -20,7 +22,7 @@ class SourceSpanWithContext extends SourceSpanBase {
/// [text] should start at `start.column` from the beginning of a line in
/// [context].
SourceSpanWithContext(
- SourceLocation start, SourceLocation end, String text, this.context)
+ SourceLocation start, SourceLocation end, String text, this._context)
: super(start, end, text) {
if (!context.contains(text)) {
throw new ArgumentError(
« lib/src/location.dart ('K') | « lib/src/span_exception.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698