| OLD | NEW |
| 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 import "dart:_internal"; | 5 import "dart:_internal"; |
| 6 import "dart:collection" show ListBase; | 6 import "dart:collection" show ListBase; |
| 7 import 'dart:math' show Random; | 7 import 'dart:math' show Random; |
| 8 | 8 |
| 9 @patch | 9 @patch |
| 10 class ByteData implements TypedData { | 10 class ByteData implements TypedData { |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 factory Int8List(int length) native "TypedData_Int8Array_new"; | 724 factory Int8List(int length) native "TypedData_Int8Array_new"; |
| 725 | 725 |
| 726 @patch | 726 @patch |
| 727 factory Int8List.fromList(List<int> elements) { | 727 factory Int8List.fromList(List<int> elements) { |
| 728 return new Int8List(elements.length) | 728 return new Int8List(elements.length) |
| 729 ..setRange(0, elements.length, elements); | 729 ..setRange(0, elements.length, elements); |
| 730 } | 730 } |
| 731 } | 731 } |
| 732 | 732 |
| 733 class _Int8List extends _TypedList with _IntListMixin implements Int8List { | 733 class _Int8List extends _TypedList with _IntListMixin implements Int8List { |
| 734 Type get runtimeType => Int8List; | |
| 735 | |
| 736 // Method(s) implementing List interface. | 734 // Method(s) implementing List interface. |
| 737 int operator [](int index) { | 735 int operator [](int index) { |
| 738 if (index < 0 || index >= length) { | 736 if (index < 0 || index >= length) { |
| 739 throw new RangeError.index(index, this, "index"); | 737 throw new RangeError.index(index, this, "index"); |
| 740 } | 738 } |
| 741 return _getInt8(index); | 739 return _getInt8(index); |
| 742 } | 740 } |
| 743 | 741 |
| 744 void operator []=(int index, int value) { | 742 void operator []=(int index, int value) { |
| 745 if (index < 0 || index >= length) { | 743 if (index < 0 || index >= length) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 765 factory Uint8List(int length) native "TypedData_Uint8Array_new"; | 763 factory Uint8List(int length) native "TypedData_Uint8Array_new"; |
| 766 | 764 |
| 767 @patch | 765 @patch |
| 768 factory Uint8List.fromList(List<int> elements) { | 766 factory Uint8List.fromList(List<int> elements) { |
| 769 return new Uint8List(elements.length) | 767 return new Uint8List(elements.length) |
| 770 ..setRange(0, elements.length, elements); | 768 ..setRange(0, elements.length, elements); |
| 771 } | 769 } |
| 772 } | 770 } |
| 773 | 771 |
| 774 class _Uint8List extends _TypedList with _IntListMixin implements Uint8List { | 772 class _Uint8List extends _TypedList with _IntListMixin implements Uint8List { |
| 775 Type get runtimeType => Uint8List; | |
| 776 | |
| 777 // Methods implementing List interface. | 773 // Methods implementing List interface. |
| 778 int operator [](int index) { | 774 int operator [](int index) { |
| 779 if (index < 0 || index >= length) { | 775 if (index < 0 || index >= length) { |
| 780 throw new RangeError.index(index, this, "index"); | 776 throw new RangeError.index(index, this, "index"); |
| 781 } | 777 } |
| 782 return _getUint8(index); | 778 return _getUint8(index); |
| 783 } | 779 } |
| 784 | 780 |
| 785 void operator []=(int index, int value) { | 781 void operator []=(int index, int value) { |
| 786 if (index < 0 || index >= length) { | 782 if (index < 0 || index >= length) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 808 @patch | 804 @patch |
| 809 factory Uint8ClampedList.fromList(List<int> elements) { | 805 factory Uint8ClampedList.fromList(List<int> elements) { |
| 810 return new Uint8ClampedList(elements.length) | 806 return new Uint8ClampedList(elements.length) |
| 811 ..setRange(0, elements.length, elements); | 807 ..setRange(0, elements.length, elements); |
| 812 } | 808 } |
| 813 } | 809 } |
| 814 | 810 |
| 815 class _Uint8ClampedList extends _TypedList | 811 class _Uint8ClampedList extends _TypedList |
| 816 with _IntListMixin | 812 with _IntListMixin |
| 817 implements Uint8ClampedList { | 813 implements Uint8ClampedList { |
| 818 Type get runtimeType => Uint8ClampedList; | |
| 819 | |
| 820 // Methods implementing List interface. | 814 // Methods implementing List interface. |
| 821 int operator [](int index) { | 815 int operator [](int index) { |
| 822 if (index < 0 || index >= length) { | 816 if (index < 0 || index >= length) { |
| 823 throw new RangeError.index(index, this, "index"); | 817 throw new RangeError.index(index, this, "index"); |
| 824 } | 818 } |
| 825 return _getUint8(index); | 819 return _getUint8(index); |
| 826 } | 820 } |
| 827 | 821 |
| 828 void operator []=(int index, int value) { | 822 void operator []=(int index, int value) { |
| 829 if (index < 0 || index >= length) { | 823 if (index < 0 || index >= length) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 849 factory Int16List(int length) native "TypedData_Int16Array_new"; | 843 factory Int16List(int length) native "TypedData_Int16Array_new"; |
| 850 | 844 |
| 851 @patch | 845 @patch |
| 852 factory Int16List.fromList(List<int> elements) { | 846 factory Int16List.fromList(List<int> elements) { |
| 853 return new Int16List(elements.length) | 847 return new Int16List(elements.length) |
| 854 ..setRange(0, elements.length, elements); | 848 ..setRange(0, elements.length, elements); |
| 855 } | 849 } |
| 856 } | 850 } |
| 857 | 851 |
| 858 class _Int16List extends _TypedList with _IntListMixin implements Int16List { | 852 class _Int16List extends _TypedList with _IntListMixin implements Int16List { |
| 859 Type get runtimeType => Int16List; | |
| 860 | |
| 861 // Method(s) implementing List interface. | 853 // Method(s) implementing List interface. |
| 862 int operator [](int index) { | 854 int operator [](int index) { |
| 863 if (index < 0 || index >= length) { | 855 if (index < 0 || index >= length) { |
| 864 throw new RangeError.index(index, this, "index"); | 856 throw new RangeError.index(index, this, "index"); |
| 865 } | 857 } |
| 866 return _getIndexedInt16(index); | 858 return _getIndexedInt16(index); |
| 867 } | 859 } |
| 868 | 860 |
| 869 void operator []=(int index, int value) { | 861 void operator []=(int index, int value) { |
| 870 if (index < 0 || index >= length) { | 862 if (index < 0 || index >= length) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 factory Uint16List(int length) native "TypedData_Uint16Array_new"; | 901 factory Uint16List(int length) native "TypedData_Uint16Array_new"; |
| 910 | 902 |
| 911 @patch | 903 @patch |
| 912 factory Uint16List.fromList(List<int> elements) { | 904 factory Uint16List.fromList(List<int> elements) { |
| 913 return new Uint16List(elements.length) | 905 return new Uint16List(elements.length) |
| 914 ..setRange(0, elements.length, elements); | 906 ..setRange(0, elements.length, elements); |
| 915 } | 907 } |
| 916 } | 908 } |
| 917 | 909 |
| 918 class _Uint16List extends _TypedList with _IntListMixin implements Uint16List { | 910 class _Uint16List extends _TypedList with _IntListMixin implements Uint16List { |
| 919 Type get runtimeType => Uint16List; | |
| 920 | |
| 921 // Method(s) implementing the List interface. | 911 // Method(s) implementing the List interface. |
| 922 int operator [](int index) { | 912 int operator [](int index) { |
| 923 if (index < 0 || index >= length) { | 913 if (index < 0 || index >= length) { |
| 924 throw new RangeError.index(index, this, "index"); | 914 throw new RangeError.index(index, this, "index"); |
| 925 } | 915 } |
| 926 return _getIndexedUint16(index); | 916 return _getIndexedUint16(index); |
| 927 } | 917 } |
| 928 | 918 |
| 929 void operator []=(int index, int value) { | 919 void operator []=(int index, int value) { |
| 930 if (index < 0 || index >= length) { | 920 if (index < 0 || index >= length) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 factory Int32List(int length) native "TypedData_Int32Array_new"; | 959 factory Int32List(int length) native "TypedData_Int32Array_new"; |
| 970 | 960 |
| 971 @patch | 961 @patch |
| 972 factory Int32List.fromList(List<int> elements) { | 962 factory Int32List.fromList(List<int> elements) { |
| 973 return new Int32List(elements.length) | 963 return new Int32List(elements.length) |
| 974 ..setRange(0, elements.length, elements); | 964 ..setRange(0, elements.length, elements); |
| 975 } | 965 } |
| 976 } | 966 } |
| 977 | 967 |
| 978 class _Int32List extends _TypedList with _IntListMixin implements Int32List { | 968 class _Int32List extends _TypedList with _IntListMixin implements Int32List { |
| 979 Type get runtimeType => Int32List; | |
| 980 | |
| 981 // Method(s) implementing the List interface. | 969 // Method(s) implementing the List interface. |
| 982 int operator [](int index) { | 970 int operator [](int index) { |
| 983 if (index < 0 || index >= length) { | 971 if (index < 0 || index >= length) { |
| 984 throw new RangeError.index(index, this, "index"); | 972 throw new RangeError.index(index, this, "index"); |
| 985 } | 973 } |
| 986 return _getIndexedInt32(index); | 974 return _getIndexedInt32(index); |
| 987 } | 975 } |
| 988 | 976 |
| 989 void operator []=(int index, int value) { | 977 void operator []=(int index, int value) { |
| 990 if (index < 0 || index >= length) { | 978 if (index < 0 || index >= length) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1018 factory Uint32List(int length) native "TypedData_Uint32Array_new"; | 1006 factory Uint32List(int length) native "TypedData_Uint32Array_new"; |
| 1019 | 1007 |
| 1020 @patch | 1008 @patch |
| 1021 factory Uint32List.fromList(List<int> elements) { | 1009 factory Uint32List.fromList(List<int> elements) { |
| 1022 return new Uint32List(elements.length) | 1010 return new Uint32List(elements.length) |
| 1023 ..setRange(0, elements.length, elements); | 1011 ..setRange(0, elements.length, elements); |
| 1024 } | 1012 } |
| 1025 } | 1013 } |
| 1026 | 1014 |
| 1027 class _Uint32List extends _TypedList with _IntListMixin implements Uint32List { | 1015 class _Uint32List extends _TypedList with _IntListMixin implements Uint32List { |
| 1028 Type get runtimeType => Uint32List; | |
| 1029 | |
| 1030 // Method(s) implementing the List interface. | 1016 // Method(s) implementing the List interface. |
| 1031 int operator [](int index) { | 1017 int operator [](int index) { |
| 1032 if (index < 0 || index >= length) { | 1018 if (index < 0 || index >= length) { |
| 1033 throw new RangeError.index(index, this, "index"); | 1019 throw new RangeError.index(index, this, "index"); |
| 1034 } | 1020 } |
| 1035 return _getIndexedUint32(index); | 1021 return _getIndexedUint32(index); |
| 1036 } | 1022 } |
| 1037 | 1023 |
| 1038 void operator []=(int index, int value) { | 1024 void operator []=(int index, int value) { |
| 1039 if (index < 0 || index >= length) { | 1025 if (index < 0 || index >= length) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1067 factory Int64List(int length) native "TypedData_Int64Array_new"; | 1053 factory Int64List(int length) native "TypedData_Int64Array_new"; |
| 1068 | 1054 |
| 1069 @patch | 1055 @patch |
| 1070 factory Int64List.fromList(List<int> elements) { | 1056 factory Int64List.fromList(List<int> elements) { |
| 1071 return new Int64List(elements.length) | 1057 return new Int64List(elements.length) |
| 1072 ..setRange(0, elements.length, elements); | 1058 ..setRange(0, elements.length, elements); |
| 1073 } | 1059 } |
| 1074 } | 1060 } |
| 1075 | 1061 |
| 1076 class _Int64List extends _TypedList with _IntListMixin implements Int64List { | 1062 class _Int64List extends _TypedList with _IntListMixin implements Int64List { |
| 1077 Type get runtimeType => Int64List; | |
| 1078 | |
| 1079 // Method(s) implementing the List interface. | 1063 // Method(s) implementing the List interface. |
| 1080 int operator [](int index) { | 1064 int operator [](int index) { |
| 1081 if (index < 0 || index >= length) { | 1065 if (index < 0 || index >= length) { |
| 1082 throw new RangeError.index(index, this, "index"); | 1066 throw new RangeError.index(index, this, "index"); |
| 1083 } | 1067 } |
| 1084 return _getIndexedInt64(index); | 1068 return _getIndexedInt64(index); |
| 1085 } | 1069 } |
| 1086 | 1070 |
| 1087 void operator []=(int index, int value) { | 1071 void operator []=(int index, int value) { |
| 1088 if (index < 0 || index >= length) { | 1072 if (index < 0 || index >= length) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1116 factory Uint64List(int length) native "TypedData_Uint64Array_new"; | 1100 factory Uint64List(int length) native "TypedData_Uint64Array_new"; |
| 1117 | 1101 |
| 1118 @patch | 1102 @patch |
| 1119 factory Uint64List.fromList(List<int> elements) { | 1103 factory Uint64List.fromList(List<int> elements) { |
| 1120 return new Uint64List(elements.length) | 1104 return new Uint64List(elements.length) |
| 1121 ..setRange(0, elements.length, elements); | 1105 ..setRange(0, elements.length, elements); |
| 1122 } | 1106 } |
| 1123 } | 1107 } |
| 1124 | 1108 |
| 1125 class _Uint64List extends _TypedList with _IntListMixin implements Uint64List { | 1109 class _Uint64List extends _TypedList with _IntListMixin implements Uint64List { |
| 1126 Type get runtimeType => Uint64List; | |
| 1127 | |
| 1128 // Method(s) implementing the List interface. | 1110 // Method(s) implementing the List interface. |
| 1129 int operator [](int index) { | 1111 int operator [](int index) { |
| 1130 if (index < 0 || index >= length) { | 1112 if (index < 0 || index >= length) { |
| 1131 throw new RangeError.index(index, this, "index"); | 1113 throw new RangeError.index(index, this, "index"); |
| 1132 } | 1114 } |
| 1133 return _getIndexedUint64(index); | 1115 return _getIndexedUint64(index); |
| 1134 } | 1116 } |
| 1135 | 1117 |
| 1136 void operator []=(int index, int value) { | 1118 void operator []=(int index, int value) { |
| 1137 if (index < 0 || index >= length) { | 1119 if (index < 0 || index >= length) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1167 @patch | 1149 @patch |
| 1168 factory Float32List.fromList(List<double> elements) { | 1150 factory Float32List.fromList(List<double> elements) { |
| 1169 return new Float32List(elements.length) | 1151 return new Float32List(elements.length) |
| 1170 ..setRange(0, elements.length, elements); | 1152 ..setRange(0, elements.length, elements); |
| 1171 } | 1153 } |
| 1172 } | 1154 } |
| 1173 | 1155 |
| 1174 class _Float32List extends _TypedList | 1156 class _Float32List extends _TypedList |
| 1175 with _DoubleListMixin | 1157 with _DoubleListMixin |
| 1176 implements Float32List { | 1158 implements Float32List { |
| 1177 Type get runtimeType => Float32List; | |
| 1178 | |
| 1179 // Method(s) implementing the List interface. | 1159 // Method(s) implementing the List interface. |
| 1180 double operator [](int index) { | 1160 double operator [](int index) { |
| 1181 if (index < 0 || index >= length) { | 1161 if (index < 0 || index >= length) { |
| 1182 throw new RangeError.index(index, this, "index"); | 1162 throw new RangeError.index(index, this, "index"); |
| 1183 } | 1163 } |
| 1184 return _getIndexedFloat32(index); | 1164 return _getIndexedFloat32(index); |
| 1185 } | 1165 } |
| 1186 | 1166 |
| 1187 void operator []=(int index, double value) { | 1167 void operator []=(int index, double value) { |
| 1188 if (index < 0 || index >= length) { | 1168 if (index < 0 || index >= length) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1218 @patch | 1198 @patch |
| 1219 factory Float64List.fromList(List<double> elements) { | 1199 factory Float64List.fromList(List<double> elements) { |
| 1220 return new Float64List(elements.length) | 1200 return new Float64List(elements.length) |
| 1221 ..setRange(0, elements.length, elements); | 1201 ..setRange(0, elements.length, elements); |
| 1222 } | 1202 } |
| 1223 } | 1203 } |
| 1224 | 1204 |
| 1225 class _Float64List extends _TypedList | 1205 class _Float64List extends _TypedList |
| 1226 with _DoubleListMixin | 1206 with _DoubleListMixin |
| 1227 implements Float64List { | 1207 implements Float64List { |
| 1228 Type get runtimeType => Float64List; | |
| 1229 | |
| 1230 // Method(s) implementing the List interface. | 1208 // Method(s) implementing the List interface. |
| 1231 double operator [](int index) { | 1209 double operator [](int index) { |
| 1232 if (index < 0 || index >= length) { | 1210 if (index < 0 || index >= length) { |
| 1233 throw new RangeError.index(index, this, "index"); | 1211 throw new RangeError.index(index, this, "index"); |
| 1234 } | 1212 } |
| 1235 return _getIndexedFloat64(index); | 1213 return _getIndexedFloat64(index); |
| 1236 } | 1214 } |
| 1237 | 1215 |
| 1238 void operator []=(int index, double value) { | 1216 void operator []=(int index, double value) { |
| 1239 if (index < 0 || index >= length) { | 1217 if (index < 0 || index >= length) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1269 @patch | 1247 @patch |
| 1270 factory Float32x4List.fromList(List<Float32x4> elements) { | 1248 factory Float32x4List.fromList(List<Float32x4> elements) { |
| 1271 return new Float32x4List(elements.length) | 1249 return new Float32x4List(elements.length) |
| 1272 ..setRange(0, elements.length, elements); | 1250 ..setRange(0, elements.length, elements); |
| 1273 } | 1251 } |
| 1274 } | 1252 } |
| 1275 | 1253 |
| 1276 class _Float32x4List extends _TypedList | 1254 class _Float32x4List extends _TypedList |
| 1277 with _Float32x4ListMixin | 1255 with _Float32x4ListMixin |
| 1278 implements Float32x4List { | 1256 implements Float32x4List { |
| 1279 Type get runtimeType => Float32x4List; | |
| 1280 | |
| 1281 Float32x4 operator [](int index) { | 1257 Float32x4 operator [](int index) { |
| 1282 if (index < 0 || index >= length) { | 1258 if (index < 0 || index >= length) { |
| 1283 throw new RangeError.index(index, this, "index"); | 1259 throw new RangeError.index(index, this, "index"); |
| 1284 } | 1260 } |
| 1285 return _getIndexedFloat32x4(index); | 1261 return _getIndexedFloat32x4(index); |
| 1286 } | 1262 } |
| 1287 | 1263 |
| 1288 void operator []=(int index, Float32x4 value) { | 1264 void operator []=(int index, Float32x4 value) { |
| 1289 if (index < 0 || index >= length) { | 1265 if (index < 0 || index >= length) { |
| 1290 throw new RangeError.index(index, this, "index"); | 1266 throw new RangeError.index(index, this, "index"); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1319 @patch | 1295 @patch |
| 1320 factory Int32x4List.fromList(List<Int32x4> elements) { | 1296 factory Int32x4List.fromList(List<Int32x4> elements) { |
| 1321 return new Int32x4List(elements.length) | 1297 return new Int32x4List(elements.length) |
| 1322 ..setRange(0, elements.length, elements); | 1298 ..setRange(0, elements.length, elements); |
| 1323 } | 1299 } |
| 1324 } | 1300 } |
| 1325 | 1301 |
| 1326 class _Int32x4List extends _TypedList | 1302 class _Int32x4List extends _TypedList |
| 1327 with _Int32x4ListMixin | 1303 with _Int32x4ListMixin |
| 1328 implements Int32x4List { | 1304 implements Int32x4List { |
| 1329 Type get runtimeType => Int32x4List; | |
| 1330 | |
| 1331 Int32x4 operator [](int index) { | 1305 Int32x4 operator [](int index) { |
| 1332 if (index < 0 || index >= length) { | 1306 if (index < 0 || index >= length) { |
| 1333 throw new RangeError.index(index, this, "index"); | 1307 throw new RangeError.index(index, this, "index"); |
| 1334 } | 1308 } |
| 1335 return _getIndexedInt32x4(index); | 1309 return _getIndexedInt32x4(index); |
| 1336 } | 1310 } |
| 1337 | 1311 |
| 1338 void operator []=(int index, Int32x4 value) { | 1312 void operator []=(int index, Int32x4 value) { |
| 1339 if (index < 0 || index >= length) { | 1313 if (index < 0 || index >= length) { |
| 1340 throw new RangeError.index(index, this, "index"); | 1314 throw new RangeError.index(index, this, "index"); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1369 @patch | 1343 @patch |
| 1370 factory Float64x2List.fromList(List<Float64x2> elements) { | 1344 factory Float64x2List.fromList(List<Float64x2> elements) { |
| 1371 return new Float64x2List(elements.length) | 1345 return new Float64x2List(elements.length) |
| 1372 ..setRange(0, elements.length, elements); | 1346 ..setRange(0, elements.length, elements); |
| 1373 } | 1347 } |
| 1374 } | 1348 } |
| 1375 | 1349 |
| 1376 class _Float64x2List extends _TypedList | 1350 class _Float64x2List extends _TypedList |
| 1377 with _Float64x2ListMixin | 1351 with _Float64x2ListMixin |
| 1378 implements Float64x2List { | 1352 implements Float64x2List { |
| 1379 Type get runtimeType => Float64x2List; | |
| 1380 | |
| 1381 Float64x2 operator [](int index) { | 1353 Float64x2 operator [](int index) { |
| 1382 if (index < 0 || index >= length) { | 1354 if (index < 0 || index >= length) { |
| 1383 throw new RangeError.index(index, this, "index"); | 1355 throw new RangeError.index(index, this, "index"); |
| 1384 } | 1356 } |
| 1385 return _getIndexedFloat64x2(index); | 1357 return _getIndexedFloat64x2(index); |
| 1386 } | 1358 } |
| 1387 | 1359 |
| 1388 void operator []=(int index, Float64x2 value) { | 1360 void operator []=(int index, Float64x2 value) { |
| 1389 if (index < 0 || index >= length) { | 1361 if (index < 0 || index >= length) { |
| 1390 throw new RangeError.index(index, this, "index"); | 1362 throw new RangeError.index(index, this, "index"); |
| (...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3089 'BYTES_PER_ELEMENT ($alignment)'); | 3061 'BYTES_PER_ELEMENT ($alignment)'); |
| 3090 } | 3062 } |
| 3091 } | 3063 } |
| 3092 | 3064 |
| 3093 int _defaultIfNull(object, value) { | 3065 int _defaultIfNull(object, value) { |
| 3094 if (object == null) { | 3066 if (object == null) { |
| 3095 return value; | 3067 return value; |
| 3096 } | 3068 } |
| 3097 return object; | 3069 return object; |
| 3098 } | 3070 } |
| OLD | NEW |