| 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 | 4 |
| 5 import "dart:collection"; | 5 import "dart:collection"; |
| 6 import "dart:typeddata"; | 6 import "dart:typed_data"; |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 | 8 |
| 9 void main() { | 9 void main() { |
| 10 // Fixed length lists, length 4. | 10 // Fixed length lists, length 4. |
| 11 testFixedLengthList(new List(4)); | 11 testFixedLengthList(new List(4)); |
| 12 testFixedLengthList(new List(4).toList(growable: false)); | 12 testFixedLengthList(new List(4).toList(growable: false)); |
| 13 testFixedLengthList((new List()..length = 4).toList(growable: false)); | 13 testFixedLengthList((new List()..length = 4).toList(growable: false)); |
| 14 // ListBase implementation of List. | 14 // ListBase implementation of List. |
| 15 testFixedLengthList(new MyFixedList(new List(4))); | 15 testFixedLengthList(new MyFixedList(new List(4))); |
| 16 testFixedLengthList(new MyFixedList(new List(4)).toList(growable: false)); | 16 testFixedLengthList(new MyFixedList(new List(4)).toList(growable: false)); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 314 } |
| 315 | 315 |
| 316 class MyFixedList<E> extends ListBase<E> { | 316 class MyFixedList<E> extends ListBase<E> { |
| 317 List<E> _source; | 317 List<E> _source; |
| 318 MyFixedList(this._source); | 318 MyFixedList(this._source); |
| 319 int get length => _source.length; | 319 int get length => _source.length; |
| 320 void set length(int length) { throw new UnsupportedError("Fixed length!"); } | 320 void set length(int length) { throw new UnsupportedError("Fixed length!"); } |
| 321 E operator[](int index) => _source[index]; | 321 E operator[](int index) => _source[index]; |
| 322 void operator[]=(int index, E value) { _source[index] = value; } | 322 void operator[]=(int index, E value) { _source[index] = value; } |
| 323 } | 323 } |
| OLD | NEW |