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

Side by Side Diff: tools/dom/templates/html/impl/impl_Element.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
« no previous file with comments | « tools/dom/src/WrappedList.dart ('k') | tools/dom/templates/html/impl/impl_Node.darttemplate » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // TODO(jacobr): use _Lists.dart to remove some of the duplicated 7 // TODO(jacobr): use _Lists.dart to remove some of the duplicated
8 // functionality. 8 // functionality.
9 class _ChildrenElementList implements List { 9 class _ChildrenElementList implements List {
10 // Raw Element. 10 // Raw Element.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 void sort([int compare(Element a, Element b)]) { 156 void sort([int compare(Element a, Element b)]) {
157 throw new UnsupportedError('TODO(jacobr): should we impl?'); 157 throw new UnsupportedError('TODO(jacobr): should we impl?');
158 } 158 }
159 159
160 dynamic reduce(dynamic initialValue, 160 dynamic reduce(dynamic initialValue,
161 dynamic combine(dynamic previousValue, Element element)) { 161 dynamic combine(dynamic previousValue, Element element)) {
162 return IterableMixinWorkaround.reduce(this, initialValue, combine); 162 return IterableMixinWorkaround.reduce(this, initialValue, combine);
163 } 163 }
164 164
165 dynamic fold(dynamic initialValue,
166 dynamic combine(dynamic previousValue, Element element)) {
167 return IterableMixinWorkaround.fold(this, initialValue, combine);
168 }
169
165 void setRange(int start, int rangeLength, List from, [int startFrom = 0]) { 170 void setRange(int start, int rangeLength, List from, [int startFrom = 0]) {
166 throw new UnimplementedError(); 171 throw new UnimplementedError();
167 } 172 }
168 173
169 void remove(Object object) { 174 void remove(Object object) {
170 if (object is Element) { 175 if (object is Element) {
171 Element element = object; 176 Element element = object;
172 if (identical(element.parentNode, _element)) { 177 if (identical(element.parentNode, _element)) {
173 _element.$dom_removeChild(element); 178 _element.$dom_removeChild(element);
174 } 179 }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 406
402 void sort([int compare(Element a, Element b)]) { 407 void sort([int compare(Element a, Element b)]) {
403 throw new UnsupportedError(''); 408 throw new UnsupportedError('');
404 } 409 }
405 410
406 dynamic reduce(dynamic initialValue, 411 dynamic reduce(dynamic initialValue,
407 dynamic combine(dynamic previousValue, Element element)) { 412 dynamic combine(dynamic previousValue, Element element)) {
408 return IterableMixinWorkaround.reduce(this, initialValue, combine); 413 return IterableMixinWorkaround.reduce(this, initialValue, combine);
409 } 414 }
410 415
416 dynamic fold(dynamic initialValue,
417 dynamic combine(dynamic previousValue, Element element)) {
418 return IterableMixinWorkaround.fold(this, initialValue, combine);
419 }
420
411 void setRange(int start, int rangeLength, List from, [int startFrom = 0]) { 421 void setRange(int start, int rangeLength, List from, [int startFrom = 0]) {
412 throw new UnsupportedError(''); 422 throw new UnsupportedError('');
413 } 423 }
414 424
415 void removeRange(int start, int rangeLength) { 425 void removeRange(int start, int rangeLength) {
416 throw new UnsupportedError(''); 426 throw new UnsupportedError('');
417 } 427 }
418 428
419 void insertRange(int start, int rangeLength, [initialValue = null]) { 429 void insertRange(int start, int rangeLength, [initialValue = null]) {
420 throw new UnsupportedError(''); 430 throw new UnsupportedError('');
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 const ScrollAlignment._internal(this._value); 1131 const ScrollAlignment._internal(this._value);
1122 toString() => 'ScrollAlignment.$_value'; 1132 toString() => 'ScrollAlignment.$_value';
1123 1133
1124 /// Attempt to align the element to the top of the scrollable area. 1134 /// Attempt to align the element to the top of the scrollable area.
1125 static const TOP = const ScrollAlignment._internal('TOP'); 1135 static const TOP = const ScrollAlignment._internal('TOP');
1126 /// Attempt to center the element in the scrollable area. 1136 /// Attempt to center the element in the scrollable area.
1127 static const CENTER = const ScrollAlignment._internal('CENTER'); 1137 static const CENTER = const ScrollAlignment._internal('CENTER');
1128 /// Attempt to align the element to the bottom of the scrollable area. 1138 /// Attempt to align the element to the bottom of the scrollable area.
1129 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1139 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1130 } 1140 }
OLDNEW
« no previous file with comments | « tools/dom/src/WrappedList.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