Index: runtime/lib/arrays.dart |
=================================================================== |
--- runtime/lib/arrays.dart (revision 402) |
+++ runtime/lib/arrays.dart (working copy) |
@@ -86,5 +86,17 @@ |
} |
return -1; |
} |
+ |
+ static void rangeCheck(Array a, int start, int length) { |
+ if (length < 0) { |
+ throw new IllegalArgumentException("negative length $length"); |
+ } |
+ if (start < 0 || start > a.length) { |
+ throw new IndexOutOfRangeException(start); |
+ } |
+ if (start + length > a.length) { |
+ throw new IndexOutOfRangeException(start + length); |
+ } |
+ } |
} |