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

Unified Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 11971016: Create IterableMixinWorkaround and move most of the Collections methods there. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo (mappedByList instead of mappedBy). Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/corelib/iterable_min_max_test.dart ('k') | tools/dom/templates/html/impl/impl_Node.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_Element.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index 557c4206b564a62ac8c869199e6b4d866ea72c48..1d5626cf0c51f650828a260b65d58d0873375495 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -58,46 +58,47 @@ class _ChildrenElementList implements List {
}
String join([String separator]) {
- return Collections.joinList(this, separator);
+ return IterableMixinWorkaround.joinList(this, separator);
}
List mappedBy(f(Element element)) {
- return new MappedList<Element, dynamic>(this, f);
+ return IterableMixinWorkaround.mappedByList(this, f);
}
- Iterable<Element> where(bool f(Element element))
- => new WhereIterable(this, f);
+ Iterable<Element> where(bool f(Element element)) {
+ return IterableMixinWorkaround.where(this, f);
+ }
bool get isEmpty {
return _element.$dom_firstElementChild == null;
}
List<Element> take(int n) {
- return new ListView<Element>(this, 0, n);
+ return IterableMixinWorkaround.takeList(this, n);
}
Iterable<Element> takeWhile(bool test(Element value)) {
- return new TakeWhileIterable<Element>(this, test);
+ return IterableMixinWorkaround.takeWhile(this, test);
}
List<Element> skip(int n) {
- return new ListView<Element>(this, n, null);
+ return IterableMixinWorkaround.skipList(this, n);
}
Iterable<Element> skipWhile(bool test(Element value)) {
- return new SkipWhileIterable<Element>(this, test);
+ return IterableMixinWorkaround.skipWhile(this, test);
}
Element firstMatching(bool test(Element value), {Element orElse()}) {
- return Collections.firstMatching(this, test, orElse);
+ return IterableMixinWorkaround.firstMatching(this, test, orElse);
}
Element lastMatching(bool test(Element value), {Element orElse()}) {
- return Collections.lastMatchingInList(this, test, orElse);
+ return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
}
Element singleMatching(bool test(Element value)) {
- return Collections.singleMatching(this, test);
+ return IterableMixinWorkaround.singleMatching(this, test);
}
Element elementAt(int index) {
@@ -142,7 +143,7 @@ class _ChildrenElementList implements List {
dynamic reduce(dynamic initialValue,
dynamic combine(dynamic previousValue, Element element)) {
- return Collections.reduce(this, initialValue, combine);
+ return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
void setRange(int start, int rangeLength, List from, [int startFrom = 0]) {
@@ -210,11 +211,11 @@ class _ChildrenElementList implements List {
}
Element min([int compare(Element a, Element b)]) {
- return Collections.min(this, compare);
+ return IterableMixinWorkaround.min(this, compare);
}
Element max([int compare(Element a, Element b)]) {
- return Collections.max(this, compare);
+ return IterableMixinWorkaround.max(this, compare);
}
}
@@ -241,15 +242,16 @@ class _FrozenElementList implements List {
}
String join([String separator]) {
- return Collections.joinList(this, separator);
+ return IterableMixinWorkaround.joinList(this, separator);
}
List mappedBy(f(Element element)) {
- return new MappedList<Element, dynamic>(this, f);
+ return IterableMixinWorkaround.mappedByList(this, f);
}
- Iterable<Element> where(bool f(Element element))
- => new WhereIterable(this, f);
+ Iterable<Element> where(bool f(Element element)) {
+ return IterableMixinWorkaround.where(this, f);
+ }
bool every(bool f(Element element)) {
for(Element element in this) {
@@ -273,31 +275,31 @@ class _FrozenElementList implements List {
Set<Element> toSet() => new Set<Element>.from(this);
List<Element> take(int n) {
- return new ListView<Element>(this, 0, n);
+ return IterableMixinWorkaround.takeList(this, n);
}
Iterable<Element> takeWhile(bool test(Element value)) {
- return new TakeWhileIterable<Element>(this, test);
+ return IterableMixinWorkaround.takeWhile(this, test);
}
List<Element> skip(int n) {
- return new ListView<Element>(this, n, null);
+ return IterableMixinWorkaround.skipList(this, n);
}
Iterable<Element> skipWhile(bool test(Element value)) {
- return new SkipWhileIterable<Element>(this, test);
+ return IterableMixinWorkaround.skipWhile(this, test);
}
Element firstMatching(bool test(Element value), {Element orElse()}) {
- return Collections.firstMatching(this, test, orElse);
+ return IterableMixinWorkaround.firstMatching(this, test, orElse);
}
Element lastMatching(bool test(Element value), {Element orElse()}) {
- return Collections.lastMatchingInList(this, test, orElse);
+ return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
}
Element singleMatching(bool test(Element value)) {
- return Collections.singleMatching(this, test);
+ return IterableMixinWorkaround.singleMatching(this, test);
}
Element elementAt(int index) {
@@ -338,7 +340,7 @@ class _FrozenElementList implements List {
dynamic reduce(dynamic initialValue,
dynamic combine(dynamic previousValue, Element element)) {
- return Collections.reduce(this, initialValue, combine);
+ return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
void setRange(int start, int rangeLength, List from, [int startFrom = 0]) {
@@ -381,11 +383,11 @@ class _FrozenElementList implements List {
Element get single => _nodeList.single;
Element min([int compare(Element a, Element b)]) {
- return Collections.min(this, compare);
+ return IterableMixinWorkaround.min(this, compare);
}
Element max([int compare(Element a, Element b)]) {
- return Collections.max(this, compare);
+ return IterableMixinWorkaround.max(this, compare);
}
}
« no previous file with comments | « tests/corelib/iterable_min_max_test.dart ('k') | tools/dom/templates/html/impl/impl_Node.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698