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:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user