OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library source_span.span; | |
6 | |
7 import 'location.dart'; | 5 import 'location.dart'; |
8 import 'span_mixin.dart'; | 6 import 'span_mixin.dart'; |
9 | 7 |
10 /// A class that describes a segment of source text. | 8 /// A class that describes a segment of source text. |
11 abstract class SourceSpan implements Comparable<SourceSpan> { | 9 abstract class SourceSpan implements Comparable<SourceSpan> { |
12 /// The start location of this span. | 10 /// The start location of this span. |
13 final SourceLocation start; | 11 final SourceLocation start; |
14 | 12 |
15 /// The end location of this span, exclusive. | 13 /// The end location of this span, exclusive. |
16 final SourceLocation end; | 14 final SourceLocation end; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 throw new ArgumentError("Source URLs \"${start.sourceUrl}\" and " | 67 throw new ArgumentError("Source URLs \"${start.sourceUrl}\" and " |
70 " \"${end.sourceUrl}\" don't match."); | 68 " \"${end.sourceUrl}\" don't match."); |
71 } else if (end.offset < start.offset) { | 69 } else if (end.offset < start.offset) { |
72 throw new ArgumentError('End $end must come after start $start.'); | 70 throw new ArgumentError('End $end must come after start $start.'); |
73 } else if (text.length != start.distance(end)) { | 71 } else if (text.length != start.distance(end)) { |
74 throw new ArgumentError('Text "$text" must be ${start.distance(end)} ' | 72 throw new ArgumentError('Text "$text" must be ${start.distance(end)} ' |
75 'characters long.'); | 73 'characters long.'); |
76 } | 74 } |
77 } | 75 } |
78 } | 76 } |
OLD | NEW |