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

Unified Diff: lib/html/dartium/html_dartium.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 9956126: Fix for Issue 2399. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: supressions 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:
Download patch
« no previous file with comments | « lib/dom/templates/immutable_list_mixin.darttemplate ('k') | lib/html/frog/html_frog.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/html/dartium/html_dartium.dart
diff --git a/lib/html/dartium/html_dartium.dart b/lib/html/dartium/html_dartium.dart
index 4c3568322a8e51cd4bdbe0ad852da41434f3cd93..14ef105a3330a02c17f83bd09033128b92fb8e23 100644
--- a/lib/html/dartium/html_dartium.dart
+++ b/lib/html/dartium/html_dartium.dart
@@ -4739,10 +4739,22 @@ class _CanvasPixelArrayImpl extends _DOMTypeBase implements CanvasPixelArray {
int operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, int value) {
- throw new UnsupportedOperationException("Cannot assign element of immutable List.");
+ return _ptr[index] = _unwrap(value);
}
+ // -- start List<int> mixins.
+ // int is the element type.
+
+ // From Iterable<int>:
+
+ Iterator<int> 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<int>(this);
+ }
+
+ // From Collection<int>:
void add(int value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
@@ -4756,78 +4768,56 @@ class _CanvasPixelArrayImpl extends _DOMTypeBase implements CanvasPixelArray {
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(int a, int b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(int element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(int element)) => _Collections.map(this, [], f);
- int indexOf(int element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<int> filter(bool f(int element)) =>
+ _Collections.filter(this, <int>[], f);
- int lastIndexOf(int element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(int element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(int element)) => _Collections.some(this, f);
- int removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- int last() {
- return this[length - 1];
- }
+ // From List<int>:
- void forEach(void f(int element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(int a, int b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(int element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(int element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<int> filter(bool f(int element)) {
- return _Collections.filter(this, new List<int>(), f);
+ int lastIndexOf(int element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(int element)) {
- return _Collections.every(this, f);
- }
+ int last() => this[length - 1];
- bool some(bool f(int element)) {
- return _Collections.some(this, f);
+ int removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<int> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [int initialValue]) {
+ void insertRange(int start, int rangeLength, [int initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<int> getRange(int start, int length) {
- throw new NotImplementedException();
- }
-
- bool isEmpty() {
- return length == 0;
- }
+ List<int> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <int>[]);
- Iterator<int> iterator() {
- return new _FixedSizeListIterator<int>(this);
- }
+ // -- end List<int> mixins.
}
class _CanvasRenderingContextImpl extends _DOMTypeBase implements CanvasRenderingContext {
@@ -9376,11 +9366,23 @@ class _Float32ArrayImpl extends _ArrayBufferViewImpl implements Float32Array, Li
num operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, num value) {
- throw new UnsupportedOperationException("Cannot assign element of immutable List.");
+ return _ptr[index] = _unwrap(value);
+ }
+ // -- start List<num> mixins.
+ // num is the element type.
+
+ // From Iterable<num>:
+
+ Iterator<num> 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<num>(this);
}
+ // From Collection<num>:
+
void add(num value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
@@ -9393,78 +9395,56 @@ class _Float32ArrayImpl extends _ArrayBufferViewImpl implements Float32Array, Li
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(num a, num b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(num element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(num element)) => _Collections.map(this, [], f);
- int indexOf(num element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<num> filter(bool f(num element)) =>
+ _Collections.filter(this, <num>[], f);
- int lastIndexOf(num element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(num element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(num element)) => _Collections.some(this, f);
- num removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- num last() {
- return this[length - 1];
- }
+ // From List<num>:
- void forEach(void f(num element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(num a, num b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(num element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(num element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<num> filter(bool f(num element)) {
- return _Collections.filter(this, new List<num>(), f);
+ int lastIndexOf(num element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(num element)) {
- return _Collections.every(this, f);
- }
+ num last() => this[length - 1];
- bool some(bool f(num element)) {
- return _Collections.some(this, f);
+ num removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<num> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<num> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [num initialValue]) {
+ void insertRange(int start, int rangeLength, [num initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<num> getRange(int start, int length) {
- throw new NotImplementedException();
- }
+ List<num> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <num>[]);
- bool isEmpty() {
- return length == 0;
- }
-
- Iterator<num> iterator() {
- return new _FixedSizeListIterator<num>(this);
- }
+ // -- end List<num> mixins.
void setElements(Object array, [int offset = null]) {
if (offset === null) {
@@ -9492,10 +9472,22 @@ class _Float64ArrayImpl extends _ArrayBufferViewImpl implements Float64Array, Li
num operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, num value) {
- throw new UnsupportedOperationException("Cannot assign element of immutable List.");
+ return _ptr[index] = _unwrap(value);
}
+ // -- start List<num> mixins.
+ // num is the element type.
+
+ // From Iterable<num>:
+
+ Iterator<num> 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<num>(this);
+ }
+
+ // From Collection<num>:
void add(num value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
@@ -9509,78 +9501,56 @@ class _Float64ArrayImpl extends _ArrayBufferViewImpl implements Float64Array, Li
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(num a, num b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(num element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(num element)) => _Collections.map(this, [], f);
- int indexOf(num element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<num> filter(bool f(num element)) =>
+ _Collections.filter(this, <num>[], f);
- int lastIndexOf(num element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(num element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(num element)) => _Collections.some(this, f);
- num removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- num last() {
- return this[length - 1];
- }
+ // From List<num>:
- void forEach(void f(num element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(num a, num b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(num element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(num element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<num> filter(bool f(num element)) {
- return _Collections.filter(this, new List<num>(), f);
+ int lastIndexOf(num element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(num element)) {
- return _Collections.every(this, f);
- }
+ num last() => this[length - 1];
- bool some(bool f(num element)) {
- return _Collections.some(this, f);
+ num removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<num> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<num> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [num initialValue]) {
+ void insertRange(int start, int rangeLength, [num initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<num> getRange(int start, int length) {
- throw new NotImplementedException();
- }
+ List<num> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <num>[]);
- bool isEmpty() {
- return length == 0;
- }
-
- Iterator<num> iterator() {
- return new _FixedSizeListIterator<num>(this);
- }
+ // -- end List<num> mixins.
void setElements(Object array, [int offset = null]) {
if (offset === null) {
@@ -9852,10 +9822,22 @@ class _HTMLCollectionImpl extends _DOMTypeBase implements HTMLCollection {
Node operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, Node value) {
throw new UnsupportedOperationException("Cannot assign element of immutable List.");
}
+ // -- start List<Node> mixins.
+ // Node is the element type.
+
+ // From Iterable<Node>:
+
+ Iterator<Node> 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<Node>(this);
+ }
+
+ // From Collection<Node>:
void add(Node value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
@@ -9869,78 +9851,56 @@ class _HTMLCollectionImpl extends _DOMTypeBase implements HTMLCollection {
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(Node a, Node b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(Node element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(Node element)) => _Collections.map(this, [], f);
- int indexOf(Node element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<Node> filter(bool f(Node element)) =>
+ _Collections.filter(this, <Node>[], f);
- int lastIndexOf(Node element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(Node element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(Node element)) => _Collections.some(this, f);
- Node removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- Node last() {
- return this[length - 1];
- }
+ // From List<Node>:
- void forEach(void f(Node element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(Node a, Node b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(Node element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(Node element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<Node> filter(bool f(Node element)) {
- return _Collections.filter(this, new List<Node>(), f);
+ int lastIndexOf(Node element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(Node element)) {
- return _Collections.every(this, f);
- }
+ Node last() => this[length - 1];
- bool some(bool f(Node element)) {
- return _Collections.some(this, f);
+ Node removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<Node> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [Node initialValue]) {
+ void insertRange(int start, int rangeLength, [Node initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<Node> getRange(int start, int length) {
- throw new NotImplementedException();
- }
-
- bool isEmpty() {
- return length == 0;
- }
+ List<Node> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <Node>[]);
- Iterator<Node> iterator() {
- return new _FixedSizeListIterator<Node>(this);
- }
+ // -- end List<Node> mixins.
Node item(int index) {
return _wrap(_ptr.item(_unwrap(index)));
@@ -10924,11 +10884,23 @@ class _Int16ArrayImpl extends _ArrayBufferViewImpl implements Int16Array, List<i
int operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, int value) {
- throw new UnsupportedOperationException("Cannot assign element of immutable List.");
+ return _ptr[index] = _unwrap(value);
+ }
+ // -- start List<int> mixins.
+ // int is the element type.
+
+ // From Iterable<int>:
+
+ Iterator<int> 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<int>(this);
}
+ // From Collection<int>:
+
void add(int value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
@@ -10941,78 +10913,56 @@ class _Int16ArrayImpl extends _ArrayBufferViewImpl implements Int16Array, List<i
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(int a, int b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(int element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(int element)) => _Collections.map(this, [], f);
- int indexOf(int element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<int> filter(bool f(int element)) =>
+ _Collections.filter(this, <int>[], f);
- int lastIndexOf(int element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(int element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(int element)) => _Collections.some(this, f);
- int removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- int last() {
- return this[length - 1];
- }
+ // From List<int>:
- void forEach(void f(int element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(int a, int b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(int element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(int element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<int> filter(bool f(int element)) {
- return _Collections.filter(this, new List<int>(), f);
+ int lastIndexOf(int element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(int element)) {
- return _Collections.every(this, f);
- }
+ int last() => this[length - 1];
- bool some(bool f(int element)) {
- return _Collections.some(this, f);
+ int removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<int> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [int initialValue]) {
+ void insertRange(int start, int rangeLength, [int initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<int> getRange(int start, int length) {
- throw new NotImplementedException();
- }
+ List<int> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <int>[]);
- bool isEmpty() {
- return length == 0;
- }
-
- Iterator<int> iterator() {
- return new _FixedSizeListIterator<int>(this);
- }
+ // -- end List<int> mixins.
void setElements(Object array, [int offset = null]) {
if (offset === null) {
@@ -11040,11 +10990,23 @@ class _Int32ArrayImpl extends _ArrayBufferViewImpl implements Int32Array, List<i
int operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, int value) {
- throw new UnsupportedOperationException("Cannot assign element of immutable List.");
+ return _ptr[index] = _unwrap(value);
+ }
+ // -- start List<int> mixins.
+ // int is the element type.
+
+ // From Iterable<int>:
+
+ Iterator<int> 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<int>(this);
}
+ // From Collection<int>:
+
void add(int value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
@@ -11057,78 +11019,56 @@ class _Int32ArrayImpl extends _ArrayBufferViewImpl implements Int32Array, List<i
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(int a, int b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(int element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(int element)) => _Collections.map(this, [], f);
- int indexOf(int element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<int> filter(bool f(int element)) =>
+ _Collections.filter(this, <int>[], f);
- int lastIndexOf(int element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(int element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(int element)) => _Collections.some(this, f);
- int removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- int last() {
- return this[length - 1];
- }
+ // From List<int>:
- void forEach(void f(int element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(int a, int b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(int element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(int element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<int> filter(bool f(int element)) {
- return _Collections.filter(this, new List<int>(), f);
+ int lastIndexOf(int element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(int element)) {
- return _Collections.every(this, f);
- }
+ int last() => this[length - 1];
- bool some(bool f(int element)) {
- return _Collections.some(this, f);
+ int removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<int> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [int initialValue]) {
+ void insertRange(int start, int rangeLength, [int initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<int> getRange(int start, int length) {
- throw new NotImplementedException();
- }
-
- bool isEmpty() {
- return length == 0;
- }
+ List<int> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <int>[]);
- Iterator<int> iterator() {
- return new _FixedSizeListIterator<int>(this);
- }
+ // -- end List<int> mixins.
void setElements(Object array, [int offset = null]) {
if (offset === null) {
@@ -11156,11 +11096,23 @@ class _Int8ArrayImpl extends _ArrayBufferViewImpl implements Int8Array, List<int
int operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, int value) {
- throw new UnsupportedOperationException("Cannot assign element of immutable List.");
+ return _ptr[index] = _unwrap(value);
+ }
+ // -- start List<int> mixins.
+ // int is the element type.
+
+ // From Iterable<int>:
+
+ Iterator<int> 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<int>(this);
}
+ // From Collection<int>:
+
void add(int value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
@@ -11173,78 +11125,56 @@ class _Int8ArrayImpl extends _ArrayBufferViewImpl implements Int8Array, List<int
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(int a, int b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(int element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(int element)) => _Collections.map(this, [], f);
- int indexOf(int element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<int> filter(bool f(int element)) =>
+ _Collections.filter(this, <int>[], f);
- int lastIndexOf(int element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(int element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(int element)) => _Collections.some(this, f);
- int removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- int last() {
- return this[length - 1];
- }
+ // From List<int>:
- void forEach(void f(int element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(int a, int b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(int element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(int element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<int> filter(bool f(int element)) {
- return _Collections.filter(this, new List<int>(), f);
+ int lastIndexOf(int element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(int element)) {
- return _Collections.every(this, f);
- }
+ int last() => this[length - 1];
- bool some(bool f(int element)) {
- return _Collections.some(this, f);
+ int removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<int> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [int initialValue]) {
+ void insertRange(int start, int rangeLength, [int initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<int> getRange(int start, int length) {
- throw new NotImplementedException();
- }
+ List<int> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <int>[]);
- bool isEmpty() {
- return length == 0;
- }
-
- Iterator<int> iterator() {
- return new _FixedSizeListIterator<int>(this);
- }
+ // -- end List<int> mixins.
void setElements(Object array, [int offset = null]) {
if (offset === null) {
@@ -11831,10 +11761,22 @@ class _MediaListImpl extends _DOMTypeBase implements MediaList {
String operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, String value) {
throw new UnsupportedOperationException("Cannot assign element of immutable List.");
}
+ // -- start List<String> mixins.
+ // String is the element type.
+
+ // From Iterable<String>:
+
+ Iterator<String> 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<String>(this);
+ }
+
+ // From Collection<String>:
void add(String value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
@@ -11848,78 +11790,56 @@ class _MediaListImpl extends _DOMTypeBase implements MediaList {
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(String a, String b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(String element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(String element)) => _Collections.map(this, [], f);
- int indexOf(String element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<String> filter(bool f(String element)) =>
+ _Collections.filter(this, <String>[], f);
- int lastIndexOf(String element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(String element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(String element)) => _Collections.some(this, f);
- String removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- String last() {
- return this[length - 1];
- }
+ // From List<String>:
- void forEach(void f(String element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(String a, String b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(String element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(String element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<String> filter(bool f(String element)) {
- return _Collections.filter(this, new List<String>(), f);
+ int lastIndexOf(String element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(String element)) {
- return _Collections.every(this, f);
- }
+ String last() => this[length - 1];
- bool some(bool f(String element)) {
- return _Collections.some(this, f);
+ String removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<String> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<String> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [String initialValue]) {
+ void insertRange(int start, int rangeLength, [String initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<String> getRange(int start, int length) {
- throw new NotImplementedException();
- }
-
- bool isEmpty() {
- return length == 0;
- }
+ List<String> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <String>[]);
- Iterator<String> iterator() {
- return new _FixedSizeListIterator<String>(this);
- }
+ // -- end List<String> mixins.
void appendMedium(String newMedium) {
_ptr.appendMedium(_unwrap(newMedium));
@@ -12299,10 +12219,22 @@ class _NamedNodeMapImpl extends _DOMTypeBase implements NamedNodeMap {
Node operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, Node value) {
throw new UnsupportedOperationException("Cannot assign element of immutable List.");
}
+ // -- start List<Node> mixins.
+ // Node is the element type.
+
+ // From Iterable<Node>:
+
+ Iterator<Node> 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<Node>(this);
+ }
+
+ // From Collection<Node>:
void add(Node value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
@@ -12316,78 +12248,56 @@ class _NamedNodeMapImpl extends _DOMTypeBase implements NamedNodeMap {
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(Node a, Node b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(Node element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(Node element)) => _Collections.map(this, [], f);
- int indexOf(Node element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<Node> filter(bool f(Node element)) =>
+ _Collections.filter(this, <Node>[], f);
- int lastIndexOf(Node element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(Node element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(Node element)) => _Collections.some(this, f);
- Node removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- Node last() {
- return this[length - 1];
- }
+ // From List<Node>:
- void forEach(void f(Node element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(Node a, Node b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(Node element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(Node element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<Node> filter(bool f(Node element)) {
- return _Collections.filter(this, new List<Node>(), f);
+ int lastIndexOf(Node element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(Node element)) {
- return _Collections.every(this, f);
- }
+ Node last() => this[length - 1];
- bool some(bool f(Node element)) {
- return _Collections.some(this, f);
+ Node removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<Node> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [Node initialValue]) {
+ void insertRange(int start, int rangeLength, [Node initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<Node> getRange(int start, int length) {
- throw new NotImplementedException();
- }
-
- bool isEmpty() {
- return length == 0;
- }
+ List<Node> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <Node>[]);
- Iterator<Node> iterator() {
- return new _FixedSizeListIterator<Node>(this);
- }
+ // -- end List<Node> mixins.
Node getNamedItem(String name) {
return _wrap(_ptr.getNamedItem(_unwrap(name)));
@@ -12887,7 +12797,6 @@ class _NodeListImpl extends _DOMTypeBase implements NodeList {
Node operator[](int index) => _wrap(_ptr[index]);
-
}
class _NodeSelectorImpl extends _DOMTypeBase implements NodeSelector {
@@ -18585,10 +18494,22 @@ class _StyleSheetListImpl extends _DOMTypeBase implements StyleSheetList {
StyleSheet operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, StyleSheet value) {
throw new UnsupportedOperationException("Cannot assign element of immutable List.");
}
+ // -- start List<StyleSheet> mixins.
+ // StyleSheet is the element type.
+
+ // From Iterable<StyleSheet>:
+
+ Iterator<StyleSheet> 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<StyleSheet>(this);
+ }
+
+ // From Collection<StyleSheet>:
void add(StyleSheet value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
@@ -18602,78 +18523,56 @@ class _StyleSheetListImpl extends _DOMTypeBase implements StyleSheetList {
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(StyleSheet a, StyleSheet b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(StyleSheet element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(StyleSheet element)) => _Collections.map(this, [], f);
- int indexOf(StyleSheet element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<StyleSheet> filter(bool f(StyleSheet element)) =>
+ _Collections.filter(this, <StyleSheet>[], f);
- int lastIndexOf(StyleSheet element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(StyleSheet element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(StyleSheet element)) => _Collections.some(this, f);
- StyleSheet removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- StyleSheet last() {
- return this[length - 1];
- }
+ // From List<StyleSheet>:
- void forEach(void f(StyleSheet element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(StyleSheet a, StyleSheet b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(StyleSheet element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(StyleSheet element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<StyleSheet> filter(bool f(StyleSheet element)) {
- return _Collections.filter(this, new List<StyleSheet>(), f);
+ int lastIndexOf(StyleSheet element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(StyleSheet element)) {
- return _Collections.every(this, f);
- }
+ StyleSheet last() => this[length - 1];
- bool some(bool f(StyleSheet element)) {
- return _Collections.some(this, f);
+ StyleSheet removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<StyleSheet> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<StyleSheet> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [StyleSheet initialValue]) {
+ void insertRange(int start, int rangeLength, [StyleSheet initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<StyleSheet> getRange(int start, int length) {
- throw new NotImplementedException();
- }
-
- bool isEmpty() {
- return length == 0;
- }
+ List<StyleSheet> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <StyleSheet>[]);
- Iterator<StyleSheet> iterator() {
- return new _FixedSizeListIterator<StyleSheet>(this);
- }
+ // -- end List<StyleSheet> mixins.
StyleSheet item(int index) {
return _wrap(_ptr.item(_unwrap(index)));
@@ -19343,10 +19242,22 @@ class _TouchListImpl extends _DOMTypeBase implements TouchList {
Touch operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, Touch value) {
throw new UnsupportedOperationException("Cannot assign element of immutable List.");
}
+ // -- start List<Touch> mixins.
+ // Touch is the element type.
+
+ // From Iterable<Touch>:
+
+ Iterator<Touch> 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<Touch>(this);
+ }
+
+ // From Collection<Touch>:
void add(Touch value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
@@ -19360,78 +19271,56 @@ class _TouchListImpl extends _DOMTypeBase implements TouchList {
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(Touch a, Touch b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(Touch element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(Touch element)) => _Collections.map(this, [], f);
- int indexOf(Touch element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<Touch> filter(bool f(Touch element)) =>
+ _Collections.filter(this, <Touch>[], f);
- int lastIndexOf(Touch element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(Touch element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(Touch element)) => _Collections.some(this, f);
- Touch removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- Touch last() {
- return this[length - 1];
- }
+ // From List<Touch>:
- void forEach(void f(Touch element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(Touch a, Touch b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(Touch element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(Touch element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<Touch> filter(bool f(Touch element)) {
- return _Collections.filter(this, new List<Touch>(), f);
+ int lastIndexOf(Touch element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(Touch element)) {
- return _Collections.every(this, f);
- }
+ Touch last() => this[length - 1];
- bool some(bool f(Touch element)) {
- return _Collections.some(this, f);
+ Touch removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<Touch> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<Touch> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [Touch initialValue]) {
+ void insertRange(int start, int rangeLength, [Touch initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<Touch> getRange(int start, int length) {
- throw new NotImplementedException();
- }
-
- bool isEmpty() {
- return length == 0;
- }
+ List<Touch> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <Touch>[]);
- Iterator<Touch> iterator() {
- return new _FixedSizeListIterator<Touch>(this);
- }
+ // -- end List<Touch> mixins.
Touch item(int index) {
return _wrap(_ptr.item(_unwrap(index)));
@@ -19570,11 +19459,23 @@ class _Uint16ArrayImpl extends _ArrayBufferViewImpl implements Uint16Array, List
int operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, int value) {
- throw new UnsupportedOperationException("Cannot assign element of immutable List.");
+ return _ptr[index] = _unwrap(value);
+ }
+ // -- start List<int> mixins.
+ // int is the element type.
+
+ // From Iterable<int>:
+
+ Iterator<int> 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<int>(this);
}
+ // From Collection<int>:
+
void add(int value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
@@ -19587,78 +19488,56 @@ class _Uint16ArrayImpl extends _ArrayBufferViewImpl implements Uint16Array, List
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(int a, int b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(int element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(int element)) => _Collections.map(this, [], f);
- int indexOf(int element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<int> filter(bool f(int element)) =>
+ _Collections.filter(this, <int>[], f);
- int lastIndexOf(int element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(int element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(int element)) => _Collections.some(this, f);
- int removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- int last() {
- return this[length - 1];
- }
+ // From List<int>:
- void forEach(void f(int element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(int a, int b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(int element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(int element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<int> filter(bool f(int element)) {
- return _Collections.filter(this, new List<int>(), f);
+ int lastIndexOf(int element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(int element)) {
- return _Collections.every(this, f);
- }
+ int last() => this[length - 1];
- bool some(bool f(int element)) {
- return _Collections.some(this, f);
+ int removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<int> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [int initialValue]) {
+ void insertRange(int start, int rangeLength, [int initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<int> getRange(int start, int length) {
- throw new NotImplementedException();
- }
-
- bool isEmpty() {
- return length == 0;
- }
+ List<int> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <int>[]);
- Iterator<int> iterator() {
- return new _FixedSizeListIterator<int>(this);
- }
+ // -- end List<int> mixins.
void setElements(Object array, [int offset = null]) {
if (offset === null) {
@@ -19686,11 +19565,23 @@ class _Uint32ArrayImpl extends _ArrayBufferViewImpl implements Uint32Array, List
int operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, int value) {
- throw new UnsupportedOperationException("Cannot assign element of immutable List.");
+ return _ptr[index] = _unwrap(value);
+ }
+ // -- start List<int> mixins.
+ // int is the element type.
+
+ // From Iterable<int>:
+
+ Iterator<int> 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<int>(this);
}
+ // From Collection<int>:
+
void add(int value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
@@ -19703,78 +19594,56 @@ class _Uint32ArrayImpl extends _ArrayBufferViewImpl implements Uint32Array, List
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(int a, int b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(int element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(int element)) => _Collections.map(this, [], f);
- int indexOf(int element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<int> filter(bool f(int element)) =>
+ _Collections.filter(this, <int>[], f);
- int lastIndexOf(int element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(int element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(int element)) => _Collections.some(this, f);
- int removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- int last() {
- return this[length - 1];
- }
+ // From List<int>:
- void forEach(void f(int element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(int a, int b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(int element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(int element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<int> filter(bool f(int element)) {
- return _Collections.filter(this, new List<int>(), f);
+ int lastIndexOf(int element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(int element)) {
- return _Collections.every(this, f);
- }
+ int last() => this[length - 1];
- bool some(bool f(int element)) {
- return _Collections.some(this, f);
+ int removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<int> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [int initialValue]) {
+ void insertRange(int start, int rangeLength, [int initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<int> getRange(int start, int length) {
- throw new NotImplementedException();
- }
-
- bool isEmpty() {
- return length == 0;
- }
+ List<int> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <int>[]);
- Iterator<int> iterator() {
- return new _FixedSizeListIterator<int>(this);
- }
+ // -- end List<int> mixins.
void setElements(Object array, [int offset = null]) {
if (offset === null) {
@@ -19802,11 +19671,23 @@ class _Uint8ArrayImpl extends _ArrayBufferViewImpl implements Uint8Array, List<i
int operator[](int index) => _wrap(_ptr[index]);
-
void operator[]=(int index, int value) {
- throw new UnsupportedOperationException("Cannot assign element of immutable List.");
+ return _ptr[index] = _unwrap(value);
+ }
+ // -- start List<int> mixins.
+ // int is the element type.
+
+ // From Iterable<int>:
+
+ Iterator<int> 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<int>(this);
}
+ // From Collection<int>:
+
void add(int value) {
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
@@ -19819,78 +19700,56 @@ class _Uint8ArrayImpl extends _ArrayBufferViewImpl implements Uint8Array, List<i
throw new UnsupportedOperationException("Cannot add to immutable List.");
}
- void sort(int compare(int a, int b)) {
- throw new UnsupportedOperationException("Cannot sort immutable List.");
- }
+ void forEach(void f(int element)) => _Collections.forEach(this, f);
- void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
- throw new UnsupportedOperationException("This object is immutable.");
- }
+ Collection map(f(int element)) => _Collections.map(this, [], f);
- int indexOf(int element, [int start = 0]) {
- return _Lists.indexOf(this, element, start, this.length);
- }
+ Collection<int> filter(bool f(int element)) =>
+ _Collections.filter(this, <int>[], f);
- int lastIndexOf(int element, [int start = null]) {
- if (start === null) start = length - 1;
- return _Lists.lastIndexOf(this, element, start);
- }
+ bool every(bool f(int element)) => _Collections.every(this, f);
- int clear() {
- throw new UnsupportedOperationException("Cannot clear immutable List.");
- }
+ bool some(bool f(int element)) => _Collections.some(this, f);
- int removeLast() {
- throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
- }
+ bool isEmpty() => this.length == 0;
- int last() {
- return this[length - 1];
- }
+ // From List<int>:
- void forEach(void f(int element)) {
- _Collections.forEach(this, f);
+ void sort(int compare(int a, int b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
}
- Collection map(f(int element)) {
- return _Collections.map(this, [], f);
- }
+ int indexOf(int element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
- Collection<int> filter(bool f(int element)) {
- return _Collections.filter(this, new List<int>(), f);
+ int lastIndexOf(int element, [int start]) {
+ if (start === null) start = length - 1;
+ return _Lists.lastIndexOf(this, element, start);
}
- bool every(bool f(int element)) {
- return _Collections.every(this, f);
- }
+ int last() => this[length - 1];
- bool some(bool f(int element)) {
- return _Collections.some(this, f);
+ int removeLast() {
+ throw new UnsupportedOperationException("Cannot removeLast on immutable List.");
}
- void setRange(int start, int length, List<int> from, [int startFrom]) {
+ // FIXME: implement these.
+ void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
throw new UnsupportedOperationException("Cannot setRange on immutable List.");
}
- void removeRange(int start, int length) {
+ void removeRange(int start, int rangeLength) {
throw new UnsupportedOperationException("Cannot removeRange on immutable List.");
}
- void insertRange(int start, int length, [int initialValue]) {
+ void insertRange(int start, int rangeLength, [int initialValue]) {
throw new UnsupportedOperationException("Cannot insertRange on immutable List.");
}
- List<int> getRange(int start, int length) {
- throw new NotImplementedException();
- }
-
- bool isEmpty() {
- return length == 0;
- }
+ List<int> getRange(int start, int rangeLength) =>
+ _Lists.getRange(this, start, rangeLength, <int>[]);
- Iterator<int> iterator() {
- return new _FixedSizeListIterator<int>(this);
- }
+ // -- end List<int> mixins.
void setElements(Object array, [int offset = null]) {
if (offset === null) {
« no previous file with comments | « lib/dom/templates/immutable_list_mixin.darttemplate ('k') | lib/html/frog/html_frog.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698