Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: sdk/lib/internal/list.dart

Issue 397243002: Make IterableMixinWorkaround using classes return correctly typed Iterables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment, Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/internal/iterable.dart ('k') | tests/corelib/corelib.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 /** This operation is not supported by an unmodifiable map. */ 289 /** This operation is not supported by an unmodifiable map. */
290 void clear() { 290 void clear() {
291 throw new UnsupportedError("Cannot modify an unmodifiable map"); 291 throw new UnsupportedError("Cannot modify an unmodifiable map");
292 } 292 }
293 293
294 /** This operation is not supported by an unmodifiable map. */ 294 /** This operation is not supported by an unmodifiable map. */
295 void addAll(Map<int, E> other) { 295 void addAll(Map<int, E> other) {
296 throw new UnsupportedError("Cannot modify an unmodifiable map"); 296 throw new UnsupportedError("Cannot modify an unmodifiable map");
297 } 297 }
298
299 String toString() => Maps.mapToString(this);
298 } 300 }
299 301
300 class ReversedListIterable<E> extends ListIterable<E> { 302 class ReversedListIterable<E> extends ListIterable<E> {
301 Iterable<E> _source; 303 Iterable<E> _source;
302 ReversedListIterable(this._source); 304 ReversedListIterable(this._source);
303 305
304 int get length => _source.length; 306 int get length => _source.length;
305 307
306 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); 308 E elementAt(int index) => _source.elementAt(_source.length - 1 - index);
307 } 309 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 * or become empty or been otherwise modified. 369 * or become empty or been otherwise modified.
368 * It will still be a valid object, so references to it will not, e.g., crash 370 * 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. 371 * the runtime if accessed, but no promises are made wrt. its contents.
370 * 372 *
371 * This unspecified behavior is the reason the function is not exposed to 373 * This unspecified behavior is the reason the function is not exposed to
372 * users. We allow the underlying implementation to make the most efficient 374 * users. We allow the underlying implementation to make the most efficient
373 * conversion, at the cost of leaving the original list in an unspecified 375 * conversion, at the cost of leaving the original list in an unspecified
374 * state. 376 * state.
375 */ 377 */
376 external List makeListFixedLength(List growableList); 378 external List makeListFixedLength(List growableList);
OLDNEW
« no previous file with comments | « sdk/lib/internal/iterable.dart ('k') | tests/corelib/corelib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698