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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 throw new UnsupportedError( | 103 throw new UnsupportedError( |
104 "Cannot modify an unmodifiable list"); | 104 "Cannot modify an unmodifiable list"); |
105 } | 105 } |
106 | 106 |
107 /** This operation is not supported by an unmodifiable list. */ | 107 /** This operation is not supported by an unmodifiable list. */ |
108 void set length(int newLength) { | 108 void set length(int newLength) { |
109 throw new UnsupportedError( | 109 throw new UnsupportedError( |
110 "Cannot change the length of an unmodifiable list"); | 110 "Cannot change the length of an unmodifiable list"); |
111 } | 111 } |
112 | 112 |
| 113 void set last(E value) { |
| 114 throw new UnsupportedError( |
| 115 "Cannot modify an unmodifiable list"); |
| 116 } |
| 117 |
113 /** This operation is not supported by an unmodifiable list. */ | 118 /** This operation is not supported by an unmodifiable list. */ |
114 void setAll(int at, Iterable<E> iterable) { | 119 void setAll(int at, Iterable<E> iterable) { |
115 throw new UnsupportedError( | 120 throw new UnsupportedError( |
116 "Cannot modify an unmodifiable list"); | 121 "Cannot modify an unmodifiable list"); |
117 } | 122 } |
118 | 123 |
119 /** This operation is not supported by an unmodifiable list. */ | 124 /** This operation is not supported by an unmodifiable list. */ |
120 void add(E value) { | 125 void add(E value) { |
121 throw new UnsupportedError( | 126 throw new UnsupportedError( |
122 "Cannot add to an unmodifiable list"); | 127 "Cannot add to an unmodifiable list"); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 * or become empty or been otherwise modified. | 372 * or become empty or been otherwise modified. |
368 * It will still be a valid object, so references to it will not, e.g., crash | 373 * It will still be a valid object, so references to it will not, e.g., crash |
369 * the runtime if accessed, but no promises are made wrt. its contents. | 374 * the runtime if accessed, but no promises are made wrt. its contents. |
370 * | 375 * |
371 * This unspecified behavior is the reason the function is not exposed to | 376 * This unspecified behavior is the reason the function is not exposed to |
372 * users. We allow the underlying implementation to make the most efficient | 377 * users. We allow the underlying implementation to make the most efficient |
373 * conversion, at the cost of leaving the original list in an unspecified | 378 * conversion, at the cost of leaving the original list in an unspecified |
374 * state. | 379 * state. |
375 */ | 380 */ |
376 external List makeListFixedLength(List growableList); | 381 external List makeListFixedLength(List growableList); |
OLD | NEW |