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

Side by Side Diff: lib/dom/templates/html/impl/impl_NodeList.darttemplate

Issue 10928060: Partially migrate from old getter syntax to new one. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 // TODO(nweiz): when all implementations we target have the same name for the 5 // TODO(nweiz): when all implementations we target have the same name for the
6 // coreimpl implementation of List<E>, extend that rather than wrapping. 6 // coreimpl implementation of List<E>, extend that rather than wrapping.
7 class _ListWrapper<E> implements List<E> { 7 class _ListWrapper<E> implements List<E> {
8 List _list; 8 List _list;
9 9
10 _ListWrapper(List this._list); 10 _ListWrapper(List this._list);
11 11
12 Iterator<E> iterator() => _list.iterator(); 12 Iterator<E> iterator() => _list.iterator();
13 13
14 void forEach(void f(E element)) => _list.forEach(f); 14 void forEach(void f(E element)) => _list.forEach(f);
15 15
16 Collection map(f(E element)) => _list.map(f); 16 Collection map(f(E element)) => _list.map(f);
17 17
18 List<E> filter(bool f(E element)) => _list.filter(f); 18 List<E> filter(bool f(E element)) => _list.filter(f);
19 19
20 bool every(bool f(E element)) => _list.every(f); 20 bool every(bool f(E element)) => _list.every(f);
21 21
22 bool some(bool f(E element)) => _list.some(f); 22 bool some(bool f(E element)) => _list.some(f);
23 23
24 bool isEmpty() => _list.isEmpty(); 24 bool isEmpty() => _list.isEmpty();
25 25
26 int get length() => _list.length; 26 int get length => _list.length;
27 27
28 E operator [](int index) => _list[index]; 28 E operator [](int index) => _list[index];
29 29
30 void operator []=(int index, E value) { _list[index] = value; } 30 void operator []=(int index, E value) { _list[index] = value; }
31 31
32 void set length(int newLength) { _list.length = newLength; } 32 void set length(int newLength) { _list.length = newLength; }
33 33
34 void add(E value) => _list.add(value); 34 void add(E value) => _list.add(value);
35 35
36 void addLast(E value) => _list.addLast(value); 36 void addLast(E value) => _list.addLast(value);
(...skipping 18 matching lines...) Expand all
55 55
56 void setRange(int start, int rangeLength, List<E> from, [int startFrom = 0]) 56 void setRange(int start, int rangeLength, List<E> from, [int startFrom = 0])
57 => _list.setRange(start, rangeLength, from, startFrom); 57 => _list.setRange(start, rangeLength, from, startFrom);
58 58
59 void removeRange(int start, int rangeLength) => 59 void removeRange(int start, int rangeLength) =>
60 _list.removeRange(start, rangeLength); 60 _list.removeRange(start, rangeLength);
61 61
62 void insertRange(int start, int rangeLength, [E initialValue = null]) => 62 void insertRange(int start, int rangeLength, [E initialValue = null]) =>
63 _list.insertRange(start, rangeLength, initialValue); 63 _list.insertRange(start, rangeLength, initialValue);
64 64
65 E get first() => _list[0]; 65 E get first => _list[0];
66 } 66 }
67 67
68 /** 68 /**
69 * This class is used to insure the results of list operations are NodeLists 69 * This class is used to insure the results of list operations are NodeLists
70 * instead of lists. 70 * instead of lists.
71 */ 71 */
72 class _NodeListWrapper extends _ListWrapper<Node> implements NodeList { 72 class _NodeListWrapper extends _ListWrapper<Node> implements NodeList {
73 _NodeListWrapper(List list) : super(list); 73 _NodeListWrapper(List list) : super(list);
74 74
75 NodeList filter(bool f(Node element)) => 75 NodeList filter(bool f(Node element)) =>
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 throw new UnsupportedOperationException("Cannot sort immutable List."); 145 throw new UnsupportedOperationException("Cannot sort immutable List.");
146 } 146 }
147 147
148 int indexOf(Node element, [int start = 0]) => 148 int indexOf(Node element, [int start = 0]) =>
149 _Lists.indexOf(this, element, start, this.length); 149 _Lists.indexOf(this, element, start, this.length);
150 150
151 int lastIndexOf(Node element, [int start = 0]) => 151 int lastIndexOf(Node element, [int start = 0]) =>
152 _Lists.lastIndexOf(this, element, start); 152 _Lists.lastIndexOf(this, element, start);
153 153
154 Node last() => this[length - 1]; 154 Node last() => this[length - 1];
155 Node get first() => this[0]; 155 Node get first => this[0];
156 156
157 // FIXME: implement thesee. 157 // FIXME: implement thesee.
158 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) { 158 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) {
159 throw new UnsupportedOperationException("Cannot setRange on immutable List." ); 159 throw new UnsupportedOperationException("Cannot setRange on immutable List." );
160 } 160 }
161 void removeRange(int start, int rangeLength) { 161 void removeRange(int start, int rangeLength) {
162 throw new UnsupportedOperationException("Cannot removeRange on immutable Lis t."); 162 throw new UnsupportedOperationException("Cannot removeRange on immutable Lis t.");
163 } 163 }
164 void insertRange(int start, int rangeLength, [Node initialValue]) { 164 void insertRange(int start, int rangeLength, [Node initialValue]) {
165 throw new UnsupportedOperationException("Cannot insertRange on immutable Lis t."); 165 throw new UnsupportedOperationException("Cannot insertRange on immutable Lis t.");
166 } 166 }
167 NodeList getRange(int start, int rangeLength) => 167 NodeList getRange(int start, int rangeLength) =>
168 new _NodeListWrapper(_Lists.getRange(this, start, rangeLength, <Node>[])); 168 new _NodeListWrapper(_Lists.getRange(this, start, rangeLength, <Node>[]));
169 169
170 // -- end List<Node> mixins. 170 // -- end List<Node> mixins.
171 171
172 $!MEMBERS 172 $!MEMBERS
173 } 173 }
OLDNEW
« no previous file with comments | « lib/dom/templates/html/impl/impl_Node.darttemplate ('k') | lib/dom/templates/html/impl/impl_SVGElement.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698