Chromium Code Reviews| Index: sdk/lib/_internal/compiler/js_lib/native_typed_data.dart |
| diff --git a/sdk/lib/_internal/compiler/js_lib/native_typed_data.dart b/sdk/lib/_internal/compiler/js_lib/native_typed_data.dart |
| index 3267296bec6375bb31e9041eed3c1c0f7c495af2..7769b46b4923f3af8369eeae22b418905e6288e9 100644 |
| --- a/sdk/lib/_internal/compiler/js_lib/native_typed_data.dart |
| +++ b/sdk/lib/_internal/compiler/js_lib/native_typed_data.dart |
| @@ -149,7 +149,10 @@ class NativeFloat32x4List |
| void _invalidIndex(int index, int length) { |
| if (index < 0 || index >= length) { |
|
Lasse Reichstein Nielsen
2014/11/11 10:23:15
This check is also used for things that are not pu
|
| - throw new RangeError.index(index, this); |
| + if (length == this.length) { |
| + throw new RangeError.index(index, this); |
| + } |
| + throw new RangeError.range(index, 0, length - 1); |
| } else { |
| throw new ArgumentError('Invalid list index $index'); |
| } |
| @@ -255,7 +258,10 @@ class NativeInt32x4List |
| void _invalidIndex(int index, int length) { |
| if (index < 0 || index >= length) { |
| - throw new RangeError.index(index, this); |
| + if (length == this.length) { |
| + throw new RangeError.index(index, this); |
| + } |
| + throw new RangeError.range(index, 0, length - 1); |
| } else { |
| throw new ArgumentError('Invalid list index $index'); |
| } |
| @@ -361,7 +367,10 @@ class NativeFloat64x2List |
| void _invalidIndex(int index, int length) { |
| if (index < 0 || index >= length) { |
| - throw new RangeError.index(index, this); |
| + if (length == this.length) { |
| + throw new RangeError.index(index, this); |
| + } |
| + throw new RangeError.range(index, 0, length - 1); |
| } else { |
| throw new ArgumentError('Invalid list index $index'); |
| } |
| @@ -438,7 +447,10 @@ class NativeTypedData implements TypedData { |
| void _invalidIndex(int index, int length) { |
| if (index < 0 || index >= length) { |
| - throw new RangeError.index(index, this); |
| + if (length == this.length) { |
| + throw new RangeError.index(index, this); |
| + } |
| + throw new RangeError.range(index, 0, length - 1); |
| } else { |
| throw new ArgumentError('Invalid list index $index'); |
| } |