| OLD | NEW |
| 1 part of dart._internal; | 1 part of dart._internal; |
| 2 | 2 abstract class FixedLengthListMixin<E> {void set length(int newLength) { |
| 3 abstract class FixedLengthListMixin<E> { | 3 throw new UnsupportedError("Cannot change the length of a fixed-length list"); |
| 4 void set length(int newLength) { | |
| 5 throw new UnsupportedError( | |
| 6 "Cannot change the length of a fixed-length list"); | |
| 7 } | 4 } |
| 8 void add(E value) { | 5 void add(E value) { |
| 9 throw new UnsupportedError("Cannot add to a fixed-length list"); | 6 throw new UnsupportedError("Cannot add to a fixed-length list"); |
| 10 } | 7 } |
| 11 void insert(int index, E value) { | 8 void insert(int index, E value) { |
| 12 throw new UnsupportedError("Cannot add to a fixed-length list"); | 9 throw new UnsupportedError("Cannot add to a fixed-length list"); |
| 13 } | 10 } |
| 14 void insertAll(int at, Iterable<E> iterable) { | 11 void insertAll(int at, Iterable<E> iterable) { |
| 15 throw new UnsupportedError("Cannot add to a fixed-length list"); | 12 throw new UnsupportedError("Cannot add to a fixed-length list"); |
| 16 } | 13 } |
| 17 void addAll(Iterable<E> iterable) { | 14 void addAll(Iterable<E> iterable) { |
| 18 throw new UnsupportedError("Cannot add to a fixed-length list"); | 15 throw new UnsupportedError("Cannot add to a fixed-length list"); |
| 19 } | 16 } |
| 20 bool remove(Object element) { | 17 bool remove(Object element) { |
| 21 throw new UnsupportedError("Cannot remove from a fixed-length list"); | 18 throw new UnsupportedError("Cannot remove from a fixed-length list"); |
| 22 } | 19 } |
| 23 void removeWhere(bool test(E element)) { | 20 void removeWhere(bool test(E element)) { |
| 24 throw new UnsupportedError("Cannot remove from a fixed-length list"); | 21 throw new UnsupportedError("Cannot remove from a fixed-length list"); |
| 25 } | 22 } |
| 26 void retainWhere(bool test(E element)) { | 23 void retainWhere(bool test(E element)) { |
| 27 throw new UnsupportedError("Cannot remove from a fixed-length list"); | 24 throw new UnsupportedError("Cannot remove from a fixed-length list"); |
| 28 } | 25 } |
| 29 void clear() { | 26 void clear() { |
| 30 throw new UnsupportedError("Cannot clear a fixed-length list"); | 27 throw new UnsupportedError("Cannot clear a fixed-length list"); |
| 31 } | 28 } |
| 32 E removeAt(int index) { | 29 E removeAt(int index) { |
| 33 throw new UnsupportedError("Cannot remove from a fixed-length list"); | 30 throw new UnsupportedError("Cannot remove from a fixed-length list"); |
| 34 } | 31 } |
| 35 E removeLast() { | 32 E removeLast() { |
| 36 throw new UnsupportedError("Cannot remove from a fixed-length list"); | 33 throw new UnsupportedError("Cannot remove from a fixed-length list"); |
| 37 } | 34 } |
| 38 void removeRange(int start, int end) { | 35 void removeRange(int start, int end) { |
| 39 throw new UnsupportedError("Cannot remove from a fixed-length list"); | 36 throw new UnsupportedError("Cannot remove from a fixed-length list"); |
| 40 } | 37 } |
| 41 void replaceRange(int start, int end, Iterable<E> iterable) { | 38 void replaceRange(int start, int end, Iterable<E> iterable) { |
| 42 throw new UnsupportedError("Cannot remove from a fixed-length list"); | 39 throw new UnsupportedError("Cannot remove from a fixed-length list"); |
| 43 } | 40 } |
| 44 } | 41 } |
| 45 abstract class UnmodifiableListMixin<E> implements List<E> { | 42 abstract class UnmodifiableListMixin<E> implements List<E> {void operator []=(i
nt index, E value) { |
| 46 void operator []=(int index, E value) { | 43 throw new UnsupportedError("Cannot modify an unmodifiable list"); |
| 47 throw new UnsupportedError("Cannot modify an unmodifiable list"); | |
| 48 } | |
| 49 void set length(int newLength) { | |
| 50 throw new UnsupportedError( | |
| 51 "Cannot change the length of an unmodifiable list"); | |
| 52 } | |
| 53 void setAll(int at, Iterable<E> iterable) { | |
| 54 throw new UnsupportedError("Cannot modify an unmodifiable list"); | |
| 55 } | |
| 56 void add(E value) { | |
| 57 throw new UnsupportedError("Cannot add to an unmodifiable list"); | |
| 58 } | |
| 59 E insert(int index, E value) { | |
| 60 throw new UnsupportedError("Cannot add to an unmodifiable list"); | |
| 61 } | |
| 62 void insertAll(int at, Iterable<E> iterable) { | |
| 63 throw new UnsupportedError("Cannot add to an unmodifiable list"); | |
| 64 } | |
| 65 void addAll(Iterable<E> iterable) { | |
| 66 throw new UnsupportedError("Cannot add to an unmodifiable list"); | |
| 67 } | |
| 68 bool remove(Object element) { | |
| 69 throw new UnsupportedError("Cannot remove from an unmodifiable list"); | |
| 70 } | |
| 71 void removeWhere(bool test(E element)) { | |
| 72 throw new UnsupportedError("Cannot remove from an unmodifiable list"); | |
| 73 } | |
| 74 void retainWhere(bool test(E element)) { | |
| 75 throw new UnsupportedError("Cannot remove from an unmodifiable list"); | |
| 76 } | |
| 77 void sort([Comparator<E> compare]) { | |
| 78 throw new UnsupportedError("Cannot modify an unmodifiable list"); | |
| 79 } | |
| 80 void shuffle([Random random]) { | |
| 81 throw new UnsupportedError("Cannot modify an unmodifiable list"); | |
| 82 } | |
| 83 void clear() { | |
| 84 throw new UnsupportedError("Cannot clear an unmodifiable list"); | |
| 85 } | |
| 86 E removeAt(int index) { | |
| 87 throw new UnsupportedError("Cannot remove from an unmodifiable list"); | |
| 88 } | |
| 89 E removeLast() { | |
| 90 throw new UnsupportedError("Cannot remove from an unmodifiable list"); | |
| 91 } | |
| 92 void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) { | |
| 93 throw new UnsupportedError("Cannot modify an unmodifiable list"); | |
| 94 } | |
| 95 void removeRange(int start, int end) { | |
| 96 throw new UnsupportedError("Cannot remove from an unmodifiable list"); | |
| 97 } | |
| 98 void replaceRange(int start, int end, Iterable<E> iterable) { | |
| 99 throw new UnsupportedError("Cannot remove from an unmodifiable list"); | |
| 100 } | |
| 101 void fillRange(int start, int end, [E fillValue]) { | |
| 102 throw new UnsupportedError("Cannot modify an unmodifiable list"); | |
| 103 } | |
| 104 } | 44 } |
| 105 abstract class FixedLengthListBase<E> = ListBase<E> | 45 void set length(int newLength) { |
| 106 with FixedLengthListMixin<E>; | 46 throw new UnsupportedError("Cannot change the length of an unmodifiable list"); |
| 107 abstract class UnmodifiableListBase<E> = ListBase<E> | |
| 108 with UnmodifiableListMixin<E>; | |
| 109 class _ListIndicesIterable extends ListIterable<int> { | |
| 110 List _backedList; | |
| 111 _ListIndicesIterable(this._backedList); | |
| 112 int get length => _backedList.length; | |
| 113 int elementAt(int index) { | |
| 114 RangeError.checkValidIndex(index, this); | |
| 115 return index; | |
| 116 } | |
| 117 } | 47 } |
| 118 class ListMapView<E> implements Map<int, E> { | 48 void setAll(int at, Iterable<E> iterable) { |
| 119 List<E> _values; | 49 throw new UnsupportedError("Cannot modify an unmodifiable list"); |
| 120 ListMapView(this._values); | |
| 121 E operator [](int key) => ((__x18) => DDC$RT.cast(__x18, dynamic, E, | |
| 122 "CastGeneral", """line 251, column 29 of dart:_internal/list.dart: """, | |
| 123 __x18 is E, false))(containsKey(key) ? _values[key] : null); | |
| 124 int get length => _values.length; | |
| 125 Iterable<E> get values => new SubListIterable<E>(_values, 0, null); | |
| 126 Iterable<int> get keys => new _ListIndicesIterable(_values); | |
| 127 bool get isEmpty => _values.isEmpty; | |
| 128 bool get isNotEmpty => _values.isNotEmpty; | |
| 129 bool containsValue(Object value) => _values.contains(value); | |
| 130 bool containsKey(int key) => key is int && key >= 0 && key < length; | |
| 131 void forEach(void f(int key, E value)) { | |
| 132 int length = _values.length; | |
| 133 for (int i = 0; i < length; i++) { | |
| 134 f(i, _values[i]); | |
| 135 if (length != _values.length) { | |
| 136 throw new ConcurrentModificationError(_values); | |
| 137 } | |
| 138 } | |
| 139 } | |
| 140 void operator []=(int key, E value) { | |
| 141 throw new UnsupportedError("Cannot modify an unmodifiable map"); | |
| 142 } | |
| 143 E putIfAbsent(int key, E ifAbsent()) { | |
| 144 throw new UnsupportedError("Cannot modify an unmodifiable map"); | |
| 145 } | |
| 146 E remove(int key) { | |
| 147 throw new UnsupportedError("Cannot modify an unmodifiable map"); | |
| 148 } | |
| 149 void clear() { | |
| 150 throw new UnsupportedError("Cannot modify an unmodifiable map"); | |
| 151 } | |
| 152 void addAll(Map<int, E> other) { | |
| 153 throw new UnsupportedError("Cannot modify an unmodifiable map"); | |
| 154 } | |
| 155 String toString() => Maps.mapToString(this); | |
| 156 } | 50 } |
| 157 class ReversedListIterable<E> extends ListIterable<E> { | 51 void add(E value) { |
| 158 Iterable<E> _source; | 52 throw new UnsupportedError("Cannot add to an unmodifiable list"); |
| 159 ReversedListIterable(this._source); | |
| 160 int get length => _source.length; | |
| 161 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); | |
| 162 } | 53 } |
| 163 abstract class UnmodifiableListError { | 54 E insert(int index, E value) { |
| 164 static UnsupportedError add() => | 55 throw new UnsupportedError("Cannot add to an unmodifiable list"); |
| 165 new UnsupportedError("Cannot add to unmodifiable List"); | |
| 166 static UnsupportedError change() => | |
| 167 new UnsupportedError("Cannot change the content of an unmodifiable List"); | |
| 168 static UnsupportedError length() => | |
| 169 new UnsupportedError("Cannot change length of unmodifiable List"); | |
| 170 static UnsupportedError remove() => | |
| 171 new UnsupportedError("Cannot remove from unmodifiable List"); | |
| 172 } | 56 } |
| 173 abstract class NonGrowableListError { | 57 void insertAll(int at, Iterable<E> iterable) { |
| 174 static UnsupportedError add() => | 58 throw new UnsupportedError("Cannot add to an unmodifiable list"); |
| 175 new UnsupportedError("Cannot add to non-growable List"); | |
| 176 static UnsupportedError length() => | |
| 177 new UnsupportedError("Cannot change length of non-growable List"); | |
| 178 static UnsupportedError remove() => | |
| 179 new UnsupportedError("Cannot remove from non-growable List"); | |
| 180 } | 59 } |
| 181 List makeListFixedLength(List growableList) { | 60 void addAll(Iterable<E> iterable) { |
| 182 JSArray.markFixedList(growableList); | 61 throw new UnsupportedError("Cannot add to an unmodifiable list"); |
| 183 return growableList; | |
| 184 } | 62 } |
| 63 bool remove(Object element) { |
| 64 throw new UnsupportedError("Cannot remove from an unmodifiable list"); |
| 65 } |
| 66 void removeWhere(bool test(E element)) { |
| 67 throw new UnsupportedError("Cannot remove from an unmodifiable list"); |
| 68 } |
| 69 void retainWhere(bool test(E element)) { |
| 70 throw new UnsupportedError("Cannot remove from an unmodifiable list"); |
| 71 } |
| 72 void sort([Comparator<E> compare]) { |
| 73 throw new UnsupportedError("Cannot modify an unmodifiable list"); |
| 74 } |
| 75 void shuffle([Random random]) { |
| 76 throw new UnsupportedError("Cannot modify an unmodifiable list"); |
| 77 } |
| 78 void clear() { |
| 79 throw new UnsupportedError("Cannot clear an unmodifiable list"); |
| 80 } |
| 81 E removeAt(int index) { |
| 82 throw new UnsupportedError("Cannot remove from an unmodifiable list"); |
| 83 } |
| 84 E removeLast() { |
| 85 throw new UnsupportedError("Cannot remove from an unmodifiable list"); |
| 86 } |
| 87 void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) { |
| 88 throw new UnsupportedError("Cannot modify an unmodifiable list"); |
| 89 } |
| 90 void removeRange(int start, int end) { |
| 91 throw new UnsupportedError("Cannot remove from an unmodifiable list"); |
| 92 } |
| 93 void replaceRange(int start, int end, Iterable<E> iterable) { |
| 94 throw new UnsupportedError("Cannot remove from an unmodifiable list"); |
| 95 } |
| 96 void fillRange(int start, int end, [E fillValue]) { |
| 97 throw new UnsupportedError("Cannot modify an unmodifiable list"); |
| 98 } |
| 99 } |
| 100 abstract class FixedLengthListBase<E> = ListBase<E> with FixedLengthListMixin<E
>; |
| 101 abstract class UnmodifiableListBase<E> = ListBase<E> with UnmodifiableListMixin
<E>; |
| 102 class _ListIndicesIterable extends ListIterable<int> {List _backedList; |
| 103 _ListIndicesIterable(this._backedList); |
| 104 int get length => _backedList.length; |
| 105 int elementAt(int index) { |
| 106 RangeError.checkValidIndex(index, this); |
| 107 return index; |
| 108 } |
| 109 } |
| 110 class ListMapView<E> implements Map<int, E> {List<E> _values; |
| 111 ListMapView(this._values); |
| 112 E operator [](int key) => ((__x18) => DDC$RT.cast(__x18, dynamic, E, "CastGener
al", """line 251, column 29 of dart:_internal/list.dart: """, __x18 is E, false)
)(containsKey(key) ? _values[key] : null); |
| 113 int get length => _values.length; |
| 114 Iterable<E> get values => new SubListIterable<E>(_values, 0, null); |
| 115 Iterable<int> get keys => new _ListIndicesIterable(_values); |
| 116 bool get isEmpty => _values.isEmpty; |
| 117 bool get isNotEmpty => _values.isNotEmpty; |
| 118 bool containsValue(Object value) => _values.contains(value); |
| 119 bool containsKey(int key) => key is int && key >= 0 && key < length; |
| 120 void forEach(void f(int key, E value)) { |
| 121 int length = _values.length; |
| 122 for (int i = 0; |
| 123 i < length; |
| 124 i++) { |
| 125 f(i, _values[i]); |
| 126 if (length != _values.length) { |
| 127 throw new ConcurrentModificationError(_values); |
| 128 } |
| 129 } |
| 130 } |
| 131 void operator []=(int key, E value) { |
| 132 throw new UnsupportedError("Cannot modify an unmodifiable map"); |
| 133 } |
| 134 E putIfAbsent(int key, E ifAbsent()) { |
| 135 throw new UnsupportedError("Cannot modify an unmodifiable map"); |
| 136 } |
| 137 E remove(int key) { |
| 138 throw new UnsupportedError("Cannot modify an unmodifiable map"); |
| 139 } |
| 140 void clear() { |
| 141 throw new UnsupportedError("Cannot modify an unmodifiable map"); |
| 142 } |
| 143 void addAll(Map<int, E> other) { |
| 144 throw new UnsupportedError("Cannot modify an unmodifiable map"); |
| 145 } |
| 146 String toString() => Maps.mapToString(this); |
| 147 } |
| 148 class ReversedListIterable<E> extends ListIterable<E> {Iterable<E> _source; |
| 149 ReversedListIterable(this._source); |
| 150 int get length => _source.length; |
| 151 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); |
| 152 } |
| 153 abstract class UnmodifiableListError {static UnsupportedError add() => new Unsu
pportedError("Cannot add to unmodifiable List"); |
| 154 static UnsupportedError change() => new UnsupportedError("Cannot change the con
tent of an unmodifiable List"); |
| 155 static UnsupportedError length() => new UnsupportedError("Cannot change length
of unmodifiable List"); |
| 156 static UnsupportedError remove() => new UnsupportedError("Cannot remove from un
modifiable List"); |
| 157 } |
| 158 abstract class NonGrowableListError {static UnsupportedError add() => new Unsup
portedError("Cannot add to non-growable List"); |
| 159 static UnsupportedError length() => new UnsupportedError("Cannot change length
of non-growable List"); |
| 160 static UnsupportedError remove() => new UnsupportedError("Cannot remove from no
n-growable List"); |
| 161 } |
| 162 List makeListFixedLength(List growableList) { |
| 163 JSArray.markFixedList(growableList); |
| 164 return growableList; |
| 165 } |
| OLD | NEW |