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

Side by Side Diff: test/generated_sdk/lib/internal/iterable.dart

Issue 1010893004: Allow S->T <: dynamic->T (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase and address comments Created 5 years, 9 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
« no previous file with comments | « test/dart_codegen/expect/types.txt ('k') | tool/input_sdk/lib/internal/iterable.dart » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 * Marker interface for [Iterable] subclasses that have an efficient 8 * Marker interface for [Iterable] subclasses that have an efficient
9 * [length] implementation. 9 * [length] implementation.
10 */ 10 */
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 411
412 int get length => _source.length; 412 int get length => _source.length;
413 T elementAt(int index) => _f(_source.elementAt(index)); 413 T elementAt(int index) => _f(_source.elementAt(index));
414 } 414 }
415 415
416 416
417 typedef bool _ElementPredicate<E>(E element); 417 typedef bool _ElementPredicate<E>(E element);
418 418
419 class WhereIterable<E> extends IterableBase<E> { 419 class WhereIterable<E> extends IterableBase<E> {
420 final Iterable<E> _iterable; 420 final Iterable<E> _iterable;
421 final _ElementPredicate _f; 421 final _ElementPredicate<E> _f;
422 422
423 WhereIterable(this._iterable, bool this._f(E element)); 423 WhereIterable(this._iterable, bool this._f(E element));
424 424
425 Iterator<E> get iterator => new WhereIterator<E>(_iterable.iterator, _f); 425 Iterator<E> get iterator => new WhereIterator<E>(_iterable.iterator, _f);
426 } 426 }
427 427
428 class WhereIterator<E> extends Iterator<E> { 428 class WhereIterator<E> extends Iterator<E> {
429 final Iterator<E> _iterator; 429 final Iterator<E> _iterator;
430 final _ElementPredicate _f; 430 final _ElementPredicate<E> _f;
431 431
432 WhereIterator(this._iterator, bool this._f(E element)); 432 WhereIterator(this._iterator, bool this._f(E element));
433 433
434 bool moveNext() { 434 bool moveNext() {
435 while (_iterator.moveNext()) { 435 while (_iterator.moveNext()) {
436 if (_f(_iterator.current)) { 436 if (_f(_iterator.current)) {
437 return true; 437 return true;
438 } 438 }
439 } 439 }
440 return false; 440 return false;
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 * Creates errors throw by [Iterable] when the element count is wrong. 1160 * Creates errors throw by [Iterable] when the element count is wrong.
1161 */ 1161 */
1162 abstract class IterableElementError { 1162 abstract class IterableElementError {
1163 /** Error thrown thrown by, e.g., [Iterable.first] when there is no result. */ 1163 /** Error thrown thrown by, e.g., [Iterable.first] when there is no result. */
1164 static StateError noElement() => new StateError("No element"); 1164 static StateError noElement() => new StateError("No element");
1165 /** Error thrown by, e.g., [Iterable.single] if there are too many results. */ 1165 /** Error thrown by, e.g., [Iterable.single] if there are too many results. */
1166 static StateError tooMany() => new StateError("Too many elements"); 1166 static StateError tooMany() => new StateError("Too many elements");
1167 /** Error thrown by, e.g., [List.setRange] if there are too few elements. */ 1167 /** Error thrown by, e.g., [List.setRange] if there are too few elements. */
1168 static StateError tooFew() => new StateError("Too few elements"); 1168 static StateError tooFew() => new StateError("Too few elements");
1169 } 1169 }
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/types.txt ('k') | tool/input_sdk/lib/internal/iterable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698