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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } | 351 } |
352 | 352 |
353 int elementAt(int index) { | 353 int elementAt(int index) { |
354 return this[index]; | 354 return this[index]; |
355 } | 355 } |
356 | 356 |
357 bool get isEmpty { | 357 bool get isEmpty { |
358 return this.length == 0; | 358 return this.length == 0; |
359 } | 359 } |
360 | 360 |
| 361 bool get isNotEmpty => !isEmpty; |
361 | 362 |
362 // Method(s) implementing the List interface. | 363 // Method(s) implementing the List interface. |
363 | 364 |
364 set length(newLength) { | 365 set length(newLength) { |
365 throw new UnsupportedError( | 366 throw new UnsupportedError( |
366 "Cannot resize a non-extendable array"); | 367 "Cannot resize a non-extendable array"); |
367 } | 368 } |
368 | 369 |
369 void add(value) { | 370 void add(value) { |
370 throw new UnsupportedError( | 371 throw new UnsupportedError( |
(...skipping 2734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3105 return value; | 3106 return value; |
3106 } | 3107 } |
3107 return object; | 3108 return object; |
3108 } | 3109 } |
3109 | 3110 |
3110 | 3111 |
3111 void _throwRangeError(int index, int length) { | 3112 void _throwRangeError(int index, int length) { |
3112 String message = "$index must be in the range [0..$length)"; | 3113 String message = "$index must be in the range [0..$length)"; |
3113 throw new RangeError(message); | 3114 throw new RangeError(message); |
3114 } | 3115 } |
OLD | NEW |