| 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 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 { |
| 11 /* patch */ factory Int8List(int length) { | 11 /* patch */ factory Int8List(int length) { |
| 12 return new _Int8Array(length); | 12 return new _Int8Array(length); |
| 13 } | 13 } |
| 14 | 14 |
| 15 /* patch */ factory Int8List.fromList(List<int> elements) { | 15 /* patch */ factory Int8List.fromList(List<int> elements) { |
| 16 return new _Int8Array(elements.length) | 16 return new _Int8Array(elements.length) |
| 17 ..setRange(0, elements.length, elements); | 17 ..setRange(0, elements.length, elements); |
| 18 } | 18 } |
| 19 | |
| 20 /* patch */ factory Int8List.view(ByteBuffer buffer, | |
| 21 [int offsetInBytes = 0, int length]) { | |
| 22 return new _Int8ArrayView(buffer, offsetInBytes, length); | |
| 23 } | |
| 24 } | 19 } |
| 25 | 20 |
| 26 | 21 |
| 27 patch class Uint8List { | 22 patch class Uint8List { |
| 28 /* patch */ factory Uint8List(int length) { | 23 /* patch */ factory Uint8List(int length) { |
| 29 return new _Uint8Array(length); | 24 return new _Uint8Array(length); |
| 30 } | 25 } |
| 31 | 26 |
| 32 /* patch */ factory Uint8List.fromList(List<int> elements) { | 27 /* patch */ factory Uint8List.fromList(List<int> elements) { |
| 33 return new _Uint8Array(elements.length) | 28 return new _Uint8Array(elements.length) |
| 34 ..setRange(0, elements.length, elements); | 29 ..setRange(0, elements.length, elements); |
| 35 } | 30 } |
| 36 | |
| 37 /* patch */ factory Uint8List.view(ByteBuffer buffer, | |
| 38 [int offsetInBytes = 0, int length]) { | |
| 39 return new _Uint8ArrayView(buffer, offsetInBytes, length); | |
| 40 } | |
| 41 } | 31 } |
| 42 | 32 |
| 43 | 33 |
| 44 patch class Uint8ClampedList { | 34 patch class Uint8ClampedList { |
| 45 /* patch */ factory Uint8ClampedList(int length) { | 35 /* patch */ factory Uint8ClampedList(int length) { |
| 46 return new _Uint8ClampedArray(length); | 36 return new _Uint8ClampedArray(length); |
| 47 } | 37 } |
| 48 | 38 |
| 49 /* patch */ factory Uint8ClampedList.fromList(List<int> elements) { | 39 /* patch */ factory Uint8ClampedList.fromList(List<int> elements) { |
| 50 return new _Uint8ClampedArray(elements.length) | 40 return new _Uint8ClampedArray(elements.length) |
| 51 ..setRange(0, elements.length, elements); | 41 ..setRange(0, elements.length, elements); |
| 52 } | 42 } |
| 53 | |
| 54 /* patch */ factory Uint8ClampedList.view(ByteBuffer buffer, | |
| 55 [int offsetInBytes = 0, | |
| 56 int length]) { | |
| 57 return new _Uint8ClampedArrayView(buffer, offsetInBytes, length); | |
| 58 } | |
| 59 } | 43 } |
| 60 | 44 |
| 61 | 45 |
| 62 patch class Int16List { | 46 patch class Int16List { |
| 63 /* patch */ factory Int16List(int length) { | 47 /* patch */ factory Int16List(int length) { |
| 64 return new _Int16Array(length); | 48 return new _Int16Array(length); |
| 65 } | 49 } |
| 66 | 50 |
| 67 /* patch */ factory Int16List.fromList(List<int> elements) { | 51 /* patch */ factory Int16List.fromList(List<int> elements) { |
| 68 return new _Int16Array(elements.length) | 52 return new _Int16Array(elements.length) |
| 69 ..setRange(0, elements.length, elements); | 53 ..setRange(0, elements.length, elements); |
| 70 } | 54 } |
| 71 | |
| 72 /* patch */ factory Int16List.view(ByteBuffer buffer, | |
| 73 [int offsetInBytes = 0, int length]) { | |
| 74 return new _Int16ArrayView(buffer, offsetInBytes, length); | |
| 75 } | |
| 76 } | 55 } |
| 77 | 56 |
| 78 | 57 |
| 79 patch class Uint16List { | 58 patch class Uint16List { |
| 80 /* patch */ factory Uint16List(int length) { | 59 /* patch */ factory Uint16List(int length) { |
| 81 return new _Uint16Array(length); | 60 return new _Uint16Array(length); |
| 82 } | 61 } |
| 83 | 62 |
| 84 /* patch */ factory Uint16List.fromList(List<int> elements) { | 63 /* patch */ factory Uint16List.fromList(List<int> elements) { |
| 85 return new _Uint16Array(elements.length) | 64 return new _Uint16Array(elements.length) |
| 86 ..setRange(0, elements.length, elements); | 65 ..setRange(0, elements.length, elements); |
| 87 } | 66 } |
| 88 | |
| 89 /* patch */ factory Uint16List.view(ByteBuffer buffer, | |
| 90 [int offsetInBytes = 0, int length]) { | |
| 91 return new _Uint16ArrayView(buffer, offsetInBytes, length); | |
| 92 } | |
| 93 } | 67 } |
| 94 | 68 |
| 95 | 69 |
| 96 patch class Int32List { | 70 patch class Int32List { |
| 97 /* patch */ factory Int32List(int length) { | 71 /* patch */ factory Int32List(int length) { |
| 98 return new _Int32Array(length); | 72 return new _Int32Array(length); |
| 99 } | 73 } |
| 100 | 74 |
| 101 /* patch */ factory Int32List.fromList(List<int> elements) { | 75 /* patch */ factory Int32List.fromList(List<int> elements) { |
| 102 return new _Int32Array(elements.length) | 76 return new _Int32Array(elements.length) |
| 103 ..setRange(0, elements.length, elements); | 77 ..setRange(0, elements.length, elements); |
| 104 } | 78 } |
| 105 | |
| 106 /* patch */ factory Int32List.view(ByteBuffer buffer, | |
| 107 [int offsetInBytes = 0, int length]) { | |
| 108 return new _Int32ArrayView(buffer, offsetInBytes, length); | |
| 109 } | |
| 110 } | 79 } |
| 111 | 80 |
| 112 | 81 |
| 113 patch class Uint32List { | 82 patch class Uint32List { |
| 114 /* patch */ factory Uint32List(int length) { | 83 /* patch */ factory Uint32List(int length) { |
| 115 return new _Uint32Array(length); | 84 return new _Uint32Array(length); |
| 116 } | 85 } |
| 117 | 86 |
| 118 /* patch */ factory Uint32List.fromList(List<int> elements) { | 87 /* patch */ factory Uint32List.fromList(List<int> elements) { |
| 119 return new _Uint32Array(elements.length) | 88 return new _Uint32Array(elements.length) |
| 120 ..setRange(0, elements.length, elements); | 89 ..setRange(0, elements.length, elements); |
| 121 } | 90 } |
| 122 | |
| 123 /* patch */ factory Uint32List.view(ByteBuffer buffer, | |
| 124 [int offsetInBytes = 0, int length]) { | |
| 125 return new _Uint32ArrayView(buffer, offsetInBytes, length); | |
| 126 } | |
| 127 } | 91 } |
| 128 | 92 |
| 129 | 93 |
| 130 patch class Int64List { | 94 patch class Int64List { |
| 131 /* patch */ factory Int64List(int length) { | 95 /* patch */ factory Int64List(int length) { |
| 132 return new _Int64Array(length); | 96 return new _Int64Array(length); |
| 133 } | 97 } |
| 134 | 98 |
| 135 /* patch */ factory Int64List.fromList(List<int> elements) { | 99 /* patch */ factory Int64List.fromList(List<int> elements) { |
| 136 return new _Int64Array(elements.length) | 100 return new _Int64Array(elements.length) |
| 137 ..setRange(0, elements.length, elements); | 101 ..setRange(0, elements.length, elements); |
| 138 } | 102 } |
| 139 | |
| 140 /* patch */ factory Int64List.view(ByteBuffer buffer, | |
| 141 [int offsetInBytes = 0, int length]) { | |
| 142 return new _Int64ArrayView(buffer, offsetInBytes, length); | |
| 143 } | |
| 144 } | 103 } |
| 145 | 104 |
| 146 | 105 |
| 147 patch class Uint64List { | 106 patch class Uint64List { |
| 148 /* patch */ factory Uint64List(int length) { | 107 /* patch */ factory Uint64List(int length) { |
| 149 return new _Uint64Array(length); | 108 return new _Uint64Array(length); |
| 150 } | 109 } |
| 151 | 110 |
| 152 /* patch */ factory Uint64List.fromList(List<int> elements) { | 111 /* patch */ factory Uint64List.fromList(List<int> elements) { |
| 153 return new _Uint64Array(elements.length) | 112 return new _Uint64Array(elements.length) |
| 154 ..setRange(0, elements.length, elements); | 113 ..setRange(0, elements.length, elements); |
| 155 } | 114 } |
| 156 | |
| 157 /* patch */ factory Uint64List.view(ByteBuffer buffer, | |
| 158 [int offsetInBytes = 0, int length]) { | |
| 159 return new _Uint64ArrayView(buffer, offsetInBytes, length); | |
| 160 } | |
| 161 } | 115 } |
| 162 | 116 |
| 163 | 117 |
| 164 patch class Float32List { | 118 patch class Float32List { |
| 165 /* patch */ factory Float32List(int length) { | 119 /* patch */ factory Float32List(int length) { |
| 166 return new _Float32Array(length); | 120 return new _Float32Array(length); |
| 167 } | 121 } |
| 168 | 122 |
| 169 /* patch */ factory Float32List.fromList(List<double> elements) { | 123 /* patch */ factory Float32List.fromList(List<double> elements) { |
| 170 return new _Float32Array(elements.length) | 124 return new _Float32Array(elements.length) |
| 171 ..setRange(0, elements.length, elements); | 125 ..setRange(0, elements.length, elements); |
| 172 } | 126 } |
| 173 | |
| 174 /* patch */ factory Float32List.view(ByteBuffer buffer, | |
| 175 [int offsetInBytes = 0, int length]) { | |
| 176 return new _Float32ArrayView(buffer, offsetInBytes, length); | |
| 177 } | |
| 178 } | 127 } |
| 179 | 128 |
| 180 | 129 |
| 181 patch class Float64List { | 130 patch class Float64List { |
| 182 /* patch */ factory Float64List(int length) { | 131 /* patch */ factory Float64List(int length) { |
| 183 return new _Float64Array(length); | 132 return new _Float64Array(length); |
| 184 } | 133 } |
| 185 | 134 |
| 186 /* patch */ factory Float64List.fromList(List<double> elements) { | 135 /* patch */ factory Float64List.fromList(List<double> elements) { |
| 187 return new _Float64Array(elements.length) | 136 return new _Float64Array(elements.length) |
| 188 ..setRange(0, elements.length, elements); | 137 ..setRange(0, elements.length, elements); |
| 189 } | 138 } |
| 139 } |
| 190 | 140 |
| 191 /* patch */ factory Float64List.view(ByteBuffer buffer, | |
| 192 [int offsetInBytes = 0, int length]) { | |
| 193 return new _Float64ArrayView(buffer, offsetInBytes, length); | |
| 194 } | |
| 195 } | |
| 196 | 141 |
| 197 patch class Float32x4List { | 142 patch class Float32x4List { |
| 198 /* patch */ factory Float32x4List(int length) { | 143 /* patch */ factory Float32x4List(int length) { |
| 199 return new _Float32x4Array(length); | 144 return new _Float32x4Array(length); |
| 200 } | 145 } |
| 201 | 146 |
| 202 /* patch */ factory Float32x4List.fromList(List<Float32x4> elements) { | 147 /* patch */ factory Float32x4List.fromList(List<Float32x4> elements) { |
| 203 return new _Float32x4Array(elements.length) | 148 return new _Float32x4Array(elements.length) |
| 204 ..setRange(0, elements.length, elements); | 149 ..setRange(0, elements.length, elements); |
| 205 } | 150 } |
| 206 | |
| 207 /* patch */ factory Float32x4List.view(ByteBuffer buffer, | |
| 208 [int offsetInBytes = 0, int length]) { | |
| 209 return new _Float32x4ArrayView(buffer, offsetInBytes, length); | |
| 210 } | |
| 211 } | 151 } |
| 212 | 152 |
| 213 | 153 |
| 214 patch class Int32x4List { | 154 patch class Int32x4List { |
| 215 /* patch */ factory Int32x4List(int length) { | 155 /* patch */ factory Int32x4List(int length) { |
| 216 return new _Int32x4Array(length); | 156 return new _Int32x4Array(length); |
| 217 } | 157 } |
| 218 | 158 |
| 219 /* patch */ factory Int32x4List.fromList(List<Int32x4> elements) { | 159 /* patch */ factory Int32x4List.fromList(List<Int32x4> elements) { |
| 220 return new _Int32x4Array(elements.length) | 160 return new _Int32x4Array(elements.length) |
| 221 ..setRange(0, elements.length, elements); | 161 ..setRange(0, elements.length, elements); |
| 222 } | 162 } |
| 223 | 163 |
| 224 /* patch */ factory Int32x4List.view(ByteBuffer buffer, | |
| 225 [int offsetInBytes = 0, int length]) { | |
| 226 return new _Int32x4ArrayView(buffer, offsetInBytes, length); | |
| 227 } | |
| 228 } | 164 } |
| 229 | 165 |
| 230 | |
| 231 patch class Float64x2List { | 166 patch class Float64x2List { |
| 232 /* patch */ factory Float64x2List(int length) { | 167 /* patch */ factory Float64x2List(int length) { |
| 233 return new _Float64x2Array(length); | 168 return new _Float64x2Array(length); |
| 234 } | 169 } |
| 235 | 170 |
| 236 /* patch */ factory Float64x2List.fromList(List<Float64x2> elements) { | 171 /* patch */ factory Float64x2List.fromList(List<Float64x2> elements) { |
| 237 return new _Float64x2Array(elements.length) | 172 return new _Float64x2Array(elements.length) |
| 238 ..setRange(0, elements.length, elements); | 173 ..setRange(0, elements.length, elements); |
| 239 } | 174 } |
| 240 | |
| 241 /* patch */ factory Float64x2List.view(ByteBuffer buffer, | |
| 242 [int offsetInBytes = 0, int length]) { | |
| 243 return new _Float64x2ArrayView(buffer, offsetInBytes, length); | |
| 244 } | |
| 245 } | 175 } |
| 246 | 176 |
| 247 | 177 |
| 248 patch class Float32x4 { | 178 patch class Float32x4 { |
| 249 /* patch */ factory Float32x4(double x, double y, double z, double w) { | 179 /* patch */ factory Float32x4(double x, double y, double z, double w) { |
| 250 return new _Float32x4(x, y, z, w); | 180 return new _Float32x4(x, y, z, w); |
| 251 } | 181 } |
| 252 /* patch */ factory Float32x4.splat(double v) { | 182 /* patch */ factory Float32x4.splat(double v) { |
| 253 return new _Float32x4.splat(v); | 183 return new _Float32x4.splat(v); |
| 254 } | 184 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 } | 225 } |
| 296 } | 226 } |
| 297 | 227 |
| 298 | 228 |
| 299 patch class ByteData { | 229 patch class ByteData { |
| 300 /* patch */ factory ByteData(int length) { | 230 /* patch */ factory ByteData(int length) { |
| 301 var list = new _Uint8Array(length); | 231 var list = new _Uint8Array(length); |
| 302 return new _ByteDataView(list, 0, length); | 232 return new _ByteDataView(list, 0, length); |
| 303 } | 233 } |
| 304 | 234 |
| 305 /* patch */ factory ByteData.view(ByteBuffer buffer, | |
| 306 [int offsetInBytes = 0, int length]) { | |
| 307 if (length == null) { | |
| 308 length = buffer.lengthInBytes - offsetInBytes; | |
| 309 } | |
| 310 return new _ByteDataView(buffer._data, offsetInBytes, length); | |
| 311 } | |
| 312 | |
| 313 // Called directly from C code. | 235 // Called directly from C code. |
| 314 factory ByteData._view(TypedData typedData, int offsetInBytes, int length) { | 236 factory ByteData._view(TypedData typedData, int offsetInBytes, int length) { |
| 315 return new _ByteDataView(typedData, offsetInBytes, length); | 237 return new _ByteDataView(typedData, offsetInBytes, length); |
| 316 } | 238 } |
| 317 } | 239 } |
| 318 | 240 |
| 319 | 241 |
| 320 // Based class for _TypedList that provides common methods for implementing | 242 // Based class for _TypedList that provides common methods for implementing |
| 321 // the collection and list interfaces. | 243 // the collection and list interfaces. |
| 322 | 244 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 class _ByteBuffer implements ByteBuffer { | 536 class _ByteBuffer implements ByteBuffer { |
| 615 final _TypedList _data; | 537 final _TypedList _data; |
| 616 | 538 |
| 617 _ByteBuffer(this._data); | 539 _ByteBuffer(this._data); |
| 618 | 540 |
| 619 // Forward calls to _data. | 541 // Forward calls to _data. |
| 620 int get lengthInBytes => _data.lengthInBytes; | 542 int get lengthInBytes => _data.lengthInBytes; |
| 621 int get hashCode => _data.hashCode; | 543 int get hashCode => _data.hashCode; |
| 622 bool operator==(Object other) => | 544 bool operator==(Object other) => |
| 623 (other is _ByteBuffer) && identical(_data, other._data); | 545 (other is _ByteBuffer) && identical(_data, other._data); |
| 546 |
| 547 ByteData asByteData([int offsetInBytes = 0, int length]) { |
| 548 if (length == null) { |
| 549 length = this.lengthInBytes - offsetInBytes; |
| 550 } |
| 551 return new _ByteDataView(this._data, offsetInBytes, length); |
| 552 } |
| 553 |
| 554 Int8List asInt8List([int offsetInBytes = 0, int length]) { |
| 555 if (length == null) { |
| 556 length = this.lengthInBytes - offsetInBytes; |
| 557 } |
| 558 return new _Int8ArrayView(this, offsetInBytes, length); |
| 559 } |
| 560 |
| 561 Uint8List asUint8List([int offsetInBytes = 0, int length]) { |
| 562 if (length == null) { |
| 563 length = this.lengthInBytes - offsetInBytes; |
| 564 } |
| 565 return new _Uint8ArrayView(this, offsetInBytes, length); |
| 566 } |
| 567 |
| 568 Uint8ClampedList asUint8ClampedList([int offsetInBytes = 0, int length]) { |
| 569 if (length == null) { |
| 570 length = this.lengthInBytes - offsetInBytes; |
| 571 } |
| 572 return new _Uint8ClampedArrayView(this, offsetInBytes, length); |
| 573 } |
| 574 |
| 575 Int16List asInt16List([int offsetInBytes = 0, int length]) { |
| 576 if (length == null) { |
| 577 length = (this.lengthInBytes - offsetInBytes) ~/ |
| 578 Int16List.BYTES_PER_ELEMENT; |
| 579 } |
| 580 return new _Int16ArrayView(this, offsetInBytes, length); |
| 581 } |
| 582 |
| 583 Uint16List asUint16List([int offsetInBytes = 0, int length]) { |
| 584 if (length == null) { |
| 585 length = (this.lengthInBytes - offsetInBytes) ~/ |
| 586 Uint16List.BYTES_PER_ELEMENT; |
| 587 } |
| 588 return new _Uint16ArrayView(this, offsetInBytes, length); |
| 589 } |
| 590 |
| 591 Int32List asInt32List([int offsetInBytes = 0, int length]) { |
| 592 if (length == null) { |
| 593 length = (this.lengthInBytes - offsetInBytes) ~/ |
| 594 Int32List.BYTES_PER_ELEMENT; |
| 595 } |
| 596 return new _Int32ArrayView(this, offsetInBytes, length); |
| 597 } |
| 598 |
| 599 Uint32List asUint32List([int offsetInBytes = 0, int length]) { |
| 600 if (length == null) { |
| 601 length = (this.lengthInBytes - offsetInBytes) ~/ |
| 602 Uint32List.BYTES_PER_ELEMENT; |
| 603 } |
| 604 return new _Uint32ArrayView(this, offsetInBytes, length); |
| 605 } |
| 606 |
| 607 Int64List asInt64List([int offsetInBytes = 0, int length]) { |
| 608 if (length == null) { |
| 609 length = (this.lengthInBytes - offsetInBytes) ~/ |
| 610 Int64List.BYTES_PER_ELEMENT; |
| 611 } |
| 612 return new _Int64ArrayView(this, offsetInBytes, length); |
| 613 } |
| 614 |
| 615 Uint64List asUint64List([int offsetInBytes = 0, int length]) { |
| 616 if (length == null) { |
| 617 length = (this.lengthInBytes - offsetInBytes) ~/ |
| 618 Uint64List.BYTES_PER_ELEMENT; |
| 619 } |
| 620 return new _Uint64ArrayView(this, offsetInBytes, length); |
| 621 } |
| 622 |
| 623 Float32List asFloat32List([int offsetInBytes = 0, int length]) { |
| 624 if (length == null) { |
| 625 length = (this.lengthInBytes - offsetInBytes) ~/ |
| 626 Float32List.BYTES_PER_ELEMENT; |
| 627 } |
| 628 return new _Float32ArrayView(this, offsetInBytes, length); |
| 629 } |
| 630 |
| 631 Float64List asFloat64List([int offsetInBytes = 0, int length]) { |
| 632 if (length == null) { |
| 633 length = (this.lengthInBytes - offsetInBytes) ~/ |
| 634 Float64List.BYTES_PER_ELEMENT; |
| 635 } |
| 636 return new _Float64ArrayView(this, offsetInBytes, length); |
| 637 } |
| 638 |
| 639 Float32x4List asFloat32x4List([int offsetInBytes = 0, int length]) { |
| 640 if (length == null) { |
| 641 length = (this.lengthInBytes - offsetInBytes) ~/ |
| 642 Float32x4List.BYTES_PER_ELEMENT; |
| 643 } |
| 644 return new _Float32x4ArrayView(this, offsetInBytes, length); |
| 645 } |
| 646 |
| 647 Int32x4List asInt32x4List([int offsetInBytes = 0, int length]) { |
| 648 if (length == null) { |
| 649 length = (this.lengthInBytes - offsetInBytes) ~/ |
| 650 Int32x4List.BYTES_PER_ELEMENT; |
| 651 } |
| 652 return new _Int32x4ArrayView(this, offsetInBytes, length); |
| 653 } |
| 654 |
| 655 Float64x2List asFloat64x2List([int offsetInBytes = 0, int length]) { |
| 656 if (length == null) { |
| 657 length = (this.lengthInBytes - offsetInBytes) ~/ |
| 658 Float64x2List.BYTES_PER_ELEMENT; |
| 659 } |
| 660 return new _Float64x2ArrayView(this, offsetInBytes, length); |
| 661 } |
| 624 } | 662 } |
| 625 | 663 |
| 626 | 664 |
| 627 abstract class _TypedList extends _TypedListBase { | 665 abstract class _TypedList extends _TypedListBase { |
| 628 // Default method implementing parts of the TypedData interface. | 666 // Default method implementing parts of the TypedData interface. |
| 629 int get offsetInBytes { | 667 int get offsetInBytes { |
| 630 return 0; | 668 return 0; |
| 631 } | 669 } |
| 632 | 670 |
| 633 int get lengthInBytes { | 671 int get lengthInBytes { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 } | 726 } |
| 689 | 727 |
| 690 | 728 |
| 691 class _Int8Array extends _TypedList implements Int8List { | 729 class _Int8Array extends _TypedList implements Int8List { |
| 692 // Factory constructors. | 730 // Factory constructors. |
| 693 | 731 |
| 694 factory _Int8Array(int length) { | 732 factory _Int8Array(int length) { |
| 695 return _new(length); | 733 return _new(length); |
| 696 } | 734 } |
| 697 | 735 |
| 698 factory _Int8Array.view(ByteBuffer buffer, | |
| 699 [int offsetInBytes = 0, int length]) { | |
| 700 if (length == null) { | |
| 701 length = buffer.lengthInBytes - offsetInBytes; | |
| 702 } | |
| 703 return new _Int8ArrayView(buffer, offsetInBytes, length); | |
| 704 } | |
| 705 | |
| 706 | 736 |
| 707 // Method(s) implementing List interface. | 737 // Method(s) implementing List interface. |
| 708 | 738 |
| 709 int operator[](int index) { | 739 int operator[](int index) { |
| 710 if (index < 0 || index >= length) { | 740 if (index < 0 || index >= length) { |
| 711 _throwRangeError(index, length); | 741 _throwRangeError(index, length); |
| 712 } | 742 } |
| 713 return _getInt8(index); | 743 return _getInt8(index); |
| 714 } | 744 } |
| 715 | 745 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 742 } | 772 } |
| 743 | 773 |
| 744 | 774 |
| 745 class _Uint8Array extends _TypedList implements Uint8List { | 775 class _Uint8Array extends _TypedList implements Uint8List { |
| 746 // Factory constructors. | 776 // Factory constructors. |
| 747 | 777 |
| 748 factory _Uint8Array(int length) { | 778 factory _Uint8Array(int length) { |
| 749 return _new(length); | 779 return _new(length); |
| 750 } | 780 } |
| 751 | 781 |
| 752 factory _Uint8Array.view(ByteBuffer buffer, | |
| 753 [int offsetInBytes = 0, int length]) { | |
| 754 if (length == null) { | |
| 755 length = buffer.lengthInBytes - offsetInBytes; | |
| 756 } | |
| 757 return new _Uint8ArrayView(buffer, offsetInBytes, length); | |
| 758 } | |
| 759 | |
| 760 | 782 |
| 761 // Methods implementing List interface. | 783 // Methods implementing List interface. |
| 762 int operator[](int index) { | 784 int operator[](int index) { |
| 763 if (index < 0 || index >= length) { | 785 if (index < 0 || index >= length) { |
| 764 _throwRangeError(index, length); | 786 _throwRangeError(index, length); |
| 765 } | 787 } |
| 766 return _getUint8(index); | 788 return _getUint8(index); |
| 767 } | 789 } |
| 768 | 790 |
| 769 void operator[]=(int index, int value) { | 791 void operator[]=(int index, int value) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 794 } | 816 } |
| 795 | 817 |
| 796 | 818 |
| 797 class _Uint8ClampedArray extends _TypedList implements Uint8ClampedList { | 819 class _Uint8ClampedArray extends _TypedList implements Uint8ClampedList { |
| 798 // Factory constructors. | 820 // Factory constructors. |
| 799 | 821 |
| 800 factory _Uint8ClampedArray(int length) { | 822 factory _Uint8ClampedArray(int length) { |
| 801 return _new(length); | 823 return _new(length); |
| 802 } | 824 } |
| 803 | 825 |
| 804 factory _Uint8ClampedArray.view(ByteBuffer buffer, | |
| 805 [int offsetInBytes = 0, int length]) { | |
| 806 if (length == null) { | |
| 807 length = buffer.lengthInBytes - offsetInBytes; | |
| 808 } | |
| 809 return new _Uint8ClampedArrayView(buffer, offsetInBytes, length); | |
| 810 } | |
| 811 | |
| 812 // Methods implementing List interface. | 826 // Methods implementing List interface. |
| 813 | 827 |
| 814 int operator[](int index) { | 828 int operator[](int index) { |
| 815 if (index < 0 || index >= length) { | 829 if (index < 0 || index >= length) { |
| 816 _throwRangeError(index, length); | 830 _throwRangeError(index, length); |
| 817 } | 831 } |
| 818 return _getUint8(index); | 832 return _getUint8(index); |
| 819 } | 833 } |
| 820 | 834 |
| 821 void operator[]=(int index, int value) { | 835 void operator[]=(int index, int value) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 847 } | 861 } |
| 848 | 862 |
| 849 | 863 |
| 850 class _Int16Array extends _TypedList implements Int16List { | 864 class _Int16Array extends _TypedList implements Int16List { |
| 851 // Factory constructors. | 865 // Factory constructors. |
| 852 | 866 |
| 853 factory _Int16Array(int length) { | 867 factory _Int16Array(int length) { |
| 854 return _new(length); | 868 return _new(length); |
| 855 } | 869 } |
| 856 | 870 |
| 857 factory _Int16Array.view(ByteBuffer buffer, | |
| 858 [int offsetInBytes = 0, int length]) { | |
| 859 if (length == null) { | |
| 860 length = (buffer.lengthInBytes - offsetInBytes) ~/ | |
| 861 Int16List.BYTES_PER_ELEMENT; | |
| 862 } | |
| 863 return new _Int16ArrayView(buffer, offsetInBytes, length); | |
| 864 } | |
| 865 | |
| 866 | 871 |
| 867 // Method(s) implementing List interface. | 872 // Method(s) implementing List interface. |
| 868 | 873 |
| 869 int operator[](int index) { | 874 int operator[](int index) { |
| 870 if (index < 0 || index >= length) { | 875 if (index < 0 || index >= length) { |
| 871 _throwRangeError(index, length); | 876 _throwRangeError(index, length); |
| 872 } | 877 } |
| 873 return _getIndexedInt16(index); | 878 return _getIndexedInt16(index); |
| 874 } | 879 } |
| 875 | 880 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 } | 915 } |
| 911 | 916 |
| 912 | 917 |
| 913 class _Uint16Array extends _TypedList implements Uint16List { | 918 class _Uint16Array extends _TypedList implements Uint16List { |
| 914 // Factory constructors. | 919 // Factory constructors. |
| 915 | 920 |
| 916 factory _Uint16Array(int length) { | 921 factory _Uint16Array(int length) { |
| 917 return _new(length); | 922 return _new(length); |
| 918 } | 923 } |
| 919 | 924 |
| 920 factory _Uint16Array.view(ByteBuffer buffer, | |
| 921 [int offsetInBytes = 0, int length]) { | |
| 922 if (length == null) { | |
| 923 length = (buffer.lengthInBytes - offsetInBytes) ~/ | |
| 924 Uint16List.BYTES_PER_ELEMENT; | |
| 925 } | |
| 926 return new _Uint16ArrayView(buffer, offsetInBytes, length); | |
| 927 } | |
| 928 | |
| 929 | 925 |
| 930 // Method(s) implementing the List interface. | 926 // Method(s) implementing the List interface. |
| 931 | 927 |
| 932 int operator[](int index) { | 928 int operator[](int index) { |
| 933 if (index < 0 || index >= length) { | 929 if (index < 0 || index >= length) { |
| 934 _throwRangeError(index, length); | 930 _throwRangeError(index, length); |
| 935 } | 931 } |
| 936 return _getIndexedUint16(index); | 932 return _getIndexedUint16(index); |
| 937 } | 933 } |
| 938 | 934 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 } | 969 } |
| 974 | 970 |
| 975 | 971 |
| 976 class _Int32Array extends _TypedList implements Int32List { | 972 class _Int32Array extends _TypedList implements Int32List { |
| 977 // Factory constructors. | 973 // Factory constructors. |
| 978 | 974 |
| 979 factory _Int32Array(int length) { | 975 factory _Int32Array(int length) { |
| 980 return _new(length); | 976 return _new(length); |
| 981 } | 977 } |
| 982 | 978 |
| 983 factory _Int32Array.view(ByteBuffer buffer, | |
| 984 [int offsetInBytes = 0, int length]) { | |
| 985 if (length == null) { | |
| 986 length = (buffer.lengthInBytes - offsetInBytes) ~/ | |
| 987 Int32List.BYTES_PER_ELEMENT; | |
| 988 } | |
| 989 return new _Int32ArrayView(buffer, offsetInBytes, length); | |
| 990 } | |
| 991 | |
| 992 | 979 |
| 993 // Method(s) implementing the List interface. | 980 // Method(s) implementing the List interface. |
| 994 | 981 |
| 995 int operator[](int index) { | 982 int operator[](int index) { |
| 996 if (index < 0 || index >= length) { | 983 if (index < 0 || index >= length) { |
| 997 _throwRangeError(index, length); | 984 _throwRangeError(index, length); |
| 998 } | 985 } |
| 999 return _getIndexedInt32(index); | 986 return _getIndexedInt32(index); |
| 1000 } | 987 } |
| 1001 | 988 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 } | 1023 } |
| 1037 | 1024 |
| 1038 | 1025 |
| 1039 class _Uint32Array extends _TypedList implements Uint32List { | 1026 class _Uint32Array extends _TypedList implements Uint32List { |
| 1040 // Factory constructors. | 1027 // Factory constructors. |
| 1041 | 1028 |
| 1042 factory _Uint32Array(int length) { | 1029 factory _Uint32Array(int length) { |
| 1043 return _new(length); | 1030 return _new(length); |
| 1044 } | 1031 } |
| 1045 | 1032 |
| 1046 factory _Uint32Array.view(ByteBuffer buffer, | |
| 1047 [int offsetInBytes = 0, int length]) { | |
| 1048 if (length == null) { | |
| 1049 length = (buffer.lengthInBytes - offsetInBytes) ~/ | |
| 1050 Uint32List.BYTES_PER_ELEMENT; | |
| 1051 } | |
| 1052 return new _Uint32ArrayView(buffer, offsetInBytes, length); | |
| 1053 } | |
| 1054 | |
| 1055 | 1033 |
| 1056 // Method(s) implementing the List interface. | 1034 // Method(s) implementing the List interface. |
| 1057 | 1035 |
| 1058 int operator[](int index) { | 1036 int operator[](int index) { |
| 1059 if (index < 0 || index >= length) { | 1037 if (index < 0 || index >= length) { |
| 1060 _throwRangeError(index, length); | 1038 _throwRangeError(index, length); |
| 1061 } | 1039 } |
| 1062 return _getIndexedUint32(index); | 1040 return _getIndexedUint32(index); |
| 1063 } | 1041 } |
| 1064 | 1042 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 } | 1077 } |
| 1100 | 1078 |
| 1101 | 1079 |
| 1102 class _Int64Array extends _TypedList implements Int64List { | 1080 class _Int64Array extends _TypedList implements Int64List { |
| 1103 // Factory constructors. | 1081 // Factory constructors. |
| 1104 | 1082 |
| 1105 factory _Int64Array(int length) { | 1083 factory _Int64Array(int length) { |
| 1106 return _new(length); | 1084 return _new(length); |
| 1107 } | 1085 } |
| 1108 | 1086 |
| 1109 factory _Int64Array.view(ByteBuffer buffer, | |
| 1110 [int offsetInBytes = 0, int length]) { | |
| 1111 if (length == null) { | |
| 1112 length = (buffer.lengthInBytes - offsetInBytes) ~/ | |
| 1113 Int32List.BYTES_PER_ELEMENT; | |
| 1114 } | |
| 1115 return new _Int64ArrayView(buffer, offsetInBytes, length); | |
| 1116 } | |
| 1117 | |
| 1118 | 1087 |
| 1119 // Method(s) implementing the List interface. | 1088 // Method(s) implementing the List interface. |
| 1120 | 1089 |
| 1121 int operator[](int index) { | 1090 int operator[](int index) { |
| 1122 if (index < 0 || index >= length) { | 1091 if (index < 0 || index >= length) { |
| 1123 _throwRangeError(index, length); | 1092 _throwRangeError(index, length); |
| 1124 } | 1093 } |
| 1125 return _getIndexedInt64(index); | 1094 return _getIndexedInt64(index); |
| 1126 } | 1095 } |
| 1127 | 1096 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 } | 1131 } |
| 1163 | 1132 |
| 1164 | 1133 |
| 1165 class _Uint64Array extends _TypedList implements Uint64List { | 1134 class _Uint64Array extends _TypedList implements Uint64List { |
| 1166 // Factory constructors. | 1135 // Factory constructors. |
| 1167 | 1136 |
| 1168 factory _Uint64Array(int length) { | 1137 factory _Uint64Array(int length) { |
| 1169 return _new(length); | 1138 return _new(length); |
| 1170 } | 1139 } |
| 1171 | 1140 |
| 1172 factory _Uint64Array.view(ByteBuffer buffer, | |
| 1173 [int offsetInBytes = 0, int length]) { | |
| 1174 if (length == null) { | |
| 1175 length = (buffer.lengthInBytes - offsetInBytes) ~/ | |
| 1176 Uint64List.BYTES_PER_ELEMENT; | |
| 1177 } | |
| 1178 return new _Uint64ArrayView(buffer, offsetInBytes, length); | |
| 1179 } | |
| 1180 | |
| 1181 | 1141 |
| 1182 // Method(s) implementing the List interface. | 1142 // Method(s) implementing the List interface. |
| 1183 | 1143 |
| 1184 int operator[](int index) { | 1144 int operator[](int index) { |
| 1185 if (index < 0 || index >= length) { | 1145 if (index < 0 || index >= length) { |
| 1186 _throwRangeError(index, length); | 1146 _throwRangeError(index, length); |
| 1187 } | 1147 } |
| 1188 return _getIndexedUint64(index); | 1148 return _getIndexedUint64(index); |
| 1189 } | 1149 } |
| 1190 | 1150 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 } | 1185 } |
| 1226 | 1186 |
| 1227 | 1187 |
| 1228 class _Float32Array extends _TypedList implements Float32List { | 1188 class _Float32Array extends _TypedList implements Float32List { |
| 1229 // Factory constructors. | 1189 // Factory constructors. |
| 1230 | 1190 |
| 1231 factory _Float32Array(int length) { | 1191 factory _Float32Array(int length) { |
| 1232 return _new(length); | 1192 return _new(length); |
| 1233 } | 1193 } |
| 1234 | 1194 |
| 1235 factory _Float32Array.view(ByteBuffer buffer, | |
| 1236 [int offsetInBytes = 0, int length]) { | |
| 1237 if (length == null) { | |
| 1238 length = (buffer.lengthInBytes - offsetInBytes) ~/ | |
| 1239 Float32List.BYTES_PER_ELEMENT; | |
| 1240 } | |
| 1241 return new _Float32ArrayView(buffer, offsetInBytes, length); | |
| 1242 } | |
| 1243 | |
| 1244 | 1195 |
| 1245 // Method(s) implementing the List interface. | 1196 // Method(s) implementing the List interface. |
| 1246 | 1197 |
| 1247 double operator[](int index) { | 1198 double operator[](int index) { |
| 1248 if (index < 0 || index >= length) { | 1199 if (index < 0 || index >= length) { |
| 1249 _throwRangeError(index, length); | 1200 _throwRangeError(index, length); |
| 1250 } | 1201 } |
| 1251 return _getIndexedFloat32(index); | 1202 return _getIndexedFloat32(index); |
| 1252 } | 1203 } |
| 1253 | 1204 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 } | 1239 } |
| 1289 | 1240 |
| 1290 | 1241 |
| 1291 class _Float64Array extends _TypedList implements Float64List { | 1242 class _Float64Array extends _TypedList implements Float64List { |
| 1292 // Factory constructors. | 1243 // Factory constructors. |
| 1293 | 1244 |
| 1294 factory _Float64Array(int length) { | 1245 factory _Float64Array(int length) { |
| 1295 return _new(length); | 1246 return _new(length); |
| 1296 } | 1247 } |
| 1297 | 1248 |
| 1298 factory _Float64Array.view(ByteBuffer buffer, | |
| 1299 [int offsetInBytes = 0, int length]) { | |
| 1300 if (length == null) { | |
| 1301 length = (buffer.lengthInBytes - offsetInBytes) ~/ | |
| 1302 Float64List.BYTES_PER_ELEMENT; | |
| 1303 } | |
| 1304 return new _Float64ArrayView(buffer, offsetInBytes, length); | |
| 1305 } | |
| 1306 | |
| 1307 | 1249 |
| 1308 // Method(s) implementing the List interface. | 1250 // Method(s) implementing the List interface. |
| 1309 | 1251 |
| 1310 double operator[](int index) { | 1252 double operator[](int index) { |
| 1311 if (index < 0 || index >= length) { | 1253 if (index < 0 || index >= length) { |
| 1312 _throwRangeError(index, length); | 1254 _throwRangeError(index, length); |
| 1313 } | 1255 } |
| 1314 return _getIndexedFloat64(index); | 1256 return _getIndexedFloat64(index); |
| 1315 } | 1257 } |
| 1316 | 1258 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 } | 1293 } |
| 1352 | 1294 |
| 1353 | 1295 |
| 1354 class _Float32x4Array extends _TypedList implements Float32x4List { | 1296 class _Float32x4Array extends _TypedList implements Float32x4List { |
| 1355 // Factory constructors. | 1297 // Factory constructors. |
| 1356 | 1298 |
| 1357 factory _Float32x4Array(int length) { | 1299 factory _Float32x4Array(int length) { |
| 1358 return _new(length); | 1300 return _new(length); |
| 1359 } | 1301 } |
| 1360 | 1302 |
| 1361 factory _Float32x4Array.view(ByteBuffer buffer, | |
| 1362 [int offsetInBytes = 0, int length]) { | |
| 1363 if (length == null) { | |
| 1364 length = (buffer.lengthInBytes - offsetInBytes) ~/ | |
| 1365 Float32x4List.BYTES_PER_ELEMENT; | |
| 1366 } | |
| 1367 return new _Float32x4ArrayView(buffer, offsetInBytes, length); | |
| 1368 } | |
| 1369 | |
| 1370 | 1303 |
| 1371 Float32x4 operator[](int index) { | 1304 Float32x4 operator[](int index) { |
| 1372 if (index < 0 || index >= length) { | 1305 if (index < 0 || index >= length) { |
| 1373 _throwRangeError(index, length); | 1306 _throwRangeError(index, length); |
| 1374 } | 1307 } |
| 1375 return _getIndexedFloat32x4(index); | 1308 return _getIndexedFloat32x4(index); |
| 1376 } | 1309 } |
| 1377 | 1310 |
| 1378 void operator[]=(int index, Float32x4 value) { | 1311 void operator[]=(int index, Float32x4 value) { |
| 1379 if (index < 0 || index >= length) { | 1312 if (index < 0 || index >= length) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 } | 1345 } |
| 1413 | 1346 |
| 1414 | 1347 |
| 1415 class _Int32x4Array extends _TypedList implements Int32x4List { | 1348 class _Int32x4Array extends _TypedList implements Int32x4List { |
| 1416 // Factory constructors. | 1349 // Factory constructors. |
| 1417 | 1350 |
| 1418 factory _Int32x4Array(int length) { | 1351 factory _Int32x4Array(int length) { |
| 1419 return _new(length); | 1352 return _new(length); |
| 1420 } | 1353 } |
| 1421 | 1354 |
| 1422 factory _Int32x4Array.view(ByteBuffer buffer, | |
| 1423 [int offsetInBytes = 0, int length]) { | |
| 1424 if (length == null) { | |
| 1425 length = (buffer.lengthInBytes - offsetInBytes) ~/ | |
| 1426 Int32x4List.BYTES_PER_ELEMENT; | |
| 1427 } | |
| 1428 return new _Int32x4ArrayView(buffer, offsetInBytes, length); | |
| 1429 } | |
| 1430 | |
| 1431 | 1355 |
| 1432 Int32x4 operator[](int index) { | 1356 Int32x4 operator[](int index) { |
| 1433 if (index < 0 || index >= length) { | 1357 if (index < 0 || index >= length) { |
| 1434 _throwRangeError(index, length); | 1358 _throwRangeError(index, length); |
| 1435 } | 1359 } |
| 1436 return _getIndexedInt32x4(index); | 1360 return _getIndexedInt32x4(index); |
| 1437 } | 1361 } |
| 1438 | 1362 |
| 1439 void operator[]=(int index, Int32x4 value) { | 1363 void operator[]=(int index, Int32x4 value) { |
| 1440 if (index < 0 || index >= length) { | 1364 if (index < 0 || index >= length) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 } | 1397 } |
| 1474 | 1398 |
| 1475 | 1399 |
| 1476 class _Float64x2Array extends _TypedList implements Float64x2List { | 1400 class _Float64x2Array extends _TypedList implements Float64x2List { |
| 1477 // Factory constructors. | 1401 // Factory constructors. |
| 1478 | 1402 |
| 1479 factory _Float64x2Array(int length) { | 1403 factory _Float64x2Array(int length) { |
| 1480 return _new(length); | 1404 return _new(length); |
| 1481 } | 1405 } |
| 1482 | 1406 |
| 1483 factory _Float64x2Array.view(ByteBuffer buffer, | |
| 1484 [int offsetInBytes = 0, int length]) { | |
| 1485 if (length == null) { | |
| 1486 length = (buffer.lengthInBytes - offsetInBytes) ~/ | |
| 1487 Float64x2List.BYTES_PER_ELEMENT; | |
| 1488 } | |
| 1489 return new _Float64x2ArrayView(buffer, offsetInBytes, length); | |
| 1490 } | |
| 1491 | |
| 1492 | 1407 |
| 1493 Float64x2 operator[](int index) { | 1408 Float64x2 operator[](int index) { |
| 1494 if (index < 0 || index >= length) { | 1409 if (index < 0 || index >= length) { |
| 1495 _throwRangeError(index, length); | 1410 _throwRangeError(index, length); |
| 1496 } | 1411 } |
| 1497 return _getIndexedFloat64x2(index); | 1412 return _getIndexedFloat64x2(index); |
| 1498 } | 1413 } |
| 1499 | 1414 |
| 1500 void operator[]=(int index, Float64x2 value) { | 1415 void operator[]=(int index, Float64x2 value) { |
| 1501 if (index < 0 || index >= length) { | 1416 if (index < 0 || index >= length) { |
| (...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3644 return value; | 3559 return value; |
| 3645 } | 3560 } |
| 3646 return object; | 3561 return object; |
| 3647 } | 3562 } |
| 3648 | 3563 |
| 3649 | 3564 |
| 3650 void _throwRangeError(int index, int length) { | 3565 void _throwRangeError(int index, int length) { |
| 3651 String message = "$index must be in the range [0..$length)"; | 3566 String message = "$index must be in the range [0..$length)"; |
| 3652 throw new RangeError(message); | 3567 throw new RangeError(message); |
| 3653 } | 3568 } |
| OLD | NEW |