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

Unified Diff: sdk/lib/web_sql/dart2js/web_sql_dart2js.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/dartium/svg_dartium.dart ('k') | sdk/lib/web_sql/dartium/web_sql_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
diff --git a/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart b/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
index cc7f88b39e59beee5bc573efb7db293f790a613f..851be055ed0328e3765ed6e1ad5784a89a0618e4 100644
--- a/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
+++ b/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
@@ -193,7 +193,7 @@ class SqlResultSet native "SQLResultSet" {
@DocsEditable
@DomName('SQLResultSetRowList')
-class SqlResultSetRowList implements JavaScriptIndexingBehavior, List<Map> native "SQLResultSetRowList" {
+class SqlResultSetRowList extends Object with ListMixin<Map>, ImmutableListMixin<Map> implements JavaScriptIndexingBehavior, List<Map> native "SQLResultSetRowList" {
@DomName('SQLResultSetRowList.length')
@DocsEditable
@@ -207,196 +207,11 @@ class SqlResultSetRowList implements JavaScriptIndexingBehavior, List<Map> nativ
// -- start List<Map> mixins.
// Map is the element type.
- // From Iterable<Map>:
- Iterator<Map> 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<Map>(this);
- }
-
- Map reduce(Map combine(Map value, Map element)) {
- return IterableMixinWorkaround.reduce(this, combine);
- }
-
- dynamic fold(dynamic initialValue,
- dynamic combine(dynamic previousValue, Map element)) {
- return IterableMixinWorkaround.fold(this, initialValue, combine);
- }
-
- bool contains(Map element) => IterableMixinWorkaround.contains(this, element);
-
- void forEach(void f(Map element)) => IterableMixinWorkaround.forEach(this, f);
-
- String join([String separator = ""]) =>
- IterableMixinWorkaround.joinList(this, separator);
-
- Iterable map(f(Map element)) =>
- IterableMixinWorkaround.mapList(this, f);
-
- Iterable<Map> where(bool f(Map element)) =>
- IterableMixinWorkaround.where(this, f);
-
- Iterable expand(Iterable f(Map element)) =>
- IterableMixinWorkaround.expand(this, f);
-
- bool every(bool f(Map element)) => IterableMixinWorkaround.every(this, f);
-
- bool any(bool f(Map element)) => IterableMixinWorkaround.any(this, f);
-
- List<Map> toList({ bool growable: true }) =>
- new List<Map>.from(this, growable: growable);
-
- Set<Map> toSet() => new Set<Map>.from(this);
-
- bool get isEmpty => this.length == 0;
-
- Iterable<Map> take(int n) => IterableMixinWorkaround.takeList(this, n);
-
- Iterable<Map> takeWhile(bool test(Map value)) {
- return IterableMixinWorkaround.takeWhile(this, test);
- }
-
- Iterable<Map> skip(int n) => IterableMixinWorkaround.skipList(this, n);
-
- Iterable<Map> skipWhile(bool test(Map value)) {
- return IterableMixinWorkaround.skipWhile(this, test);
- }
-
- Map firstWhere(bool test(Map value), { Map orElse() }) {
- return IterableMixinWorkaround.firstWhere(this, test, orElse);
- }
-
- Map lastWhere(bool test(Map value), {Map orElse()}) {
- return IterableMixinWorkaround.lastWhereList(this, test, orElse);
- }
-
- Map singleWhere(bool test(Map value)) {
- return IterableMixinWorkaround.singleWhere(this, test);
- }
-
- Map elementAt(int index) {
- return this[index];
- }
-
- // From Collection<Map>:
-
- void add(Map value) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void addAll(Iterable<Map> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- // From List<Map>:
void set length(int value) {
throw new UnsupportedError("Cannot resize immutable List.");
}
- void clear() {
- throw new UnsupportedError("Cannot clear immutable List.");
- }
-
- Iterable<Map> get reversed {
- return IterableMixinWorkaround.reversedList(this);
- }
-
- void sort([int compare(Map a, Map b)]) {
- throw new UnsupportedError("Cannot sort immutable List.");
- }
-
- int indexOf(Map element, [int start = 0]) =>
- Lists.indexOf(this, element, start, this.length);
-
- int lastIndexOf(Map element, [int start]) {
- if (start == null) start = length - 1;
- return Lists.lastIndexOf(this, element, start);
- }
-
- Map get first {
- if (this.length > 0) return this[0];
- throw new StateError("No elements");
- }
-
- Map get last {
- if (this.length > 0) return this[this.length - 1];
- throw new StateError("No elements");
- }
-
- Map 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, Map element) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void insertAll(int index, Iterable<Map> iterable) {
- throw new UnsupportedError("Cannot add to immutable List.");
- }
-
- void setAll(int index, Iterable<Map> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- Map removeAt(int pos) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- Map 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(Map element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void retainWhere(bool test(Map element)) {
- throw new UnsupportedError("Cannot remove from immutable List.");
- }
-
- void setRange(int start, int end, Iterable<Map> 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<Map> iterable) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- void fillRange(int start, int end, [Map fillValue]) {
- throw new UnsupportedError("Cannot modify an immutable List.");
- }
-
- Iterable<Map> getRange(int start, int end) =>
- IterableMixinWorkaround.getRangeList(this, start, end);
-
- List<Map> sublist(int start, [int end]) {
- if (end == null) end = length;
- return Lists.getRange(this, start, end, <Map>[]);
- }
-
- Map<int, Map> asMap() =>
- IterableMixinWorkaround.asMapList(this);
-
- String toString() {
- StringBuffer buffer = new StringBuffer('[');
- buffer.writeAll(this, ', ');
- buffer.write(']');
- return buffer.toString();
- }
-
// -- end List<Map> mixins.
@DomName('SQLResultSetRowList.item')
« no previous file with comments | « sdk/lib/svg/dartium/svg_dartium.dart ('k') | sdk/lib/web_sql/dartium/web_sql_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698