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

Unified Diff: runtime/lib/typed_data.dart

Issue 1132603003: Change RangeError instances to use RangeError.range. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adapt function fingerprints too. Created 5 years, 7 months 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 | runtime/vm/exceptions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/typed_data.dart
diff --git a/runtime/lib/typed_data.dart b/runtime/lib/typed_data.dart
index a6d5dfdc0b10cebe944f80a32d57b1a798df3eaa..f70781a8c2b9527de873ec00a30b91315afb5677 100644
--- a/runtime/lib/typed_data.dart
+++ b/runtime/lib/typed_data.dart
@@ -487,14 +487,9 @@ abstract class _TypedListBase {
void setRange(int start, int end, Iterable from, [int skipCount = 0]) {
// Check ranges.
- if ((start < 0) || (start > length)) {
- throw _newRangeError(start, length + 1);
- }
- if ((end < 0) || (end > length)) {
- throw _newRangeError(end, length + 1);
- }
- if (start > end) {
- throw _newRangeError(start, end + 1);
+ if (0 > start || start > end || end > length) {
+ RangeError.checkValidRange(start, end, length); // Always throws.
+ assert(false);
}
if (skipCount < 0) {
throw new ArgumentError(skipCount);
@@ -942,14 +937,14 @@ class _Int8Array extends _TypedList with _IntListMixin implements Int8List {
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getInt8(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setInt8(index, _toInt8(value));
}
@@ -983,14 +978,14 @@ class _Uint8Array extends _TypedList with _IntListMixin implements Uint8List {
// Methods implementing List interface.
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getUint8(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setUint8(index, _toUint8(value));
}
@@ -1023,14 +1018,14 @@ class _Uint8ClampedArray extends _TypedList with _IntListMixin implements Uint8C
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getUint8(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setUint8(index, _toClampedUint8(value));
}
@@ -1065,14 +1060,14 @@ class _Int16Array extends _TypedList with _IntListMixin implements Int16List {
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedInt16(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedInt16(index, _toInt16(value));
}
@@ -1125,14 +1120,14 @@ class _Uint16Array extends _TypedList with _IntListMixin implements Uint16List {
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedUint16(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedUint16(index, _toUint16(value));
}
@@ -1185,14 +1180,14 @@ class _Int32Array extends _TypedList with _IntListMixin implements Int32List {
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedInt32(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedInt32(index, _toInt32(value));
}
@@ -1235,14 +1230,14 @@ class _Uint32Array extends _TypedList with _IntListMixin implements Uint32List {
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedUint32(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedUint32(index, _toUint32(value));
}
@@ -1285,14 +1280,14 @@ class _Int64Array extends _TypedList with _IntListMixin implements Int64List {
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedInt64(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedInt64(index, _toInt64(value));
}
@@ -1335,14 +1330,14 @@ class _Uint64Array extends _TypedList with _IntListMixin implements Uint64List {
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedUint64(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedUint64(index, _toUint64(value));
}
@@ -1385,14 +1380,14 @@ class _Float32Array extends _TypedList with _DoubleListMixin implements Float32L
double operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat32(index);
}
void operator[]=(int index, double value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedFloat32(index, value);
}
@@ -1435,14 +1430,14 @@ class _Float64Array extends _TypedList with _DoubleListMixin implements Float64L
double operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat64(index);
}
void operator[]=(int index, double value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedFloat64(index, value);
}
@@ -1483,14 +1478,14 @@ class _Float32x4Array extends _TypedList with _Float32x4ListMixin implements Flo
Float32x4 operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat32x4(index);
}
void operator[]=(int index, Float32x4 value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedFloat32x4(index, value);
}
@@ -1531,14 +1526,14 @@ class _Int32x4Array extends _TypedList with _Int32x4ListMixin implements Int32x4
Int32x4 operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedInt32x4(index);
}
void operator[]=(int index, Int32x4 value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedInt32x4(index, value);
}
@@ -1579,14 +1574,14 @@ class _Float64x2Array extends _TypedList with _Float64x2ListMixin implements Flo
Float64x2 operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat64x2(index);
}
void operator[]=(int index, Float64x2 value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedFloat64x2(index, value);
}
@@ -1628,14 +1623,14 @@ class _ExternalInt8Array extends _TypedList with _IntListMixin implements Int8Li
// Method(s) implementing the List interface.
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getInt8(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setInt8(index, value);
}
@@ -1671,14 +1666,14 @@ class _ExternalUint8Array extends _TypedList with _IntListMixin implements Uint8
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getUint8(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setUint8(index, _toUint8(value));
}
@@ -1713,14 +1708,14 @@ class _ExternalUint8ClampedArray extends _TypedList with _IntListMixin implement
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getUint8(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setUint8(index, _toClampedUint8(value));
}
@@ -1756,14 +1751,14 @@ class _ExternalInt16Array extends _TypedList with _IntListMixin implements Int16
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedInt16(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedInt16(index, _toInt16(value));
}
@@ -1807,14 +1802,14 @@ class _ExternalUint16Array extends _TypedList with _IntListMixin implements Uint
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedUint16(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedUint16(index, _toUint16(value));
}
@@ -1858,14 +1853,14 @@ class _ExternalInt32Array extends _TypedList with _IntListMixin implements Int32
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedInt32(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedInt32(index, _toInt32(value));
}
@@ -1909,14 +1904,14 @@ class _ExternalUint32Array extends _TypedList with _IntListMixin implements Uint
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedUint32(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedUint32(index, _toUint32(value));
}
@@ -1960,14 +1955,14 @@ class _ExternalInt64Array extends _TypedList with _IntListMixin implements Int64
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedInt64(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedInt64(index, _toInt64(value));
}
@@ -2011,14 +2006,14 @@ class _ExternalUint64Array extends _TypedList with _IntListMixin implements Uint
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedUint64(index);
}
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedUint64(index, _toUint64(value));
}
@@ -2062,14 +2057,14 @@ class _ExternalFloat32Array extends _TypedList with _DoubleListMixin implements
double operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat32(index);
}
void operator[]=(int index, double value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedFloat32(index, value);
}
@@ -2113,14 +2108,14 @@ class _ExternalFloat64Array extends _TypedList with _DoubleListMixin implements
double operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat64(index);
}
void operator[]=(int index, double value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedFloat64(index, value);
}
@@ -2164,14 +2159,14 @@ class _ExternalFloat32x4Array extends _TypedList with _Float32x4ListMixin implem
Float32x4 operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat32x4(index);
}
void operator[]=(int index, Float32x4 value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedFloat32x4(index, value);
}
@@ -2215,14 +2210,14 @@ class _ExternalInt32x4Array extends _TypedList with _Int32x4ListMixin implements
Int32x4 operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedInt32x4(index);
}
void operator[]=(int index, Int32x4 value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedInt32x4(index, value);
}
@@ -2266,14 +2261,14 @@ class _ExternalFloat64x2Array extends _TypedList with _Float64x2ListMixin implem
Float64x2 operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat64x2(index);
}
void operator[]=(int index, Float64x2 value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_setIndexedFloat64x2(index, value);
}
@@ -2594,7 +2589,7 @@ class _Int8ArrayView extends _TypedListView with _IntListMixin implements Int8Li
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getInt8(offsetInBytes +
(index * Int8List.BYTES_PER_ELEMENT));
@@ -2602,7 +2597,7 @@ class _Int8ArrayView extends _TypedListView with _IntListMixin implements Int8Li
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT),
_toInt8(value));
@@ -2641,7 +2636,7 @@ class _Uint8ArrayView extends _TypedListView with _IntListMixin implements Uint8
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getUint8(offsetInBytes +
(index * Uint8List.BYTES_PER_ELEMENT));
@@ -2649,7 +2644,7 @@ class _Uint8ArrayView extends _TypedListView with _IntListMixin implements Uint8
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT),
_toUint8(value));
@@ -2689,7 +2684,7 @@ class _Uint8ClampedArrayView extends _TypedListView with _IntListMixin implement
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getUint8(offsetInBytes +
(index * Uint8List.BYTES_PER_ELEMENT));
@@ -2697,7 +2692,7 @@ class _Uint8ClampedArrayView extends _TypedListView with _IntListMixin implement
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT),
_toClampedUint8(value));
@@ -2737,7 +2732,7 @@ class _Int16ArrayView extends _TypedListView with _IntListMixin implements Int16
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getInt16(offsetInBytes +
(index * Int16List.BYTES_PER_ELEMENT));
@@ -2745,7 +2740,7 @@ class _Int16ArrayView extends _TypedListView with _IntListMixin implements Int16
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT),
_toInt16(value));
@@ -2795,7 +2790,7 @@ class _Uint16ArrayView extends _TypedListView with _IntListMixin implements Uint
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getUint16(offsetInBytes +
(index * Uint16List.BYTES_PER_ELEMENT));
@@ -2803,7 +2798,7 @@ class _Uint16ArrayView extends _TypedListView with _IntListMixin implements Uint
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT),
_toUint16(value));
@@ -2852,7 +2847,7 @@ class _Int32ArrayView extends _TypedListView with _IntListMixin implements Int32
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getInt32(offsetInBytes +
(index * Int32List.BYTES_PER_ELEMENT));
@@ -2860,7 +2855,7 @@ class _Int32ArrayView extends _TypedListView with _IntListMixin implements Int32
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT),
_toInt32(value));
@@ -2900,7 +2895,7 @@ class _Uint32ArrayView extends _TypedListView with _IntListMixin implements Uint
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getUint32(offsetInBytes +
(index * Uint32List.BYTES_PER_ELEMENT));
@@ -2908,7 +2903,7 @@ class _Uint32ArrayView extends _TypedListView with _IntListMixin implements Uint
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT),
_toUint32(value));
@@ -2948,7 +2943,7 @@ class _Int64ArrayView extends _TypedListView with _IntListMixin implements Int64
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getInt64(offsetInBytes +
(index * Int64List.BYTES_PER_ELEMENT));
@@ -2956,7 +2951,7 @@ class _Int64ArrayView extends _TypedListView with _IntListMixin implements Int64
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT),
_toInt64(value));
@@ -2996,7 +2991,7 @@ class _Uint64ArrayView extends _TypedListView with _IntListMixin implements Uint
int operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getUint64(offsetInBytes +
(index * Uint64List.BYTES_PER_ELEMENT));
@@ -3004,7 +2999,7 @@ class _Uint64ArrayView extends _TypedListView with _IntListMixin implements Uint
void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT),
_toUint64(value));
@@ -3044,7 +3039,7 @@ class _Float32ArrayView extends _TypedListView with _DoubleListMixin implements
double operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getFloat32(offsetInBytes +
(index * Float32List.BYTES_PER_ELEMENT));
@@ -3052,7 +3047,7 @@ class _Float32ArrayView extends _TypedListView with _DoubleListMixin implements
void operator[]=(int index, double value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setFloat32(offsetInBytes +
(index * Float32List.BYTES_PER_ELEMENT), value);
@@ -3092,7 +3087,7 @@ class _Float64ArrayView extends _TypedListView with _DoubleListMixin implements
double operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getFloat64(offsetInBytes +
(index * Float64List.BYTES_PER_ELEMENT));
@@ -3100,7 +3095,7 @@ class _Float64ArrayView extends _TypedListView with _DoubleListMixin implements
void operator[]=(int index, double value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setFloat64(offsetInBytes +
(index * Float64List.BYTES_PER_ELEMENT), value);
@@ -3140,7 +3135,7 @@ class _Float32x4ArrayView extends _TypedListView with _Float32x4ListMixin implem
Float32x4 operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getFloat32x4(offsetInBytes +
(index * Float32x4List.BYTES_PER_ELEMENT));
@@ -3148,7 +3143,7 @@ class _Float32x4ArrayView extends _TypedListView with _Float32x4ListMixin implem
void operator[]=(int index, Float32x4 value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setFloat32x4(offsetInBytes +
(index * Float32x4List.BYTES_PER_ELEMENT), value);
@@ -3188,7 +3183,7 @@ class _Int32x4ArrayView extends _TypedListView with _Int32x4ListMixin implements
Int32x4 operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getInt32x4(offsetInBytes +
(index * Int32x4List.BYTES_PER_ELEMENT));
@@ -3196,7 +3191,7 @@ class _Int32x4ArrayView extends _TypedListView with _Int32x4ListMixin implements
void operator[]=(int index, Int32x4 value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setInt32x4(offsetInBytes +
(index * Int32x4List.BYTES_PER_ELEMENT), value);
@@ -3236,7 +3231,7 @@ class _Float64x2ArrayView extends _TypedListView with _Float64x2ListMixin implem
Float64x2 operator[](int index) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
return _typedData._getFloat64x2(offsetInBytes +
(index * Float64x2List.BYTES_PER_ELEMENT));
@@ -3244,7 +3239,7 @@ class _Float64x2ArrayView extends _TypedListView with _Float64x2ListMixin implem
void operator[]=(int index, Float64x2 value) {
if (index < 0 || index >= length) {
- throw _newRangeError(index, length);
+ throw new RangeError.index(index, this, "index");
}
_typedData._setFloat64x2(offsetInBytes +
(index * Float64x2List.BYTES_PER_ELEMENT), value);
@@ -3297,33 +3292,33 @@ class _ByteDataView implements ByteData {
int getInt8(int byteOffset) {
if (byteOffset < 0 || byteOffset >= length) {
- throw _newRangeError(byteOffset, length);
+ throw new RangeError.index(byteOffset, this, "byteOffset");
}
return _typedData._getInt8(_offset + byteOffset);
}
void setInt8(int byteOffset, int value) {
if (byteOffset < 0 || byteOffset >= length) {
- throw _newRangeError(byteOffset, length);
+ throw new RangeError.index(byteOffset, this, "byteOffset");
}
_typedData._setInt8(_offset + byteOffset, value);
}
int getUint8(int byteOffset) {
if (byteOffset < 0 || byteOffset >= length) {
- throw _newRangeError(byteOffset, length);
+ throw new RangeError.index(byteOffset, this, "byteOffset");
}
return _typedData._getUint8(_offset + byteOffset);
}
void setUint8(int byteOffset, int value) {
if (byteOffset < 0 || byteOffset >= length) {
- throw _newRangeError(byteOffset, length);
+ throw new RangeError.index(byteOffset, this, "byteOffset");
}
_typedData._setUint8(_offset + byteOffset, value);
}
int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 1 >= length) {
- throw _newRangeError(byteOffset + 1, length);
+ throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
}
var result = _typedData._getInt16(_offset + byteOffset);
if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3335,7 +3330,7 @@ class _ByteDataView implements ByteData {
int value,
[Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 1 >= length) {
- throw _newRangeError(byteOffset + 1, length);
+ throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
}
_typedData._setInt16(_offset + byteOffset,
identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value));
@@ -3343,7 +3338,7 @@ class _ByteDataView implements ByteData {
int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 1 >= length) {
- throw _newRangeError(byteOffset + 1, length);
+ throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
}
var result = _typedData._getUint16(_offset + byteOffset);
if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3355,7 +3350,7 @@ class _ByteDataView implements ByteData {
int value,
[Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 1 >= length) {
- throw _newRangeError(byteOffset + 1, length);
+ throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
}
_typedData._setUint16(_offset + byteOffset,
identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value));
@@ -3363,7 +3358,7 @@ class _ByteDataView implements ByteData {
int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
- throw _newRangeError(byteOffset + 3, length);
+ throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
var result = _typedData._getInt32(_offset + byteOffset);
if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3375,7 +3370,7 @@ class _ByteDataView implements ByteData {
int value,
[Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
- throw _newRangeError(byteOffset + 3, length);
+ throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
_typedData._setInt32(_offset + byteOffset,
identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value));
@@ -3383,7 +3378,7 @@ class _ByteDataView implements ByteData {
int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
- throw _newRangeError(byteOffset + 3, length);
+ throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
var result = _typedData._getUint32(_offset + byteOffset);
if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3395,7 +3390,7 @@ class _ByteDataView implements ByteData {
int value,
[Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
- throw _newRangeError(byteOffset + 3, length);
+ throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
_typedData._setUint32(_offset + byteOffset,
identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value));
@@ -3403,7 +3398,7 @@ class _ByteDataView implements ByteData {
int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 7 >= length) {
- throw _newRangeError(byteOffset + 7, length);
+ throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
}
var result = _typedData._getInt64(_offset + byteOffset);
if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3415,7 +3410,7 @@ class _ByteDataView implements ByteData {
int value,
[Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 7 >= length) {
- throw _newRangeError(byteOffset + 7, length);
+ throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
}
_typedData._setInt64(_offset + byteOffset,
identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value));
@@ -3423,7 +3418,7 @@ class _ByteDataView implements ByteData {
int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 7 >= length) {
- throw _newRangeError(byteOffset + 7, length);
+ throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
}
var result = _typedData._getUint64(_offset + byteOffset);
if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3435,7 +3430,7 @@ class _ByteDataView implements ByteData {
int value,
[Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 7 >= length) {
- throw _newRangeError(byteOffset + 7, length);
+ throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
}
_typedData._setUint64(_offset + byteOffset,
identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value));
@@ -3444,7 +3439,7 @@ class _ByteDataView implements ByteData {
double getFloat32(int byteOffset,
[Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
- throw _newRangeError(byteOffset + 3, length);
+ throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
if (identical(endian, Endianness.HOST_ENDIAN)) {
return _typedData._getFloat32(_offset + byteOffset);
@@ -3456,7 +3451,7 @@ class _ByteDataView implements ByteData {
double value,
[Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
- throw _newRangeError(byteOffset + 3, length);
+ throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
if (identical(endian, Endianness.HOST_ENDIAN)) {
_typedData._setFloat32(_offset + byteOffset, value);
@@ -3469,7 +3464,7 @@ class _ByteDataView implements ByteData {
double getFloat64(int byteOffset,
[Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 7 >= length) {
- throw _newRangeError(byteOffset + 7, length);
+ throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
}
if (identical(endian, Endianness.HOST_ENDIAN)) {
return _typedData._getFloat64(_offset + byteOffset);
@@ -3481,7 +3476,7 @@ class _ByteDataView implements ByteData {
double value,
[Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 7 >= length) {
- throw _newRangeError(byteOffset + 7, length);
+ throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
}
if (identical(endian, Endianness.HOST_ENDIAN)) {
_typedData._setFloat64(_offset + byteOffset, value);
@@ -3494,7 +3489,7 @@ class _ByteDataView implements ByteData {
Float32x4 getFloat32x4(int byteOffset,
[Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
- throw _newRangeError(byteOffset + 3, length);
+ throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
// TODO(johnmccutchan) : Need to resolve this for endianity.
return _typedData._getFloat32x4(_offset + byteOffset);
@@ -3503,7 +3498,7 @@ class _ByteDataView implements ByteData {
Float32x4 value,
[Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
- throw _newRangeError(byteOffset + 3, length);
+ throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
// TODO(johnmccutchan) : Need to resolve this for endianity.
_typedData._setFloat32x4(_offset + byteOffset, value);
@@ -3621,9 +3616,3 @@ int _defaultIfNull(object, value) {
}
return object;
}
-
-
-_newRangeError(int index, int length) {
- String message = "$index must be in the range [0..$length)";
- return new RangeError(message);
-}
« no previous file with comments | « no previous file | runtime/vm/exceptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698