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

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

Issue 9963029: Fix some warnings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload (due to error messages during upload) Created 8 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 // 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);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 int lastIndexOf(E element, [int start = 0]) => 44 int lastIndexOf(E element, [int start = 0]) =>
45 _list.lastIndexOf(element, start); 45 _list.lastIndexOf(element, start);
46 46
47 void clear() => _list.clear(); 47 void clear() => _list.clear();
48 48
49 E removeLast() => _list.removeLast(); 49 E removeLast() => _list.removeLast();
50 50
51 E last() => _list.last(); 51 E last() => _list.last();
52 52
53 List<E> getRange(int start, int length) => _list.getRange(start, length); 53 List<E> getRange(int start, int rangeLength) =>
54 _list.getRange(start, rangeLength);
54 55
55 void setRange(int start, int length, List<E> from, [int startFrom = 0]) => 56 void setRange(int start, int rangeLength, List<E> from, [int startFrom = 0])
56 _list.setRange(start, length, from, startFrom); 57 => _list.setRange(start, rangeLength, from, startFrom);
57 58
58 void removeRange(int start, int length) => _list.removeRange(start, length); 59 void removeRange(int start, int rangeLength) =>
60 _list.removeRange(start, rangeLength);
59 61
60 void insertRange(int start, int length, [E initialValue = null]) => 62 void insertRange(int start, int rangeLength, [E initialValue = null]) =>
61 _list.insertRange(start, length, initialValue); 63 _list.insertRange(start, rangeLength, initialValue);
62 64
63 E get first() => _list[0]; 65 E get first() => _list[0];
64 } 66 }
65 67
66 /** 68 /**
67 * 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
68 * instead of lists. 70 * instead of lists.
69 */ 71 */
70 class _NodeListWrapper extends _ListWrapper<Node> implements NodeList { 72 class _NodeListWrapper extends _ListWrapper<Node> implements NodeList {
71 _NodeListWrapper(List list) : super(list); 73 _NodeListWrapper(List list) : super(list);
72 74
73 NodeList filter(bool f(Node element)) => 75 NodeList filter(bool f(Node element)) =>
74 new _NodeListWrapper(_list.filter(f)); 76 new _NodeListWrapper(_list.filter(f));
75 77
76 NodeList getRange(int start, int length) => 78 NodeList getRange(int start, int rangeLength) =>
77 new _NodeListWrapper(_list.getRange(start, length)); 79 new _NodeListWrapper(_list.getRange(start, rangeLength));
78 } 80 }
79 81
80 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 82 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
81 _NodeImpl _parent; 83 _NodeImpl _parent;
82 84
83 // -- start List<Node> mixins. 85 // -- start List<Node> mixins.
84 // Node is the element type. 86 // Node is the element type.
85 87
86 // From Iterable<Node>: 88 // From Iterable<Node>:
87 89
(...skipping 14 matching lines...) Expand all
102 _parent.$dom_appendChild(value); 104 _parent.$dom_appendChild(value);
103 } 105 }
104 106
105 void addAll(Collection<_NodeImpl> collection) { 107 void addAll(Collection<_NodeImpl> collection) {
106 for (_NodeImpl node in collection) { 108 for (_NodeImpl node in collection) {
107 _parent.$dom_appendChild(node); 109 _parent.$dom_appendChild(node);
108 } 110 }
109 } 111 }
110 112
111 _NodeImpl removeLast() { 113 _NodeImpl removeLast() {
112 final last = this.last(); 114 final result = this.last();
113 if (last != null) { 115 if (result != null) {
114 _parent.$dom_removeChild(last); 116 _parent.$dom_removeChild(result);
115 } 117 }
116 return last; 118 return result;
117 } 119 }
118 120
119 void clear() { 121 void clear() {
120 _parent.text = ''; 122 _parent.text = '';
121 } 123 }
122 124
123 void operator []=(int index, _NodeImpl value) { 125 void operator []=(int index, _NodeImpl value) {
124 _parent.$dom_replaceChild(value, this[index]); 126 _parent.$dom_replaceChild(value, this[index]);
125 } 127 }
126 128
(...skipping 19 matching lines...) Expand all
146 int indexOf(Node element, [int start = 0]) => 148 int indexOf(Node element, [int start = 0]) =>
147 _Lists.indexOf(this, element, start, this.length); 149 _Lists.indexOf(this, element, start, this.length);
148 150
149 int lastIndexOf(Node element, [int start = 0]) => 151 int lastIndexOf(Node element, [int start = 0]) =>
150 _Lists.lastIndexOf(this, element, start); 152 _Lists.lastIndexOf(this, element, start);
151 153
152 Node last() => this[length - 1]; 154 Node last() => this[length - 1];
153 Node get first() => this[0]; 155 Node get first() => this[0];
154 156
155 // FIXME: implement thesee. 157 // FIXME: implement thesee.
156 void setRange(int start, int length, List<Node> from, [int startFrom]) { 158 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) {
157 throw new UnsupportedOperationException("Cannot setRange on immutable List." ); 159 throw new UnsupportedOperationException("Cannot setRange on immutable List." );
158 } 160 }
159 void removeRange(int start, int length) { 161 void removeRange(int start, int rangeLength) {
160 throw new UnsupportedOperationException("Cannot removeRange on immutable Lis t."); 162 throw new UnsupportedOperationException("Cannot removeRange on immutable Lis t.");
161 } 163 }
162 void insertRange(int start, int length, [Node initialValue]) { 164 void insertRange(int start, int rangeLength, [Node initialValue]) {
163 throw new UnsupportedOperationException("Cannot insertRange on immutable Lis t."); 165 throw new UnsupportedOperationException("Cannot insertRange on immutable Lis t.");
164 } 166 }
165 NodeList getRange(int start, int length) => 167 NodeList getRange(int start, int rangeLength) =>
166 new _NodeListWrapper(_Lists.getRange(this, start, length, <Node>[])); 168 new _NodeListWrapper(_Lists.getRange(this, start, rangeLength, <Node>[]));
167 169
168 // -- end List<Node> mixins. 170 // -- end List<Node> mixins.
169 171
170 $!MEMBERS 172 $!MEMBERS
171 } 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