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

Unified Diff: lib/dom/frog/dom_frog.dart

Issue 10332038: FileList is a sequence - make it have indexer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/dom/dom.dart ('k') | lib/dom/idl/dart/dart.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/dom/frog/dom_frog.dart
diff --git a/lib/dom/frog/dom_frog.dart b/lib/dom/frog/dom_frog.dart
index 208514f0a6b5a963efc74b1c046e5bd86ba5e362..9d67d688bfdb5487b441bc6395273032e17514dc 100644
--- a/lib/dom/frog/dom_frog.dart
+++ b/lib/dom/frog/dom_frog.dart
@@ -2270,6 +2270,88 @@ class _FileListJs extends _DOMTypeJs implements FileList native "*FileList" {
final int length;
+ _FileJs operator[](int index) native "return this[index];";
+
+ void operator[]=(int index, _FileJs value) {
+ throw new UnsupportedOperationException("Cannot assign element of immutable List.");
+ }
+ // -- start List<File> mixins.
+ // File is the element type.
+
+ // From Iterable<File>:
+
+ Iterator<File> iterator() {
+ // Note: NodeLists are not fixed size. And most probably length shouldn't
+ // be cached in both iterator _and_ forEach method. For now caching it
+ // for consistency.
+ return new _FixedSizeListIterator<File>(this);
+ }
+
+ // From Collection<File>:
+
+ void add(File value) {
+ throw new UnsupportedOperationException("Cannot add to immutable List.");
+ }
+
+ void addLast(File value) {
+ throw new UnsupportedOperationException("Cannot add to immutable List.");
+ }
+
+ void addAll(Collection<File> collection) {
+ throw new UnsupportedOperationException("Cannot add to immutable List.");
+ }
+
+ void forEach(void f(File element)) => _Collections.forEach(this, f);
+
+ Collection map(f(File element)) => _Collections.map(this, [], f);
+
+ Collection<File> filter(bool f(File element)) =>
+ _Collections.filter(this, <File>[], f);
+
+ bool every(bool f(File element)) => _Collections.every(this, f);
+
+ bool some(bool f(File element)) => _Collections.some(this, f);
+
+ bool isEmpty() => this.length == 0;
+
+ // From List<File>:
+
+ void sort(int compare(File a, File b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
+ }
+
+ int indexOf(File element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
+
+ int lastIndexOf(File element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
+ }
+
+ File last() => this[length - 1];
+
+ File removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
+ }
+
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<File> from, [int startFrom]) {
+ throw new UnsupportedOperationException("Cannot setRange on immutable List.");
+ }
+
+ void removeRange(int start, int rangeLength) {
+ throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
+ }
+
+ void insertRange(int start, int rangeLength, [File initialValue]) {
+ throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
+ }
+
+ List<File> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <File>[]);
+
+ // -- end List<File> mixins.
+
_FileJs item(int index) native;
}
@@ -15016,7 +15098,7 @@ interface FileException {
// WARNING: Do not edit - generated code.
-interface FileList {
+interface FileList extends List<File> {
final int length;
« no previous file with comments | « lib/dom/dom.dart ('k') | lib/dom/idl/dart/dart.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698