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

Unified Diff: tools/dom/templates/immutable_list_mixin.darttemplate

Issue 14071002: Added new version of reduce. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed more uses of max, and a few bugs. Created 7 years, 8 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
Index: tools/dom/templates/immutable_list_mixin.darttemplate
diff --git a/tools/dom/templates/immutable_list_mixin.darttemplate b/tools/dom/templates/immutable_list_mixin.darttemplate
index a2c1a99b339ca6100ad9381ea07f08ef580e36a6..7376bc48fadec25daabddba5995c88d746d6050b 100644
--- a/tools/dom/templates/immutable_list_mixin.darttemplate
+++ b/tools/dom/templates/immutable_list_mixin.darttemplate
@@ -14,11 +14,12 @@ $if DEFINE_LENGTH_AS_NUM_ITEMS
// SVG Collections expose numberOfItems rather than length.
int get length => numberOfItems;
$endif
- dynamic reduce(dynamic initialValue, dynamic combine(dynamic, $E)) {
- return IterableMixinWorkaround.reduce(this, initialValue, combine);
+ $E reduce($E combine($E value, $E element)) {
+ return IterableMixinWorkaround.reduce(this, combine);
}
- dynamic fold(dynamic initialValue, dynamic combine(dynamic, $E)) {
+ dynamic fold(dynamic initialValue,
+ dynamic combine(dynamic previousValue, $E element)) {
return IterableMixinWorkaround.fold(this, initialValue, combine);
}
@@ -138,12 +139,6 @@ $endif
throw new StateError("More than one element");
}
- $E min([int compare($E a, $E b)]) =>
- IterableMixinWorkaround.min(this, compare);
-
- $E max([int compare($E a, $E b)]) =>
- IterableMixinWorkaround.max(this, compare);
-
void insert(int index, $E element) {
throw new UnsupportedError("Cannot add to immutable List.");
}

Powered by Google App Engine
This is Rietveld 408576698