Chromium Code Reviews| Index: lib/src/span.dart |
| diff --git a/lib/src/span.dart b/lib/src/span.dart |
| index 9f150482c6da354adbbad9753a12a306b4bf432c..bb66d169f8eb95d56c98c0fe6de0b43137a992b8 100644 |
| --- a/lib/src/span.dart |
| +++ b/lib/src/span.dart |
| @@ -5,6 +5,7 @@ |
| library source_span.span; |
| import 'location.dart'; |
| +import 'span_context.dart'; |
| import 'span_mixin.dart'; |
| /// A class that describes a segment of source text. |
| @@ -76,3 +77,26 @@ class SourceSpanBase extends SourceSpanMixin { |
| } |
| } |
| } |
| + |
| +/// A class that describes a segment of source text. |
|
nweiz
2015/03/24 23:01:17
Update this doc comment.
Siggi Cherem (dart-lang)
2015/03/25 00:33:25
Done.
|
| +class SourceSpanWithContext extends SourceSpanBase |
| + implements SourceSpanContext { |
| + /// Line containing the source-span |
|
nweiz
2015/03/24 23:01:17
"The text of the line containing this span.
If th
Siggi Cherem (dart-lang)
2015/03/25 00:33:25
Sounds good. Done
|
| + final String contextLine; |
| + |
| + /// Creates a new span from [start] to [end] (exclusive) containing [text], in |
| + /// the context of [contextLine]. |
| + /// |
| + /// [start] and [end] must have the same source URL and [start] must come |
| + /// before [end]. [text] must have a number of characters equal to the |
| + /// distance between [start] and [end]. [contextLine] must contain [text], and |
| + /// [text] should start at `start.column`. |
| + SourceSpanWithContext(SourceLocation start, SourceLocation end, String text, |
| + this.contextLine) : super(start, end, text) { |
|
nweiz
2015/03/24 23:01:17
Nit: put the super call on its own line.
Siggi Cherem (dart-lang)
2015/03/25 00:33:25
Done. This made me realized I was not running the
nweiz
2015/03/25 01:10:39
I actually prefer to have format-everything CLs se
Siggi Cherem (dart-lang)
2015/03/26 21:07:29
OK reverted all other formatter changes.
In dev_c
|
| + var index = contextLine.indexOf(text); |
| + if (index != start.column) { |
| + throw new ArgumentError('The context line "$contextLine" must ' |
| + 'contain "$text" starting at column ${start.column + 1}.'); |
|
nweiz
2015/03/24 23:01:17
I'd throw separate errors for [contextLine] not co
Siggi Cherem (dart-lang)
2015/03/25 00:33:25
Done.
|
| + } |
| + } |
| +} |