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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Issue 11414069: Make mappedBy lazy. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload due to error. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index b9beb7011a8a83bfe5320eb231454f292efa545f..30234756445131eafecd7ff789c9e44c39eaf643 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -6964,7 +6964,7 @@ class DOMMimeTypeArray extends NativeFieldWrapperClass1 implements List<DOMMimeT
void forEach(void f(DOMMimeType element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(DOMMimeType element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(DOMMimeType element)) => new MappedIterable(this, f);
Collection<DOMMimeType> where(bool f(DOMMimeType element)) =>
_Collections.where(this, <DOMMimeType>[], f);
@@ -7125,7 +7125,7 @@ class DOMPluginArray extends NativeFieldWrapperClass1 implements List<DOMPlugin>
void forEach(void f(DOMPlugin element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(DOMPlugin element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(DOMPlugin element)) => new MappedIterable(this, f);
Collection<DOMPlugin> where(bool f(DOMPlugin element)) =>
_Collections.where(this, <DOMPlugin>[], f);
@@ -8803,13 +8803,7 @@ class _ChildrenElementList implements List {
return false;
}
- Collection mappedBy(f(Element element)) {
- final out = [];
- for (Element el in this) {
- out.add(f(el));
- }
- return out;
- }
+ Iterable mappedBy(f(Element element)) => new MappedIterable(this, f);
bool get isEmpty {
return _element.$dom_firstElementChild == null;
@@ -8920,13 +8914,7 @@ class _FrozenElementList implements List {
}
}
- Collection mappedBy(f(Element element)) {
- final out = [];
- for (Element el in this) {
- out.add(f(el));
- }
- return out;
- }
+ Iterable mappedBy(f(Element element)) => new MappedIterable(this, f);
List<Element> where(bool f(Element element)) {
final out = [];
@@ -10977,7 +10965,7 @@ class Float32Array extends ArrayBufferView implements List<num> {
void forEach(void f(num element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(num element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(num element)) => new MappedIterable(this, f);
Collection<num> where(bool f(num element)) =>
_Collections.where(this, <num>[], f);
@@ -11108,7 +11096,7 @@ class Float64Array extends ArrayBufferView implements List<num> {
void forEach(void f(num element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(num element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(num element)) => new MappedIterable(this, f);
Collection<num> where(bool f(num element)) =>
_Collections.where(this, <num>[], f);
@@ -11685,7 +11673,7 @@ class HTMLAllCollection extends NativeFieldWrapperClass1 implements List<Node> {
void forEach(void f(Node element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(Node element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(Node element)) => new MappedIterable(this, f);
Collection<Node> where(bool f(Node element)) =>
_Collections.where(this, <Node>[], f);
@@ -11796,7 +11784,7 @@ class HTMLCollection extends NativeFieldWrapperClass1 implements List<Node> {
void forEach(void f(Node element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(Node element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(Node element)) => new MappedIterable(this, f);
Collection<Node> where(bool f(Node element)) =>
_Collections.where(this, <Node>[], f);
@@ -14039,7 +14027,7 @@ class Int16Array extends ArrayBufferView implements List<int> {
void forEach(void f(int element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(int element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(int element)) => new MappedIterable(this, f);
Collection<int> where(bool f(int element)) =>
_Collections.where(this, <int>[], f);
@@ -14170,7 +14158,7 @@ class Int32Array extends ArrayBufferView implements List<int> {
void forEach(void f(int element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(int element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(int element)) => new MappedIterable(this, f);
Collection<int> where(bool f(int element)) =>
_Collections.where(this, <int>[], f);
@@ -14301,7 +14289,7 @@ class Int8Array extends ArrayBufferView implements List<int> {
void forEach(void f(int element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(int element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(int element)) => new MappedIterable(this, f);
Collection<int> where(bool f(int element)) =>
_Collections.where(this, <int>[], f);
@@ -17200,7 +17188,7 @@ class NamedNodeMap extends NativeFieldWrapperClass1 implements List<Node> {
void forEach(void f(Node element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(Node element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(Node element)) => new MappedIterable(this, f);
Collection<Node> where(bool f(Node element)) =>
_Collections.where(this, <Node>[], f);
@@ -17461,7 +17449,7 @@ class _ChildNodeListLazy implements List {
void forEach(void f(Node element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(Node element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(Node element)) => new MappedIterable(this, f);
Collection<Node> where(bool f(Node element)) =>
new _NodeListWrapper(_Collections.where(this, <Node>[], f));
@@ -17790,7 +17778,7 @@ class _ListWrapper<E> implements List<E> {
void forEach(void f(E element)) => _list.forEach(f);
- Collection mappedBy(f(E element)) => _list.mappedBy(f);
+ Iterable mappedBy(f(E element)) => new MappedIterable(this, f);
List<E> where(bool f(E element)) => _list.where(f);
@@ -17907,7 +17895,7 @@ class NodeList extends NativeFieldWrapperClass1 implements List<Node> {
void forEach(void f(Node element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(Node element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(Node element)) => new MappedIterable(this, f);
Collection<Node> where(bool f(Node element)) =>
new _NodeListWrapper(_Collections.where(this, <Node>[], f));
@@ -20215,7 +20203,7 @@ class SQLResultSetRowList extends NativeFieldWrapperClass1 implements List<Map>
void forEach(void f(Map element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(Map element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(Map element)) => new MappedIterable(this, f);
Collection<Map> where(bool f(Map element)) =>
_Collections.where(this, <Map>[], f);
@@ -20933,7 +20921,7 @@ class SourceBufferList extends EventTarget implements List<SourceBuffer> {
void forEach(void f(SourceBuffer element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(SourceBuffer element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(SourceBuffer element)) => new MappedIterable(this, f);
Collection<SourceBuffer> where(bool f(SourceBuffer element)) =>
_Collections.where(this, <SourceBuffer>[], f);
@@ -21132,7 +21120,7 @@ class SpeechGrammarList extends NativeFieldWrapperClass1 implements List<SpeechG
void forEach(void f(SpeechGrammar element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(SpeechGrammar element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(SpeechGrammar element)) => new MappedIterable(this, f);
Collection<SpeechGrammar> where(bool f(SpeechGrammar element)) =>
_Collections.where(this, <SpeechGrammar>[], f);
@@ -22793,7 +22781,7 @@ class TextTrackCueList extends NativeFieldWrapperClass1 implements List<TextTrac
void forEach(void f(TextTrackCue element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(TextTrackCue element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(TextTrackCue element)) => new MappedIterable(this, f);
Collection<TextTrackCue> where(bool f(TextTrackCue element)) =>
_Collections.where(this, <TextTrackCue>[], f);
@@ -22906,7 +22894,7 @@ class TextTrackList extends EventTarget implements List<TextTrack> {
void forEach(void f(TextTrack element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(TextTrack element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(TextTrack element)) => new MappedIterable(this, f);
Collection<TextTrack> where(bool f(TextTrack element)) =>
_Collections.where(this, <TextTrack>[], f);
@@ -23177,7 +23165,7 @@ class TouchList extends NativeFieldWrapperClass1 implements List<Touch> {
void forEach(void f(Touch element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(Touch element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(Touch element)) => new MappedIterable(this, f);
Collection<Touch> where(bool f(Touch element)) =>
_Collections.where(this, <Touch>[], f);
@@ -23545,7 +23533,7 @@ class Uint16Array extends ArrayBufferView implements List<int> {
void forEach(void f(int element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(int element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(int element)) => new MappedIterable(this, f);
Collection<int> where(bool f(int element)) =>
_Collections.where(this, <int>[], f);
@@ -23676,7 +23664,7 @@ class Uint32Array extends ArrayBufferView implements List<int> {
void forEach(void f(int element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(int element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(int element)) => new MappedIterable(this, f);
Collection<int> where(bool f(int element)) =>
_Collections.where(this, <int>[], f);
@@ -23807,7 +23795,7 @@ class Uint8Array extends ArrayBufferView implements List<int> {
void forEach(void f(int element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(int element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(int element)) => new MappedIterable(this, f);
Collection<int> where(bool f(int element)) =>
_Collections.where(this, <int>[], f);
@@ -26491,7 +26479,7 @@ class _CSSRuleList extends NativeFieldWrapperClass1 implements List<CSSRule> {
void forEach(void f(CSSRule element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(CSSRule element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(CSSRule element)) => new MappedIterable(this, f);
Collection<CSSRule> where(bool f(CSSRule element)) =>
_Collections.where(this, <CSSRule>[], f);
@@ -26594,7 +26582,7 @@ class _CSSValueList extends CSSValue implements List<CSSValue> {
void forEach(void f(CSSValue element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(CSSValue element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(CSSValue element)) => new MappedIterable(this, f);
Collection<CSSValue> where(bool f(CSSValue element)) =>
_Collections.where(this, <CSSValue>[], f);
@@ -26697,7 +26685,7 @@ class _ClientRectList extends NativeFieldWrapperClass1 implements List<ClientRec
void forEach(void f(ClientRect element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(ClientRect element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(ClientRect element)) => new MappedIterable(this, f);
Collection<ClientRect> where(bool f(ClientRect element)) =>
_Collections.where(this, <ClientRect>[], f);
@@ -26808,7 +26796,7 @@ class _DOMStringList extends NativeFieldWrapperClass1 implements List<String> {
void forEach(void f(String element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(String element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(String element)) => new MappedIterable(this, f);
Collection<String> where(bool f(String element)) =>
_Collections.where(this, <String>[], f);
@@ -27380,7 +27368,7 @@ class _EntryArray extends NativeFieldWrapperClass1 implements List<Entry> {
void forEach(void f(Entry element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(Entry element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(Entry element)) => new MappedIterable(this, f);
Collection<Entry> where(bool f(Entry element)) =>
_Collections.where(this, <Entry>[], f);
@@ -27483,7 +27471,7 @@ class _EntryArraySync extends NativeFieldWrapperClass1 implements List<EntrySync
void forEach(void f(EntrySync element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(EntrySync element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(EntrySync element)) => new MappedIterable(this, f);
Collection<EntrySync> where(bool f(EntrySync element)) =>
_Collections.where(this, <EntrySync>[], f);
@@ -27594,7 +27582,7 @@ class _FileList extends NativeFieldWrapperClass1 implements List<File> {
void forEach(void f(File element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(File element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(File element)) => new MappedIterable(this, f);
Collection<File> where(bool f(File element)) =>
_Collections.where(this, <File>[], f);
@@ -27721,7 +27709,7 @@ class _GamepadList extends NativeFieldWrapperClass1 implements List<Gamepad> {
void forEach(void f(Gamepad element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(Gamepad element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(Gamepad element)) => new MappedIterable(this, f);
Collection<Gamepad> where(bool f(Gamepad element)) =>
_Collections.where(this, <Gamepad>[], f);
@@ -27873,7 +27861,7 @@ class _MediaStreamList extends NativeFieldWrapperClass1 implements List<MediaStr
void forEach(void f(MediaStream element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(MediaStream element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(MediaStream element)) => new MappedIterable(this, f);
Collection<MediaStream> where(bool f(MediaStream element)) =>
_Collections.where(this, <MediaStream>[], f);
@@ -28080,7 +28068,7 @@ class _SpeechInputResultList extends NativeFieldWrapperClass1 implements List<Sp
void forEach(void f(SpeechInputResult element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(SpeechInputResult element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(SpeechInputResult element)) => new MappedIterable(this, f);
Collection<SpeechInputResult> where(bool f(SpeechInputResult element)) =>
_Collections.where(this, <SpeechInputResult>[], f);
@@ -28191,7 +28179,7 @@ class _SpeechRecognitionResultList extends NativeFieldWrapperClass1 implements L
void forEach(void f(SpeechRecognitionResult element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(SpeechRecognitionResult element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(SpeechRecognitionResult element)) => new MappedIterable(this, f);
Collection<SpeechRecognitionResult> where(bool f(SpeechRecognitionResult element)) =>
_Collections.where(this, <SpeechRecognitionResult>[], f);
@@ -28294,7 +28282,7 @@ class _StyleSheetList extends NativeFieldWrapperClass1 implements List<StyleShee
void forEach(void f(StyleSheet element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(StyleSheet element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(StyleSheet element)) => new MappedIterable(this, f);
Collection<StyleSheet> where(bool f(StyleSheet element)) =>
_Collections.where(this, <StyleSheet>[], f);
@@ -28405,7 +28393,7 @@ class _WebKitAnimationList extends NativeFieldWrapperClass1 implements List<Anim
void forEach(void f(Animation element)) => _Collections.forEach(this, f);
- Collection mappedBy(f(Animation element)) => _Collections.mappedBy(this, [], f);
+ Iterable mappedBy(f(Animation element)) => new MappedIterable(this, f);
Collection<Animation> where(bool f(Animation element)) =>
_Collections.where(this, <Animation>[], f);
@@ -28563,7 +28551,7 @@ abstract class CssClassSet implements Set<String> {
readClasses().forEach(f);
}
- Collection mappedBy(f(String element)) => readClasses().mappedBy(f);
+ Iterable mappedBy(f(String element)) => readClasses().mappedBy(f);
Collection<String> where(bool f(String element)) => readClasses().where(f);
@@ -28732,7 +28720,7 @@ class FilteredElementList implements List {
return result;
}
- Collection mappedBy(f(Element element)) => _filtered.mappedBy(f);
+ Iterable mappedBy(f(Element element)) => _filtered.mappedBy(f);
Collection<Element> where(bool f(Element element)) => _filtered.where(f);
bool every(bool f(Element element)) => _filtered.every(f);
bool some(bool f(Element element)) => _filtered.some(f);
@@ -29567,13 +29555,8 @@ class _Collections {
}
}
- static List mappedBy(Iterable<Object> source,
- List<Object> destination,
- f(o)) {
- for (final e in source) {
- destination.add(f(e));
- }
- return destination;
+ static Iterable mappedBy(Iterable<Object> source, f(o)) {
+ return new MappedIterable(source, f);
}
static bool some(Iterable<Object> iterable, bool f(Object o)) {

Powered by Google App Engine
This is Rietveld 408576698