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

Side by Side Diff: tools/dom/templates/html/impl/impl_Node.darttemplate

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:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 /** 7 /**
8 * Lazy implementation of the child nodes of an element that does not request 8 * Lazy implementation of the child nodes of an element that does not request
9 * the actual child nodes of an element until strictly necessary greatly 9 * the actual child nodes of an element until strictly necessary greatly
10 * improving performance for the typical cases where it is not required. 10 * improving performance for the typical cases where it is not required.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // looking up the nodeList only once instead of once per iteration. 143 // looking up the nodeList only once instead of once per iteration.
144 bool contains(Node element) => IterableMixinWorkaround.contains(this, element) ; 144 bool contains(Node element) => IterableMixinWorkaround.contains(this, element) ;
145 145
146 void forEach(void f(Node element)) => IterableMixinWorkaround.forEach(this, f) ; 146 void forEach(void f(Node element)) => IterableMixinWorkaround.forEach(this, f) ;
147 147
148 dynamic reduce(dynamic initialValue, 148 dynamic reduce(dynamic initialValue,
149 dynamic combine(dynamic previousValue, Node element)) { 149 dynamic combine(dynamic previousValue, Node element)) {
150 return IterableMixinWorkaround.reduce(this, initialValue, combine); 150 return IterableMixinWorkaround.reduce(this, initialValue, combine);
151 } 151 }
152 152
153 dynamic fold(dynamic initialValue,
154 dynamic combine(dynamic previousValue, Node element)) {
155 return IterableMixinWorkaround.fold(this, initialValue, combine);
156 }
157
153 String join([String separator]) { 158 String join([String separator]) {
154 return IterableMixinWorkaround.joinList(this, separator); 159 return IterableMixinWorkaround.joinList(this, separator);
155 } 160 }
156 161
157 Iterable map(f(Node element)) { 162 Iterable map(f(Node element)) {
158 return IterableMixinWorkaround.mapList(this, f); 163 return IterableMixinWorkaround.mapList(this, f);
159 } 164 }
160 165
161 Iterable<Node> where(bool f(Node element)) { 166 Iterable<Node> where(bool f(Node element)) {
162 return IterableMixinWorkaround.where(this, f); 167 return IterableMixinWorkaround.where(this, f);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 if (_modelChangedStream == null) { 413 if (_modelChangedStream == null) {
409 // Ensure the model is cached locally to minimize change notifications. 414 // Ensure the model is cached locally to minimize change notifications.
410 _model = model; 415 _model = model;
411 _modelChangedStream = new StreamController.broadcast(); 416 _modelChangedStream = new StreamController.broadcast();
412 } 417 }
413 return _modelChangedStream.stream; 418 return _modelChangedStream.stream;
414 } 419 }
415 420
416 $!MEMBERS 421 $!MEMBERS
417 } 422 }
OLDNEW
« no previous file with comments | « tools/dom/templates/html/impl/impl_Element.darttemplate ('k') | tools/dom/templates/immutable_list_mixin.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698