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

Side by Side Diff: client/dom/generated/src/frog/Int8Array.dart

Issue 9290010: Revert "Implement List<T> operations on dom types via manual mixins." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 1
2 class Int8ArrayJs extends ArrayBufferViewJs implements Int8Array, List<int> nati ve "*Int8Array" { 2 class Int8ArrayJs extends ArrayBufferViewJs implements Int8Array, List<int> nati ve "*Int8Array" {
3 3
4 factory Int8Array(int length) => _construct(length); 4 factory Int8Array(int length) => _construct(length);
5 5
6 factory Int8Array.fromList(List<int> list) => _construct(list); 6 factory Int8Array.fromList(List<int> list) => _construct(list);
7 7
8 factory Int8Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer); 8 factory Int8Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
9 9
10 static _construct(arg) native 'return new Int8Array(arg);'; 10 static _construct(arg) native 'return new Int8Array(arg);';
11 11
12 static final int BYTES_PER_ELEMENT = 1; 12 static final int BYTES_PER_ELEMENT = 1;
13 13
14 int get length() native "return this.length;"; 14 int get length() native "return this.length;";
15 15
16 int operator[](int index) native "return this[index];"; 16 int operator[](int index) native;
17 17
18 void operator[]=(int index, int value) native "this[index] = value"; 18 void operator[]=(int index, int value) native;
19 // -- start List<int> mixins.
20 // int is the element type.
21
22 // From Iterable<int>:
23
24 Iterator<int> iterator() {
25 // Note: NodeLists are not fixed size. And most probably length shouldn't
26 // be cached in both iterator _and_ forEach method. For now caching it
27 // for consistency.
28 return new _FixedSizeListIterator<int>(this);
29 }
30
31 // From Collection<int>:
32
33 void add(int value) {
34 throw new UnsupportedOperationException("Cannot add to immutable List.");
35 }
36
37 void addLast(int value) {
38 throw new UnsupportedOperationException("Cannot add to immutable List.");
39 }
40
41 void addAll(Collection<int> collection) {
42 throw new UnsupportedOperationException("Cannot add to immutable List.");
43 }
44
45 void forEach(void f(int element)) => _Collections.forEach(this, f);
46
47 Collection map(f(int element)) => _Collections.map(this, [], f);
48
49 Collection<int> filter(bool f(int element)) =>
50 _Collections.filter(this, <int>[], f);
51
52 bool every(bool f(int element)) => _Collections.every(this, f);
53
54 bool some(bool f(int element)) => _Collections.some(this, f);
55
56 bool isEmpty() => this.length == 0;
57
58 // From List<int>:
59
60 void sort(int compare(int a, int b)) {
61 throw new UnsupportedOperationException("Cannot sort immutable List.");
62 }
63
64 int indexOf(int element, [int start = 0]) =>
65 _Lists.indexOf(this, element, start, this.length);
66
67 int lastIndexOf(int element, [int start = 0]) =>
68 _Lists.lastIndexOf(this, element, start);
69
70 int last() => this[length - 1];
71
72 // FIXME: implement thesee.
73 void setRange(int start, int length, List<int> from, [int startFrom]) {
74 throw new UnsupportedOperationException("Cannot setRange on immutable List." );
75 }
76 void removeRange(int start, int length) {
77 throw new UnsupportedOperationException("Cannot removeRange on immutable Lis t.");
78 }
79 void insertRange(int start, int length, [int initialValue]) {
80 throw new UnsupportedOperationException("Cannot insertRange on immutable Lis t.");
81 }
82 List<int> getRange(int start, int length) =>
83 _Lists.getRange(this, start, length, <int>[]);
84
85 // -- end List<int> mixins.
86 19
87 void setElements(Object array, [int offset = null]) native; 20 void setElements(Object array, [int offset = null]) native;
88 21
89 Int8ArrayJs subarray(int start, [int end = null]) native; 22 Int8ArrayJs subarray(int start, [int end = null]) native;
90 } 23 }
OLDNEW
« no previous file with comments | « client/dom/generated/src/frog/Int32Array.dart ('k') | client/dom/generated/src/frog/MediaList.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698