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