OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // VMOptions=--use-far-branches | |
5 | 4 |
6 import "dart:collection"; | 5 import "dart:collection"; |
7 import "dart:typed_data"; | 6 import "dart:typed_data"; |
8 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
9 | 8 |
10 void main() { | 9 void main() { |
11 // Typed lists - fixed length and can only contain integers. | 10 // Typed lists - fixed length and can only contain integers. |
12 testTypedList(new Uint8List(4)); | 11 testTypedList(new Uint8List(4)); |
13 testTypedList(new Int8List(4)); | 12 testTypedList(new Int8List(4)); |
14 testTypedList(new Uint16List(4)); | 13 testTypedList(new Uint16List(4)); |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 } | 485 } |
487 | 486 |
488 class MyFixedList<E> extends ListBase<E> { | 487 class MyFixedList<E> extends ListBase<E> { |
489 List<E> _source; | 488 List<E> _source; |
490 MyFixedList(this._source); | 489 MyFixedList(this._source); |
491 int get length => _source.length; | 490 int get length => _source.length; |
492 void set length(int length) { throw new UnsupportedError("Fixed length!"); } | 491 void set length(int length) { throw new UnsupportedError("Fixed length!"); } |
493 E operator[](int index) => _source[index]; | 492 E operator[](int index) => _source[index]; |
494 void operator[]=(int index, E value) { _source[index] = value; } | 493 void operator[]=(int index, E value) { _source[index] = value; } |
495 } | 494 } |
OLD | NEW |