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

Unified Diff: pkg/source_span/lib/src/file.dart

Issue 712473002: Fix source_span tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/source_span/lib/src/file.dart
diff --git a/pkg/source_span/lib/src/file.dart b/pkg/source_span/lib/src/file.dart
index 5680733d49733b39a48e867606d20865ddba9a82..14aa22627fe4747d8e42f9442d9952cbf9c6f00d 100644
--- a/pkg/source_span/lib/src/file.dart
+++ b/pkg/source_span/lib/src/file.dart
@@ -207,6 +207,11 @@ class FileSpan extends SourceSpanMixin {
FileSpan._(this.file, this._start, this._end) {
if (_end < _start) {
throw new ArgumentError('End $_end must come after start $_start.');
+ } else if (_end > file.length) {
+ throw new RangeError("End $_end must not be greater than the number "
+ "of characters in the file, ${file.length}.");
+ } else if (_start < 0) {
+ throw new RangeError("Start may not be negative, was $_start.");
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698