Chromium Code Reviews| 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 // patch classes for Int8List ..... Float64List and ByteData implementations. | 5 // patch classes for Int8List ..... Float64List and ByteData implementations. |
| 6 | 6 |
| 7 patch class Int8List { | 7 patch class Int8List { |
| 8 /* patch */ factory Int8List(int length) { | 8 /* patch */ factory Int8List(int length) { |
| 9 return new _Int8Array(length); | 9 return new _Int8Array(length); |
| 10 } | 10 } |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 } | 468 } |
| 469 | 469 |
| 470 | 470 |
| 471 // Methods implementing the collection interface. | 471 // Methods implementing the collection interface. |
| 472 | 472 |
| 473 int get length native "TypedData_length"; | 473 int get length native "TypedData_length"; |
| 474 | 474 |
| 475 | 475 |
| 476 // Internal utility methods. | 476 // Internal utility methods. |
| 477 | 477 |
| 478 int _getInt8(int index) native "TypedData_GetInt8"; | 478 int _getInt8(int offsetInBytes) native "TypedData_GetInt8"; |
| 479 void _setInt8(int index, int value) native "TypedData_SetInt8"; | 479 void _setInt8(int offsetInBytes, int value) native "TypedData_SetInt8"; |
| 480 | 480 |
| 481 int _getUint8(int index) native "TypedData_GetUint8"; | 481 int _getUint8(int offsetInBytes) native "TypedData_GetUint8"; |
| 482 void _setUint8(int index, int value) native "TypedData_SetUint8"; | 482 void _setUint8(int offsetInBytes, int value) native "TypedData_SetUint8"; |
| 483 | 483 |
| 484 int _getInt16(int index) native "TypedData_GetInt16"; | 484 int _getIndexedInt16(int index) { |
|
Florian Schneider
2013/03/14 10:12:00
It does not make a huge difference, but it may not
siva
2013/03/14 11:16:34
True, I will move them to the respective classes.
| |
| 485 void _setInt16(int index, int value) native "TypedData_SetInt16"; | 485 return _getInt16(index * Int16List.BYTES_PER_ELEMENT); |
| 486 } | |
| 487 int _getInt16(int offsetInBytes) native "TypedData_GetInt16"; | |
| 488 void _setIndexedInt16(int index, int value) { | |
| 489 _setInt16(index * Int16List.BYTES_PER_ELEMENT, value); | |
| 490 } | |
| 491 void _setInt16(int offsetInBytes, int value) native "TypedData_SetInt16"; | |
| 486 | 492 |
| 487 int _getUint16(int index) native "TypedData_GetUint16"; | 493 int _getIndexedUint16(int index) { |
| 488 void _setUint16(int index, int value) native "TypedData_SetUint16"; | 494 return _getUint16(index * Uint16List.BYTES_PER_ELEMENT); |
| 495 } | |
| 496 int _getUint16(int offsetInBytes) native "TypedData_GetUint16"; | |
| 497 void _setIndexedUint16(int index, int value) { | |
| 498 _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value); | |
| 499 } | |
| 500 void _setUint16(int offsetInBytes, int value) native "TypedData_SetUint16"; | |
| 489 | 501 |
| 490 int _getInt32(int index) native "TypedData_GetInt32"; | 502 int _getIndexedInt32(int index) { |
| 491 void _setInt32(int index, int value) native "TypedData_SetInt32"; | 503 return _getInt32(index * Int32List.BYTES_PER_ELEMENT); |
| 504 } | |
| 505 int _getInt32(int offsetInBytes) native "TypedData_GetInt32"; | |
| 506 void _setIndexedInt32(int index, int value) { | |
| 507 _setInt32(index * Int32List.BYTES_PER_ELEMENT, value); | |
| 508 } | |
| 509 void _setInt32(int offsetInBytes, int value) native "TypedData_SetInt32"; | |
| 492 | 510 |
| 493 int _getUint32(int index) native "TypedData_GetUint32"; | 511 int _getIndexedUint32(int index) { |
| 494 void _setUint32(int index, int value) native "TypedData_SetUint32"; | 512 return _getUint32(index * Uint32List.BYTES_PER_ELEMENT); |
| 513 } | |
| 514 int _getUint32(int offsetInBytes) native "TypedData_GetUint32"; | |
| 515 void _setIndexedUint32(int index, int value) { | |
| 516 _setInt32(index * Uint32List.BYTES_PER_ELEMENT, value); | |
| 517 } | |
| 518 void _setUint32(int offsetInBytes, int value) native "TypedData_SetUint32"; | |
| 495 | 519 |
| 496 int _getInt64(int index) native "TypedData_GetInt64"; | 520 int _getIndexedInt64(int index) { |
| 497 void _setInt64(int index, int value) native "TypedData_SetInt64"; | 521 return _getInt64(index * Int64List.BYTES_PER_ELEMENT); |
| 522 } | |
| 523 int _getInt64(int offsetInBytes) native "TypedData_GetInt64"; | |
| 524 void _setIndexedInt64(int index, int value) { | |
| 525 _setInt64(index * Int64List.BYTES_PER_ELEMENT, value); | |
| 526 } | |
| 527 void _setInt64(int offsetInBytes, int value) native "TypedData_SetInt64"; | |
| 498 | 528 |
| 499 int _getUint64(int index) native "TypedData_GetUint64"; | 529 int _getIndexedUint64(int index) { |
| 500 void _setUint64(int index, int value) native "TypedData_SetUint64"; | 530 return _getUint64(index * Uint64List.BYTES_PER_ELEMENT); |
| 531 } | |
| 532 int _getUint64(int offsetInBytes) native "TypedData_GetUint64"; | |
| 533 void _setIndexedUint64(int index, int value) { | |
| 534 _setUint64(index * Uint64List.BYTES_PER_ELEMENT, value); | |
| 535 } | |
| 536 void _setUint64(int offsetInBytes, int value) native "TypedData_SetUint64"; | |
| 501 | 537 |
| 502 double _getFloat32(int index) native "TypedData_GetFloat32"; | 538 double _getIndexedFloat32(int index) { |
| 503 void _setFloat32(int index, double value) native "TypedData_SetFloat32"; | 539 return _getFloat32(index * Float32List.BYTES_PER_ELEMENT); |
| 540 } | |
| 541 double _getFloat32(int offsetInBytes) native "TypedData_GetFloat32"; | |
| 542 void _setIndexedFloat32(int index, double value) { | |
| 543 _setFloat32(index * Float32List.BYTES_PER_ELEMENT, value); | |
| 544 } | |
| 545 void _setFloat32(int offsetInBytes, double value) | |
| 546 native "TypedData_SetFloat32"; | |
| 504 | 547 |
| 505 double _getFloat64(int index) native "TypedData_GetFloat64"; | 548 double _getIndexedFloat64(int index) { |
| 506 void _setFloat64(int index, double value) native "TypedData_SetFloat64"; | 549 return _getFloat64(index * Float64List.BYTES_PER_ELEMENT); |
| 550 } | |
| 551 double _getFloat64(int offsetInBytes) native "TypedData_GetFloat64"; | |
| 552 void _setIndexedFloat64(int index, double value) { | |
| 553 _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value); | |
| 554 } | |
| 555 void _setFloat64(int offsetInBytes, double value) | |
| 556 native "TypedData_SetFloat64"; | |
| 507 } | 557 } |
| 508 | 558 |
| 509 | 559 |
| 510 class _Int8Array extends _TypedList implements Int8List { | 560 class _Int8Array extends _TypedList implements Int8List { |
| 511 // Factory constructors. | 561 // Factory constructors. |
| 512 | 562 |
| 513 factory _Int8Array(int length) { | 563 factory _Int8Array(int length) { |
| 514 if (length < 0) { | 564 if (length < 0) { |
| 515 String message = "$length must be greater than 0"; | 565 String message = "$length must be greater than 0"; |
| 516 throw new ArgumentError(message); | 566 throw new ArgumentError(message); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 706 } | 756 } |
| 707 | 757 |
| 708 | 758 |
| 709 // Method(s) implementing List interface. | 759 // Method(s) implementing List interface. |
| 710 | 760 |
| 711 int operator[](int index) { | 761 int operator[](int index) { |
| 712 if (index < 0 || index >= length) { | 762 if (index < 0 || index >= length) { |
| 713 String message = "$index must be in the range [0..$length)"; | 763 String message = "$index must be in the range [0..$length)"; |
| 714 throw new RangeError(message); | 764 throw new RangeError(message); |
| 715 } | 765 } |
| 716 return _getInt16(index); | 766 return _getIndexedInt16(index); |
| 717 } | 767 } |
| 718 | 768 |
| 719 void operator[]=(int index, int value) { | 769 void operator[]=(int index, int value) { |
| 720 if (index < 0 || index >= length) { | 770 if (index < 0 || index >= length) { |
| 721 String message = "$index must be in the range [0..$length)"; | 771 String message = "$index must be in the range [0..$length)"; |
| 722 throw new RangeError(message); | 772 throw new RangeError(message); |
| 723 } | 773 } |
| 724 _setInt16(index, _toInt16(value)); | 774 _setIndexedInt16(index, _toInt16(value)); |
| 725 } | 775 } |
| 726 | 776 |
| 727 Iterator<int> get iterator { | 777 Iterator<int> get iterator { |
| 728 return new _TypedListIterator<int>(this); | 778 return new _TypedListIterator<int>(this); |
| 729 } | 779 } |
| 730 | 780 |
| 731 | 781 |
| 732 // Method(s) implementing TypedData interface. | 782 // Method(s) implementing TypedData interface. |
| 733 | 783 |
| 734 int get elementSizeInBytes { | 784 int get elementSizeInBytes { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 767 } | 817 } |
| 768 | 818 |
| 769 | 819 |
| 770 // Method(s) implementing the List interface. | 820 // Method(s) implementing the List interface. |
| 771 | 821 |
| 772 int operator[](int index) { | 822 int operator[](int index) { |
| 773 if (index < 0 || index >= length) { | 823 if (index < 0 || index >= length) { |
| 774 String message = "$index must be in the range [0..$length)"; | 824 String message = "$index must be in the range [0..$length)"; |
| 775 throw new RangeError(message); | 825 throw new RangeError(message); |
| 776 } | 826 } |
| 777 return _getUint16(index); | 827 return _getIndexedUint16(index); |
| 778 } | 828 } |
| 779 | 829 |
| 780 void operator[]=(int index, int value) { | 830 void operator[]=(int index, int value) { |
| 781 if (index < 0 || index >= length) { | 831 if (index < 0 || index >= length) { |
| 782 String message = "$index must be in the range [0..$length)"; | 832 String message = "$index must be in the range [0..$length)"; |
| 783 throw new RangeError(message); | 833 throw new RangeError(message); |
| 784 } | 834 } |
| 785 _setUint16(index, _toUint16(value)); | 835 _setIndexedUint16(index, _toUint16(value)); |
| 786 } | 836 } |
| 787 | 837 |
| 788 Iterator<int> get iterator { | 838 Iterator<int> get iterator { |
| 789 return new _TypedListIterator<int>(this); | 839 return new _TypedListIterator<int>(this); |
| 790 } | 840 } |
| 791 | 841 |
| 792 | 842 |
| 793 // Method(s) implementing the TypedData interface. | 843 // Method(s) implementing the TypedData interface. |
| 794 | 844 |
| 795 int get elementSizeInBytes { | 845 int get elementSizeInBytes { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 828 } | 878 } |
| 829 | 879 |
| 830 | 880 |
| 831 // Method(s) implementing the List interface. | 881 // Method(s) implementing the List interface. |
| 832 | 882 |
| 833 int operator[](int index) { | 883 int operator[](int index) { |
| 834 if (index < 0 || index >= length) { | 884 if (index < 0 || index >= length) { |
| 835 String message = "$index must be in the range [0..$length)"; | 885 String message = "$index must be in the range [0..$length)"; |
| 836 throw new RangeError(message); | 886 throw new RangeError(message); |
| 837 } | 887 } |
| 838 return _getInt32(index); | 888 return _getIndexedInt32(index); |
| 839 } | 889 } |
| 840 | 890 |
| 841 void operator[]=(int index, int value) { | 891 void operator[]=(int index, int value) { |
| 842 if (index < 0 || index >= length) { | 892 if (index < 0 || index >= length) { |
| 843 String message = "$index must be in the range [0..$length)"; | 893 String message = "$index must be in the range [0..$length)"; |
| 844 throw new RangeError(message); | 894 throw new RangeError(message); |
| 845 } | 895 } |
| 846 _setInt32(index, _toInt32(value)); | 896 _setIndexedInt32(index, _toInt32(value)); |
| 847 } | 897 } |
| 848 | 898 |
| 849 Iterator<int> get iterator { | 899 Iterator<int> get iterator { |
| 850 return new _TypedListIterator<int>(this); | 900 return new _TypedListIterator<int>(this); |
| 851 } | 901 } |
| 852 | 902 |
| 853 | 903 |
| 854 // Method(s) implementing TypedData interface. | 904 // Method(s) implementing TypedData interface. |
| 855 | 905 |
| 856 int get elementSizeInBytes { | 906 int get elementSizeInBytes { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 889 } | 939 } |
| 890 | 940 |
| 891 | 941 |
| 892 // Method(s) implementing the List interface. | 942 // Method(s) implementing the List interface. |
| 893 | 943 |
| 894 int operator[](int index) { | 944 int operator[](int index) { |
| 895 if (index < 0 || index >= length) { | 945 if (index < 0 || index >= length) { |
| 896 String message = "$index must be in the range [0..$length)"; | 946 String message = "$index must be in the range [0..$length)"; |
| 897 throw new RangeError(message); | 947 throw new RangeError(message); |
| 898 } | 948 } |
| 899 return _getUint32(index); | 949 return _getIndexedUint32(index); |
| 900 } | 950 } |
| 901 | 951 |
| 902 void operator[]=(int index, int value) { | 952 void operator[]=(int index, int value) { |
| 903 if (index < 0 || index >= length) { | 953 if (index < 0 || index >= length) { |
| 904 String message = "$index must be in the range [0..$length)"; | 954 String message = "$index must be in the range [0..$length)"; |
| 905 throw new RangeError(message); | 955 throw new RangeError(message); |
| 906 } | 956 } |
| 907 _setUint32(index, _toUint32(value)); | 957 _setIndexedUint32(index, _toUint32(value)); |
| 908 } | 958 } |
| 909 | 959 |
| 910 Iterator<int> get iterator { | 960 Iterator<int> get iterator { |
| 911 return new _TypedListIterator<int>(this); | 961 return new _TypedListIterator<int>(this); |
| 912 } | 962 } |
| 913 | 963 |
| 914 | 964 |
| 915 // Method(s) implementing the TypedData interface. | 965 // Method(s) implementing the TypedData interface. |
| 916 | 966 |
| 917 int get elementSizeInBytes { | 967 int get elementSizeInBytes { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 950 } | 1000 } |
| 951 | 1001 |
| 952 | 1002 |
| 953 // Method(s) implementing the List interface. | 1003 // Method(s) implementing the List interface. |
| 954 | 1004 |
| 955 int operator[](int index) { | 1005 int operator[](int index) { |
| 956 if (index < 0 || index >= length) { | 1006 if (index < 0 || index >= length) { |
| 957 String message = "$index must be in the range [0..$length)"; | 1007 String message = "$index must be in the range [0..$length)"; |
| 958 throw new RangeError(message); | 1008 throw new RangeError(message); |
| 959 } | 1009 } |
| 960 return _getInt64(index); | 1010 return _getIndexedInt64(index); |
| 961 } | 1011 } |
| 962 | 1012 |
| 963 void operator[]=(int index, int value) { | 1013 void operator[]=(int index, int value) { |
| 964 if (index < 0 || index >= length) { | 1014 if (index < 0 || index >= length) { |
| 965 String message = "$index must be in the range [0..$length)"; | 1015 String message = "$index must be in the range [0..$length)"; |
| 966 throw new RangeError(message); | 1016 throw new RangeError(message); |
| 967 } | 1017 } |
| 968 _setInt64(index, _toInt64(value)); | 1018 _setIndexedInt64(index, _toInt64(value)); |
| 969 } | 1019 } |
| 970 | 1020 |
| 971 Iterator<int> get iterator { | 1021 Iterator<int> get iterator { |
| 972 return new _TypedListIterator<int>(this); | 1022 return new _TypedListIterator<int>(this); |
| 973 } | 1023 } |
| 974 | 1024 |
| 975 | 1025 |
| 976 // Method(s) implementing the TypedData interface. | 1026 // Method(s) implementing the TypedData interface. |
| 977 | 1027 |
| 978 int get elementSizeInBytes { | 1028 int get elementSizeInBytes { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1011 } | 1061 } |
| 1012 | 1062 |
| 1013 | 1063 |
| 1014 // Method(s) implementing the List interface. | 1064 // Method(s) implementing the List interface. |
| 1015 | 1065 |
| 1016 int operator[](int index) { | 1066 int operator[](int index) { |
| 1017 if (index < 0 || index >= length) { | 1067 if (index < 0 || index >= length) { |
| 1018 String message = "$index must be in the range [0..$length)"; | 1068 String message = "$index must be in the range [0..$length)"; |
| 1019 throw new RangeError(message); | 1069 throw new RangeError(message); |
| 1020 } | 1070 } |
| 1021 return _getUint64(index); | 1071 return _getIndexedUint64(index); |
| 1022 } | 1072 } |
| 1023 | 1073 |
| 1024 void operator[]=(int index, int value) { | 1074 void operator[]=(int index, int value) { |
| 1025 if (index < 0 || index >= length) { | 1075 if (index < 0 || index >= length) { |
| 1026 String message = "$index must be in the range [0..$length)"; | 1076 String message = "$index must be in the range [0..$length)"; |
| 1027 throw new RangeError(message); | 1077 throw new RangeError(message); |
| 1028 } | 1078 } |
| 1029 _setUint64(index, _toUint64(value)); | 1079 _setIndexedUint64(index, _toUint64(value)); |
| 1030 } | 1080 } |
| 1031 | 1081 |
| 1032 Iterator<int> get iterator { | 1082 Iterator<int> get iterator { |
| 1033 return new _TypedListIterator<int>(this); | 1083 return new _TypedListIterator<int>(this); |
| 1034 } | 1084 } |
| 1035 | 1085 |
| 1036 | 1086 |
| 1037 // Method(s) implementing the TypedData interface. | 1087 // Method(s) implementing the TypedData interface. |
| 1038 | 1088 |
| 1039 int get elementSizeInBytes { | 1089 int get elementSizeInBytes { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1072 } | 1122 } |
| 1073 | 1123 |
| 1074 | 1124 |
| 1075 // Method(s) implementing the List interface. | 1125 // Method(s) implementing the List interface. |
| 1076 | 1126 |
| 1077 double operator[](int index) { | 1127 double operator[](int index) { |
| 1078 if (index < 0 || index >= length) { | 1128 if (index < 0 || index >= length) { |
| 1079 String message = "$index must be in the range [0..$length)"; | 1129 String message = "$index must be in the range [0..$length)"; |
| 1080 throw new RangeError(message); | 1130 throw new RangeError(message); |
| 1081 } | 1131 } |
| 1082 return _getFloat32(index); | 1132 return _getIndexedFloat32(index); |
| 1083 } | 1133 } |
| 1084 | 1134 |
| 1085 void operator[]=(int index, double value) { | 1135 void operator[]=(int index, double value) { |
| 1086 if (index < 0 || index >= length) { | 1136 if (index < 0 || index >= length) { |
| 1087 String message = "$index must be in the range [0..$length)"; | 1137 String message = "$index must be in the range [0..$length)"; |
| 1088 throw new RangeError(message); | 1138 throw new RangeError(message); |
| 1089 } | 1139 } |
| 1090 _setFloat32(index, value); | 1140 _setIndexedFloat32(index, value); |
| 1091 } | 1141 } |
| 1092 | 1142 |
| 1093 Iterator<double> get iterator { | 1143 Iterator<double> get iterator { |
| 1094 return new _TypedListIterator<double>(this); | 1144 return new _TypedListIterator<double>(this); |
| 1095 } | 1145 } |
| 1096 | 1146 |
| 1097 | 1147 |
| 1098 // Method(s) implementing the TypedData interface. | 1148 // Method(s) implementing the TypedData interface. |
| 1099 | 1149 |
| 1100 int get elementSizeInBytes { | 1150 int get elementSizeInBytes { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1133 } | 1183 } |
| 1134 | 1184 |
| 1135 | 1185 |
| 1136 // Method(s) implementing the List interface. | 1186 // Method(s) implementing the List interface. |
| 1137 | 1187 |
| 1138 double operator[](int index) { | 1188 double operator[](int index) { |
| 1139 if (index < 0 || index >= length) { | 1189 if (index < 0 || index >= length) { |
| 1140 String message = "$index must be in the range [0..$length)"; | 1190 String message = "$index must be in the range [0..$length)"; |
| 1141 throw new RangeError(message); | 1191 throw new RangeError(message); |
| 1142 } | 1192 } |
| 1143 return _getFloat64(index); | 1193 return _getIndexedFloat64(index); |
| 1144 } | 1194 } |
| 1145 | 1195 |
| 1146 void operator[]=(int index, double value) { | 1196 void operator[]=(int index, double value) { |
| 1147 if (index < 0 || index >= length) { | 1197 if (index < 0 || index >= length) { |
| 1148 String message = "$index must be in the range [0..$length)"; | 1198 String message = "$index must be in the range [0..$length)"; |
| 1149 throw new RangeError(message); | 1199 throw new RangeError(message); |
| 1150 } | 1200 } |
| 1151 _setFloat64(index, value); | 1201 _setIndexedFloat64(index, value); |
| 1152 } | 1202 } |
| 1153 | 1203 |
| 1154 Iterator<double> get iterator { | 1204 Iterator<double> get iterator { |
| 1155 return new _TypedListIterator<double>(this); | 1205 return new _TypedListIterator<double>(this); |
| 1156 } | 1206 } |
| 1157 | 1207 |
| 1158 | 1208 |
| 1159 // Method(s) implementing the TypedData interface. | 1209 // Method(s) implementing the TypedData interface. |
| 1160 | 1210 |
| 1161 int get elementSizeInBytes { | 1211 int get elementSizeInBytes { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1343 } | 1393 } |
| 1344 | 1394 |
| 1345 | 1395 |
| 1346 // Method(s) implementing the List interface. | 1396 // Method(s) implementing the List interface. |
| 1347 | 1397 |
| 1348 int operator[](int index) { | 1398 int operator[](int index) { |
| 1349 if (index < 0 || index >= length) { | 1399 if (index < 0 || index >= length) { |
| 1350 String message = "$index must be in the range [0..$length)"; | 1400 String message = "$index must be in the range [0..$length)"; |
| 1351 throw new RangeError(message); | 1401 throw new RangeError(message); |
| 1352 } | 1402 } |
| 1353 return _getInt16(index); | 1403 return _getIndexedInt16(index); |
| 1354 } | 1404 } |
| 1355 | 1405 |
| 1356 void operator[]=(int index, int value) { | 1406 void operator[]=(int index, int value) { |
| 1357 if (index < 0 || index >= length) { | 1407 if (index < 0 || index >= length) { |
| 1358 String message = "$index must be in the range [0..$length)"; | 1408 String message = "$index must be in the range [0..$length)"; |
| 1359 throw new RangeError(message); | 1409 throw new RangeError(message); |
| 1360 } | 1410 } |
| 1361 _setInt16(index, _toInt16(value)); | 1411 _setIndexedInt16(index, _toInt16(value)); |
| 1362 } | 1412 } |
| 1363 | 1413 |
| 1364 Iterator<int> get iterator { | 1414 Iterator<int> get iterator { |
| 1365 return new _TypedListIterator<int>(this); | 1415 return new _TypedListIterator<int>(this); |
| 1366 } | 1416 } |
| 1367 | 1417 |
| 1368 | 1418 |
| 1369 // Method(s) implementing the TypedData interface. | 1419 // Method(s) implementing the TypedData interface. |
| 1370 | 1420 |
| 1371 int get elementSizeInBytes { | 1421 int get elementSizeInBytes { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1396 } | 1446 } |
| 1397 | 1447 |
| 1398 | 1448 |
| 1399 // Method(s) implementing the List interface. | 1449 // Method(s) implementing the List interface. |
| 1400 | 1450 |
| 1401 int operator[](int index) { | 1451 int operator[](int index) { |
| 1402 if (index < 0 || index >= length) { | 1452 if (index < 0 || index >= length) { |
| 1403 String message = "$index must be in the range [0..$length)"; | 1453 String message = "$index must be in the range [0..$length)"; |
| 1404 throw new RangeError(message); | 1454 throw new RangeError(message); |
| 1405 } | 1455 } |
| 1406 return _getUint16(index); | 1456 return _getIndexedUint16(index); |
| 1407 } | 1457 } |
| 1408 | 1458 |
| 1409 void operator[]=(int index, int value) { | 1459 void operator[]=(int index, int value) { |
| 1410 if (index < 0 || index >= length) { | 1460 if (index < 0 || index >= length) { |
| 1411 String message = "$index must be in the range [0..$length)"; | 1461 String message = "$index must be in the range [0..$length)"; |
| 1412 throw new RangeError(message); | 1462 throw new RangeError(message); |
| 1413 } | 1463 } |
| 1414 _setUint16(index, _toUint16(value)); | 1464 _setIndexedUint16(index, _toUint16(value)); |
| 1415 } | 1465 } |
| 1416 | 1466 |
| 1417 Iterator<int> get iterator { | 1467 Iterator<int> get iterator { |
| 1418 return new _TypedListIterator<int>(this); | 1468 return new _TypedListIterator<int>(this); |
| 1419 } | 1469 } |
| 1420 | 1470 |
| 1421 | 1471 |
| 1422 // Method(s) implementing the TypedData interface. | 1472 // Method(s) implementing the TypedData interface. |
| 1423 | 1473 |
| 1424 int get elementSizeInBytes { | 1474 int get elementSizeInBytes { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1449 } | 1499 } |
| 1450 | 1500 |
| 1451 | 1501 |
| 1452 // Method(s) implementing the List interface. | 1502 // Method(s) implementing the List interface. |
| 1453 | 1503 |
| 1454 int operator[](int index) { | 1504 int operator[](int index) { |
| 1455 if (index < 0 || index >= length) { | 1505 if (index < 0 || index >= length) { |
| 1456 String message = "$index must be in the range [0..$length)"; | 1506 String message = "$index must be in the range [0..$length)"; |
| 1457 throw new RangeError(message); | 1507 throw new RangeError(message); |
| 1458 } | 1508 } |
| 1459 return _getInt32(index); | 1509 return _getIndexedInt32(index); |
| 1460 } | 1510 } |
| 1461 | 1511 |
| 1462 void operator[]=(int index, int value) { | 1512 void operator[]=(int index, int value) { |
| 1463 if (index < 0 || index >= length) { | 1513 if (index < 0 || index >= length) { |
| 1464 String message = "$index must be in the range [0..$length)"; | 1514 String message = "$index must be in the range [0..$length)"; |
| 1465 throw new RangeError(message); | 1515 throw new RangeError(message); |
| 1466 } | 1516 } |
| 1467 _setInt32(index, _toInt32(value)); | 1517 _setIndexedInt32(index, _toInt32(value)); |
| 1468 } | 1518 } |
| 1469 | 1519 |
| 1470 Iterator<int> get iterator { | 1520 Iterator<int> get iterator { |
| 1471 return new _TypedListIterator<int>(this); | 1521 return new _TypedListIterator<int>(this); |
| 1472 } | 1522 } |
| 1473 | 1523 |
| 1474 | 1524 |
| 1475 // Method(s) implementing the TypedData interface. | 1525 // Method(s) implementing the TypedData interface. |
| 1476 | 1526 |
| 1477 int get elementSizeInBytes { | 1527 int get elementSizeInBytes { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1502 } | 1552 } |
| 1503 | 1553 |
| 1504 | 1554 |
| 1505 // Method(s) implementing the List interface. | 1555 // Method(s) implementing the List interface. |
| 1506 | 1556 |
| 1507 int operator[](int index) { | 1557 int operator[](int index) { |
| 1508 if (index < 0 || index >= length) { | 1558 if (index < 0 || index >= length) { |
| 1509 String message = "$index must be in the range [0..$length)"; | 1559 String message = "$index must be in the range [0..$length)"; |
| 1510 throw new RangeError(message); | 1560 throw new RangeError(message); |
| 1511 } | 1561 } |
| 1512 return _getUint32(index); | 1562 return _getIndexedUint32(index); |
| 1513 } | 1563 } |
| 1514 | 1564 |
| 1515 void operator[]=(int index, int value) { | 1565 void operator[]=(int index, int value) { |
| 1516 if (index < 0 || index >= length) { | 1566 if (index < 0 || index >= length) { |
| 1517 String message = "$index must be in the range [0..$length)"; | 1567 String message = "$index must be in the range [0..$length)"; |
| 1518 throw new RangeError(message); | 1568 throw new RangeError(message); |
| 1519 } | 1569 } |
| 1520 _setUint32(index, _toUint32(value)); | 1570 _setIndexedUint32(index, _toUint32(value)); |
| 1521 } | 1571 } |
| 1522 | 1572 |
| 1523 Iterator<int> get iterator { | 1573 Iterator<int> get iterator { |
| 1524 return new _TypedListIterator<int>(this); | 1574 return new _TypedListIterator<int>(this); |
| 1525 } | 1575 } |
| 1526 | 1576 |
| 1527 | 1577 |
| 1528 // Method(s) implementing the TypedData interface. | 1578 // Method(s) implementing the TypedData interface. |
| 1529 | 1579 |
| 1530 int get elementSizeInBytes { | 1580 int get elementSizeInBytes { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1555 } | 1605 } |
| 1556 | 1606 |
| 1557 | 1607 |
| 1558 // Method(s) implementing the List interface. | 1608 // Method(s) implementing the List interface. |
| 1559 | 1609 |
| 1560 int operator[](int index) { | 1610 int operator[](int index) { |
| 1561 if (index < 0 || index >= length) { | 1611 if (index < 0 || index >= length) { |
| 1562 String message = "$index must be in the range [0..$length)"; | 1612 String message = "$index must be in the range [0..$length)"; |
| 1563 throw new RangeError(message); | 1613 throw new RangeError(message); |
| 1564 } | 1614 } |
| 1565 return _getInt64(index); | 1615 return _getIndexedInt64(index); |
| 1566 } | 1616 } |
| 1567 | 1617 |
| 1568 void operator[]=(int index, int value) { | 1618 void operator[]=(int index, int value) { |
| 1569 if (index < 0 || index >= length) { | 1619 if (index < 0 || index >= length) { |
| 1570 String message = "$index must be in the range [0..$length)"; | 1620 String message = "$index must be in the range [0..$length)"; |
| 1571 throw new RangeError(message); | 1621 throw new RangeError(message); |
| 1572 } | 1622 } |
| 1573 _setInt64(index, _toInt64(value)); | 1623 _setIndexedInt64(index, _toInt64(value)); |
| 1574 } | 1624 } |
| 1575 | 1625 |
| 1576 Iterator<int> get iterator { | 1626 Iterator<int> get iterator { |
| 1577 return new _TypedListIterator<int>(this); | 1627 return new _TypedListIterator<int>(this); |
| 1578 } | 1628 } |
| 1579 | 1629 |
| 1580 | 1630 |
| 1581 // Method(s) implementing the TypedData interface. | 1631 // Method(s) implementing the TypedData interface. |
| 1582 | 1632 |
| 1583 int get elementSizeInBytes { | 1633 int get elementSizeInBytes { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1608 } | 1658 } |
| 1609 | 1659 |
| 1610 | 1660 |
| 1611 // Method(s) implementing the List interface. | 1661 // Method(s) implementing the List interface. |
| 1612 | 1662 |
| 1613 int operator[](int index) { | 1663 int operator[](int index) { |
| 1614 if (index < 0 || index >= length) { | 1664 if (index < 0 || index >= length) { |
| 1615 String message = "$index must be in the range [0..$length)"; | 1665 String message = "$index must be in the range [0..$length)"; |
| 1616 throw new RangeError(message); | 1666 throw new RangeError(message); |
| 1617 } | 1667 } |
| 1618 return _getUint64(index); | 1668 return _getIndexedUint64(index); |
| 1619 } | 1669 } |
| 1620 | 1670 |
| 1621 void operator[]=(int index, int value) { | 1671 void operator[]=(int index, int value) { |
| 1622 if (index < 0 || index >= length) { | 1672 if (index < 0 || index >= length) { |
| 1623 String message = "$index must be in the range [0..$length)"; | 1673 String message = "$index must be in the range [0..$length)"; |
| 1624 throw new RangeError(message); | 1674 throw new RangeError(message); |
| 1625 } | 1675 } |
| 1626 _setUint64(index, _toUint64(value)); | 1676 _setIndexedUint64(index, _toUint64(value)); |
| 1627 } | 1677 } |
| 1628 | 1678 |
| 1629 Iterator<int> get iterator { | 1679 Iterator<int> get iterator { |
| 1630 return new _TypedListIterator<int>(this); | 1680 return new _TypedListIterator<int>(this); |
| 1631 } | 1681 } |
| 1632 | 1682 |
| 1633 | 1683 |
| 1634 // Method(s) implementing the TypedData interface. | 1684 // Method(s) implementing the TypedData interface. |
| 1635 | 1685 |
| 1636 Uint64List _createList(int length) { | 1686 Uint64List _createList(int length) { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1661 } | 1711 } |
| 1662 | 1712 |
| 1663 | 1713 |
| 1664 // Method(s) implementing the List interface. | 1714 // Method(s) implementing the List interface. |
| 1665 | 1715 |
| 1666 double operator[](int index) { | 1716 double operator[](int index) { |
| 1667 if (index < 0 || index >= length) { | 1717 if (index < 0 || index >= length) { |
| 1668 String message = "$index must be in the range [0..$length)"; | 1718 String message = "$index must be in the range [0..$length)"; |
| 1669 throw new RangeError(message); | 1719 throw new RangeError(message); |
| 1670 } | 1720 } |
| 1671 return _getFloat32(index); | 1721 return _getIndexedFloat32(index); |
| 1672 } | 1722 } |
| 1673 | 1723 |
| 1674 void operator[]=(int index, double value) { | 1724 void operator[]=(int index, double value) { |
| 1675 if (index < 0 || index >= length) { | 1725 if (index < 0 || index >= length) { |
| 1676 String message = "$index must be in the range [0..$length)"; | 1726 String message = "$index must be in the range [0..$length)"; |
| 1677 throw new RangeError(message); | 1727 throw new RangeError(message); |
| 1678 } | 1728 } |
| 1679 _setFloat32(index, value); | 1729 _setIndexedFloat32(index, value); |
| 1680 } | 1730 } |
| 1681 | 1731 |
| 1682 Iterator<double> get iterator { | 1732 Iterator<double> get iterator { |
| 1683 return new _TypedListIterator<double>(this); | 1733 return new _TypedListIterator<double>(this); |
| 1684 } | 1734 } |
| 1685 | 1735 |
| 1686 | 1736 |
| 1687 // Method(s) implementing the TypedData interface. | 1737 // Method(s) implementing the TypedData interface. |
| 1688 | 1738 |
| 1689 int get elementSizeInBytes { | 1739 int get elementSizeInBytes { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1714 } | 1764 } |
| 1715 | 1765 |
| 1716 | 1766 |
| 1717 // Method(s) implementing the List interface. | 1767 // Method(s) implementing the List interface. |
| 1718 | 1768 |
| 1719 double operator[](int index) { | 1769 double operator[](int index) { |
| 1720 if (index < 0 || index >= length) { | 1770 if (index < 0 || index >= length) { |
| 1721 String message = "$index must be in the range [0..$length)"; | 1771 String message = "$index must be in the range [0..$length)"; |
| 1722 throw new RangeError(message); | 1772 throw new RangeError(message); |
| 1723 } | 1773 } |
| 1724 return _getFloat64(index); | 1774 return _getIndexedFloat64(index); |
| 1725 } | 1775 } |
| 1726 | 1776 |
| 1727 void operator[]=(int index, double value) { | 1777 void operator[]=(int index, double value) { |
| 1728 if (index < 0 || index >= length) { | 1778 if (index < 0 || index >= length) { |
| 1729 String message = "$index must be in the range [0..$length)"; | 1779 String message = "$index must be in the range [0..$length)"; |
| 1730 throw new RangeError(message); | 1780 throw new RangeError(message); |
| 1731 } | 1781 } |
| 1732 _setFloat64(index, value); | 1782 _setIndexedFloat64(index, value); |
| 1733 } | 1783 } |
| 1734 | 1784 |
| 1735 Iterator<double> get iterator { | 1785 Iterator<double> get iterator { |
| 1736 return new _TypedListIterator<double>(this); | 1786 return new _TypedListIterator<double>(this); |
| 1737 } | 1787 } |
| 1738 | 1788 |
| 1739 | 1789 |
| 1740 // Method(s) implementing the TypedData interface. | 1790 // Method(s) implementing the TypedData interface. |
| 1741 | 1791 |
| 1742 int get elementSizeInBytes { | 1792 int get elementSizeInBytes { |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2481 } | 2531 } |
| 2482 } | 2532 } |
| 2483 | 2533 |
| 2484 | 2534 |
| 2485 int _defaultIfNull(object, value) { | 2535 int _defaultIfNull(object, value) { |
| 2486 if (object == null) { | 2536 if (object == null) { |
| 2487 return value; | 2537 return value; |
| 2488 } | 2538 } |
| 2489 return object; | 2539 return object; |
| 2490 } | 2540 } |
| OLD | NEW |