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

Unified Diff: lib/src/span.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.dart
diff --git a/lib/src/span.dart b/lib/src/span.dart
index fe1ac3956bcbcc4f0dd1e0ca492959424de60e85..6ee68b494de361d2e421c1a483f62a46523ef4ba 100644
--- a/lib/src/span.dart
+++ b/lib/src/span.dart
@@ -58,11 +58,18 @@ abstract class SourceSpan implements Comparable<SourceSpan> {
/// A base class for source spans with [start], [end], and [text] known at
/// construction time.
class SourceSpanBase extends SourceSpanMixin {
- final SourceLocation start;
- final SourceLocation end;
- final String text;
+ // These fields go through getters so that subclasses can override them.
+
+ SourceLocation get start => _start;
+ final SourceLocation _start;
+
+ SourceLocation get end => _end;
+ final SourceLocation _end;
+
+ String get text => _text;
+ final String _text;
- SourceSpanBase(this.start, this.end, this.text) {
+ SourceSpanBase(this._start, this._end, this._text) {
if (end.sourceUrl != start.sourceUrl) {
throw new ArgumentError("Source URLs \"${start.sourceUrl}\" and "
" \"${end.sourceUrl}\" don't match.");
« lib/src/location.dart ('K') | « lib/src/location.dart ('k') | lib/src/span_exception.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698