There are NativeTypedData classes that aren't lists and have no "length".

Review URL: https://codereview.chromium.org//714873002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41661 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
lrn@google.com 2014-11-11 11:03:39 +00:00
parent e0ed6f6385
commit b22e265e1f

View file

@ -447,8 +447,11 @@ class NativeTypedData implements TypedData {
void _invalidIndex(int index, int length) {
if (index < 0 || index >= length) {
if (length == this.length) {
throw new RangeError.index(index, this);
if (this is List) {
var list = this; // Typed as dynamic to avoid warning.
if (length == list.length) {
throw new RangeError.index(index, this);
}
}
throw new RangeError.range(index, 0, length - 1);
} else {