| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 abstract class UnmodifiableListBase<E> = | 231 abstract class UnmodifiableListBase<E> = |
| 232 ListBase<E> with UnmodifiableListMixin<E>; | 232 ListBase<E> with UnmodifiableListMixin<E>; |
| 233 | 233 |
| 234 class _ListIndicesIterable extends ListIterable<int> { | 234 class _ListIndicesIterable extends ListIterable<int> { |
| 235 List _backedList; | 235 List _backedList; |
| 236 | 236 |
| 237 _ListIndicesIterable(this._backedList); | 237 _ListIndicesIterable(this._backedList); |
| 238 | 238 |
| 239 int get length => _backedList.length; | 239 int get length => _backedList.length; |
| 240 int elementAt(int index) { | 240 int elementAt(int index) { |
| 241 if (index < 0 || index >= length) { | 241 RangeError.checkValidIndex(index, this); |
| 242 throw new RangeError.index(index, this); | |
| 243 } | |
| 244 return index; | 242 return index; |
| 245 } | 243 } |
| 246 } | 244 } |
| 247 | 245 |
| 248 class ListMapView<E> implements Map<int, E> { | 246 class ListMapView<E> implements Map<int, E> { |
| 249 List<E> _values; | 247 List<E> _values; |
| 250 | 248 |
| 251 ListMapView(this._values); | 249 ListMapView(this._values); |
| 252 | 250 |
| 253 E operator[] (int key) => containsKey(key) ? _values[key] : null; | 251 E operator[] (int key) => containsKey(key) ? _values[key] : null; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 * or become empty or been otherwise modified. | 367 * or become empty or been otherwise modified. |
| 370 * 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 |
| 371 * 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. |
| 372 * | 370 * |
| 373 * 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 |
| 374 * users. We allow the underlying implementation to make the most efficient | 372 * users. We allow the underlying implementation to make the most efficient |
| 375 * 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 |
| 376 * state. | 374 * state. |
| 377 */ | 375 */ |
| 378 external List makeListFixedLength(List growableList); | 376 external List makeListFixedLength(List growableList); |
| OLD | NEW |