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

Unified Diff: sdk/lib/svg/dartium/svg_dartium.dart

Issue 14036014: Updating DOM code to use list mixins (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « sdk/lib/svg/dart2js/svg_dart2js.dart ('k') | sdk/lib/web_sql/dart2js/web_sql_dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/svg/dartium/svg_dartium.dart
diff --git a/sdk/lib/svg/dartium/svg_dartium.dart b/sdk/lib/svg/dartium/svg_dartium.dart
index 7cf7d6cc9e9ba214e016f007abf1320af233744c..3310b73a22ef93d5b3c5bf09dcd6411327fd9c6d 100644
--- a/sdk/lib/svg/dartium/svg_dartium.dart
+++ b/sdk/lib/svg/dartium/svg_dartium.dart
@@ -3266,7 +3266,7 @@ class Length extends NativeFieldWrapperClass1 {
@DocsEditable
@DomName('SVGLengthList')
-class LengthList extends NativeFieldWrapperClass1 implements List<Length> {
+class LengthList extends NativeFieldWrapperClass1 with ListMixin<Length>, ImmutableListMixin<Length> implements List<Length> {
LengthList.internal();
@DomName('SVGLengthList.numberOfItems')
@@ -3281,196 +3281,13 @@ class LengthList extends NativeFieldWrapperClass1 implements List<Length> {
// -- start List<Length> mixins.
// Length is the element type.
- // From Iterable<Length>:
-
- Iterator<Length> get 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<Length>(this);
- }
-
// SVG Collections expose numberOfItems rather than length.
int get length => numberOfItems;
- Length reduce(Length combine(Length value, Length element)) {
- return IterableMixinWorkaround.reduce(this, combine);
- }
-
- dynamic fold(dynamic initialValue,
- dynamic combine(dynamic previousValue, Length element)) {
- return IterableMixinWorkaround.fold(this, initialValue, combine);
- }
-
- bool contains(Length element) => IterableMixinWorkaround.contains(this, element);
-
- void forEach(void f(Length element)) => IterableMixinWorkaround.forEach(this, f);
-
- String join([String separator = ""]) =>
- IterableMixinWorkaround.joinList(this, separator);
-
- Iterable map(f(Length element)) =>
- IterableMixinWorkaround.mapList(this, f);
-
- Iterable<Length> where(bool f(Length element)) =>
- IterableMixinWorkaround.where(this, f);
-
- Iterable expand(Iterable f(Length element)) =>
- IterableMixinWorkaround.expand(this, f);
-
- bool every(bool f(Length element)) => IterableMixinWorkaround.every(this, f);
-
- bool any(bool f(Length element)) => IterableMixinWorkaround.any(this, f);
-
- List<Length> toList({ bool growable: true }) =>
- new List<Length>.from(this, growable: growable);
-
- Set<Length> toSet() => new Set<Length>.from(this);
-
- bool get isEmpty => this.length == 0;
-
- Iterable<Length> take(int n) => IterableMixinWorkaround.takeList(this, n);
-
- Iterable<Length> takeWhile(bool test(Length value)) {
- return IterableMixinWorkaround.takeWhile(this, test);
- }
-
- Iterable<Length> skip(int n) => IterableMixinWorkaround.skipList(this, n);
-
- Iterable<Length> skipWhile(bool test(Length value)) {
- return IterableMixinWorkaround.skipWhile(this, test);
- }
-
- Length firstWhere(bool test(Length value), { Length orElse() }) {
- return IterableMixinWorkaround.firstWhere(this, test, orElse);
- }
-
- Length lastWhere(bool test(Length value), {Length orElse()}) {
- return IterableMixinWorkaround.lastWhereList(this, test, orElse);
- }
-
- Length singleWhere(bool test(Length value)) {
- return IterableMixinWorkaround.singleWhere(this, test);
- }
-
- Length elementAt(int index) {
- return this[index];
- }
- // From Collection<Length>:
-
- void add(Length value) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void addAll(Iterable<Length> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- // From List<Length>:
void set length(int value) {
throw new UnsupportedError("Cannot resize immutable List.");
}
- // clear() defined by IDL.
-
- Iterable<Length> get reversed {
- return IterableMixinWorkaround.reversedList(this);
- }
-
- void sort([int compare(Length a, Length b)]) {
- throw new UnsupportedError("Cannot sort immutable List.");
- }
-
- int indexOf(Length element, [int start = 0]) =>
- Lists.indexOf(this, element, start, this.length);
-
- int lastIndexOf(Length element, [int start]) {
- if (start == null) start = length - 1;
- return Lists.lastIndexOf(this, element, start);
- }
-
- Length get first {
- if (this.length > 0) return this[0];
- throw new StateError("No elements");
- }
-
- Length get last {
- if (this.length > 0) return this[this.length - 1];
- throw new StateError("No elements");
- }
-
- Length get single {
- if (length == 1) return this[0];
- if (length == 0) throw new StateError("No elements");
- throw new StateError("More than one element");
- }
-
- void insert(int index, Length element) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void insertAll(int index, Iterable<Length> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void setAll(int index, Iterable<Length> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- Length removeAt(int pos) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- Length removeLast() {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- bool remove(Object object) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void removeWhere(bool test(Length element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void retainWhere(bool test(Length element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void setRange(int start, int end, Iterable<Length> iterable, [int skipCount=0]) {
- throw new UnsupportedError("Cannot setRange on immutable List.");
- }
-
- void removeRange(int start, int end) {
- throw new UnsupportedError("Cannot removeRange on immutable List.");
- }
-
- void replaceRange(int start, int end, Iterable<Length> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- void fillRange(int start, int end, [Length fillValue]) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- Iterable<Length> getRange(int start, int end) =>
- IterableMixinWorkaround.getRangeList(this, start, end);
-
- List<Length> sublist(int start, [int end]) {
- if (end == null) end = length;
- return Lists.getRange(this, start, end, <Length>[]);
- }
-
- Map<int, Length> asMap() =>
- IterableMixinWorkaround.asMapList(this);
-
- String toString() {
- StringBuffer buffer = new StringBuffer('[');
- buffer.writeAll(this, ', ');
- buffer.write(']');
- return buffer.toString();
- }
-
// -- end List<Length> mixins.
@DomName('SVGLengthList.appendItem')
@@ -3987,7 +3804,7 @@ class Number extends NativeFieldWrapperClass1 {
@DocsEditable
@DomName('SVGNumberList')
-class NumberList extends NativeFieldWrapperClass1 implements List<Number> {
+class NumberList extends NativeFieldWrapperClass1 with ListMixin<Number>, ImmutableListMixin<Number> implements List<Number> {
NumberList.internal();
@DomName('SVGNumberList.numberOfItems')
@@ -4002,196 +3819,13 @@ class NumberList extends NativeFieldWrapperClass1 implements List<Number> {
// -- start List<Number> mixins.
// Number is the element type.
- // From Iterable<Number>:
-
- Iterator<Number> get 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<Number>(this);
- }
-
// SVG Collections expose numberOfItems rather than length.
int get length => numberOfItems;
- Number reduce(Number combine(Number value, Number element)) {
- return IterableMixinWorkaround.reduce(this, combine);
- }
-
- dynamic fold(dynamic initialValue,
- dynamic combine(dynamic previousValue, Number element)) {
- return IterableMixinWorkaround.fold(this, initialValue, combine);
- }
-
- bool contains(Number element) => IterableMixinWorkaround.contains(this, element);
-
- void forEach(void f(Number element)) => IterableMixinWorkaround.forEach(this, f);
-
- String join([String separator = ""]) =>
- IterableMixinWorkaround.joinList(this, separator);
-
- Iterable map(f(Number element)) =>
- IterableMixinWorkaround.mapList(this, f);
-
- Iterable<Number> where(bool f(Number element)) =>
- IterableMixinWorkaround.where(this, f);
- Iterable expand(Iterable f(Number element)) =>
- IterableMixinWorkaround.expand(this, f);
-
- bool every(bool f(Number element)) => IterableMixinWorkaround.every(this, f);
-
- bool any(bool f(Number element)) => IterableMixinWorkaround.any(this, f);
-
- List<Number> toList({ bool growable: true }) =>
- new List<Number>.from(this, growable: growable);
-
- Set<Number> toSet() => new Set<Number>.from(this);
-
- bool get isEmpty => this.length == 0;
-
- Iterable<Number> take(int n) => IterableMixinWorkaround.takeList(this, n);
-
- Iterable<Number> takeWhile(bool test(Number value)) {
- return IterableMixinWorkaround.takeWhile(this, test);
- }
-
- Iterable<Number> skip(int n) => IterableMixinWorkaround.skipList(this, n);
-
- Iterable<Number> skipWhile(bool test(Number value)) {
- return IterableMixinWorkaround.skipWhile(this, test);
- }
-
- Number firstWhere(bool test(Number value), { Number orElse() }) {
- return IterableMixinWorkaround.firstWhere(this, test, orElse);
- }
-
- Number lastWhere(bool test(Number value), {Number orElse()}) {
- return IterableMixinWorkaround.lastWhereList(this, test, orElse);
- }
-
- Number singleWhere(bool test(Number value)) {
- return IterableMixinWorkaround.singleWhere(this, test);
- }
-
- Number elementAt(int index) {
- return this[index];
- }
-
- // From Collection<Number>:
-
- void add(Number value) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void addAll(Iterable<Number> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- // From List<Number>:
void set length(int value) {
throw new UnsupportedError("Cannot resize immutable List.");
}
- // clear() defined by IDL.
-
- Iterable<Number> get reversed {
- return IterableMixinWorkaround.reversedList(this);
- }
-
- void sort([int compare(Number a, Number b)]) {
- throw new UnsupportedError("Cannot sort immutable List.");
- }
-
- int indexOf(Number element, [int start = 0]) =>
- Lists.indexOf(this, element, start, this.length);
-
- int lastIndexOf(Number element, [int start]) {
- if (start == null) start = length - 1;
- return Lists.lastIndexOf(this, element, start);
- }
-
- Number get first {
- if (this.length > 0) return this[0];
- throw new StateError("No elements");
- }
-
- Number get last {
- if (this.length > 0) return this[this.length - 1];
- throw new StateError("No elements");
- }
-
- Number get single {
- if (length == 1) return this[0];
- if (length == 0) throw new StateError("No elements");
- throw new StateError("More than one element");
- }
-
- void insert(int index, Number element) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void insertAll(int index, Iterable<Number> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void setAll(int index, Iterable<Number> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- Number removeAt(int pos) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- Number removeLast() {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- bool remove(Object object) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void removeWhere(bool test(Number element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void retainWhere(bool test(Number element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void setRange(int start, int end, Iterable<Number> iterable, [int skipCount=0]) {
- throw new UnsupportedError("Cannot setRange on immutable List.");
- }
-
- void removeRange(int start, int end) {
- throw new UnsupportedError("Cannot removeRange on immutable List.");
- }
-
- void replaceRange(int start, int end, Iterable<Number> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- void fillRange(int start, int end, [Number fillValue]) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- Iterable<Number> getRange(int start, int end) =>
- IterableMixinWorkaround.getRangeList(this, start, end);
-
- List<Number> sublist(int start, [int end]) {
- if (end == null) end = length;
- return Lists.getRange(this, start, end, <Number>[]);
- }
-
- Map<int, Number> asMap() =>
- IterableMixinWorkaround.asMapList(this);
-
- String toString() {
- StringBuffer buffer = new StringBuffer('[');
- buffer.writeAll(this, ', ');
- buffer.write(']');
- return buffer.toString();
- }
-
// -- end List<Number> mixins.
@DomName('SVGNumberList.appendItem')
@@ -5135,7 +4769,7 @@ class PathSegLinetoVerticalRel extends PathSeg {
@DocsEditable
@DomName('SVGPathSegList')
-class PathSegList extends NativeFieldWrapperClass1 implements List<PathSeg> {
+class PathSegList extends NativeFieldWrapperClass1 with ListMixin<PathSeg>, ImmutableListMixin<PathSeg> implements List<PathSeg> {
PathSegList.internal();
@DomName('SVGPathSegList.numberOfItems')
@@ -5150,196 +4784,13 @@ class PathSegList extends NativeFieldWrapperClass1 implements List<PathSeg> {
// -- start List<PathSeg> mixins.
// PathSeg is the element type.
- // From Iterable<PathSeg>:
-
- Iterator<PathSeg> get 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<PathSeg>(this);
- }
-
// SVG Collections expose numberOfItems rather than length.
int get length => numberOfItems;
- PathSeg reduce(PathSeg combine(PathSeg value, PathSeg element)) {
- return IterableMixinWorkaround.reduce(this, combine);
- }
-
- dynamic fold(dynamic initialValue,
- dynamic combine(dynamic previousValue, PathSeg element)) {
- return IterableMixinWorkaround.fold(this, initialValue, combine);
- }
-
- bool contains(PathSeg element) => IterableMixinWorkaround.contains(this, element);
-
- void forEach(void f(PathSeg element)) => IterableMixinWorkaround.forEach(this, f);
-
- String join([String separator = ""]) =>
- IterableMixinWorkaround.joinList(this, separator);
-
- Iterable map(f(PathSeg element)) =>
- IterableMixinWorkaround.mapList(this, f);
-
- Iterable<PathSeg> where(bool f(PathSeg element)) =>
- IterableMixinWorkaround.where(this, f);
-
- Iterable expand(Iterable f(PathSeg element)) =>
- IterableMixinWorkaround.expand(this, f);
-
- bool every(bool f(PathSeg element)) => IterableMixinWorkaround.every(this, f);
-
- bool any(bool f(PathSeg element)) => IterableMixinWorkaround.any(this, f);
-
- List<PathSeg> toList({ bool growable: true }) =>
- new List<PathSeg>.from(this, growable: growable);
-
- Set<PathSeg> toSet() => new Set<PathSeg>.from(this);
-
- bool get isEmpty => this.length == 0;
-
- Iterable<PathSeg> take(int n) => IterableMixinWorkaround.takeList(this, n);
-
- Iterable<PathSeg> takeWhile(bool test(PathSeg value)) {
- return IterableMixinWorkaround.takeWhile(this, test);
- }
-
- Iterable<PathSeg> skip(int n) => IterableMixinWorkaround.skipList(this, n);
- Iterable<PathSeg> skipWhile(bool test(PathSeg value)) {
- return IterableMixinWorkaround.skipWhile(this, test);
- }
-
- PathSeg firstWhere(bool test(PathSeg value), { PathSeg orElse() }) {
- return IterableMixinWorkaround.firstWhere(this, test, orElse);
- }
-
- PathSeg lastWhere(bool test(PathSeg value), {PathSeg orElse()}) {
- return IterableMixinWorkaround.lastWhereList(this, test, orElse);
- }
-
- PathSeg singleWhere(bool test(PathSeg value)) {
- return IterableMixinWorkaround.singleWhere(this, test);
- }
-
- PathSeg elementAt(int index) {
- return this[index];
- }
-
- // From Collection<PathSeg>:
-
- void add(PathSeg value) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void addAll(Iterable<PathSeg> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- // From List<PathSeg>:
void set length(int value) {
throw new UnsupportedError("Cannot resize immutable List.");
}
- // clear() defined by IDL.
-
- Iterable<PathSeg> get reversed {
- return IterableMixinWorkaround.reversedList(this);
- }
-
- void sort([int compare(PathSeg a, PathSeg b)]) {
- throw new UnsupportedError("Cannot sort immutable List.");
- }
-
- int indexOf(PathSeg element, [int start = 0]) =>
- Lists.indexOf(this, element, start, this.length);
-
- int lastIndexOf(PathSeg element, [int start]) {
- if (start == null) start = length - 1;
- return Lists.lastIndexOf(this, element, start);
- }
-
- PathSeg get first {
- if (this.length > 0) return this[0];
- throw new StateError("No elements");
- }
-
- PathSeg get last {
- if (this.length > 0) return this[this.length - 1];
- throw new StateError("No elements");
- }
-
- PathSeg get single {
- if (length == 1) return this[0];
- if (length == 0) throw new StateError("No elements");
- throw new StateError("More than one element");
- }
-
- void insert(int index, PathSeg element) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void insertAll(int index, Iterable<PathSeg> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void setAll(int index, Iterable<PathSeg> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- PathSeg removeAt(int pos) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- PathSeg removeLast() {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- bool remove(Object object) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void removeWhere(bool test(PathSeg element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void retainWhere(bool test(PathSeg element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void setRange(int start, int end, Iterable<PathSeg> iterable, [int skipCount=0]) {
- throw new UnsupportedError("Cannot setRange on immutable List.");
- }
-
- void removeRange(int start, int end) {
- throw new UnsupportedError("Cannot removeRange on immutable List.");
- }
-
- void replaceRange(int start, int end, Iterable<PathSeg> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- void fillRange(int start, int end, [PathSeg fillValue]) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- Iterable<PathSeg> getRange(int start, int end) =>
- IterableMixinWorkaround.getRangeList(this, start, end);
-
- List<PathSeg> sublist(int start, [int end]) {
- if (end == null) end = length;
- return Lists.getRange(this, start, end, <PathSeg>[]);
- }
-
- Map<int, PathSeg> asMap() =>
- IterableMixinWorkaround.asMapList(this);
-
- String toString() {
- StringBuffer buffer = new StringBuffer('[');
- buffer.writeAll(this, ', ');
- buffer.write(']');
- return buffer.toString();
- }
-
// -- end List<PathSeg> mixins.
@DomName('SVGPathSegList.appendItem')
@@ -6137,7 +5588,7 @@ class StopElement extends StyledElement {
@DocsEditable
@DomName('SVGStringList')
-class StringList extends NativeFieldWrapperClass1 implements List<String> {
+class StringList extends NativeFieldWrapperClass1 with ListMixin<String>, ImmutableListMixin<String> implements List<String> {
StringList.internal();
@DomName('SVGStringList.numberOfItems')
@@ -6152,196 +5603,13 @@ class StringList extends NativeFieldWrapperClass1 implements List<String> {
// -- start List<String> mixins.
// String is the element type.
- // From Iterable<String>:
-
- Iterator<String> get 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);
- }
-
// SVG Collections expose numberOfItems rather than length.
int get length => numberOfItems;
- String reduce(String combine(String value, String element)) {
- return IterableMixinWorkaround.reduce(this, combine);
- }
-
- dynamic fold(dynamic initialValue,
- dynamic combine(dynamic previousValue, String element)) {
- return IterableMixinWorkaround.fold(this, initialValue, combine);
- }
-
- bool contains(String element) => IterableMixinWorkaround.contains(this, element);
-
- void forEach(void f(String element)) => IterableMixinWorkaround.forEach(this, f);
-
- String join([String separator = ""]) =>
- IterableMixinWorkaround.joinList(this, separator);
-
- Iterable map(f(String element)) =>
- IterableMixinWorkaround.mapList(this, f);
-
- Iterable<String> where(bool f(String element)) =>
- IterableMixinWorkaround.where(this, f);
-
- Iterable expand(Iterable f(String element)) =>
- IterableMixinWorkaround.expand(this, f);
-
- bool every(bool f(String element)) => IterableMixinWorkaround.every(this, f);
-
- bool any(bool f(String element)) => IterableMixinWorkaround.any(this, f);
-
- List<String> toList({ bool growable: true }) =>
- new List<String>.from(this, growable: growable);
-
- Set<String> toSet() => new Set<String>.from(this);
-
- bool get isEmpty => this.length == 0;
-
- Iterable<String> take(int n) => IterableMixinWorkaround.takeList(this, n);
-
- Iterable<String> takeWhile(bool test(String value)) {
- return IterableMixinWorkaround.takeWhile(this, test);
- }
-
- Iterable<String> skip(int n) => IterableMixinWorkaround.skipList(this, n);
-
- Iterable<String> skipWhile(bool test(String value)) {
- return IterableMixinWorkaround.skipWhile(this, test);
- }
-
- String firstWhere(bool test(String value), { String orElse() }) {
- return IterableMixinWorkaround.firstWhere(this, test, orElse);
- }
-
- String lastWhere(bool test(String value), {String orElse()}) {
- return IterableMixinWorkaround.lastWhereList(this, test, orElse);
- }
-
- String singleWhere(bool test(String value)) {
- return IterableMixinWorkaround.singleWhere(this, test);
- }
-
- String elementAt(int index) {
- return this[index];
- }
- // From Collection<String>:
-
- void add(String value) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void addAll(Iterable<String> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- // From List<String>:
void set length(int value) {
throw new UnsupportedError("Cannot resize immutable List.");
}
- // clear() defined by IDL.
-
- Iterable<String> get reversed {
- return IterableMixinWorkaround.reversedList(this);
- }
-
- void sort([int compare(String a, String b)]) {
- throw new UnsupportedError("Cannot sort immutable List.");
- }
-
- int indexOf(String element, [int start = 0]) =>
- Lists.indexOf(this, element, start, this.length);
-
- int lastIndexOf(String element, [int start]) {
- if (start == null) start = length - 1;
- return Lists.lastIndexOf(this, element, start);
- }
-
- String get first {
- if (this.length > 0) return this[0];
- throw new StateError("No elements");
- }
-
- String get last {
- if (this.length > 0) return this[this.length - 1];
- throw new StateError("No elements");
- }
-
- String get single {
- if (length == 1) return this[0];
- if (length == 0) throw new StateError("No elements");
- throw new StateError("More than one element");
- }
-
- void insert(int index, String element) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void insertAll(int index, Iterable<String> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void setAll(int index, Iterable<String> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- String removeAt(int pos) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- String removeLast() {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- bool remove(Object object) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void removeWhere(bool test(String element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void retainWhere(bool test(String element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void setRange(int start, int end, Iterable<String> iterable, [int skipCount=0]) {
- throw new UnsupportedError("Cannot setRange on immutable List.");
- }
-
- void removeRange(int start, int end) {
- throw new UnsupportedError("Cannot removeRange on immutable List.");
- }
-
- void replaceRange(int start, int end, Iterable<String> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- void fillRange(int start, int end, [String fillValue]) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- Iterable<String> getRange(int start, int end) =>
- IterableMixinWorkaround.getRangeList(this, start, end);
-
- List<String> sublist(int start, [int end]) {
- if (end == null) end = length;
- return Lists.getRange(this, start, end, <String>[]);
- }
-
- Map<int, String> asMap() =>
- IterableMixinWorkaround.asMapList(this);
-
- String toString() {
- StringBuffer buffer = new StringBuffer('[');
- buffer.writeAll(this, ', ');
- buffer.write(']');
- return buffer.toString();
- }
-
// -- end List<String> mixins.
@DomName('SVGStringList.appendItem')
@@ -7404,7 +6672,7 @@ class Transform extends NativeFieldWrapperClass1 {
@DocsEditable
@DomName('SVGTransformList')
-class TransformList extends NativeFieldWrapperClass1 implements List<Transform> {
+class TransformList extends NativeFieldWrapperClass1 with ListMixin<Transform>, ImmutableListMixin<Transform> implements List<Transform> {
TransformList.internal();
@DomName('SVGTransformList.numberOfItems')
@@ -7419,196 +6687,13 @@ class TransformList extends NativeFieldWrapperClass1 implements List<Transform>
// -- start List<Transform> mixins.
// Transform is the element type.
- // From Iterable<Transform>:
-
- Iterator<Transform> get 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<Transform>(this);
- }
-
// SVG Collections expose numberOfItems rather than length.
int get length => numberOfItems;
- Transform reduce(Transform combine(Transform value, Transform element)) {
- return IterableMixinWorkaround.reduce(this, combine);
- }
-
- dynamic fold(dynamic initialValue,
- dynamic combine(dynamic previousValue, Transform element)) {
- return IterableMixinWorkaround.fold(this, initialValue, combine);
- }
-
- bool contains(Transform element) => IterableMixinWorkaround.contains(this, element);
-
- void forEach(void f(Transform element)) => IterableMixinWorkaround.forEach(this, f);
-
- String join([String separator = ""]) =>
- IterableMixinWorkaround.joinList(this, separator);
-
- Iterable map(f(Transform element)) =>
- IterableMixinWorkaround.mapList(this, f);
-
- Iterable<Transform> where(bool f(Transform element)) =>
- IterableMixinWorkaround.where(this, f);
- Iterable expand(Iterable f(Transform element)) =>
- IterableMixinWorkaround.expand(this, f);
-
- bool every(bool f(Transform element)) => IterableMixinWorkaround.every(this, f);
-
- bool any(bool f(Transform element)) => IterableMixinWorkaround.any(this, f);
-
- List<Transform> toList({ bool growable: true }) =>
- new List<Transform>.from(this, growable: growable);
-
- Set<Transform> toSet() => new Set<Transform>.from(this);
-
- bool get isEmpty => this.length == 0;
-
- Iterable<Transform> take(int n) => IterableMixinWorkaround.takeList(this, n);
-
- Iterable<Transform> takeWhile(bool test(Transform value)) {
- return IterableMixinWorkaround.takeWhile(this, test);
- }
-
- Iterable<Transform> skip(int n) => IterableMixinWorkaround.skipList(this, n);
-
- Iterable<Transform> skipWhile(bool test(Transform value)) {
- return IterableMixinWorkaround.skipWhile(this, test);
- }
-
- Transform firstWhere(bool test(Transform value), { Transform orElse() }) {
- return IterableMixinWorkaround.firstWhere(this, test, orElse);
- }
-
- Transform lastWhere(bool test(Transform value), {Transform orElse()}) {
- return IterableMixinWorkaround.lastWhereList(this, test, orElse);
- }
-
- Transform singleWhere(bool test(Transform value)) {
- return IterableMixinWorkaround.singleWhere(this, test);
- }
-
- Transform elementAt(int index) {
- return this[index];
- }
-
- // From Collection<Transform>:
-
- void add(Transform value) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void addAll(Iterable<Transform> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- // From List<Transform>:
void set length(int value) {
throw new UnsupportedError("Cannot resize immutable List.");
}
- // clear() defined by IDL.
-
- Iterable<Transform> get reversed {
- return IterableMixinWorkaround.reversedList(this);
- }
-
- void sort([int compare(Transform a, Transform b)]) {
- throw new UnsupportedError("Cannot sort immutable List.");
- }
-
- int indexOf(Transform element, [int start = 0]) =>
- Lists.indexOf(this, element, start, this.length);
-
- int lastIndexOf(Transform element, [int start]) {
- if (start == null) start = length - 1;
- return Lists.lastIndexOf(this, element, start);
- }
-
- Transform get first {
- if (this.length > 0) return this[0];
- throw new StateError("No elements");
- }
-
- Transform get last {
- if (this.length > 0) return this[this.length - 1];
- throw new StateError("No elements");
- }
-
- Transform get single {
- if (length == 1) return this[0];
- if (length == 0) throw new StateError("No elements");
- throw new StateError("More than one element");
- }
-
- void insert(int index, Transform element) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void insertAll(int index, Iterable<Transform> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void setAll(int index, Iterable<Transform> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- Transform removeAt(int pos) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- Transform removeLast() {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- bool remove(Object object) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void removeWhere(bool test(Transform element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void retainWhere(bool test(Transform element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void setRange(int start, int end, Iterable<Transform> iterable, [int skipCount=0]) {
- throw new UnsupportedError("Cannot setRange on immutable List.");
- }
-
- void removeRange(int start, int end) {
- throw new UnsupportedError("Cannot removeRange on immutable List.");
- }
-
- void replaceRange(int start, int end, Iterable<Transform> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- void fillRange(int start, int end, [Transform fillValue]) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- Iterable<Transform> getRange(int start, int end) =>
- IterableMixinWorkaround.getRangeList(this, start, end);
-
- List<Transform> sublist(int start, [int end]) {
- if (end == null) end = length;
- return Lists.getRange(this, start, end, <Transform>[]);
- }
-
- Map<int, Transform> asMap() =>
- IterableMixinWorkaround.asMapList(this);
-
- String toString() {
- StringBuffer buffer = new StringBuffer('[');
- buffer.writeAll(this, ', ');
- buffer.write(']');
- return buffer.toString();
- }
-
// -- end List<Transform> mixins.
@DomName('SVGTransformList.appendItem')
@@ -7997,7 +7082,7 @@ class ZoomEvent extends UIEvent {
@DocsEditable
@DomName('SVGElementInstanceList')
-class _ElementInstanceList extends NativeFieldWrapperClass1 implements List<ElementInstance> {
+class _ElementInstanceList extends NativeFieldWrapperClass1 with ListMixin<ElementInstance>, ImmutableListMixin<ElementInstance> implements List<ElementInstance> {
_ElementInstanceList.internal();
@DomName('SVGElementInstanceList.length')
@@ -8012,196 +7097,11 @@ class _ElementInstanceList extends NativeFieldWrapperClass1 implements List<Elem
// -- start List<ElementInstance> mixins.
// ElementInstance is the element type.
- // From Iterable<ElementInstance>:
-
- Iterator<ElementInstance> get 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<ElementInstance>(this);
- }
-
- ElementInstance reduce(ElementInstance combine(ElementInstance value, ElementInstance element)) {
- return IterableMixinWorkaround.reduce(this, combine);
- }
-
- dynamic fold(dynamic initialValue,
- dynamic combine(dynamic previousValue, ElementInstance element)) {
- return IterableMixinWorkaround.fold(this, initialValue, combine);
- }
-
- bool contains(ElementInstance element) => IterableMixinWorkaround.contains(this, element);
-
- void forEach(void f(ElementInstance element)) => IterableMixinWorkaround.forEach(this, f);
-
- String join([String separator = ""]) =>
- IterableMixinWorkaround.joinList(this, separator);
-
- Iterable map(f(ElementInstance element)) =>
- IterableMixinWorkaround.mapList(this, f);
-
- Iterable<ElementInstance> where(bool f(ElementInstance element)) =>
- IterableMixinWorkaround.where(this, f);
-
- Iterable expand(Iterable f(ElementInstance element)) =>
- IterableMixinWorkaround.expand(this, f);
-
- bool every(bool f(ElementInstance element)) => IterableMixinWorkaround.every(this, f);
-
- bool any(bool f(ElementInstance element)) => IterableMixinWorkaround.any(this, f);
-
- List<ElementInstance> toList({ bool growable: true }) =>
- new List<ElementInstance>.from(this, growable: growable);
-
- Set<ElementInstance> toSet() => new Set<ElementInstance>.from(this);
-
- bool get isEmpty => this.length == 0;
-
- Iterable<ElementInstance> take(int n) => IterableMixinWorkaround.takeList(this, n);
-
- Iterable<ElementInstance> takeWhile(bool test(ElementInstance value)) {
- return IterableMixinWorkaround.takeWhile(this, test);
- }
-
- Iterable<ElementInstance> skip(int n) => IterableMixinWorkaround.skipList(this, n);
- Iterable<ElementInstance> skipWhile(bool test(ElementInstance value)) {
- return IterableMixinWorkaround.skipWhile(this, test);
- }
-
- ElementInstance firstWhere(bool test(ElementInstance value), { ElementInstance orElse() }) {
- return IterableMixinWorkaround.firstWhere(this, test, orElse);
- }
-
- ElementInstance lastWhere(bool test(ElementInstance value), {ElementInstance orElse()}) {
- return IterableMixinWorkaround.lastWhereList(this, test, orElse);
- }
-
- ElementInstance singleWhere(bool test(ElementInstance value)) {
- return IterableMixinWorkaround.singleWhere(this, test);
- }
-
- ElementInstance elementAt(int index) {
- return this[index];
- }
-
- // From Collection<ElementInstance>:
-
- void add(ElementInstance value) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void addAll(Iterable<ElementInstance> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- // From List<ElementInstance>:
void set length(int value) {
throw new UnsupportedError("Cannot resize immutable List.");
}
- void clear() {
- throw new UnsupportedError("Cannot clear immutable List.");
- }
-
- Iterable<ElementInstance> get reversed {
- return IterableMixinWorkaround.reversedList(this);
- }
-
- void sort([int compare(ElementInstance a, ElementInstance b)]) {
- throw new UnsupportedError("Cannot sort immutable List.");
- }
-
- int indexOf(ElementInstance element, [int start = 0]) =>
- Lists.indexOf(this, element, start, this.length);
-
- int lastIndexOf(ElementInstance element, [int start]) {
- if (start == null) start = length - 1;
- return Lists.lastIndexOf(this, element, start);
- }
-
- ElementInstance get first {
- if (this.length > 0) return this[0];
- throw new StateError("No elements");
- }
-
- ElementInstance get last {
- if (this.length > 0) return this[this.length - 1];
- throw new StateError("No elements");
- }
-
- ElementInstance get single {
- if (length == 1) return this[0];
- if (length == 0) throw new StateError("No elements");
- throw new StateError("More than one element");
- }
-
- void insert(int index, ElementInstance element) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void insertAll(int index, Iterable<ElementInstance> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void setAll(int index, Iterable<ElementInstance> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- ElementInstance removeAt(int pos) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- ElementInstance removeLast() {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- bool remove(Object object) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void removeWhere(bool test(ElementInstance element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void retainWhere(bool test(ElementInstance element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void setRange(int start, int end, Iterable<ElementInstance> iterable, [int skipCount=0]) {
- throw new UnsupportedError("Cannot setRange on immutable List.");
- }
-
- void removeRange(int start, int end) {
- throw new UnsupportedError("Cannot removeRange on immutable List.");
- }
-
- void replaceRange(int start, int end, Iterable<ElementInstance> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- void fillRange(int start, int end, [ElementInstance fillValue]) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- Iterable<ElementInstance> getRange(int start, int end) =>
- IterableMixinWorkaround.getRangeList(this, start, end);
-
- List<ElementInstance> sublist(int start, [int end]) {
- if (end == null) end = length;
- return Lists.getRange(this, start, end, <ElementInstance>[]);
- }
-
- Map<int, ElementInstance> asMap() =>
- IterableMixinWorkaround.asMapList(this);
-
- String toString() {
- StringBuffer buffer = new StringBuffer('[');
- buffer.writeAll(this, ', ');
- buffer.write(']');
- return buffer.toString();
- }
-
// -- end List<ElementInstance> mixins.
@DomName('SVGElementInstanceList.item')
« no previous file with comments | « sdk/lib/svg/dart2js/svg_dart2js.dart ('k') | sdk/lib/web_sql/dart2js/web_sql_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698