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

Unified Diff: client/dom/templates/dom/frog/immutable_list_mixin.darttemplate

Issue 9113061: Reapply r3590 with frog fixes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged Created 8 years, 11 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 | « client/dom/src/_Lists.dart ('k') | frog/gen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/dom/templates/dom/frog/immutable_list_mixin.darttemplate
diff --git a/client/dom/templates/dom/frog/immutable_list_mixin.darttemplate b/client/dom/templates/dom/frog/immutable_list_mixin.darttemplate
new file mode 100644
index 0000000000000000000000000000000000000000..f5a22b54a9006a3d43fc656c250a59a2cf0f13ac
--- /dev/null
+++ b/client/dom/templates/dom/frog/immutable_list_mixin.darttemplate
@@ -0,0 +1,67 @@
+ // -- start List<$E> mixins.
+ // $E is the element type.
+
+ // From Iterable<$E>:
+
+ Iterator<$E> 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<$E>(this);
+ }
+
+ // From Collection<$E>:
+
+ void add($E value) {
+ throw new UnsupportedOperationException("Cannot add to immutable List.");
+ }
+
+ void addLast($E value) {
+ throw new UnsupportedOperationException("Cannot add to immutable List.");
+ }
+
+ void addAll(Collection<$E> collection) {
+ throw new UnsupportedOperationException("Cannot add to immutable List.");
+ }
+
+ void forEach(void f($E element)) => _Collections.forEach(this, f);
+
+ Collection map(f($E element)) => _Collections.map(this, [], f);
+
+ Collection<$E> filter(bool f($E element)) =>
+ _Collections.filter(this, <$E>[], f);
+
+ bool every(bool f($E element)) => _Collections.every(this, f);
+
+ bool some(bool f($E element)) => _Collections.some(this, f);
+
+ bool isEmpty() => this.length == 0;
+
+ // From List<$E>:
+
+ void sort(int compare($E a, $E b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
+ }
+
+ int indexOf($E element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
+
+ int lastIndexOf($E element, [int start = 0]) =>
+ _Lists.lastIndexOf(this, element, start);
+
+ $E last() => this[length - 1];
+
+ // FIXME: implement thesee.
+ void setRange(int start, int length, List<$E> from, [int startFrom]) {
+ throw new UnsupportedOperationException("Cannot setRange on immutable List.");
+ }
+ void removeRange(int start, int length) {
+ throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
+ }
+ void insertRange(int start, int length, [$E initialValue]) {
+ throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
+ }
+ List<$E> getRange(int start, int length) =>
+ _Lists.getRange(this, start, length, <$E>[]);
+
+ // -- end List<$E> mixins.
« no previous file with comments | « client/dom/src/_Lists.dart ('k') | frog/gen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698