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 part of dart._internal; | 5 part of dart._internal; |
6 | 6 |
7 /** | 7 /** |
8 * Mixin that throws on the length changing operations of [List]. | 8 * Mixin that throws on the length changing operations of [List]. |
9 * | 9 * |
10 * Intended to mix-in on top of [ListMixin] for fixed-length lists. | 10 * Intended to mix-in on top of [ListMixin] for fixed-length lists. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 "Cannot modify an unmodifiable list"); | 116 "Cannot modify an unmodifiable list"); |
117 } | 117 } |
118 | 118 |
119 /** This operation is not supported by an unmodifiable list. */ | 119 /** This operation is not supported by an unmodifiable list. */ |
120 void add(E value) { | 120 void add(E value) { |
121 throw new UnsupportedError( | 121 throw new UnsupportedError( |
122 "Cannot add to an unmodifiable list"); | 122 "Cannot add to an unmodifiable list"); |
123 } | 123 } |
124 | 124 |
125 /** This operation is not supported by an unmodifiable list. */ | 125 /** This operation is not supported by an unmodifiable list. */ |
126 E insert(int index, E value) { | 126 void insert(int index, E element) { |
127 throw new UnsupportedError( | 127 throw new UnsupportedError( |
128 "Cannot add to an unmodifiable list"); | 128 "Cannot add to an unmodifiable list"); |
129 } | 129 } |
130 | 130 |
131 /** This operation is not supported by an unmodifiable list. */ | 131 /** This operation is not supported by an unmodifiable list. */ |
132 void insertAll(int at, Iterable<E> iterable) { | 132 void insertAll(int at, Iterable<E> iterable) { |
133 throw new UnsupportedError( | 133 throw new UnsupportedError( |
134 "Cannot add to an unmodifiable list"); | 134 "Cannot add to an unmodifiable list"); |
135 } | 135 } |
136 | 136 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 * or as returned by [makeListFixedLength]. | 383 * or as returned by [makeListFixedLength]. |
384 * | 384 * |
385 * The operation is efficient. It doesn't copy the elements, but converts | 385 * The operation is efficient. It doesn't copy the elements, but converts |
386 * the existing list directly to a fixed length list. | 386 * the existing list directly to a fixed length list. |
387 * That means that it is a destructive conversion. | 387 * That means that it is a destructive conversion. |
388 * The original list should not be used afterwards. | 388 * The original list should not be used afterwards. |
389 * | 389 * |
390 * The unmodifiable list type is similar to the one used by const lists. | 390 * The unmodifiable list type is similar to the one used by const lists. |
391 */ | 391 */ |
392 external List makeFixedListUnmodifiable(List fixedLengthList); | 392 external List makeFixedListUnmodifiable(List fixedLengthList); |
OLD | NEW |