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

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

Issue 12262037: Make List.skip, List.take and List.reversed return Iterables, not Lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments, small fixes. Created 7 years, 10 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 // 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 Element addLast(Element value) => add(value); 138 Element addLast(Element value) => add(value);
139 139
140 Iterator<Element> get iterator => toList().iterator; 140 Iterator<Element> get iterator => toList().iterator;
141 141
142 void addAll(Iterable<Element> iterable) { 142 void addAll(Iterable<Element> iterable) {
143 for (Element element in iterable) { 143 for (Element element in iterable) {
144 _element.$dom_appendChild(element); 144 _element.$dom_appendChild(element);
145 } 145 }
146 } 146 }
147 147
148 List<Element> get reversed { 148 Iterable<Element> get reversed {
149 return IterableMixinWorkaround.reversedList(this); 149 return IterableMixinWorkaround.reversedList(this);
150 } 150 }
151 151
152 void sort([int compare(Element a, Element b)]) { 152 void sort([int compare(Element a, Element b)]) {
153 throw new UnsupportedError('TODO(jacobr): should we impl?'); 153 throw new UnsupportedError('TODO(jacobr): should we impl?');
154 } 154 }
155 155
156 dynamic reduce(dynamic initialValue, 156 dynamic reduce(dynamic initialValue,
157 dynamic combine(dynamic previousValue, Element element)) { 157 dynamic combine(dynamic previousValue, Element element)) {
158 return IterableMixinWorkaround.reduce(this, initialValue, combine); 158 return IterableMixinWorkaround.reduce(this, initialValue, combine);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 void addLast(Element value) { 372 void addLast(Element value) {
373 throw new UnsupportedError(''); 373 throw new UnsupportedError('');
374 } 374 }
375 375
376 Iterator<Element> get iterator => new _FrozenElementListIterator(this); 376 Iterator<Element> get iterator => new _FrozenElementListIterator(this);
377 377
378 void addAll(Iterable<Element> iterable) { 378 void addAll(Iterable<Element> iterable) {
379 throw new UnsupportedError(''); 379 throw new UnsupportedError('');
380 } 380 }
381 381
382 List<Element> get reversed { 382 Iterable<Element> get reversed {
383 return IterableMixinWorkaround.reversedList(this); 383 return IterableMixinWorkaround.reversedList(this);
384 } 384 }
385 385
386 void sort([int compare(Element a, Element b)]) { 386 void sort([int compare(Element a, Element b)]) {
387 throw new UnsupportedError(''); 387 throw new UnsupportedError('');
388 } 388 }
389 389
390 dynamic reduce(dynamic initialValue, 390 dynamic reduce(dynamic initialValue,
391 dynamic combine(dynamic previousValue, Element element)) { 391 dynamic combine(dynamic previousValue, Element element)) {
392 return IterableMixinWorkaround.reduce(this, initialValue, combine); 392 return IterableMixinWorkaround.reduce(this, initialValue, combine);
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 const ScrollAlignment._internal(this._value); 1112 const ScrollAlignment._internal(this._value);
1113 toString() => 'ScrollAlignment.$_value'; 1113 toString() => 'ScrollAlignment.$_value';
1114 1114
1115 /// Attempt to align the element to the top of the scrollable area. 1115 /// Attempt to align the element to the top of the scrollable area.
1116 static const TOP = const ScrollAlignment._internal('TOP'); 1116 static const TOP = const ScrollAlignment._internal('TOP');
1117 /// Attempt to center the element in the scrollable area. 1117 /// Attempt to center the element in the scrollable area.
1118 static const CENTER = const ScrollAlignment._internal('CENTER'); 1118 static const CENTER = const ScrollAlignment._internal('CENTER');
1119 /// Attempt to align the element to the bottom of the scrollable area. 1119 /// Attempt to align the element to the bottom of the scrollable area.
1120 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1120 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1121 } 1121 }
OLDNEW
« no previous file with comments | « tests/corelib/list_reversed_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