mirror of
https://github.com/dart-lang/sdk
synced 2024-10-04 16:14:50 +00:00
Add WhereIterable.map
This makes some nice code improvements for dart2js. dart2js can't inline the MappedIterable factory constructor and specialize by optimization, so specializing by hand removes the test "is EfficientLength" for code like "x.where(f).map(g)". R=lrn@google.com Review URL: https://codereview.chromium.org/2354093002 .
This commit is contained in:
parent
74686371b3
commit
127b419fc1
|
@ -426,6 +426,10 @@ class WhereIterable<E> extends Iterable<E> {
|
|||
WhereIterable(this._iterable, bool this._f(E element));
|
||||
|
||||
Iterator<E> get iterator => new WhereIterator<E>(_iterable.iterator, _f);
|
||||
|
||||
// Specialization of [Iterable.map] to non-EfficientLength.
|
||||
Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E element)) =>
|
||||
new MappedIterable<E, dynamic/*=T*/>._(this, f);
|
||||
}
|
||||
|
||||
class WhereIterator<E> extends Iterator<E> {
|
||||
|
|
Loading…
Reference in a new issue