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

Side by Side 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: Tweaks 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/exceptions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // patch classes for Int8List ..... Float64List and ByteData implementations. 5 // patch classes for Int8List ..... Float64List and ByteData implementations.
6 6
7 import "dart:_internal"; 7 import "dart:_internal";
8 import 'dart:math' show Random; 8 import 'dart:math' show Random;
9 9
10 patch class Int8List { 10 patch class Int8List {
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 List sublist(int start, [int end]) { 479 List sublist(int start, [int end]) {
480 if (end == null) end = this.length; 480 if (end == null) end = this.length;
481 var length = end - start; 481 var length = end - start;
482 _rangeCheck(this.length, start, length); 482 _rangeCheck(this.length, start, length);
483 List result = _createList(length); 483 List result = _createList(length);
484 result.setRange(0, length, this, start); 484 result.setRange(0, length, this, start);
485 return result; 485 return result;
486 } 486 }
487 487
488 void setRange(int start, int end, Iterable from, [int skipCount = 0]) { 488 void setRange(int start, int end, Iterable from, [int skipCount = 0]) {
489 // Check ranges. 489 if (0 <= start && start <= end && end <= length) {
Ivan Posva 2015/05/14 18:13:18 () around comparisons is generally the style we ar
490 if ((start < 0) || (start > length)) { 490 final count = end - start;
491 throw _newRangeError(start, length + 1); 491 if (count == 0) return;
492 }
493 if ((end < 0) || (end > length)) {
494 throw _newRangeError(end, length + 1);
495 }
496 if (start > end) {
497 throw _newRangeError(start, end + 1);
498 }
499 if (skipCount < 0) {
Ivan Posva 2015/05/14 18:13:18 This part is missed in the new code.
Lasse Reichstein Nielsen 2015/05/18 12:21:09 Acknowledged.
500 throw new ArgumentError(skipCount);
501 }
502 492
503 final count = end - start; 493 if (from is _TypedListBase) {
504 if ((from.length - skipCount) < count) { 494 if ((from.length - skipCount) < count) {
Ivan Posva 2015/05/14 18:13:18 This part will be missed if count is 0 in the new
505 throw IterableElementError.tooFew(); 495 throw IterableElementError.tooFew();
506 } 496 }
507 497 if (this.elementSizeInBytes == from.elementSizeInBytes) {
508 if (from is _TypedListBase) { 498 if ((count < 10) && (from.buffer != this.buffer)) {
509 if (this.elementSizeInBytes == from.elementSizeInBytes) { 499 Lists.copy(from, skipCount, this, start, count);
510 if ((count < 10) && (from.buffer != this.buffer)) { 500 return;
511 Lists.copy(from, skipCount, this, start, count); 501 } else if (this.buffer._data._setRange(
512 return; 502 start * elementSizeInBytes + this.offsetInBytes,
513 } else if (this.buffer._data._setRange( 503 count * elementSizeInBytes,
514 start * elementSizeInBytes + this.offsetInBytes, 504 from.buffer._data,
515 count * elementSizeInBytes, 505 skipCount * elementSizeInBytes + from.offsetInBytes,
516 from.buffer._data, 506 ClassID.getID(this), ClassID.getID(from))) {
517 skipCount * elementSizeInBytes + from.offsetInBytes, 507 return;
518 ClassID.getID(this), ClassID.getID(from))) { 508 }
509 } else if (from.buffer == this.buffer) {
510 // Different element sizes, but same buffer means that we need
511 // an intermediate structure.
512 // TODO(srdjan): Optimize to skip copying if the range does not overla p.
Søren Gjesse 2015/05/13 11:22:08 Long line.
Lasse Reichstein Nielsen 2015/05/18 12:21:09 Done.
513 final temp_buffer = new List(count);
514 for (var i = 0; i < count; i++) {
515 temp_buffer[i] = from[skipCount + i];
516 }
517 for (var i = start; i < end; i++) {
518 this[i] = temp_buffer[i - start];
519 }
519 return; 520 return;
520 } 521 }
521 } else if (from.buffer == this.buffer) {
522 // Different element sizes, but same buffer means that we need
523 // an intermediate structure.
524 // TODO(srdjan): Optimize to skip copying if the range does not overlap.
525 final temp_buffer = new List(count);
526 for (var i = 0; i < count; i++) {
527 temp_buffer[i] = from[skipCount + i];
528 }
529 for (var i = start; i < end; i++) {
530 this[i] = temp_buffer[i - start];
531 }
532 return;
533 } 522 }
523
524 List otherList;
525 int otherStart;
526 if (from is List) {
527 otherList = from;
528 otherStart = skipCount;
529 } else {
530 otherList = from.skip(skipCount).take(count).toList(growable: false);
531 otherStart = 0;
532 }
533 if (otherStart + count > otherList.length) {
534 throw IterableElementError.tooFew();
535 }
536 Lists.copy(otherList, otherStart, this, start, count);
537 return;
534 } 538 }
535 539 assert(end != null);
Søren Gjesse 2015/05/13 11:22:08 assert(start != null) as well for completeness.
Lasse Reichstein Nielsen 2015/05/18 12:21:08 The assert is only relevant because RangeError.che
536 if (count == 0) return; 540 // Guaranteed to fail.
537 List otherList; 541 RangeError.checkValidRange(start, end, length);
Søren Gjesse 2015/05/13 11:22:08 Add assert(false)?
Lasse Reichstein Nielsen 2015/05/18 12:21:09 Slightly icky, but ok.
538 int otherStart;
539 if (from is List) {
540 otherList = from;
541 otherStart = skipCount;
542 } else {
543 otherList = from.skip(skipCount).toList(growable: false);
544 otherStart = 0;
545 }
546 if (otherStart + count > otherList.length) {
547 throw IterableElementError.tooFew();
548 }
549 Lists.copy(otherList, otherStart, this, start, count);
550 } 542 }
551 543
552 void setAll(int index, Iterable iterable) { 544 void setAll(int index, Iterable iterable) {
553 final end = iterable.length + index; 545 final end = iterable.length + index;
554 setRange(index, end, iterable); 546 setRange(index, end, iterable);
555 } 547 }
556 548
557 void fillRange(int start, int end, [fillValue]) { 549 void fillRange(int start, int end, [fillValue]) {
558 RangeError.checkValidRange(start, end, this.length); 550 RangeError.checkValidRange(start, end, this.length);
559 for (var i = start; i < end; ++i) { 551 for (var i = start; i < end; ++i) {
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 // Factory constructors. 926 // Factory constructors.
935 927
936 factory _Int8Array(int length) { 928 factory _Int8Array(int length) {
937 return _new(length); 929 return _new(length);
938 } 930 }
939 931
940 932
941 // Method(s) implementing List interface. 933 // Method(s) implementing List interface.
942 934
943 int operator[](int index) { 935 int operator[](int index) {
944 if (index < 0 || index >= length) { 936 if (index >= 0 && index < length) {
Ivan Posva 2015/05/14 18:13:18 Please do not change the style of the functions! H
Lasse Reichstein Nielsen 2015/05/18 12:21:09 This was a, possibly premature, attempt to improve
945 throw _newRangeError(index, length); 937 return _getInt8(index);
946 } 938 }
947 return _getInt8(index); 939 throw new RangeError.index(index, this, "index");
948 } 940 }
949 941
950 void operator[]=(int index, int value) { 942 void operator[]=(int index, int value) {
951 if (index < 0 || index >= length) { 943 if (index >= 0 && index < length) {
952 throw _newRangeError(index, length); 944 _setInt8(index, _toInt8(value));
945 return;
953 } 946 }
954 _setInt8(index, _toInt8(value)); 947 throw new RangeError.index(index, this, "index");
955 } 948 }
956 949
957 950
958 // Method(s) implementing TypedData interface. 951 // Method(s) implementing TypedData interface.
959 952
960 int get elementSizeInBytes { 953 int get elementSizeInBytes {
961 return Int8List.BYTES_PER_ELEMENT; 954 return Int8List.BYTES_PER_ELEMENT;
962 } 955 }
963 956
964 957
(...skipping 10 matching lines...) Expand all
975 class _Uint8Array extends _TypedList with _IntListMixin implements Uint8List { 968 class _Uint8Array extends _TypedList with _IntListMixin implements Uint8List {
976 // Factory constructors. 969 // Factory constructors.
977 970
978 factory _Uint8Array(int length) { 971 factory _Uint8Array(int length) {
979 return _new(length); 972 return _new(length);
980 } 973 }
981 974
982 975
983 // Methods implementing List interface. 976 // Methods implementing List interface.
984 int operator[](int index) { 977 int operator[](int index) {
985 if (index < 0 || index >= length) { 978 if (index >= 0 && index < length) {
986 throw _newRangeError(index, length); 979 return _getUint8(index);
987 } 980 }
988 return _getUint8(index); 981 throw new RangeError.index(index, this, "index");
989 } 982 }
990 983
991 void operator[]=(int index, int value) { 984 void operator[]=(int index, int value) {
992 if (index < 0 || index >= length) { 985 if (index >= 0 && index < length) {
993 throw _newRangeError(index, length); 986 _setUint8(index, _toUint8(value));
987 return;
994 } 988 }
995 _setUint8(index, _toUint8(value)); 989 throw new RangeError.index(index, this, "index");
996 } 990 }
997 991
998 992
999 // Methods implementing TypedData interface. 993 // Methods implementing TypedData interface.
1000 int get elementSizeInBytes { 994 int get elementSizeInBytes {
1001 return Uint8List.BYTES_PER_ELEMENT; 995 return Uint8List.BYTES_PER_ELEMENT;
1002 } 996 }
1003 997
1004 998
1005 // Internal utility methods. 999 // Internal utility methods.
1006 1000
1007 _Uint8Array _createList(int length) { 1001 _Uint8Array _createList(int length) {
1008 return _new(length); 1002 return _new(length);
1009 } 1003 }
1010 1004
1011 static _Uint8Array _new(int length) native "TypedData_Uint8Array_new"; 1005 static _Uint8Array _new(int length) native "TypedData_Uint8Array_new";
1012 } 1006 }
1013 1007
1014 1008
1015 class _Uint8ClampedArray extends _TypedList with _IntListMixin implements Uint8C lampedList { 1009 class _Uint8ClampedArray extends _TypedList with _IntListMixin implements Uint8C lampedList {
1016 // Factory constructors. 1010 // Factory constructors.
1017 1011
1018 factory _Uint8ClampedArray(int length) { 1012 factory _Uint8ClampedArray(int length) {
1019 return _new(length); 1013 return _new(length);
1020 } 1014 }
1021 1015
1022 // Methods implementing List interface. 1016 // Methods implementing List interface.
1023 1017
1024 int operator[](int index) { 1018 int operator[](int index) {
1025 if (index < 0 || index >= length) { 1019 if (index >= 0 && index < length) {
1026 throw _newRangeError(index, length); 1020 return _getUint8(index);
1027 } 1021 }
1028 return _getUint8(index); 1022 throw new RangeError.index(index, this, "index");
1029 } 1023 }
1030 1024
1031 void operator[]=(int index, int value) { 1025 void operator[]=(int index, int value) {
1032 if (index < 0 || index >= length) { 1026 if (index >= 0 && index < length) {
1033 throw _newRangeError(index, length); 1027 _setUint8(index, _toClampedUint8(value));
1028 return;
1034 } 1029 }
1035 _setUint8(index, _toClampedUint8(value)); 1030 throw new RangeError.index(index, this, "index");
1036 } 1031 }
1037 1032
1038 1033
1039 // Methods implementing TypedData interface. 1034 // Methods implementing TypedData interface.
1040 int get elementSizeInBytes { 1035 int get elementSizeInBytes {
1041 return Uint8List.BYTES_PER_ELEMENT; 1036 return Uint8List.BYTES_PER_ELEMENT;
1042 } 1037 }
1043 1038
1044 1039
1045 // Internal utility methods. 1040 // Internal utility methods.
(...skipping 11 matching lines...) Expand all
1057 // Factory constructors. 1052 // Factory constructors.
1058 1053
1059 factory _Int16Array(int length) { 1054 factory _Int16Array(int length) {
1060 return _new(length); 1055 return _new(length);
1061 } 1056 }
1062 1057
1063 1058
1064 // Method(s) implementing List interface. 1059 // Method(s) implementing List interface.
1065 1060
1066 int operator[](int index) { 1061 int operator[](int index) {
1067 if (index < 0 || index >= length) { 1062 if (index >= 0 && index < length) {
1068 throw _newRangeError(index, length); 1063 return _getIndexedInt16(index);
1069 } 1064 }
1070 return _getIndexedInt16(index); 1065 throw new RangeError.index(index, this, "index");
1071 } 1066 }
1072 1067
1073 void operator[]=(int index, int value) { 1068 void operator[]=(int index, int value) {
1074 if (index < 0 || index >= length) { 1069 if (index >= 0 && index < length) {
1075 throw _newRangeError(index, length); 1070 _setIndexedInt16(index, _toInt16(value));
1071 return;
1076 } 1072 }
1077 _setIndexedInt16(index, _toInt16(value)); 1073 throw new RangeError.index(index, this, "index");
1078 } 1074 }
1079 1075
1080 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { 1076 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
1081 if (ClassID.getID(iterable) == CodeUnits.cid) { 1077 if (ClassID.getID(iterable) == CodeUnits.cid) {
1082 end = RangeError.checkValidRange(start, end, this.length); 1078 end = RangeError.checkValidRange(start, end, this.length);
1083 int length = end - start; 1079 int length = end - start;
1084 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT; 1080 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT;
1085 _setCodeUnits(iterable, byteStart, length, skipCount); 1081 _setCodeUnits(iterable, byteStart, length, skipCount);
1086 } else { 1082 } else {
1087 super.setRange(start, end, iterable, skipCount); 1083 super.setRange(start, end, iterable, skipCount);
(...skipping 29 matching lines...) Expand all
1117 // Factory constructors. 1113 // Factory constructors.
1118 1114
1119 factory _Uint16Array(int length) { 1115 factory _Uint16Array(int length) {
1120 return _new(length); 1116 return _new(length);
1121 } 1117 }
1122 1118
1123 1119
1124 // Method(s) implementing the List interface. 1120 // Method(s) implementing the List interface.
1125 1121
1126 int operator[](int index) { 1122 int operator[](int index) {
1127 if (index < 0 || index >= length) { 1123 if (index >= 0 && index < length) {
1128 throw _newRangeError(index, length); 1124 return _getIndexedUint16(index);
1129 } 1125 }
1130 return _getIndexedUint16(index); 1126 throw new RangeError.index(index, this, "index");
1131 } 1127 }
1132 1128
1133 void operator[]=(int index, int value) { 1129 void operator[]=(int index, int value) {
1134 if (index < 0 || index >= length) { 1130 if (index >= 0 && index < length) {
1135 throw _newRangeError(index, length); 1131 _setIndexedUint16(index, _toUint16(value));
1132 return;
1136 } 1133 }
1137 _setIndexedUint16(index, _toUint16(value)); 1134 throw new RangeError.index(index, this, "index");
1138 } 1135 }
1139 1136
1140 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { 1137 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
1141 if (ClassID.getID(iterable) == CodeUnits.cid) { 1138 if (ClassID.getID(iterable) == CodeUnits.cid) {
1142 end = RangeError.checkValidRange(start, end, this.length); 1139 end = RangeError.checkValidRange(start, end, this.length);
1143 int length = end - start; 1140 int length = end - start;
1144 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT; 1141 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT;
1145 _setCodeUnits(iterable, byteStart, length, skipCount); 1142 _setCodeUnits(iterable, byteStart, length, skipCount);
1146 } else { 1143 } else {
1147 super.setRange(start, end, iterable, skipCount); 1144 super.setRange(start, end, iterable, skipCount);
(...skipping 29 matching lines...) Expand all
1177 // Factory constructors. 1174 // Factory constructors.
1178 1175
1179 factory _Int32Array(int length) { 1176 factory _Int32Array(int length) {
1180 return _new(length); 1177 return _new(length);
1181 } 1178 }
1182 1179
1183 1180
1184 // Method(s) implementing the List interface. 1181 // Method(s) implementing the List interface.
1185 1182
1186 int operator[](int index) { 1183 int operator[](int index) {
1187 if (index < 0 || index >= length) { 1184 if (index >= 0 && index < length) {
1188 throw _newRangeError(index, length); 1185 return _getIndexedInt32(index);
1189 } 1186 }
1190 return _getIndexedInt32(index); 1187 throw new RangeError.index(index, this, "index");
1191 } 1188 }
1192 1189
1193 void operator[]=(int index, int value) { 1190 void operator[]=(int index, int value) {
1194 if (index < 0 || index >= length) { 1191 if (index >= 0 && index < length) {
1195 throw _newRangeError(index, length); 1192 _setIndexedInt32(index, _toInt32(value));
1193 return;
1196 } 1194 }
1197 _setIndexedInt32(index, _toInt32(value)); 1195 throw new RangeError.index(index, this, "index");
1198 } 1196 }
1199 1197
1200 1198
1201 // Method(s) implementing TypedData interface. 1199 // Method(s) implementing TypedData interface.
1202 1200
1203 int get elementSizeInBytes { 1201 int get elementSizeInBytes {
1204 return Int32List.BYTES_PER_ELEMENT; 1202 return Int32List.BYTES_PER_ELEMENT;
1205 } 1203 }
1206 1204
1207 1205
(...skipping 19 matching lines...) Expand all
1227 // Factory constructors. 1225 // Factory constructors.
1228 1226
1229 factory _Uint32Array(int length) { 1227 factory _Uint32Array(int length) {
1230 return _new(length); 1228 return _new(length);
1231 } 1229 }
1232 1230
1233 1231
1234 // Method(s) implementing the List interface. 1232 // Method(s) implementing the List interface.
1235 1233
1236 int operator[](int index) { 1234 int operator[](int index) {
1237 if (index < 0 || index >= length) { 1235 if (index >= 0 && index < length) {
1238 throw _newRangeError(index, length); 1236 return _getIndexedUint32(index);
1239 } 1237 }
1240 return _getIndexedUint32(index); 1238 throw new RangeError.index(index, this, "index");
1241 } 1239 }
1242 1240
1243 void operator[]=(int index, int value) { 1241 void operator[]=(int index, int value) {
1244 if (index < 0 || index >= length) { 1242 if (index >= 0 && index < length) {
1245 throw _newRangeError(index, length); 1243 _setIndexedUint32(index, _toUint32(value));
1244 return;
1246 } 1245 }
1247 _setIndexedUint32(index, _toUint32(value)); 1246 throw new RangeError.index(index, this, "index");
1248 } 1247 }
1249 1248
1250 1249
1251 // Method(s) implementing the TypedData interface. 1250 // Method(s) implementing the TypedData interface.
1252 1251
1253 int get elementSizeInBytes { 1252 int get elementSizeInBytes {
1254 return Uint32List.BYTES_PER_ELEMENT; 1253 return Uint32List.BYTES_PER_ELEMENT;
1255 } 1254 }
1256 1255
1257 1256
(...skipping 19 matching lines...) Expand all
1277 // Factory constructors. 1276 // Factory constructors.
1278 1277
1279 factory _Int64Array(int length) { 1278 factory _Int64Array(int length) {
1280 return _new(length); 1279 return _new(length);
1281 } 1280 }
1282 1281
1283 1282
1284 // Method(s) implementing the List interface. 1283 // Method(s) implementing the List interface.
1285 1284
1286 int operator[](int index) { 1285 int operator[](int index) {
1287 if (index < 0 || index >= length) { 1286 if (index >= 0 && index < length) {
1288 throw _newRangeError(index, length); 1287 return _getIndexedInt64(index);
1289 } 1288 }
1290 return _getIndexedInt64(index); 1289 throw new RangeError.index(index, this, "index");
1291 } 1290 }
1292 1291
1293 void operator[]=(int index, int value) { 1292 void operator[]=(int index, int value) {
1294 if (index < 0 || index >= length) { 1293 if (index >= 0 && index < length) {
1295 throw _newRangeError(index, length); 1294 _setIndexedInt64(index, _toInt64(value));
1295 return;
1296 } 1296 }
1297 _setIndexedInt64(index, _toInt64(value)); 1297 throw new RangeError.index(index, this, "index");
1298 } 1298 }
1299 1299
1300 1300
1301 // Method(s) implementing the TypedData interface. 1301 // Method(s) implementing the TypedData interface.
1302 1302
1303 int get elementSizeInBytes { 1303 int get elementSizeInBytes {
1304 return Int64List.BYTES_PER_ELEMENT; 1304 return Int64List.BYTES_PER_ELEMENT;
1305 } 1305 }
1306 1306
1307 1307
(...skipping 19 matching lines...) Expand all
1327 // Factory constructors. 1327 // Factory constructors.
1328 1328
1329 factory _Uint64Array(int length) { 1329 factory _Uint64Array(int length) {
1330 return _new(length); 1330 return _new(length);
1331 } 1331 }
1332 1332
1333 1333
1334 // Method(s) implementing the List interface. 1334 // Method(s) implementing the List interface.
1335 1335
1336 int operator[](int index) { 1336 int operator[](int index) {
1337 if (index < 0 || index >= length) { 1337 if (index >= 0 && index < length) {
1338 throw _newRangeError(index, length); 1338 return _getIndexedUint64(index);
1339 } 1339 }
1340 return _getIndexedUint64(index); 1340 throw new RangeError.index(index, this, "index");
1341 } 1341 }
1342 1342
1343 void operator[]=(int index, int value) { 1343 void operator[]=(int index, int value) {
1344 if (index < 0 || index >= length) { 1344 if (index >= 0 && index < length) {
1345 throw _newRangeError(index, length); 1345 _setIndexedUint64(index, _toUint64(value));
1346 return;
1346 } 1347 }
1347 _setIndexedUint64(index, _toUint64(value)); 1348 throw new RangeError.index(index, this, "index");
1348 } 1349 }
1349 1350
1350 1351
1351 // Method(s) implementing the TypedData interface. 1352 // Method(s) implementing the TypedData interface.
1352 1353
1353 int get elementSizeInBytes { 1354 int get elementSizeInBytes {
1354 return Uint64List.BYTES_PER_ELEMENT; 1355 return Uint64List.BYTES_PER_ELEMENT;
1355 } 1356 }
1356 1357
1357 1358
(...skipping 19 matching lines...) Expand all
1377 // Factory constructors. 1378 // Factory constructors.
1378 1379
1379 factory _Float32Array(int length) { 1380 factory _Float32Array(int length) {
1380 return _new(length); 1381 return _new(length);
1381 } 1382 }
1382 1383
1383 1384
1384 // Method(s) implementing the List interface. 1385 // Method(s) implementing the List interface.
1385 1386
1386 double operator[](int index) { 1387 double operator[](int index) {
1387 if (index < 0 || index >= length) { 1388 if (index >= 0 && index < length) {
1388 throw _newRangeError(index, length); 1389 return _getIndexedFloat32(index);
1389 } 1390 }
1390 return _getIndexedFloat32(index); 1391 throw new RangeError.index(index, this, "index");
1391 } 1392 }
1392 1393
1393 void operator[]=(int index, double value) { 1394 void operator[]=(int index, double value) {
1394 if (index < 0 || index >= length) { 1395 if (index >= 0 && index < length) {
1395 throw _newRangeError(index, length); 1396 _setIndexedFloat32(index, value);
1397 return;
1396 } 1398 }
1397 _setIndexedFloat32(index, value); 1399 throw new RangeError.index(index, this, "index");
1398 } 1400 }
1399 1401
1400 1402
1401 // Method(s) implementing the TypedData interface. 1403 // Method(s) implementing the TypedData interface.
1402 1404
1403 int get elementSizeInBytes { 1405 int get elementSizeInBytes {
1404 return Float32List.BYTES_PER_ELEMENT; 1406 return Float32List.BYTES_PER_ELEMENT;
1405 } 1407 }
1406 1408
1407 1409
(...skipping 19 matching lines...) Expand all
1427 // Factory constructors. 1429 // Factory constructors.
1428 1430
1429 factory _Float64Array(int length) { 1431 factory _Float64Array(int length) {
1430 return _new(length); 1432 return _new(length);
1431 } 1433 }
1432 1434
1433 1435
1434 // Method(s) implementing the List interface. 1436 // Method(s) implementing the List interface.
1435 1437
1436 double operator[](int index) { 1438 double operator[](int index) {
1437 if (index < 0 || index >= length) { 1439 if (index >= 0 && index < length) {
1438 throw _newRangeError(index, length); 1440 return _getIndexedFloat64(index);
1439 } 1441 }
1440 return _getIndexedFloat64(index); 1442 throw new RangeError.index(index, this, "index");
1441 } 1443 }
1442 1444
1443 void operator[]=(int index, double value) { 1445 void operator[]=(int index, double value) {
1444 if (index < 0 || index >= length) { 1446 if (index >= 0 && index < length) {
1445 throw _newRangeError(index, length); 1447 _setIndexedFloat64(index, value);
1448 return;
1446 } 1449 }
1447 _setIndexedFloat64(index, value); 1450 throw new RangeError.index(index, this, "index");
1448 } 1451 }
1449 1452
1450 1453
1451 // Method(s) implementing the TypedData interface. 1454 // Method(s) implementing the TypedData interface.
1452 1455
1453 int get elementSizeInBytes { 1456 int get elementSizeInBytes {
1454 return Float64List.BYTES_PER_ELEMENT; 1457 return Float64List.BYTES_PER_ELEMENT;
1455 } 1458 }
1456 1459
1457 1460
(...skipping 17 matching lines...) Expand all
1475 1478
1476 class _Float32x4Array extends _TypedList with _Float32x4ListMixin implements Flo at32x4List { 1479 class _Float32x4Array extends _TypedList with _Float32x4ListMixin implements Flo at32x4List {
1477 // Factory constructors. 1480 // Factory constructors.
1478 1481
1479 factory _Float32x4Array(int length) { 1482 factory _Float32x4Array(int length) {
1480 return _new(length); 1483 return _new(length);
1481 } 1484 }
1482 1485
1483 1486
1484 Float32x4 operator[](int index) { 1487 Float32x4 operator[](int index) {
1485 if (index < 0 || index >= length) { 1488 if (index >= 0 && index < length) {
1486 throw _newRangeError(index, length); 1489 return _getIndexedFloat32x4(index);
1487 } 1490 }
1488 return _getIndexedFloat32x4(index); 1491 throw new RangeError.index(index, this, "index");
1489 } 1492 }
1490 1493
1491 void operator[]=(int index, Float32x4 value) { 1494 void operator[]=(int index, Float32x4 value) {
1492 if (index < 0 || index >= length) { 1495 if (index >= 0 && index < length) {
1493 throw _newRangeError(index, length); 1496 _setIndexedFloat32x4(index, value);
1497 return;
1494 } 1498 }
1495 _setIndexedFloat32x4(index, value); 1499 throw new RangeError.index(index, this, "index");
1496 } 1500 }
1497 1501
1498 1502
1499 // Method(s) implementing the TypedData interface. 1503 // Method(s) implementing the TypedData interface.
1500 1504
1501 int get elementSizeInBytes { 1505 int get elementSizeInBytes {
1502 return Float32x4List.BYTES_PER_ELEMENT; 1506 return Float32x4List.BYTES_PER_ELEMENT;
1503 } 1507 }
1504 1508
1505 1509
(...skipping 17 matching lines...) Expand all
1523 1527
1524 class _Int32x4Array extends _TypedList with _Int32x4ListMixin implements Int32x4 List { 1528 class _Int32x4Array extends _TypedList with _Int32x4ListMixin implements Int32x4 List {
1525 // Factory constructors. 1529 // Factory constructors.
1526 1530
1527 factory _Int32x4Array(int length) { 1531 factory _Int32x4Array(int length) {
1528 return _new(length); 1532 return _new(length);
1529 } 1533 }
1530 1534
1531 1535
1532 Int32x4 operator[](int index) { 1536 Int32x4 operator[](int index) {
1533 if (index < 0 || index >= length) { 1537 if (index >= 0 && index < length) {
1534 throw _newRangeError(index, length); 1538 return _getIndexedInt32x4(index);
1535 } 1539 }
1536 return _getIndexedInt32x4(index); 1540 throw new RangeError.index(index, this, "index");
1537 } 1541 }
1538 1542
1539 void operator[]=(int index, Int32x4 value) { 1543 void operator[]=(int index, Int32x4 value) {
1540 if (index < 0 || index >= length) { 1544 if (index >= 0 && index < length) {
1541 throw _newRangeError(index, length); 1545 _setIndexedInt32x4(index, value);
1546 return;
1542 } 1547 }
1543 _setIndexedInt32x4(index, value); 1548 throw new RangeError.index(index, this, "index");
1544 } 1549 }
1545 1550
1546 1551
1547 // Method(s) implementing the TypedData interface. 1552 // Method(s) implementing the TypedData interface.
1548 1553
1549 int get elementSizeInBytes { 1554 int get elementSizeInBytes {
1550 return Int32x4List.BYTES_PER_ELEMENT; 1555 return Int32x4List.BYTES_PER_ELEMENT;
1551 } 1556 }
1552 1557
1553 1558
(...skipping 17 matching lines...) Expand all
1571 1576
1572 class _Float64x2Array extends _TypedList with _Float64x2ListMixin implements Flo at64x2List { 1577 class _Float64x2Array extends _TypedList with _Float64x2ListMixin implements Flo at64x2List {
1573 // Factory constructors. 1578 // Factory constructors.
1574 1579
1575 factory _Float64x2Array(int length) { 1580 factory _Float64x2Array(int length) {
1576 return _new(length); 1581 return _new(length);
1577 } 1582 }
1578 1583
1579 1584
1580 Float64x2 operator[](int index) { 1585 Float64x2 operator[](int index) {
1581 if (index < 0 || index >= length) { 1586 if (index >= 0 && index < length) {
1582 throw _newRangeError(index, length); 1587 return _getIndexedFloat64x2(index);
1583 } 1588 }
1584 return _getIndexedFloat64x2(index); 1589 throw new RangeError.index(index, this, "index");
1585 } 1590 }
1586 1591
1587 void operator[]=(int index, Float64x2 value) { 1592 void operator[]=(int index, Float64x2 value) {
1588 if (index < 0 || index >= length) { 1593 if (index >= 0 && index < length) {
1589 throw _newRangeError(index, length); 1594 _setIndexedFloat64x2(index, value);
1595 return;
1590 } 1596 }
1591 _setIndexedFloat64x2(index, value); 1597 throw new RangeError.index(index, this, "index");
1592 } 1598 }
1593 1599
1594 1600
1595 // Method(s) implementing the TypedData interface. 1601 // Method(s) implementing the TypedData interface.
1596 1602
1597 int get elementSizeInBytes { 1603 int get elementSizeInBytes {
1598 return Float64x2List.BYTES_PER_ELEMENT; 1604 return Float64x2List.BYTES_PER_ELEMENT;
1599 } 1605 }
1600 1606
1601 1607
(...skipping 18 matching lines...) Expand all
1620 class _ExternalInt8Array extends _TypedList with _IntListMixin implements Int8Li st { 1626 class _ExternalInt8Array extends _TypedList with _IntListMixin implements Int8Li st {
1621 // Factory constructors. 1627 // Factory constructors.
1622 1628
1623 factory _ExternalInt8Array(int length) { 1629 factory _ExternalInt8Array(int length) {
1624 return _new(length); 1630 return _new(length);
1625 } 1631 }
1626 1632
1627 1633
1628 // Method(s) implementing the List interface. 1634 // Method(s) implementing the List interface.
1629 int operator[](int index) { 1635 int operator[](int index) {
1630 if (index < 0 || index >= length) { 1636 if (index >= 0 && index < length) {
1631 throw _newRangeError(index, length); 1637 return _getInt8(index);
1632 } 1638 }
1633 return _getInt8(index); 1639 throw new RangeError.index(index, this, "index");
1634 } 1640 }
1635 1641
1636 void operator[]=(int index, int value) { 1642 void operator[]=(int index, int value) {
1637 if (index < 0 || index >= length) { 1643 if (index >= 0 && index < length) {
1638 throw _newRangeError(index, length); 1644 _setInt8(index, value);
1645 return;
1639 } 1646 }
1640 _setInt8(index, value); 1647 throw new RangeError.index(index, this, "index");
1641 } 1648 }
1642 1649
1643 1650
1644 // Method(s) implementing the TypedData interface. 1651 // Method(s) implementing the TypedData interface.
1645 1652
1646 int get elementSizeInBytes { 1653 int get elementSizeInBytes {
1647 return Int8List.BYTES_PER_ELEMENT; 1654 return Int8List.BYTES_PER_ELEMENT;
1648 } 1655 }
1649 1656
1650 1657
(...skipping 12 matching lines...) Expand all
1663 // Factory constructors. 1670 // Factory constructors.
1664 1671
1665 factory _ExternalUint8Array(int length) { 1672 factory _ExternalUint8Array(int length) {
1666 return _new(length); 1673 return _new(length);
1667 } 1674 }
1668 1675
1669 1676
1670 // Method(s) implementing the List interface. 1677 // Method(s) implementing the List interface.
1671 1678
1672 int operator[](int index) { 1679 int operator[](int index) {
1673 if (index < 0 || index >= length) { 1680 if (index >= 0 && index < length) {
1674 throw _newRangeError(index, length); 1681 return _getUint8(index);
1675 } 1682 }
1676 return _getUint8(index); 1683 throw new RangeError.index(index, this, "index");
1677 } 1684 }
1678 1685
1679 void operator[]=(int index, int value) { 1686 void operator[]=(int index, int value) {
1680 if (index < 0 || index >= length) { 1687 if (index >= 0 && index < length) {
1681 throw _newRangeError(index, length); 1688 _setUint8(index, _toUint8(value));
1689 return;
1682 } 1690 }
1683 _setUint8(index, _toUint8(value)); 1691 throw new RangeError.index(index, this, "index");
1684 } 1692 }
1685 1693
1686 1694
1687 // Method(s) implementing the TypedData interface. 1695 // Method(s) implementing the TypedData interface.
1688 1696
1689 int get elementSizeInBytes { 1697 int get elementSizeInBytes {
1690 return Uint8List.BYTES_PER_ELEMENT; 1698 return Uint8List.BYTES_PER_ELEMENT;
1691 } 1699 }
1692 1700
1693 1701
(...skipping 11 matching lines...) Expand all
1705 class _ExternalUint8ClampedArray extends _TypedList with _IntListMixin implement s Uint8ClampedList { 1713 class _ExternalUint8ClampedArray extends _TypedList with _IntListMixin implement s Uint8ClampedList {
1706 // Factory constructors. 1714 // Factory constructors.
1707 1715
1708 factory _ExternalUint8ClampedArray(int length) { 1716 factory _ExternalUint8ClampedArray(int length) {
1709 return _new(length); 1717 return _new(length);
1710 } 1718 }
1711 1719
1712 // Method(s) implementing the List interface. 1720 // Method(s) implementing the List interface.
1713 1721
1714 int operator[](int index) { 1722 int operator[](int index) {
1715 if (index < 0 || index >= length) { 1723 if (index >= 0 && index < length) {
1716 throw _newRangeError(index, length); 1724 return _getUint8(index);
1717 } 1725 }
1718 return _getUint8(index); 1726 throw new RangeError.index(index, this, "index");
1719 } 1727 }
1720 1728
1721 void operator[]=(int index, int value) { 1729 void operator[]=(int index, int value) {
1722 if (index < 0 || index >= length) { 1730 if (index >= 0 && index < length) {
1723 throw _newRangeError(index, length); 1731 _setUint8(index, _toClampedUint8(value));
1732 return;
1724 } 1733 }
1725 _setUint8(index, _toClampedUint8(value)); 1734 throw new RangeError.index(index, this, "index");
1726 } 1735 }
1727 1736
1728 1737
1729 // Method(s) implementing the TypedData interface. 1738 // Method(s) implementing the TypedData interface.
1730 1739
1731 int get elementSizeInBytes { 1740 int get elementSizeInBytes {
1732 return Uint8List.BYTES_PER_ELEMENT; 1741 return Uint8List.BYTES_PER_ELEMENT;
1733 } 1742 }
1734 1743
1735 1744
(...skipping 12 matching lines...) Expand all
1748 // Factory constructors. 1757 // Factory constructors.
1749 1758
1750 factory _ExternalInt16Array(int length) { 1759 factory _ExternalInt16Array(int length) {
1751 return _new(length); 1760 return _new(length);
1752 } 1761 }
1753 1762
1754 1763
1755 // Method(s) implementing the List interface. 1764 // Method(s) implementing the List interface.
1756 1765
1757 int operator[](int index) { 1766 int operator[](int index) {
1758 if (index < 0 || index >= length) { 1767 if (index >= 0 && index < length) {
1759 throw _newRangeError(index, length); 1768 return _getIndexedInt16(index);
1760 } 1769 }
1761 return _getIndexedInt16(index); 1770 throw new RangeError.index(index, this, "index");
1762 } 1771 }
1763 1772
1764 void operator[]=(int index, int value) { 1773 void operator[]=(int index, int value) {
1765 if (index < 0 || index >= length) { 1774 if (index >= 0 && index < length) {
1766 throw _newRangeError(index, length); 1775 _setIndexedInt16(index, _toInt16(value));
1776 return;
1767 } 1777 }
1768 _setIndexedInt16(index, _toInt16(value)); 1778 throw new RangeError.index(index, this, "index");
1769 } 1779 }
1770 1780
1771 1781
1772 // Method(s) implementing the TypedData interface. 1782 // Method(s) implementing the TypedData interface.
1773 1783
1774 int get elementSizeInBytes { 1784 int get elementSizeInBytes {
1775 return Int16List.BYTES_PER_ELEMENT; 1785 return Int16List.BYTES_PER_ELEMENT;
1776 } 1786 }
1777 1787
1778 1788
(...skipping 20 matching lines...) Expand all
1799 // Factory constructors. 1809 // Factory constructors.
1800 1810
1801 factory _ExternalUint16Array(int length) { 1811 factory _ExternalUint16Array(int length) {
1802 return _new(length); 1812 return _new(length);
1803 } 1813 }
1804 1814
1805 1815
1806 // Method(s) implementing the List interface. 1816 // Method(s) implementing the List interface.
1807 1817
1808 int operator[](int index) { 1818 int operator[](int index) {
1809 if (index < 0 || index >= length) { 1819 if (index >= 0 && index < length) {
1810 throw _newRangeError(index, length); 1820 return _getIndexedUint16(index);
1811 } 1821 }
1812 return _getIndexedUint16(index); 1822 throw new RangeError.index(index, this, "index");
1813 } 1823 }
1814 1824
1815 void operator[]=(int index, int value) { 1825 void operator[]=(int index, int value) {
1816 if (index < 0 || index >= length) { 1826 if (index >= 0 && index < length) {
1817 throw _newRangeError(index, length); 1827 _setIndexedUint16(index, _toUint16(value));
1828 return;
1818 } 1829 }
1819 _setIndexedUint16(index, _toUint16(value)); 1830 throw new RangeError.index(index, this, "index");
1820 } 1831 }
1821 1832
1822 1833
1823 // Method(s) implementing the TypedData interface. 1834 // Method(s) implementing the TypedData interface.
1824 1835
1825 int get elementSizeInBytes { 1836 int get elementSizeInBytes {
1826 return Uint16List.BYTES_PER_ELEMENT; 1837 return Uint16List.BYTES_PER_ELEMENT;
1827 } 1838 }
1828 1839
1829 1840
(...skipping 20 matching lines...) Expand all
1850 // Factory constructors. 1861 // Factory constructors.
1851 1862
1852 factory _ExternalInt32Array(int length) { 1863 factory _ExternalInt32Array(int length) {
1853 return _new(length); 1864 return _new(length);
1854 } 1865 }
1855 1866
1856 1867
1857 // Method(s) implementing the List interface. 1868 // Method(s) implementing the List interface.
1858 1869
1859 int operator[](int index) { 1870 int operator[](int index) {
1860 if (index < 0 || index >= length) { 1871 if (index >= 0 && index < length) {
1861 throw _newRangeError(index, length); 1872 return _getIndexedInt32(index);
1862 } 1873 }
1863 return _getIndexedInt32(index); 1874 throw new RangeError.index(index, this, "index");
1864 } 1875 }
1865 1876
1866 void operator[]=(int index, int value) { 1877 void operator[]=(int index, int value) {
1867 if (index < 0 || index >= length) { 1878 if (index >= 0 && index < length) {
1868 throw _newRangeError(index, length); 1879 _setIndexedInt32(index, _toInt32(value));
1880 return;
1869 } 1881 }
1870 _setIndexedInt32(index, _toInt32(value)); 1882 throw new RangeError.index(index, this, "index");
1871 } 1883 }
1872 1884
1873 1885
1874 // Method(s) implementing the TypedData interface. 1886 // Method(s) implementing the TypedData interface.
1875 1887
1876 int get elementSizeInBytes { 1888 int get elementSizeInBytes {
1877 return Int32List.BYTES_PER_ELEMENT; 1889 return Int32List.BYTES_PER_ELEMENT;
1878 } 1890 }
1879 1891
1880 1892
(...skipping 20 matching lines...) Expand all
1901 // Factory constructors. 1913 // Factory constructors.
1902 1914
1903 factory _ExternalUint32Array(int length) { 1915 factory _ExternalUint32Array(int length) {
1904 return _new(length); 1916 return _new(length);
1905 } 1917 }
1906 1918
1907 1919
1908 // Method(s) implementing the List interface. 1920 // Method(s) implementing the List interface.
1909 1921
1910 int operator[](int index) { 1922 int operator[](int index) {
1911 if (index < 0 || index >= length) { 1923 if (index >= 0 && index < length) {
1912 throw _newRangeError(index, length); 1924 return _getIndexedUint32(index);
1913 } 1925 }
1914 return _getIndexedUint32(index); 1926 throw new RangeError.index(index, this, "index");
1915 } 1927 }
1916 1928
1917 void operator[]=(int index, int value) { 1929 void operator[]=(int index, int value) {
1918 if (index < 0 || index >= length) { 1930 if (index >= 0 && index < length) {
1919 throw _newRangeError(index, length); 1931 _setIndexedUint32(index, _toUint32(value));
1932 return;
1920 } 1933 }
1921 _setIndexedUint32(index, _toUint32(value)); 1934 throw new RangeError.index(index, this, "index");
1922 } 1935 }
1923 1936
1924 1937
1925 // Method(s) implementing the TypedData interface. 1938 // Method(s) implementing the TypedData interface.
1926 1939
1927 int get elementSizeInBytes { 1940 int get elementSizeInBytes {
1928 return Uint32List.BYTES_PER_ELEMENT; 1941 return Uint32List.BYTES_PER_ELEMENT;
1929 } 1942 }
1930 1943
1931 1944
(...skipping 20 matching lines...) Expand all
1952 // Factory constructors. 1965 // Factory constructors.
1953 1966
1954 factory _ExternalInt64Array(int length) { 1967 factory _ExternalInt64Array(int length) {
1955 return _new(length); 1968 return _new(length);
1956 } 1969 }
1957 1970
1958 1971
1959 // Method(s) implementing the List interface. 1972 // Method(s) implementing the List interface.
1960 1973
1961 int operator[](int index) { 1974 int operator[](int index) {
1962 if (index < 0 || index >= length) { 1975 if (index >= 0 && index < length) {
1963 throw _newRangeError(index, length); 1976 return _getIndexedInt64(index);
1964 } 1977 }
1965 return _getIndexedInt64(index); 1978 throw new RangeError.index(index, this, "index");
1966 } 1979 }
1967 1980
1968 void operator[]=(int index, int value) { 1981 void operator[]=(int index, int value) {
1969 if (index < 0 || index >= length) { 1982 if (index >= 0 && index < length) {
1970 throw _newRangeError(index, length); 1983 _setIndexedInt64(index, _toInt64(value));
1984 return;
1971 } 1985 }
1972 _setIndexedInt64(index, _toInt64(value)); 1986 throw new RangeError.index(index, this, "index");
1973 } 1987 }
1974 1988
1975 1989
1976 // Method(s) implementing the TypedData interface. 1990 // Method(s) implementing the TypedData interface.
1977 1991
1978 int get elementSizeInBytes { 1992 int get elementSizeInBytes {
1979 return Int64List.BYTES_PER_ELEMENT; 1993 return Int64List.BYTES_PER_ELEMENT;
1980 } 1994 }
1981 1995
1982 1996
(...skipping 20 matching lines...) Expand all
2003 // Factory constructors. 2017 // Factory constructors.
2004 2018
2005 factory _ExternalUint64Array(int length) { 2019 factory _ExternalUint64Array(int length) {
2006 return _new(length); 2020 return _new(length);
2007 } 2021 }
2008 2022
2009 2023
2010 // Method(s) implementing the List interface. 2024 // Method(s) implementing the List interface.
2011 2025
2012 int operator[](int index) { 2026 int operator[](int index) {
2013 if (index < 0 || index >= length) { 2027 if (index >= 0 && index < length) {
2014 throw _newRangeError(index, length); 2028 return _getIndexedUint64(index);
2015 } 2029 }
2016 return _getIndexedUint64(index); 2030 throw new RangeError.index(index, this, "index");
2017 } 2031 }
2018 2032
2019 void operator[]=(int index, int value) { 2033 void operator[]=(int index, int value) {
2020 if (index < 0 || index >= length) { 2034 if (index >= 0 && index < length) {
2021 throw _newRangeError(index, length); 2035 _setIndexedUint64(index, _toUint64(value));
2036 return;
2022 } 2037 }
2023 _setIndexedUint64(index, _toUint64(value)); 2038 throw new RangeError.index(index, this, "index");
2024 } 2039 }
2025 2040
2026 2041
2027 // Method(s) implementing the TypedData interface. 2042 // Method(s) implementing the TypedData interface.
2028 2043
2029 int get elementSizeInBytes { 2044 int get elementSizeInBytes {
2030 return Uint64List.BYTES_PER_ELEMENT; 2045 return Uint64List.BYTES_PER_ELEMENT;
2031 } 2046 }
2032 2047
2033 2048
(...skipping 20 matching lines...) Expand all
2054 // Factory constructors. 2069 // Factory constructors.
2055 2070
2056 factory _ExternalFloat32Array(int length) { 2071 factory _ExternalFloat32Array(int length) {
2057 return _new(length); 2072 return _new(length);
2058 } 2073 }
2059 2074
2060 2075
2061 // Method(s) implementing the List interface. 2076 // Method(s) implementing the List interface.
2062 2077
2063 double operator[](int index) { 2078 double operator[](int index) {
2064 if (index < 0 || index >= length) { 2079 if (index >= 0 && index < length) {
2065 throw _newRangeError(index, length); 2080 return _getIndexedFloat32(index);
2066 } 2081 }
2067 return _getIndexedFloat32(index); 2082 throw new RangeError.index(index, this, "index");
2068 } 2083 }
2069 2084
2070 void operator[]=(int index, double value) { 2085 void operator[]=(int index, double value) {
2071 if (index < 0 || index >= length) { 2086 if (index >= 0 && index < length) {
2072 throw _newRangeError(index, length); 2087 _setIndexedFloat32(index, value);
2088 return;
2073 } 2089 }
2074 _setIndexedFloat32(index, value); 2090 throw new RangeError.index(index, this, "index");
2075 } 2091 }
2076 2092
2077 2093
2078 // Method(s) implementing the TypedData interface. 2094 // Method(s) implementing the TypedData interface.
2079 2095
2080 int get elementSizeInBytes { 2096 int get elementSizeInBytes {
2081 return Float32List.BYTES_PER_ELEMENT; 2097 return Float32List.BYTES_PER_ELEMENT;
2082 } 2098 }
2083 2099
2084 2100
(...skipping 20 matching lines...) Expand all
2105 // Factory constructors. 2121 // Factory constructors.
2106 2122
2107 factory _ExternalFloat64Array(int length) { 2123 factory _ExternalFloat64Array(int length) {
2108 return _new(length); 2124 return _new(length);
2109 } 2125 }
2110 2126
2111 2127
2112 // Method(s) implementing the List interface. 2128 // Method(s) implementing the List interface.
2113 2129
2114 double operator[](int index) { 2130 double operator[](int index) {
2115 if (index < 0 || index >= length) { 2131 if (index >= 0 && index < length) {
2116 throw _newRangeError(index, length); 2132 return _getIndexedFloat64(index);
2117 } 2133 }
2118 return _getIndexedFloat64(index); 2134 throw new RangeError.index(index, this, "index");
2119 } 2135 }
2120 2136
2121 void operator[]=(int index, double value) { 2137 void operator[]=(int index, double value) {
2122 if (index < 0 || index >= length) { 2138 if (index >= 0 && index < length) {
2123 throw _newRangeError(index, length); 2139 _setIndexedFloat64(index, value);
2140 return;
2124 } 2141 }
2125 _setIndexedFloat64(index, value); 2142 throw new RangeError.index(index, this, "index");
2126 } 2143 }
2127 2144
2128 2145
2129 // Method(s) implementing the TypedData interface. 2146 // Method(s) implementing the TypedData interface.
2130 2147
2131 int get elementSizeInBytes { 2148 int get elementSizeInBytes {
2132 return Float64List.BYTES_PER_ELEMENT; 2149 return Float64List.BYTES_PER_ELEMENT;
2133 } 2150 }
2134 2151
2135 2152
(...skipping 20 matching lines...) Expand all
2156 // Factory constructors. 2173 // Factory constructors.
2157 2174
2158 factory _ExternalFloat32x4Array(int length) { 2175 factory _ExternalFloat32x4Array(int length) {
2159 return _new(length); 2176 return _new(length);
2160 } 2177 }
2161 2178
2162 2179
2163 // Method(s) implementing the List interface. 2180 // Method(s) implementing the List interface.
2164 2181
2165 Float32x4 operator[](int index) { 2182 Float32x4 operator[](int index) {
2166 if (index < 0 || index >= length) { 2183 if (index >= 0 && index < length) {
2167 throw _newRangeError(index, length); 2184 return _getIndexedFloat32x4(index);
2168 } 2185 }
2169 return _getIndexedFloat32x4(index); 2186 throw new RangeError.index(index, this, "index");
2170 } 2187 }
2171 2188
2172 void operator[]=(int index, Float32x4 value) { 2189 void operator[]=(int index, Float32x4 value) {
2173 if (index < 0 || index >= length) { 2190 if (index >= 0 && index < length) {
2174 throw _newRangeError(index, length); 2191 _setIndexedFloat32x4(index, value);
2192 return;
2175 } 2193 }
2176 _setIndexedFloat32x4(index, value); 2194 throw new RangeError.index(index, this, "index");
2177 } 2195 }
2178 2196
2179 2197
2180 // Method(s) implementing the TypedData interface. 2198 // Method(s) implementing the TypedData interface.
2181 2199
2182 int get elementSizeInBytes { 2200 int get elementSizeInBytes {
2183 return Float32x4List.BYTES_PER_ELEMENT; 2201 return Float32x4List.BYTES_PER_ELEMENT;
2184 } 2202 }
2185 2203
2186 2204
(...skipping 20 matching lines...) Expand all
2207 // Factory constructors. 2225 // Factory constructors.
2208 2226
2209 factory _ExternalInt32x4Array(int length) { 2227 factory _ExternalInt32x4Array(int length) {
2210 return _new(length); 2228 return _new(length);
2211 } 2229 }
2212 2230
2213 2231
2214 // Method(s) implementing the List interface. 2232 // Method(s) implementing the List interface.
2215 2233
2216 Int32x4 operator[](int index) { 2234 Int32x4 operator[](int index) {
2217 if (index < 0 || index >= length) { 2235 if (index >= 0 && index < length) {
2218 throw _newRangeError(index, length); 2236 return _getIndexedInt32x4(index);
2219 } 2237 }
2220 return _getIndexedInt32x4(index); 2238 throw new RangeError.index(index, this, "index");
2221 } 2239 }
2222 2240
2223 void operator[]=(int index, Int32x4 value) { 2241 void operator[]=(int index, Int32x4 value) {
2224 if (index < 0 || index >= length) { 2242 if (index >= 0 && index < length) {
2225 throw _newRangeError(index, length); 2243 _setIndexedInt32x4(index, value);
2244 return;
2226 } 2245 }
2227 _setIndexedInt32x4(index, value); 2246 throw new RangeError.index(index, this, "index");
2228 } 2247 }
2229 2248
2230 2249
2231 // Method(s) implementing the TypedData interface. 2250 // Method(s) implementing the TypedData interface.
2232 2251
2233 int get elementSizeInBytes { 2252 int get elementSizeInBytes {
2234 return Int32x4List.BYTES_PER_ELEMENT; 2253 return Int32x4List.BYTES_PER_ELEMENT;
2235 } 2254 }
2236 2255
2237 2256
(...skipping 20 matching lines...) Expand all
2258 // Factory constructors. 2277 // Factory constructors.
2259 2278
2260 factory _ExternalFloat64x2Array(int length) { 2279 factory _ExternalFloat64x2Array(int length) {
2261 return _new(length); 2280 return _new(length);
2262 } 2281 }
2263 2282
2264 2283
2265 // Method(s) implementing the List interface. 2284 // Method(s) implementing the List interface.
2266 2285
2267 Float64x2 operator[](int index) { 2286 Float64x2 operator[](int index) {
2268 if (index < 0 || index >= length) { 2287 if (index >= 0 && index < length) {
2269 throw _newRangeError(index, length); 2288 return _getIndexedFloat64x2(index);
2270 } 2289 }
2271 return _getIndexedFloat64x2(index); 2290 throw new RangeError.index(index, this, "index");
2272 } 2291 }
2273 2292
2274 void operator[]=(int index, Float64x2 value) { 2293 void operator[]=(int index, Float64x2 value) {
2275 if (index < 0 || index >= length) { 2294 if (index >= 0 && index < length) {
2276 throw _newRangeError(index, length); 2295 _setIndexedFloat64x2(index, value);
2296 return;
2277 } 2297 }
2278 _setIndexedFloat64x2(index, value); 2298 throw new RangeError.index(index, this, "index");
2279 } 2299 }
2280 2300
2281 2301
2282 // Method(s) implementing the TypedData interface. 2302 // Method(s) implementing the TypedData interface.
2283 2303
2284 int get elementSizeInBytes { 2304 int get elementSizeInBytes {
2285 return Float64x2List.BYTES_PER_ELEMENT; 2305 return Float64x2List.BYTES_PER_ELEMENT;
2286 } 2306 }
2287 2307
2288 2308
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2586 Int8List.BYTES_PER_ELEMENT))) { 2606 Int8List.BYTES_PER_ELEMENT))) {
2587 _rangeCheck(buffer.lengthInBytes, 2607 _rangeCheck(buffer.lengthInBytes,
2588 _offsetInBytes, 2608 _offsetInBytes,
2589 length * Int8List.BYTES_PER_ELEMENT); 2609 length * Int8List.BYTES_PER_ELEMENT);
2590 } 2610 }
2591 2611
2592 2612
2593 // Method(s) implementing List interface. 2613 // Method(s) implementing List interface.
2594 2614
2595 int operator[](int index) { 2615 int operator[](int index) {
2596 if (index < 0 || index >= length) { 2616 if (index >= 0 && index < length) {
2597 throw _newRangeError(index, length); 2617 return _typedData._getInt8(offsetInBytes +
2618 (index * Int8List.BYTES_PER_ELEMENT));
2598 } 2619 }
2599 return _typedData._getInt8(offsetInBytes + 2620 throw new RangeError.index(index, this, "index");
2600 (index * Int8List.BYTES_PER_ELEMENT));
2601 } 2621 }
2602 2622
2603 void operator[]=(int index, int value) { 2623 void operator[]=(int index, int value) {
2604 if (index < 0 || index >= length) { 2624 if (index >= 0 && index < length) {
2605 throw _newRangeError(index, length); 2625 _typedData._setInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT),
2626 _toInt8(value));
2627 return;
2606 } 2628 }
2607 _typedData._setInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT), 2629 throw new RangeError.index(index, this, "index");
2608 _toInt8(value));
2609 } 2630 }
2610 2631
2611 2632
2612 // Method(s) implementing TypedData interface. 2633 // Method(s) implementing TypedData interface.
2613 2634
2614 int get elementSizeInBytes { 2635 int get elementSizeInBytes {
2615 return Int8List.BYTES_PER_ELEMENT; 2636 return Int8List.BYTES_PER_ELEMENT;
2616 } 2637 }
2617 2638
2618 2639
(...skipping 14 matching lines...) Expand all
2633 Uint8List.BYTES_PER_ELEMENT))) { 2654 Uint8List.BYTES_PER_ELEMENT))) {
2634 _rangeCheck(buffer.lengthInBytes, 2655 _rangeCheck(buffer.lengthInBytes,
2635 _offsetInBytes, 2656 _offsetInBytes,
2636 length * Uint8List.BYTES_PER_ELEMENT); 2657 length * Uint8List.BYTES_PER_ELEMENT);
2637 } 2658 }
2638 2659
2639 2660
2640 // Method(s) implementing List interface. 2661 // Method(s) implementing List interface.
2641 2662
2642 int operator[](int index) { 2663 int operator[](int index) {
2643 if (index < 0 || index >= length) { 2664 if (index >= 0 && index < length) {
2644 throw _newRangeError(index, length); 2665 return _typedData._getUint8(offsetInBytes +
2666 (index * Uint8List.BYTES_PER_ELEMENT));
2645 } 2667 }
2646 return _typedData._getUint8(offsetInBytes + 2668 throw new RangeError.index(index, this, "index");
2647 (index * Uint8List.BYTES_PER_ELEMENT));
2648 } 2669 }
2649 2670
2650 void operator[]=(int index, int value) { 2671 void operator[]=(int index, int value) {
2651 if (index < 0 || index >= length) { 2672 if (index >= 0 && index < length) {
2652 throw _newRangeError(index, length); 2673 _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT) ,
Søren Gjesse 2015/05/13 11:22:08 Long line - more below.
Lasse Reichstein Nielsen 2015/05/18 12:21:09 Done.
2674 _toUint8(value));
2675 return;
2653 } 2676 }
2654 _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT), 2677 throw new RangeError.index(index, this, "index");
2655 _toUint8(value));
2656 } 2678 }
2657 2679
2658 2680
2659 // Method(s) implementing TypedData interface. 2681 // Method(s) implementing TypedData interface.
2660 2682
2661 int get elementSizeInBytes { 2683 int get elementSizeInBytes {
2662 return Uint8List.BYTES_PER_ELEMENT; 2684 return Uint8List.BYTES_PER_ELEMENT;
2663 } 2685 }
2664 2686
2665 2687
(...skipping 15 matching lines...) Expand all
2681 Uint8List.BYTES_PER_ELEMENT))) { 2703 Uint8List.BYTES_PER_ELEMENT))) {
2682 _rangeCheck(buffer.lengthInBytes, 2704 _rangeCheck(buffer.lengthInBytes,
2683 offsetInBytes, 2705 offsetInBytes,
2684 length * Uint8List.BYTES_PER_ELEMENT); 2706 length * Uint8List.BYTES_PER_ELEMENT);
2685 } 2707 }
2686 2708
2687 2709
2688 // Method(s) implementing List interface. 2710 // Method(s) implementing List interface.
2689 2711
2690 int operator[](int index) { 2712 int operator[](int index) {
2691 if (index < 0 || index >= length) { 2713 if (index >= 0 && index < length) {
2692 throw _newRangeError(index, length); 2714 return _typedData._getUint8(offsetInBytes +
2715 (index * Uint8List.BYTES_PER_ELEMENT));
2693 } 2716 }
2694 return _typedData._getUint8(offsetInBytes + 2717 throw new RangeError.index(index, this, "index");
2695 (index * Uint8List.BYTES_PER_ELEMENT));
2696 } 2718 }
2697 2719
2698 void operator[]=(int index, int value) { 2720 void operator[]=(int index, int value) {
2699 if (index < 0 || index >= length) { 2721 if (index >= 0 && index < length) {
2700 throw _newRangeError(index, length); 2722 _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT) ,
2723 _toClampedUint8(value));
2724 return;
2701 } 2725 }
2702 _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT), 2726 throw new RangeError.index(index, this, "index");
2703 _toClampedUint8(value));
2704 } 2727 }
2705 2728
2706 2729
2707 // Method(s) implementing TypedData interface. 2730 // Method(s) implementing TypedData interface.
2708 2731
2709 int get elementSizeInBytes { 2732 int get elementSizeInBytes {
2710 return Uint8List.BYTES_PER_ELEMENT; 2733 return Uint8List.BYTES_PER_ELEMENT;
2711 } 2734 }
2712 2735
2713 2736
(...skipping 15 matching lines...) Expand all
2729 _rangeCheck(buffer.lengthInBytes, 2752 _rangeCheck(buffer.lengthInBytes,
2730 offsetInBytes, 2753 offsetInBytes,
2731 length * Int16List.BYTES_PER_ELEMENT); 2754 length * Int16List.BYTES_PER_ELEMENT);
2732 _offsetAlignmentCheck(_offsetInBytes, Int16List.BYTES_PER_ELEMENT); 2755 _offsetAlignmentCheck(_offsetInBytes, Int16List.BYTES_PER_ELEMENT);
2733 } 2756 }
2734 2757
2735 2758
2736 // Method(s) implementing List interface. 2759 // Method(s) implementing List interface.
2737 2760
2738 int operator[](int index) { 2761 int operator[](int index) {
2739 if (index < 0 || index >= length) { 2762 if (index >= 0 && index < length) {
2740 throw _newRangeError(index, length); 2763 return _typedData._getInt16(offsetInBytes +
2764 (index * Int16List.BYTES_PER_ELEMENT));
2741 } 2765 }
2742 return _typedData._getInt16(offsetInBytes + 2766 throw new RangeError.index(index, this, "index");
2743 (index * Int16List.BYTES_PER_ELEMENT));
2744 } 2767 }
2745 2768
2746 void operator[]=(int index, int value) { 2769 void operator[]=(int index, int value) {
2747 if (index < 0 || index >= length) { 2770 if (index >= 0 && index < length) {
2748 throw _newRangeError(index, length); 2771 _typedData._setInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT) ,
2772 _toInt16(value));
2773 return;
2749 } 2774 }
2750 _typedData._setInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT), 2775 throw new RangeError.index(index, this, "index");
2751 _toInt16(value));
2752 } 2776 }
2753 2777
2754 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { 2778 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
2755 if (ClassID.getID(iterable) == CodeUnits.cid) { 2779 if (ClassID.getID(iterable) == CodeUnits.cid) {
2756 end = RangeError.checkValidRange(start, end, this.length); 2780 end = RangeError.checkValidRange(start, end, this.length);
2757 int length = end - start; 2781 int length = end - start;
2758 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT; 2782 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT;
2759 _typedData._setCodeUnits(iterable, byteStart, length, skipCount); 2783 _typedData._setCodeUnits(iterable, byteStart, length, skipCount);
2760 } else { 2784 } else {
2761 super.setRange(start, end, iterable, skipCount); 2785 super.setRange(start, end, iterable, skipCount);
(...skipping 25 matching lines...) Expand all
2787 _rangeCheck(buffer.lengthInBytes, 2811 _rangeCheck(buffer.lengthInBytes,
2788 offsetInBytes, 2812 offsetInBytes,
2789 length * Uint16List.BYTES_PER_ELEMENT); 2813 length * Uint16List.BYTES_PER_ELEMENT);
2790 _offsetAlignmentCheck(_offsetInBytes, Uint16List.BYTES_PER_ELEMENT); 2814 _offsetAlignmentCheck(_offsetInBytes, Uint16List.BYTES_PER_ELEMENT);
2791 } 2815 }
2792 2816
2793 2817
2794 // Method(s) implementing List interface. 2818 // Method(s) implementing List interface.
2795 2819
2796 int operator[](int index) { 2820 int operator[](int index) {
2797 if (index < 0 || index >= length) { 2821 if (index >= 0 && index < length) {
2798 throw _newRangeError(index, length); 2822 return _typedData._getUint16(offsetInBytes +
2823 (index * Uint16List.BYTES_PER_ELEMENT));
2799 } 2824 }
2800 return _typedData._getUint16(offsetInBytes + 2825 throw new RangeError.index(index, this, "index");
2801 (index * Uint16List.BYTES_PER_ELEMENT));
2802 } 2826 }
2803 2827
2804 void operator[]=(int index, int value) { 2828 void operator[]=(int index, int value) {
2805 if (index < 0 || index >= length) { 2829 if (index >= 0 && index < length) {
2806 throw _newRangeError(index, length); 2830 _typedData._setUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMEN T),
2831 _toUint16(value));
2832 return;
2807 } 2833 }
2808 _typedData._setUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT) , 2834 throw new RangeError.index(index, this, "index");
2809 _toUint16(value));
2810 } 2835 }
2811 2836
2812 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { 2837 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
2813 if (ClassID.getID(iterable) == CodeUnits.cid) { 2838 if (ClassID.getID(iterable) == CodeUnits.cid) {
2814 end = RangeError.checkValidRange(start, end, this.length); 2839 end = RangeError.checkValidRange(start, end, this.length);
2815 int length = end - start; 2840 int length = end - start;
2816 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT; 2841 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT;
2817 _typedData._setCodeUnits(iterable, byteStart, length, skipCount); 2842 _typedData._setCodeUnits(iterable, byteStart, length, skipCount);
2818 } else { 2843 } else {
2819 super.setRange(start, end, iterable, skipCount); 2844 super.setRange(start, end, iterable, skipCount);
(...skipping 24 matching lines...) Expand all
2844 _rangeCheck(buffer.lengthInBytes, 2869 _rangeCheck(buffer.lengthInBytes,
2845 offsetInBytes, 2870 offsetInBytes,
2846 length * Int32List.BYTES_PER_ELEMENT); 2871 length * Int32List.BYTES_PER_ELEMENT);
2847 _offsetAlignmentCheck(_offsetInBytes, Int32List.BYTES_PER_ELEMENT); 2872 _offsetAlignmentCheck(_offsetInBytes, Int32List.BYTES_PER_ELEMENT);
2848 } 2873 }
2849 2874
2850 2875
2851 // Method(s) implementing List interface. 2876 // Method(s) implementing List interface.
2852 2877
2853 int operator[](int index) { 2878 int operator[](int index) {
2854 if (index < 0 || index >= length) { 2879 if (index >= 0 && index < length) {
2855 throw _newRangeError(index, length); 2880 return _typedData._getInt32(offsetInBytes +
2881 (index * Int32List.BYTES_PER_ELEMENT));
2856 } 2882 }
2857 return _typedData._getInt32(offsetInBytes + 2883 throw new RangeError.index(index, this, "index");
2858 (index * Int32List.BYTES_PER_ELEMENT));
2859 } 2884 }
2860 2885
2861 void operator[]=(int index, int value) { 2886 void operator[]=(int index, int value) {
2862 if (index < 0 || index >= length) { 2887 if (index >= 0 && index < length) {
2863 throw _newRangeError(index, length); 2888 _typedData._setInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT) ,
2889 _toInt32(value));
2890 return;
2864 } 2891 }
2865 _typedData._setInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT), 2892 throw new RangeError.index(index, this, "index");
2866 _toInt32(value));
2867 } 2893 }
2868 2894
2869 2895
2870 // Method(s) implementing TypedData interface. 2896 // Method(s) implementing TypedData interface.
2871 2897
2872 int get elementSizeInBytes { 2898 int get elementSizeInBytes {
2873 return Int32List.BYTES_PER_ELEMENT; 2899 return Int32List.BYTES_PER_ELEMENT;
2874 } 2900 }
2875 2901
2876 2902
(...skipping 15 matching lines...) Expand all
2892 _rangeCheck(buffer.lengthInBytes, 2918 _rangeCheck(buffer.lengthInBytes,
2893 offsetInBytes, 2919 offsetInBytes,
2894 length * Uint32List.BYTES_PER_ELEMENT); 2920 length * Uint32List.BYTES_PER_ELEMENT);
2895 _offsetAlignmentCheck(_offsetInBytes, Uint32List.BYTES_PER_ELEMENT); 2921 _offsetAlignmentCheck(_offsetInBytes, Uint32List.BYTES_PER_ELEMENT);
2896 } 2922 }
2897 2923
2898 2924
2899 // Method(s) implementing List interface. 2925 // Method(s) implementing List interface.
2900 2926
2901 int operator[](int index) { 2927 int operator[](int index) {
2902 if (index < 0 || index >= length) { 2928 if (index >= 0 && index < length) {
2903 throw _newRangeError(index, length); 2929 return _typedData._getUint32(offsetInBytes +
2930 (index * Uint32List.BYTES_PER_ELEMENT));
2904 } 2931 }
2905 return _typedData._getUint32(offsetInBytes + 2932 throw new RangeError.index(index, this, "index");
2906 (index * Uint32List.BYTES_PER_ELEMENT));
2907 } 2933 }
2908 2934
2909 void operator[]=(int index, int value) { 2935 void operator[]=(int index, int value) {
2910 if (index < 0 || index >= length) { 2936 if (index >= 0 && index < length) {
2911 throw _newRangeError(index, length); 2937 _typedData._setUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMEN T),
2938 _toUint32(value));
2939 return;
2912 } 2940 }
2913 _typedData._setUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT) , 2941 throw new RangeError.index(index, this, "index");
2914 _toUint32(value));
2915 } 2942 }
2916 2943
2917 2944
2918 // Method(s) implementing TypedData interface. 2945 // Method(s) implementing TypedData interface.
2919 2946
2920 int get elementSizeInBytes { 2947 int get elementSizeInBytes {
2921 return Uint32List.BYTES_PER_ELEMENT; 2948 return Uint32List.BYTES_PER_ELEMENT;
2922 } 2949 }
2923 2950
2924 2951
(...skipping 15 matching lines...) Expand all
2940 _rangeCheck(buffer.lengthInBytes, 2967 _rangeCheck(buffer.lengthInBytes,
2941 offsetInBytes, 2968 offsetInBytes,
2942 length * Int64List.BYTES_PER_ELEMENT); 2969 length * Int64List.BYTES_PER_ELEMENT);
2943 _offsetAlignmentCheck(_offsetInBytes, Int64List.BYTES_PER_ELEMENT); 2970 _offsetAlignmentCheck(_offsetInBytes, Int64List.BYTES_PER_ELEMENT);
2944 } 2971 }
2945 2972
2946 2973
2947 // Method(s) implementing List interface. 2974 // Method(s) implementing List interface.
2948 2975
2949 int operator[](int index) { 2976 int operator[](int index) {
2950 if (index < 0 || index >= length) { 2977 if (index >= 0 && index < length) {
2951 throw _newRangeError(index, length); 2978 return _typedData._getInt64(offsetInBytes +
2979 (index * Int64List.BYTES_PER_ELEMENT));
2952 } 2980 }
2953 return _typedData._getInt64(offsetInBytes + 2981 throw new RangeError.index(index, this, "index");
2954 (index * Int64List.BYTES_PER_ELEMENT));
2955 } 2982 }
2956 2983
2957 void operator[]=(int index, int value) { 2984 void operator[]=(int index, int value) {
2958 if (index < 0 || index >= length) { 2985 if (index >= 0 && index < length) {
2959 throw _newRangeError(index, length); 2986 _typedData._setInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT) ,
2987 _toInt64(value));
2988 return;
2960 } 2989 }
2961 _typedData._setInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT), 2990 throw new RangeError.index(index, this, "index");
2962 _toInt64(value));
2963 } 2991 }
2964 2992
2965 2993
2966 // Method(s) implementing TypedData interface. 2994 // Method(s) implementing TypedData interface.
2967 2995
2968 int get elementSizeInBytes { 2996 int get elementSizeInBytes {
2969 return Int64List.BYTES_PER_ELEMENT; 2997 return Int64List.BYTES_PER_ELEMENT;
2970 } 2998 }
2971 2999
2972 3000
(...skipping 15 matching lines...) Expand all
2988 _rangeCheck(buffer.lengthInBytes, 3016 _rangeCheck(buffer.lengthInBytes,
2989 offsetInBytes, 3017 offsetInBytes,
2990 length * Uint64List.BYTES_PER_ELEMENT); 3018 length * Uint64List.BYTES_PER_ELEMENT);
2991 _offsetAlignmentCheck(_offsetInBytes, Uint64List.BYTES_PER_ELEMENT); 3019 _offsetAlignmentCheck(_offsetInBytes, Uint64List.BYTES_PER_ELEMENT);
2992 } 3020 }
2993 3021
2994 3022
2995 // Method(s) implementing List interface. 3023 // Method(s) implementing List interface.
2996 3024
2997 int operator[](int index) { 3025 int operator[](int index) {
2998 if (index < 0 || index >= length) { 3026 if (index >= 0 && index < length) {
2999 throw _newRangeError(index, length); 3027 return _typedData._getUint64(offsetInBytes +
3028 (index * Uint64List.BYTES_PER_ELEMENT));
3000 } 3029 }
3001 return _typedData._getUint64(offsetInBytes + 3030 throw new RangeError.index(index, this, "index");
3002 (index * Uint64List.BYTES_PER_ELEMENT));
3003 } 3031 }
3004 3032
3005 void operator[]=(int index, int value) { 3033 void operator[]=(int index, int value) {
3006 if (index < 0 || index >= length) { 3034 if (index >= 0 && index < length) {
3007 throw _newRangeError(index, length); 3035 _typedData._setUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMEN T),
3036 _toUint64(value));
3037 return;
3008 } 3038 }
3009 _typedData._setUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT) , 3039 throw new RangeError.index(index, this, "index");
3010 _toUint64(value));
3011 } 3040 }
3012 3041
3013 3042
3014 // Method(s) implementing TypedData interface. 3043 // Method(s) implementing TypedData interface.
3015 3044
3016 int get elementSizeInBytes { 3045 int get elementSizeInBytes {
3017 return Uint64List.BYTES_PER_ELEMENT; 3046 return Uint64List.BYTES_PER_ELEMENT;
3018 } 3047 }
3019 3048
3020 3049
(...skipping 15 matching lines...) Expand all
3036 _rangeCheck(buffer.lengthInBytes, 3065 _rangeCheck(buffer.lengthInBytes,
3037 offsetInBytes, 3066 offsetInBytes,
3038 length * Float32List.BYTES_PER_ELEMENT); 3067 length * Float32List.BYTES_PER_ELEMENT);
3039 _offsetAlignmentCheck(_offsetInBytes, Float32List.BYTES_PER_ELEMENT); 3068 _offsetAlignmentCheck(_offsetInBytes, Float32List.BYTES_PER_ELEMENT);
3040 } 3069 }
3041 3070
3042 3071
3043 // Method(s) implementing List interface. 3072 // Method(s) implementing List interface.
3044 3073
3045 double operator[](int index) { 3074 double operator[](int index) {
3046 if (index < 0 || index >= length) { 3075 if (index >= 0 && index < length) {
3047 throw _newRangeError(index, length); 3076 return _typedData._getFloat32(offsetInBytes +
3077 (index * Float32List.BYTES_PER_ELEMENT));
3048 } 3078 }
3049 return _typedData._getFloat32(offsetInBytes + 3079 throw new RangeError.index(index, this, "index");
3050 (index * Float32List.BYTES_PER_ELEMENT));
3051 } 3080 }
3052 3081
3053 void operator[]=(int index, double value) { 3082 void operator[]=(int index, double value) {
3054 if (index < 0 || index >= length) { 3083 if (index >= 0 && index < length) {
3055 throw _newRangeError(index, length); 3084 _typedData._setFloat32(offsetInBytes +
3085 (index * Float32List.BYTES_PER_ELEMENT), value);
3086 return;
3056 } 3087 }
3057 _typedData._setFloat32(offsetInBytes + 3088 throw new RangeError.index(index, this, "index");
3058 (index * Float32List.BYTES_PER_ELEMENT), value);
3059 } 3089 }
3060 3090
3061 3091
3062 // Method(s) implementing TypedData interface. 3092 // Method(s) implementing TypedData interface.
3063 3093
3064 int get elementSizeInBytes { 3094 int get elementSizeInBytes {
3065 return Float32List.BYTES_PER_ELEMENT; 3095 return Float32List.BYTES_PER_ELEMENT;
3066 } 3096 }
3067 3097
3068 3098
(...skipping 15 matching lines...) Expand all
3084 _rangeCheck(buffer.lengthInBytes, 3114 _rangeCheck(buffer.lengthInBytes,
3085 offsetInBytes, 3115 offsetInBytes,
3086 length * Float64List.BYTES_PER_ELEMENT); 3116 length * Float64List.BYTES_PER_ELEMENT);
3087 _offsetAlignmentCheck(_offsetInBytes, Float64List.BYTES_PER_ELEMENT); 3117 _offsetAlignmentCheck(_offsetInBytes, Float64List.BYTES_PER_ELEMENT);
3088 } 3118 }
3089 3119
3090 3120
3091 // Method(s) implementing List interface. 3121 // Method(s) implementing List interface.
3092 3122
3093 double operator[](int index) { 3123 double operator[](int index) {
3094 if (index < 0 || index >= length) { 3124 if (index >= 0 && index < length) {
3095 throw _newRangeError(index, length); 3125 return _typedData._getFloat64(offsetInBytes +
3126 (index * Float64List.BYTES_PER_ELEMENT));
3096 } 3127 }
3097 return _typedData._getFloat64(offsetInBytes + 3128 throw new RangeError.index(index, this, "index");
3098 (index * Float64List.BYTES_PER_ELEMENT));
3099 } 3129 }
3100 3130
3101 void operator[]=(int index, double value) { 3131 void operator[]=(int index, double value) {
3102 if (index < 0 || index >= length) { 3132 if (index >= 0 && index < length) {
3103 throw _newRangeError(index, length); 3133 _typedData._setFloat64(offsetInBytes +
3134 (index * Float64List.BYTES_PER_ELEMENT), value);
3135 return;
3104 } 3136 }
3105 _typedData._setFloat64(offsetInBytes + 3137 throw new RangeError.index(index, this, "index");
3106 (index * Float64List.BYTES_PER_ELEMENT), value);
3107 } 3138 }
3108 3139
3109 3140
3110 // Method(s) implementing TypedData interface. 3141 // Method(s) implementing TypedData interface.
3111 3142
3112 int get elementSizeInBytes { 3143 int get elementSizeInBytes {
3113 return Float64List.BYTES_PER_ELEMENT; 3144 return Float64List.BYTES_PER_ELEMENT;
3114 } 3145 }
3115 3146
3116 3147
(...skipping 15 matching lines...) Expand all
3132 _rangeCheck(buffer.lengthInBytes, 3163 _rangeCheck(buffer.lengthInBytes,
3133 offsetInBytes, 3164 offsetInBytes,
3134 length * Float32x4List.BYTES_PER_ELEMENT); 3165 length * Float32x4List.BYTES_PER_ELEMENT);
3135 _offsetAlignmentCheck(_offsetInBytes, Float32x4List.BYTES_PER_ELEMENT); 3166 _offsetAlignmentCheck(_offsetInBytes, Float32x4List.BYTES_PER_ELEMENT);
3136 } 3167 }
3137 3168
3138 3169
3139 // Method(s) implementing List interface. 3170 // Method(s) implementing List interface.
3140 3171
3141 Float32x4 operator[](int index) { 3172 Float32x4 operator[](int index) {
3142 if (index < 0 || index >= length) { 3173 if (index >= 0 && index < length) {
3143 throw _newRangeError(index, length); 3174 return _typedData._getFloat32x4(offsetInBytes +
3175 (index * Float32x4List.BYTES_PER_ELEMENT));
3144 } 3176 }
3145 return _typedData._getFloat32x4(offsetInBytes + 3177 throw new RangeError.index(index, this, "index");
3146 (index * Float32x4List.BYTES_PER_ELEMENT));
3147 } 3178 }
3148 3179
3149 void operator[]=(int index, Float32x4 value) { 3180 void operator[]=(int index, Float32x4 value) {
3150 if (index < 0 || index >= length) { 3181 if (index >= 0 && index < length) {
3151 throw _newRangeError(index, length); 3182 _typedData._setFloat32x4(offsetInBytes +
3183 (index * Float32x4List.BYTES_PER_ELEMENT), value);
3184 return;
3152 } 3185 }
3153 _typedData._setFloat32x4(offsetInBytes + 3186 throw new RangeError.index(index, this, "index");
3154 (index * Float32x4List.BYTES_PER_ELEMENT), value);
3155 } 3187 }
3156 3188
3157 3189
3158 // Method(s) implementing TypedData interface. 3190 // Method(s) implementing TypedData interface.
3159 3191
3160 int get elementSizeInBytes { 3192 int get elementSizeInBytes {
3161 return Float32x4List.BYTES_PER_ELEMENT; 3193 return Float32x4List.BYTES_PER_ELEMENT;
3162 } 3194 }
3163 3195
3164 3196
(...skipping 15 matching lines...) Expand all
3180 _rangeCheck(buffer.lengthInBytes, 3212 _rangeCheck(buffer.lengthInBytes,
3181 offsetInBytes, 3213 offsetInBytes,
3182 length * Int32x4List.BYTES_PER_ELEMENT); 3214 length * Int32x4List.BYTES_PER_ELEMENT);
3183 _offsetAlignmentCheck(_offsetInBytes, Int32x4List.BYTES_PER_ELEMENT); 3215 _offsetAlignmentCheck(_offsetInBytes, Int32x4List.BYTES_PER_ELEMENT);
3184 } 3216 }
3185 3217
3186 3218
3187 // Method(s) implementing List interface. 3219 // Method(s) implementing List interface.
3188 3220
3189 Int32x4 operator[](int index) { 3221 Int32x4 operator[](int index) {
3190 if (index < 0 || index >= length) { 3222 if (index >= 0 && index < length) {
3191 throw _newRangeError(index, length); 3223 return _typedData._getInt32x4(offsetInBytes +
3224 (index * Int32x4List.BYTES_PER_ELEMENT));
3192 } 3225 }
3193 return _typedData._getInt32x4(offsetInBytes + 3226 throw new RangeError.index(index, this, "index");
3194 (index * Int32x4List.BYTES_PER_ELEMENT));
3195 } 3227 }
3196 3228
3197 void operator[]=(int index, Int32x4 value) { 3229 void operator[]=(int index, Int32x4 value) {
3198 if (index < 0 || index >= length) { 3230 if (index >= 0 && index < length) {
3199 throw _newRangeError(index, length); 3231 _typedData._setInt32x4(offsetInBytes +
3232 (index * Int32x4List.BYTES_PER_ELEMENT), value);
3233 return;
3200 } 3234 }
3201 _typedData._setInt32x4(offsetInBytes + 3235 throw new RangeError.index(index, this, "index");
3202 (index * Int32x4List.BYTES_PER_ELEMENT), value);
3203 } 3236 }
3204 3237
3205 3238
3206 // Method(s) implementing TypedData interface. 3239 // Method(s) implementing TypedData interface.
3207 3240
3208 int get elementSizeInBytes { 3241 int get elementSizeInBytes {
3209 return Int32x4List.BYTES_PER_ELEMENT; 3242 return Int32x4List.BYTES_PER_ELEMENT;
3210 } 3243 }
3211 3244
3212 3245
(...skipping 15 matching lines...) Expand all
3228 _rangeCheck(buffer.lengthInBytes, 3261 _rangeCheck(buffer.lengthInBytes,
3229 offsetInBytes, 3262 offsetInBytes,
3230 length * Float64x2List.BYTES_PER_ELEMENT); 3263 length * Float64x2List.BYTES_PER_ELEMENT);
3231 _offsetAlignmentCheck(_offsetInBytes, Float64x2List.BYTES_PER_ELEMENT); 3264 _offsetAlignmentCheck(_offsetInBytes, Float64x2List.BYTES_PER_ELEMENT);
3232 } 3265 }
3233 3266
3234 3267
3235 // Method(s) implementing List interface. 3268 // Method(s) implementing List interface.
3236 3269
3237 Float64x2 operator[](int index) { 3270 Float64x2 operator[](int index) {
3238 if (index < 0 || index >= length) { 3271 if (index >= 0 && index < length) {
3239 throw _newRangeError(index, length); 3272 return _typedData._getFloat64x2(offsetInBytes +
3273 (index * Float64x2List.BYTES_PER_ELEMENT));
3240 } 3274 }
3241 return _typedData._getFloat64x2(offsetInBytes + 3275 throw new RangeError.index(index, this, "index");
3242 (index * Float64x2List.BYTES_PER_ELEMENT));
3243 } 3276 }
3244 3277
3245 void operator[]=(int index, Float64x2 value) { 3278 void operator[]=(int index, Float64x2 value) {
3246 if (index < 0 || index >= length) { 3279 if (index >= 0 && index < length) {
3247 throw _newRangeError(index, length); 3280 _typedData._setFloat64x2(offsetInBytes +
3281 (index * Float64x2List.BYTES_PER_ELEMENT), value);
3282 return;
3248 } 3283 }
3249 _typedData._setFloat64x2(offsetInBytes + 3284 throw new RangeError.index(index, this, "index");
3250 (index * Float64x2List.BYTES_PER_ELEMENT), value);
3251 } 3285 }
3252 3286
3253 3287
3254 // Method(s) implementing TypedData interface. 3288 // Method(s) implementing TypedData interface.
3255 3289
3256 int get elementSizeInBytes { 3290 int get elementSizeInBytes {
3257 return Float64x2List.BYTES_PER_ELEMENT; 3291 return Float64x2List.BYTES_PER_ELEMENT;
3258 } 3292 }
3259 3293
3260 3294
(...skipping 28 matching lines...) Expand all
3289 return _offset; 3323 return _offset;
3290 } 3324 }
3291 3325
3292 int get elementSizeInBytes { 3326 int get elementSizeInBytes {
3293 return 1; 3327 return 1;
3294 } 3328 }
3295 3329
3296 // Method(s) implementing ByteData interface. 3330 // Method(s) implementing ByteData interface.
3297 3331
3298 int getInt8(int byteOffset) { 3332 int getInt8(int byteOffset) {
3299 if (byteOffset < 0 || byteOffset >= length) { 3333 if (byteOffset >= 0 && byteOffset < length) {
3300 throw _newRangeError(byteOffset, length); 3334 return _typedData._getInt8(_offset + byteOffset);
3301 } 3335 }
3302 return _typedData._getInt8(_offset + byteOffset); 3336 throw new RangeError.index(byteOffset, this, "byteOffset");
3303 } 3337 }
3304 void setInt8(int byteOffset, int value) { 3338 void setInt8(int byteOffset, int value) {
3305 if (byteOffset < 0 || byteOffset >= length) { 3339 if (byteOffset >= 0 && byteOffset < length) {
3306 throw _newRangeError(byteOffset, length); 3340 _typedData._setInt8(_offset + byteOffset, value);
3307 } 3341 return;
3308 _typedData._setInt8(_offset + byteOffset, value); 3342 }
3343 throw new RangeError.index(byteOffset, this, "byteOffset");
3309 } 3344 }
3310 3345
3311 int getUint8(int byteOffset) { 3346 int getUint8(int byteOffset) {
3312 if (byteOffset < 0 || byteOffset >= length) { 3347 if (byteOffset >= 0 && byteOffset < length) {
3313 throw _newRangeError(byteOffset, length); 3348 return _typedData._getUint8(_offset + byteOffset);
3314 } 3349 }
3315 return _typedData._getUint8(_offset + byteOffset); 3350 throw new RangeError.index(byteOffset, this, "byteOffset");
3316 } 3351 }
3317 void setUint8(int byteOffset, int value) { 3352 void setUint8(int byteOffset, int value) {
3318 if (byteOffset < 0 || byteOffset >= length) { 3353 if (byteOffset >= 0 && byteOffset < length) {
3319 throw _newRangeError(byteOffset, length); 3354 _typedData._setUint8(_offset + byteOffset, value);
3320 } 3355 return;
3321 _typedData._setUint8(_offset + byteOffset, value); 3356 }
3357 throw new RangeError.index(byteOffset, this, "byteOffset");
3322 } 3358 }
3323 3359
3324 int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 3360 int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3325 if (byteOffset < 0 || byteOffset + 1 >= length) { 3361 if (byteOffset >= 0 && byteOffset < length - 1) {
3326 throw _newRangeError(byteOffset + 1, length); 3362 var result = _typedData._getInt16(_offset + byteOffset);
3327 } 3363 if (identical(endian, Endianness.HOST_ENDIAN)) {
3328 var result = _typedData._getInt16(_offset + byteOffset); 3364 return result;
3329 if (identical(endian, Endianness.HOST_ENDIAN)) { 3365 }
3330 return result; 3366 return _byteSwap16(result).toSigned(16);
3331 } 3367 }
3332 return _byteSwap16(result).toSigned(16); 3368 throw new RangeError.range(byteOffset, 0, (length - 2), "byteOffset");
3333 } 3369 }
3334 void setInt16(int byteOffset, 3370 void setInt16(int byteOffset,
3335 int value, 3371 int value,
3336 [Endianness endian = Endianness.BIG_ENDIAN]) { 3372 [Endianness endian = Endianness.BIG_ENDIAN]) {
3337 if (byteOffset < 0 || byteOffset + 1 >= length) { 3373 if (byteOffset >= 0 && byteOffset < length - 1) {
3338 throw _newRangeError(byteOffset + 1, length); 3374 _typedData._setInt16(_offset + byteOffset,
3339 } 3375 identical(endian, Endianness.HOST_ENDIAN) ? value
3340 _typedData._setInt16(_offset + byteOffset, 3376 : _byteSwap16(value));
3341 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value)); 3377 return;
3378 }
3379 throw new RangeError.range(byteOffset, 0, (length - 2), "byteOffset");
3342 } 3380 }
3343 3381
3344 int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 3382 int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3345 if (byteOffset < 0 || byteOffset + 1 >= length) { 3383 if (byteOffset >= 0 && byteOffset < length - 1) {
3346 throw _newRangeError(byteOffset + 1, length);
3347 }
3348 var result = _typedData._getUint16(_offset + byteOffset); 3384 var result = _typedData._getUint16(_offset + byteOffset);
3349 if (identical(endian, Endianness.HOST_ENDIAN)) { 3385 if (identical(endian, Endianness.HOST_ENDIAN)) {
3350 return result; 3386 return result;
3351 } 3387 }
3352 return _byteSwap16(result); 3388 return _byteSwap16(result);
3389 }
3390 throw new RangeError.range(byteOffset, 0, (length - 2), "byteOffset");
3353 } 3391 }
3354 void setUint16(int byteOffset, 3392 void setUint16(int byteOffset,
3355 int value, 3393 int value,
3356 [Endianness endian = Endianness.BIG_ENDIAN]) { 3394 [Endianness endian = Endianness.BIG_ENDIAN]) {
3357 if (byteOffset < 0 || byteOffset + 1 >= length) { 3395 if (byteOffset >= 0 && byteOffset < length - 1) {
3358 throw _newRangeError(byteOffset + 1, length); 3396 _typedData._setUint16(_offset + byteOffset,
3359 } 3397 identical(endian, Endianness.HOST_ENDIAN) ? value
3360 _typedData._setUint16(_offset + byteOffset, 3398 : _byteSwap16(value));
3361 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value)); 3399 return;
3400 }
3401 throw new RangeError.range(byteOffset, 0, (length - 2), "byteOffset");
3362 } 3402 }
3363 3403
3364 int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 3404 int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3365 if (byteOffset < 0 || byteOffset + 3 >= length) { 3405 if (byteOffset >= 0 && byteOffset < length - 3) {
3366 throw _newRangeError(byteOffset + 3, length); 3406 var result = _typedData._getInt32(_offset + byteOffset);
3367 } 3407 if (identical(endian, Endianness.HOST_ENDIAN)) {
3368 var result = _typedData._getInt32(_offset + byteOffset); 3408 return result;
3369 if (identical(endian, Endianness.HOST_ENDIAN)) { 3409 }
3370 return result; 3410 return _byteSwap32(result).toSigned(32);
3371 } 3411 }
3372 return _byteSwap32(result).toSigned(32); 3412 throw new RangeError.range(byteOffset, 0, length - 4);
3373 } 3413 }
3374 void setInt32(int byteOffset, 3414 void setInt32(int byteOffset,
3375 int value, 3415 int value,
3376 [Endianness endian = Endianness.BIG_ENDIAN]) { 3416 [Endianness endian = Endianness.BIG_ENDIAN]) {
3377 if (byteOffset < 0 || byteOffset + 3 >= length) { 3417 if (byteOffset >= 0 && byteOffset < length - 3) {
3378 throw _newRangeError(byteOffset + 3, length); 3418 _typedData._setInt32(_offset + byteOffset,
3379 } 3419 identical(endian, Endianness.HOST_ENDIAN) ? value
3380 _typedData._setInt32(_offset + byteOffset, 3420 : _byteSwap32(value));
3381 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value)); 3421 return;
3422 }
3423 throw new RangeError.range(byteOffset, 0, length - 4);
3382 } 3424 }
3383 3425
3384 int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 3426 int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3385 if (byteOffset < 0 || byteOffset + 3 >= length) { 3427 if (byteOffset >= 0 && byteOffset < length - 3) {
3386 throw _newRangeError(byteOffset + 3, length); 3428 var result = _typedData._getUint32(_offset + byteOffset);
3387 } 3429 if (identical(endian, Endianness.HOST_ENDIAN)) {
3388 var result = _typedData._getUint32(_offset + byteOffset); 3430 return result;
3389 if (identical(endian, Endianness.HOST_ENDIAN)) { 3431 }
3390 return result; 3432 return _byteSwap32(result);
3391 } 3433 }
3392 return _byteSwap32(result); 3434 throw new RangeError.range(byteOffset, 0, length - 4);
3393 } 3435 }
3394 void setUint32(int byteOffset, 3436 void setUint32(int byteOffset,
3395 int value, 3437 int value,
3396 [Endianness endian = Endianness.BIG_ENDIAN]) { 3438 [Endianness endian = Endianness.BIG_ENDIAN]) {
3397 if (byteOffset < 0 || byteOffset + 3 >= length) { 3439 if (byteOffset >= 0 && byteOffset < length - 3) {
3398 throw _newRangeError(byteOffset + 3, length); 3440 _typedData._setUint32(_offset + byteOffset,
3399 } 3441 identical(endian, Endianness.HOST_ENDIAN) ? value
3400 _typedData._setUint32(_offset + byteOffset, 3442 : _byteSwap32(value));
3401 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value)); 3443 return;
3444 }
3445 throw new RangeError.range(byteOffset, 0, length - 4);
3402 } 3446 }
3403 3447
3404 int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 3448 int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3405 if (byteOffset < 0 || byteOffset + 7 >= length) { 3449 if (byteOffset >= 0 && byteOffset < length - 7) {
3406 throw _newRangeError(byteOffset + 7, length); 3450 var result = _typedData._getInt64(_offset + byteOffset);
3407 } 3451 if (identical(endian, Endianness.HOST_ENDIAN)) {
3408 var result = _typedData._getInt64(_offset + byteOffset); 3452 return result;
3409 if (identical(endian, Endianness.HOST_ENDIAN)) { 3453 }
3410 return result; 3454 return _byteSwap64(result).toSigned(64);
3411 } 3455 }
3412 return _byteSwap64(result).toSigned(64); 3456 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
3413 } 3457 }
3414 void setInt64(int byteOffset, 3458 void setInt64(int byteOffset,
3415 int value, 3459 int value,
3416 [Endianness endian = Endianness.BIG_ENDIAN]) { 3460 [Endianness endian = Endianness.BIG_ENDIAN]) {
3417 if (byteOffset < 0 || byteOffset + 7 >= length) { 3461 if (byteOffset >= 0 && byteOffset < length - 7) {
3418 throw _newRangeError(byteOffset + 7, length); 3462 _typedData._setInt64(_offset + byteOffset,
3419 } 3463 identical(endian, Endianness.HOST_ENDIAN) ? value
3420 _typedData._setInt64(_offset + byteOffset, 3464 : _byteSwap64(value));
3421 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value)); 3465 return;
3466 }
3467 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
3422 } 3468 }
3423 3469
3424 int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 3470 int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3425 if (byteOffset < 0 || byteOffset + 7 >= length) { 3471 if (byteOffset >= 0 && byteOffset < length - 7) {
3426 throw _newRangeError(byteOffset + 7, length); 3472 var result = _typedData._getUint64(_offset + byteOffset);
3427 } 3473 if (identical(endian, Endianness.HOST_ENDIAN)) {
3428 var result = _typedData._getUint64(_offset + byteOffset); 3474 return result;
3429 if (identical(endian, Endianness.HOST_ENDIAN)) { 3475 }
3430 return result; 3476 return _byteSwap64(result);
3431 } 3477 }
3432 return _byteSwap64(result); 3478 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
3433 } 3479 }
3434 void setUint64(int byteOffset, 3480 void setUint64(int byteOffset,
3435 int value, 3481 int value,
3436 [Endianness endian = Endianness.BIG_ENDIAN]) { 3482 [Endianness endian = Endianness.BIG_ENDIAN]) {
3437 if (byteOffset < 0 || byteOffset + 7 >= length) { 3483 if (byteOffset >= 0 && byteOffset < length - 7) {
3438 throw _newRangeError(byteOffset + 7, length); 3484 _typedData._setUint64(_offset + byteOffset,
3439 } 3485 identical(endian, Endianness.HOST_ENDIAN) ? value
3440 _typedData._setUint64(_offset + byteOffset, 3486 : _byteSwap64(value));
3441 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value)); 3487 return;
3488 }
3489 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
3442 } 3490 }
3443 3491
3444 double getFloat32(int byteOffset, 3492 double getFloat32(int byteOffset,
3445 [Endianness endian = Endianness.BIG_ENDIAN]) { 3493 [Endianness endian = Endianness.BIG_ENDIAN]) {
3446 if (byteOffset < 0 || byteOffset + 3 >= length) { 3494 if (byteOffset >= 0 && byteOffset < length - 3) {
3447 throw _newRangeError(byteOffset + 3, length); 3495 if (identical(endian, Endianness.HOST_ENDIAN)) {
3448 } 3496 return _typedData._getFloat32(_offset + byteOffset);
3449 if (identical(endian, Endianness.HOST_ENDIAN)) { 3497 }
3450 return _typedData._getFloat32(_offset + byteOffset); 3498 _convU32[0] = _byteSwap32(_typedData._getUint32(_offset + byteOffset));
3451 } 3499 return _convF32[0];
3452 _convU32[0] = _byteSwap32(_typedData._getUint32(_offset + byteOffset)); 3500 }
3453 return _convF32[0]; 3501 throw new RangeError(byteOffset, 0, length - 4, "byteOffset");
3454 } 3502 }
3455 void setFloat32(int byteOffset, 3503 void setFloat32(int byteOffset,
3456 double value, 3504 double value,
3457 [Endianness endian = Endianness.BIG_ENDIAN]) { 3505 [Endianness endian = Endianness.BIG_ENDIAN]) {
3458 if (byteOffset < 0 || byteOffset + 3 >= length) { 3506 if (byteOffset >= 0 && byteOffset < length - 3) {
3459 throw _newRangeError(byteOffset + 3, length); 3507 if (identical(endian, Endianness.HOST_ENDIAN)) {
3460 } 3508 _typedData._setFloat32(_offset + byteOffset, value);
3461 if (identical(endian, Endianness.HOST_ENDIAN)) { 3509 return;
3462 _typedData._setFloat32(_offset + byteOffset, value); 3510 }
3463 return; 3511 _convF32[0] = value;
3464 } 3512 _typedData._setUint32(_offset + byteOffset, _byteSwap32(_convU32[0]));
3465 _convF32[0] = value; 3513 return;
3466 _typedData._setUint32(_offset + byteOffset, _byteSwap32(_convU32[0])); 3514 }
3515 throw new RangeError(byteOffset, 0, length - 4, "byteOffset");
3467 } 3516 }
3468 3517
3469 double getFloat64(int byteOffset, 3518 double getFloat64(int byteOffset,
3470 [Endianness endian = Endianness.BIG_ENDIAN]) { 3519 [Endianness endian = Endianness.BIG_ENDIAN]) {
3471 if (byteOffset < 0 || byteOffset + 7 >= length) { 3520 if (byteOffset >= 0 && byteOffset < length - 7) {
3472 throw _newRangeError(byteOffset + 7, length); 3521 if (identical(endian, Endianness.HOST_ENDIAN)) {
3473 } 3522 return _typedData._getFloat64(_offset + byteOffset);
3474 if (identical(endian, Endianness.HOST_ENDIAN)) { 3523 }
3475 return _typedData._getFloat64(_offset + byteOffset); 3524 _convU64[0] = _byteSwap64(_typedData._getUint64(_offset + byteOffset));
3476 } 3525 return _convF64[0];
3477 _convU64[0] = _byteSwap64(_typedData._getUint64(_offset + byteOffset)); 3526 }
3478 return _convF64[0]; 3527 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
3479 } 3528 }
3480 void setFloat64(int byteOffset, 3529 void setFloat64(int byteOffset,
3481 double value, 3530 double value,
3482 [Endianness endian = Endianness.BIG_ENDIAN]) { 3531 [Endianness endian = Endianness.BIG_ENDIAN]) {
3483 if (byteOffset < 0 || byteOffset + 7 >= length) { 3532 if (byteOffset >= 0 && byteOffset < length - 7) {
3484 throw _newRangeError(byteOffset + 7, length);
3485 }
3486 if (identical(endian, Endianness.HOST_ENDIAN)) { 3533 if (identical(endian, Endianness.HOST_ENDIAN)) {
3487 _typedData._setFloat64(_offset + byteOffset, value); 3534 _typedData._setFloat64(_offset + byteOffset, value);
3488 return; 3535 return;
3489 } 3536 }
3490 _convF64[0] = value; 3537 _convF64[0] = value;
3491 _typedData._setUint64(_offset + byteOffset, _byteSwap64(_convU64[0])); 3538 _typedData._setUint64(_offset + byteOffset, _byteSwap64(_convU64[0]));
3539 return;
3540 }
3541 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
3492 } 3542 }
3493 3543
3494 Float32x4 getFloat32x4(int byteOffset, 3544 Float32x4 getFloat32x4(int byteOffset,
3495 [Endianness endian = Endianness.BIG_ENDIAN]) { 3545 [Endianness endian = Endianness.BIG_ENDIAN]) {
3496 if (byteOffset < 0 || byteOffset + 3 >= length) { 3546 if (byteOffset >= 0 && byteOffset < length - 15) {
3497 throw _newRangeError(byteOffset + 3, length); 3547 // TODO(johnmccutchan) : Need to resolve this for endianity.
3498 } 3548 return _typedData._getFloat32x4(_offset + byteOffset);
3499 // TODO(johnmccutchan) : Need to resolve this for endianity. 3549 }
3500 return _typedData._getFloat32x4(_offset + byteOffset); 3550 throw new RangeError.range(byteOffset, 0, length - 16, "byteOffset");
3501 } 3551 }
3502 void setFloat32x4(int byteOffset, 3552 void setFloat32x4(int byteOffset,
3503 Float32x4 value, 3553 Float32x4 value,
3504 [Endianness endian = Endianness.BIG_ENDIAN]) { 3554 [Endianness endian = Endianness.BIG_ENDIAN]) {
3505 if (byteOffset < 0 || byteOffset + 3 >= length) { 3555 if (byteOffset >= 0 && byteOffset < length - 15) {
3506 throw _newRangeError(byteOffset + 3, length); 3556 // TODO(johnmccutchan) : Need to resolve this for endianity.
3507 } 3557 _typedData._setFloat32x4(_offset + byteOffset, value);
3508 // TODO(johnmccutchan) : Need to resolve this for endianity. 3558 return;
3509 _typedData._setFloat32x4(_offset + byteOffset, value); 3559 }
3510 3560 throw new RangeError.range(byteOffset, 0, length - 16, "byteOffset");
3511 } 3561 }
3512 3562
3513 final TypedData _typedData; 3563 final TypedData _typedData;
3514 final int _offset; 3564 final int _offset;
3515 final int length; 3565 final int length;
3516 } 3566 }
3517 3567
3518 int _byteSwap16(int value) { 3568 int _byteSwap16(int value) {
3519 return ((value & 0xFF00) >> 8) | 3569 return ((value & 0xFF00) >> 8) |
3520 ((value & 0x00FF) << 8); 3570 ((value & 0x00FF) << 8);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
3614 } 3664 }
3615 } 3665 }
3616 3666
3617 3667
3618 int _defaultIfNull(object, value) { 3668 int _defaultIfNull(object, value) {
3619 if (object == null) { 3669 if (object == null) {
3620 return value; 3670 return value;
3621 } 3671 }
3622 return object; 3672 return object;
3623 } 3673 }
3624
3625
3626 _newRangeError(int index, int length) {
3627 String message = "$index must be in the range [0..$length)";
3628 return new RangeError(message);
3629 }
OLDNEW
« 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