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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 13548002: Add Iterable.fold (and Stream.fold) which replace `reduce`. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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:
Download patch
« no previous file with comments | « sdk/lib/core/iterable.dart ('k') | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 4516ec1eaa740c0c5fabb06abac07f3229f7039a..f282d2cf8dbb44d12e9bf5d4de4085ad41bd6e2c 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -7329,6 +7329,10 @@ class DomMimeTypeArray implements JavaScriptIndexingBehavior, List<DomMimeType>
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, DomMimeType)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(DomMimeType element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(DomMimeType element)) => IterableMixinWorkaround.forEach(this, f);
@@ -7593,6 +7597,10 @@ class DomPluginArray implements JavaScriptIndexingBehavior, List<DomPlugin> nati
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, DomPlugin)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(DomPlugin element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(DomPlugin element)) => IterableMixinWorkaround.forEach(this, f);
@@ -7964,6 +7972,10 @@ class DomStringList implements JavaScriptIndexingBehavior, List<String> native "
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, String)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
// contains() defined by IDL.
void forEach(void f(String element)) => IterableMixinWorkaround.forEach(this, f);
@@ -8341,6 +8353,11 @@ class _ChildrenElementList implements List {
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue,
+ dynamic combine(dynamic previousValue, Element element)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
void setRange(int start, int rangeLength, List from, [int startFrom = 0]) {
throw new UnimplementedError();
}
@@ -8587,6 +8604,11 @@ class _FrozenElementList implements List {
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue,
+ dynamic combine(dynamic previousValue, Element element)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
void setRange(int start, int rangeLength, List from, [int startFrom = 0]) {
throw new UnsupportedError('');
}
@@ -10917,6 +10939,10 @@ class FileList implements JavaScriptIndexingBehavior, List<File> native "*FileLi
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, File)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(File element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(File element)) => IterableMixinWorkaround.forEach(this, f);
@@ -11486,6 +11512,10 @@ class Float32Array extends ArrayBufferView implements JavaScriptIndexingBehavior
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, num)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(num element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(num element)) => IterableMixinWorkaround.forEach(this, f);
@@ -11714,6 +11744,10 @@ class Float64Array extends ArrayBufferView implements JavaScriptIndexingBehavior
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, num)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(num element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(num element)) => IterableMixinWorkaround.forEach(this, f);
@@ -12362,6 +12396,10 @@ class HtmlAllCollection implements JavaScriptIndexingBehavior, List<Node> native
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, Node)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(Node element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(Node element)) => IterableMixinWorkaround.forEach(this, f);
@@ -12579,6 +12617,10 @@ class HtmlCollection implements JavaScriptIndexingBehavior, List<Node> native "*
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, Node)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(Node element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(Node element)) => IterableMixinWorkaround.forEach(this, f);
@@ -14619,6 +14661,10 @@ class Int16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, int)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(int element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(int element)) => IterableMixinWorkaround.forEach(this, f);
@@ -14847,6 +14893,10 @@ class Int32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, int)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(int element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(int element)) => IterableMixinWorkaround.forEach(this, f);
@@ -15075,6 +15125,10 @@ class Int8Array extends ArrayBufferView implements JavaScriptIndexingBehavior, L
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, int)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(int element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(int element)) => IterableMixinWorkaround.forEach(this, f);
@@ -17653,6 +17707,11 @@ class _ChildNodeListLazy implements List {
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue,
+ dynamic combine(dynamic previousValue, Node element)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
String join([String separator]) {
return IterableMixinWorkaround.joinList(this, separator);
}
@@ -18151,6 +18210,10 @@ class NodeList implements JavaScriptIndexingBehavior, List<Node> native "*NodeLi
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, Node)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(Node element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(Node element)) => IterableMixinWorkaround.forEach(this, f);
@@ -20471,6 +20534,10 @@ class SourceBufferList extends EventTarget implements JavaScriptIndexingBehavior
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, SourceBuffer)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(SourceBuffer element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(SourceBuffer element)) => IterableMixinWorkaround.forEach(this, f);
@@ -20761,6 +20828,10 @@ class SpeechGrammarList implements JavaScriptIndexingBehavior, List<SpeechGramma
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, SpeechGrammar)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(SpeechGrammar element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(SpeechGrammar element)) => IterableMixinWorkaround.forEach(this, f);
@@ -22201,6 +22272,10 @@ class TextTrackCueList implements List<TextTrackCue>, JavaScriptIndexingBehavior
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, TextTrackCue)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(TextTrackCue element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(TextTrackCue element)) => IterableMixinWorkaround.forEach(this, f);
@@ -22416,6 +22491,10 @@ class TextTrackList extends EventTarget implements JavaScriptIndexingBehavior, L
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, TextTrack)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(TextTrack element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(TextTrack element)) => IterableMixinWorkaround.forEach(this, f);
@@ -22857,6 +22936,10 @@ class TouchList implements JavaScriptIndexingBehavior, List<Touch> native "*Touc
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, Touch)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(Touch element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(Touch element)) => IterableMixinWorkaround.forEach(this, f);
@@ -23335,6 +23418,10 @@ class Uint16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, int)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(int element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(int element)) => IterableMixinWorkaround.forEach(this, f);
@@ -23563,6 +23650,10 @@ class Uint32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, int)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(int element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(int element)) => IterableMixinWorkaround.forEach(this, f);
@@ -23791,6 +23882,10 @@ class Uint8Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, int)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(int element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(int element)) => IterableMixinWorkaround.forEach(this, f);
@@ -24016,6 +24111,10 @@ class Uint8ClampedArray extends Uint8Array implements JavaScriptIndexingBehavior
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, int)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(int element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(int element)) => IterableMixinWorkaround.forEach(this, f);
@@ -26556,6 +26655,10 @@ class _ClientRectList implements JavaScriptIndexingBehavior, List<Rect> native "
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, Rect)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(Rect element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(Rect element)) => IterableMixinWorkaround.forEach(this, f);
@@ -26763,6 +26866,10 @@ class _CssRuleList implements JavaScriptIndexingBehavior, List<CssRule> native "
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, CssRule)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(CssRule element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(CssRule element)) => IterableMixinWorkaround.forEach(this, f);
@@ -26970,6 +27077,10 @@ class _CssValueList extends CssValue implements List<CssValue>, JavaScriptIndexi
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, CssValue)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(CssValue element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(CssValue element)) => IterableMixinWorkaround.forEach(this, f);
@@ -27177,6 +27288,10 @@ class _EntryArray implements JavaScriptIndexingBehavior, List<Entry> native "*En
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, Entry)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(Entry element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(Entry element)) => IterableMixinWorkaround.forEach(this, f);
@@ -27384,6 +27499,10 @@ class _EntryArraySync implements JavaScriptIndexingBehavior, List<EntrySync> nat
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, EntrySync)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(EntrySync element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(EntrySync element)) => IterableMixinWorkaround.forEach(this, f);
@@ -27591,6 +27710,10 @@ class _GamepadList implements JavaScriptIndexingBehavior, List<Gamepad> native "
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, Gamepad)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(Gamepad element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(Gamepad element)) => IterableMixinWorkaround.forEach(this, f);
@@ -27861,6 +27984,10 @@ class _NamedNodeMap implements JavaScriptIndexingBehavior, List<Node> native "*N
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, Node)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(Node element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(Node element)) => IterableMixinWorkaround.forEach(this, f);
@@ -28092,6 +28219,10 @@ class _SpeechInputResultList implements JavaScriptIndexingBehavior, List<SpeechI
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, SpeechInputResult)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(SpeechInputResult element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(SpeechInputResult element)) => IterableMixinWorkaround.forEach(this, f);
@@ -28299,6 +28430,10 @@ class _SpeechRecognitionResultList implements JavaScriptIndexingBehavior, List<S
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, SpeechRecognitionResult)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(SpeechRecognitionResult element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(SpeechRecognitionResult element)) => IterableMixinWorkaround.forEach(this, f);
@@ -28506,6 +28641,10 @@ class _StyleSheetList implements JavaScriptIndexingBehavior, List<StyleSheet> na
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ dynamic fold(dynamic initialValue, dynamic combine(dynamic, StyleSheet)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
bool contains(StyleSheet element) => IterableMixinWorkaround.contains(this, element);
void forEach(void f(StyleSheet element)) => IterableMixinWorkaround.forEach(this, f);
@@ -29148,6 +29287,11 @@ abstract class CssClassSet implements Set<String> {
dynamic combine(dynamic previousValue, String element)) {
return readClasses().reduce(initialValue, combine);
}
+
+ dynamic fold(dynamic initialValue,
+ dynamic combine(dynamic previousValue, String element)) {
+ return readClasses().fold(initialValue, combine);
+ }
// interface Collection - END
// interface Set - BEGIN
@@ -31571,6 +31715,9 @@ class _WrappedList<E> implements List<E> {
dynamic reduce(initialValue, combine(previousValue, E element)) =>
_list.reduce(initialValue, combine);
+ dynamic fold(initialValue, combine(previousValue, E element)) =>
+ _list.fold(initialValue, combine);
+
bool every(bool f(E element)) => _list.every(f);
String join([String separator]) => _list.join(separator);
« no previous file with comments | « sdk/lib/core/iterable.dart ('k') | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698