Index: client/html/src/NodeWrappingImplementation.dart |
diff --git a/client/html/src/NodeWrappingImplementation.dart b/client/html/src/NodeWrappingImplementation.dart |
index 7ba378af09ca636a6098c47cfb01f5d35ae18cef..60139acb63e80c0182e2b1db6b62d7662b7e7704 100644 |
--- a/client/html/src/NodeWrappingImplementation.dart |
+++ b/client/html/src/NodeWrappingImplementation.dart |
@@ -137,65 +137,73 @@ class _ChildrenNodeList implements NodeList { |
} |
// TODO(nweiz): when all implementations we target have the same name for the |
-// coreimpl implementation of List<Node>, extend that rather than wrapping. |
-class _NodeList implements NodeList { |
- List<Node> _list; |
+// coreimpl implementation of List<E>, extend that rather than wrapping. |
+class _ListWrapper<E> implements List<E> { |
+ List<E> _list; |
- _NodeList(List<Node> this._list); |
+ _ListWrapper(List<E> this._list); |
- Iterator<Node> iterator() => _list.iterator(); |
+ Iterator<E> iterator() => _list.iterator(); |
- void forEach(void f(Node element)) => _list.forEach(f); |
+ void forEach(void f(E element)) => _list.forEach(f); |
- Collection map(f(Node element)) => _list.map(f); |
+ Collection map(f(E element)) => _list.map(f); |
- NodeList filter(bool f(Node element)) => new _NodeList(_list.filter(f)); |
+ List<E> filter(bool f(E element)) => _list.filter(f); |
- bool every(bool f(Node element)) => _list.every(f); |
+ bool every(bool f(E element)) => _list.every(f); |
- bool some(bool f(Node element)) => _list.some(f); |
+ bool some(bool f(E element)) => _list.some(f); |
bool isEmpty() => _list.isEmpty(); |
int get length() => _list.length; |
- Node operator [](int index) => _list[index]; |
+ E operator [](int index) => _list[index]; |
- void operator []=(int index, Node value) { _list[index] = value; } |
+ void operator []=(int index, E value) { _list[index] = value; } |
void set length(int newLength) { _list.length = newLength; } |
- void add(Node value) => _list.add(value); |
+ void add(E value) => _list.add(value); |
- void addLast(Node value) => _list.addLast(value); |
+ void addLast(E value) => _list.addLast(value); |
- void addAll(Collection<Node> collection) => _list.addAll(collection); |
+ void addAll(Collection<E> collection) => _list.addAll(collection); |
- void sort(int compare(Node a, Node b)) => _list.sort(compare); |
+ void sort(int compare(E a, E b)) => _list.sort(compare); |
- int indexOf(Node element, [int start = 0]) => _list.indexOf(element, start); |
+ int indexOf(E element, [int start = 0]) => _list.indexOf(element, start); |
- int lastIndexOf(Node element, [int start = 0]) => |
+ int lastIndexOf(E element, [int start = 0]) => |
_list.lastIndexOf(element, start); |
void clear() => _list.clear(); |
- Node removeLast() => _list.removeLast(); |
+ E removeLast() => _list.removeLast(); |
- Node last() => _list.last(); |
+ E last() => _list.last(); |
- NodeList getRange(int start, int length) => |
- new _NodeList(_list.getRange(start, length)); |
+ List<E> getRange(int start, int length) => _list.getRange(start, length); |
- void setRange(int start, int length, List<Node> from, [int startFrom = 0]) => |
+ void setRange(int start, int length, List<E> from, [int startFrom = 0]) => |
_list.setRange(start, length, from, startFrom); |
void removeRange(int start, int length) => _list.removeRange(start, length); |
- void insertRange(int start, int length, [Node initialValue = null]) => |
+ void insertRange(int start, int length, [E initialValue = null]) => |
_list.insertRange(start, length, initialValue); |
- Node get first() => _list[0]; |
+ E get first() => _list[0]; |
+} |
+ |
+class _NodeList extends _ListWrapper<Node> implements NodeList { |
+ _NodeList(List<Node> list) : super(list); |
+ |
+ NodeList filter(bool f(Node element)) => new _NodeList(super.filter(f)); |
+ |
+ NodeList getRange(int start, int length) => |
+ new _NodeList(super.getRange(start, length)); |
} |
class NodeWrappingImplementation extends EventTargetWrappingImplementation implements Node { |