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

Side by Side Diff: test/dart_codegen/expect/collection/queue.dart

Issue 963593002: Disable formatting and add new-lines to make tests faster. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 part of dart.collection; 1 part of dart.collection;
2 2 abstract class Queue<E> implements Iterable<E>, EfficientLength {factory Queue( ) = ListQueue<E>;
3 abstract class Queue<E> implements Iterable<E>, EfficientLength { 3 factory Queue.from(Iterable elements) = ListQueue<E>.from;
4 factory Queue() = ListQueue<E>; 4 E removeFirst();
5 factory Queue.from(Iterable elements) = ListQueue<E>.from; 5 E removeLast();
6 E removeFirst(); 6 void addFirst(E value);
7 E removeLast(); 7 void addLast(E value);
8 void addFirst(E value); 8 void add(E value);
9 void addLast(E value); 9 bool remove(Object object);
10 void add(E value); 10 void addAll(Iterable<E> iterable);
11 bool remove(Object object); 11 void removeWhere(bool test(E element));
12 void addAll(Iterable<E> iterable); 12 void retainWhere(bool test(E element));
13 void removeWhere(bool test(E element)); 13 void clear();
14 void retainWhere(bool test(E element)); 14 }
15 void clear(); 15 class DoubleLinkedQueueEntry<E> {DoubleLinkedQueueEntry<E> _previous;
16 } 16 DoubleLinkedQueueEntry<E> _next;
17 class DoubleLinkedQueueEntry<E> { 17 E _element;
18 DoubleLinkedQueueEntry<E> _previous; 18 DoubleLinkedQueueEntry(E e) : _element = e;
19 DoubleLinkedQueueEntry<E> _next; 19 void _link(DoubleLinkedQueueEntry<E> previous, DoubleLinkedQueueEntry<E> next) {
20 E _element; 20 _next = next;
21 DoubleLinkedQueueEntry(E e) : _element = e; 21 _previous = previous;
22 void _link( 22 previous._next = this;
23 DoubleLinkedQueueEntry<E> previous, DoubleLinkedQueueEntry<E> next) { 23 next._previous = this;
24 _next = next; 24 }
25 _previous = previous; 25 void append(E e) {
26 previous._next = this; 26 new DoubleLinkedQueueEntry<E>(e)._link(this, _next);
27 next._previous = this; 27 }
28 } 28 void prepend(E e) {
29 void append(E e) { 29 new DoubleLinkedQueueEntry<E>(e)._link(_previous, this);
30 new DoubleLinkedQueueEntry<E>(e)._link(this, _next); 30 }
31 } 31 E remove() {
32 void prepend(E e) { 32 _previous._next = _next;
33 new DoubleLinkedQueueEntry<E>(e)._link(_previous, this); 33 _next._previous = _previous;
34 } 34 _next = null;
35 E remove() { 35 _previous = null;
36 _previous._next = _next; 36 return _element;
37 _next._previous = _previous; 37 }
38 _next = null; 38 DoubleLinkedQueueEntry<E> _asNonSentinelEntry() {
39 _previous = null; 39 return this;
40 return _element; 40 }
41 } 41 DoubleLinkedQueueEntry<E> previousEntry() {
42 DoubleLinkedQueueEntry<E> _asNonSentinelEntry() { 42 return _previous._asNonSentinelEntry();
43 return this; 43 }
44 } 44 DoubleLinkedQueueEntry<E> nextEntry() {
45 DoubleLinkedQueueEntry<E> previousEntry() { 45 return _next._asNonSentinelEntry();
46 return _previous._asNonSentinelEntry(); 46 }
47 } 47 E get element {
48 DoubleLinkedQueueEntry<E> nextEntry() { 48 return _element;
49 return _next._asNonSentinelEntry(); 49 }
50 } 50 void set element(E e) {
51 E get element { 51 _element = e;
52 return _element; 52 }
53 } 53 }
54 void set element(E e) { 54 class _DoubleLinkedQueueEntrySentinel<E> extends DoubleLinkedQueueEntry<E> {_Do ubleLinkedQueueEntrySentinel() : super(((__x32) => DDC$RT.cast(__x32, Null, E, " CastLiteral", """line 164, column 45 of dart:collection/queue.dart: """, __x32 i s E, false))(null)) {
55 _element = e; 55 _link(this, this);
56 } 56 }
57 } 57 E remove() {
58 class _DoubleLinkedQueueEntrySentinel<E> extends DoubleLinkedQueueEntry<E> { 58 throw IterableElementError.noElement();
59 _DoubleLinkedQueueEntrySentinel() : super(((__x32) => DDC$RT.cast(__x32, Null, 59 }
60 E, "CastLiteral", 60 DoubleLinkedQueueEntry<E> _asNonSentinelEntry() {
61 """line 164, column 45 of dart:collection/queue.dart: """, __x32 is E, 61 return null;
62 false))(null)) { 62 }
63 _link(this, this); 63 void set element(E e) {
64 } 64 assert (false);}
65 E remove() { 65 E get element {
66 throw IterableElementError.noElement(); 66 throw IterableElementError.noElement();
67 } 67 }
68 DoubleLinkedQueueEntry<E> _asNonSentinelEntry() { 68 }
69 return null; 69 class DoubleLinkedQueue<E> extends IterableBase<E> implements Queue<E> {_Double LinkedQueueEntrySentinel<E> _sentinel;
70 } 70 int _elementCount = 0;
71 void set element(E e) { 71 DoubleLinkedQueue() {
72 assert(false); 72 _sentinel = new _DoubleLinkedQueueEntrySentinel<E>();
73 } 73 }
74 E get element { 74 factory DoubleLinkedQueue.from(Iterable elements) {
75 throw IterableElementError.noElement(); 75 Queue<E> list = ((__x33) => DDC$RT.cast(__x33, DDC$RT.type((DoubleLinkedQueue<dy namic> _) {
76 } 76 }
77 } 77 ), DDC$RT.type((Queue<E> _) {
78 class DoubleLinkedQueue<E> extends IterableBase<E> implements Queue<E> { 78 }
79 _DoubleLinkedQueueEntrySentinel<E> _sentinel; 79 ), "CastExact", """line 207, column 21 of dart:collection/queue.dart: """, __x33 is Queue<E>, false))(new DoubleLinkedQueue());
80 int _elementCount = 0; 80 for (final E e in elements) {
81 DoubleLinkedQueue() { 81 list.addLast(e);
82 _sentinel = new _DoubleLinkedQueueEntrySentinel<E>(); 82 }
83 } 83 return DDC$RT.cast(list, DDC$RT.type((Queue<E> _) {
84 factory DoubleLinkedQueue.from(Iterable elements) { 84 }
85 Queue<E> list = ((__x33) => DDC$RT.cast(__x33, 85 ), DDC$RT.type((DoubleLinkedQueue<E> _) {
86 DDC$RT.type((DoubleLinkedQueue<dynamic> _) {}), 86 }
87 DDC$RT.type((Queue<E> _) {}), "CastExact", 87 ), "CastGeneral", """line 211, column 12 of dart:collection/queue.dart: """, lis t is DoubleLinkedQueue<E>, false);
88 """line 207, column 21 of dart:collection/queue.dart: """, 88 }
89 __x33 is Queue<E>, false))(new DoubleLinkedQueue()); 89 int get length => _elementCount;
90 for (final E e in elements) { 90 void addLast(E value) {
91 list.addLast(e); 91 _sentinel.prepend(value);
92 } 92 _elementCount++;
93 return DDC$RT.cast(list, DDC$RT.type((Queue<E> _) {}), 93 }
94 DDC$RT.type((DoubleLinkedQueue<E> _) {}), "CastGeneral", 94 void addFirst(E value) {
95 """line 211, column 12 of dart:collection/queue.dart: """, 95 _sentinel.append(value);
96 list is DoubleLinkedQueue<E>, false); 96 _elementCount++;
97 } 97 }
98 int get length => _elementCount; 98 void add(E value) {
99 void addLast(E value) { 99 _sentinel.prepend(value);
100 _sentinel.prepend(value); 100 _elementCount++;
101 _elementCount++; 101 }
102 } 102 void addAll(Iterable<E> iterable) {
103 void addFirst(E value) { 103 for (final E value in iterable) {
104 _sentinel.append(value); 104 _sentinel.prepend(value);
105 _elementCount++; 105 _elementCount++;
106 } 106 }
107 void add(E value) { 107 }
108 _sentinel.prepend(value); 108 E removeLast() {
109 _elementCount++; 109 E result = _sentinel._previous.remove();
110 } 110 _elementCount--;
111 void addAll(Iterable<E> iterable) { 111 return result;
112 for (final E value in iterable) { 112 }
113 _sentinel.prepend(value); 113 E removeFirst() {
114 _elementCount++; 114 E result = _sentinel._next.remove();
115 } 115 _elementCount--;
116 } 116 return result;
117 E removeLast() { 117 }
118 E result = _sentinel._previous.remove(); 118 bool remove(Object o) {
119 _elementCount--; 119 DoubleLinkedQueueEntry<E> entry = _sentinel._next;
120 return result; 120 while (!identical(entry, _sentinel)) {
121 } 121 if (entry.element == o) {
122 E removeFirst() { 122 entry.remove();
123 E result = _sentinel._next.remove(); 123 _elementCount--;
124 _elementCount--; 124 return true;
125 return result; 125 }
126 } 126 entry = entry._next;
127 bool remove(Object o) { 127 }
128 DoubleLinkedQueueEntry<E> entry = _sentinel._next; 128 return false;
129 while (!identical(entry, _sentinel)) { 129 }
130 if (entry.element == o) { 130 void _filter(bool test(E element), bool removeMatching) {
131 entry.remove(); 131 DoubleLinkedQueueEntry<E> entry = _sentinel._next;
132 _elementCount--; 132 while (!identical(entry, _sentinel)) {
133 return true; 133 DoubleLinkedQueueEntry<E> next = entry._next;
134 } 134 if (identical(removeMatching, test(entry.element))) {
135 entry = entry._next; 135 entry.remove();
136 } 136 _elementCount--;
137 return false; 137 }
138 } 138 entry = next;
139 void _filter(bool test(E element), bool removeMatching) { 139 }
140 DoubleLinkedQueueEntry<E> entry = _sentinel._next; 140 }
141 while (!identical(entry, _sentinel)) { 141 void removeWhere(bool test(E element)) {
142 DoubleLinkedQueueEntry<E> next = entry._next; 142 _filter(test, true);
143 if (identical(removeMatching, test(entry.element))) { 143 }
144 entry.remove(); 144 void retainWhere(bool test(E element)) {
145 _elementCount--; 145 _filter(test, false);
146 } 146 }
147 entry = next; 147 E get first {
148 } 148 return _sentinel._next.element;
149 } 149 }
150 void removeWhere(bool test(E element)) { 150 E get last {
151 _filter(test, true); 151 return _sentinel._previous.element;
152 } 152 }
153 void retainWhere(bool test(E element)) { 153 E get single {
154 _filter(test, false); 154 if (identical(_sentinel._next, _sentinel._previous)) {
155 } 155 return _sentinel._next.element;
156 E get first { 156 }
157 return _sentinel._next.element; 157 throw IterableElementError.tooMany();
158 } 158 }
159 E get last { 159 DoubleLinkedQueueEntry<E> lastEntry() {
160 return _sentinel._previous.element; 160 return _sentinel.previousEntry();
161 } 161 }
162 E get single { 162 DoubleLinkedQueueEntry<E> firstEntry() {
163 if (identical(_sentinel._next, _sentinel._previous)) { 163 return _sentinel.nextEntry();
164 return _sentinel._next.element; 164 }
165 } 165 bool get isEmpty {
166 throw IterableElementError.tooMany(); 166 return (identical(_sentinel._next, _sentinel));
167 } 167 }
168 DoubleLinkedQueueEntry<E> lastEntry() { 168 void clear() {
169 return _sentinel.previousEntry(); 169 _sentinel._next = _sentinel;
170 } 170 _sentinel._previous = _sentinel;
171 DoubleLinkedQueueEntry<E> firstEntry() { 171 _elementCount = 0;
172 return _sentinel.nextEntry(); 172 }
173 } 173 void forEachEntry(void f(DoubleLinkedQueueEntry<E> element)) {
174 bool get isEmpty { 174 DoubleLinkedQueueEntry<E> entry = _sentinel._next;
175 return (identical(_sentinel._next, _sentinel)); 175 while (!identical(entry, _sentinel)) {
176 } 176 DoubleLinkedQueueEntry<E> nextEntry = entry._next;
177 void clear() { 177 f(entry);
178 _sentinel._next = _sentinel; 178 entry = nextEntry;
179 _sentinel._previous = _sentinel; 179 }
180 _elementCount = 0; 180 }
181 } 181 _DoubleLinkedQueueIterator<E> get iterator {
182 void forEachEntry(void f(DoubleLinkedQueueEntry<E> element)) { 182 return new _DoubleLinkedQueueIterator<E>(_sentinel);
183 DoubleLinkedQueueEntry<E> entry = _sentinel._next; 183 }
184 while (!identical(entry, _sentinel)) { 184 String toString() => IterableBase.iterableToFullString(this, '{', '}');
185 DoubleLinkedQueueEntry<E> nextEntry = entry._next; 185 }
186 f(entry); 186 class _DoubleLinkedQueueIterator<E> implements Iterator<E> {_DoubleLinkedQueueE ntrySentinel<E> _sentinel;
187 entry = nextEntry; 187 DoubleLinkedQueueEntry<E> _nextEntry = null;
188 } 188 E _current;
189 } 189 _DoubleLinkedQueueIterator(_DoubleLinkedQueueEntrySentinel<E> sentinel) : _sent inel = sentinel, _nextEntry = sentinel._next;
190 _DoubleLinkedQueueIterator<E> get iterator { 190 bool moveNext() {
191 return new _DoubleLinkedQueueIterator<E>(_sentinel); 191 if (!identical(_nextEntry, _sentinel)) {
192 } 192 _current = _nextEntry._element;
193 String toString() => IterableBase.iterableToFullString(this, '{', '}'); 193 _nextEntry = _nextEntry._next;
194 } 194 return true;
195 class _DoubleLinkedQueueIterator<E> implements Iterator<E> { 195 }
196 _DoubleLinkedQueueEntrySentinel<E> _sentinel; 196 _current = ((__x34) => DDC$RT.cast(__x34, Null, E, "CastLiteral", """line 348, column 16 of dart:collection/queue.dart: """, __x34 is E, false))(null);
197 DoubleLinkedQueueEntry<E> _nextEntry = null; 197 _nextEntry = _sentinel = null;
198 E _current; 198 return false;
199 _DoubleLinkedQueueIterator(_DoubleLinkedQueueEntrySentinel<E> sentinel) 199 }
200 : _sentinel = sentinel, 200 E get current => _current;
201 _nextEntry = sentinel._next; 201 }
202 bool moveNext() { 202 class ListQueue<E> extends IterableBase<E> implements Queue<E> {static const in t _INITIAL_CAPACITY = 8;
203 if (!identical(_nextEntry, _sentinel)) { 203 List<E> _table;
204 _current = _nextEntry._element; 204 int _head;
205 _nextEntry = _nextEntry._next; 205 int _tail;
206 return true; 206 int _modificationCount = 0;
207 } 207 ListQueue([int initialCapacity]) : _head = 0, _tail = 0 {
208 _current = ((__x34) => DDC$RT.cast(__x34, Null, E, "CastLiteral", 208 if (initialCapacity == null || initialCapacity < _INITIAL_CAPACITY) {
209 """line 348, column 16 of dart:collection/queue.dart: """, __x34 is E, 209 initialCapacity = _INITIAL_CAPACITY;
210 false))(null); 210 }
211 _nextEntry = _sentinel = null; 211 else if (!_isPowerOf2(initialCapacity)) {
212 return false; 212 initialCapacity = _nextPowerOf2(initialCapacity);
213 } 213 }
214 E get current => _current; 214 assert (_isPowerOf2(initialCapacity)); _table = new List<E>(initialCapacity);
215 } 215 }
216 class ListQueue<E> extends IterableBase<E> implements Queue<E> { 216 factory ListQueue.from(Iterable elements) {
217 static const int _INITIAL_CAPACITY = 8; 217 if (elements is List) {
218 List<E> _table; 218 int length = elements.length;
219 int _head; 219 ListQueue<E> queue = ((__x35) => DDC$RT.cast(__x35, DDC$RT.type((ListQueue<dyna mic> _) {
220 int _tail; 220 }
221 int _modificationCount = 0; 221 ), DDC$RT.type((ListQueue<E> _) {
222 ListQueue([int initialCapacity]) 222 }
223 : _head = 0, 223 ), "CastExact", """line 399, column 28 of dart:collection/queue.dart: """, __x35 is ListQueue<E>, false))(new ListQueue(length + 1));
224 _tail = 0 { 224 assert (queue._table.length > length); List sourceList = elements;
225 if (initialCapacity == null || initialCapacity < _INITIAL_CAPACITY) { 225 queue._table.setRange(0, length, DDC$RT.cast(sourceList, DDC$RT.type((List<dyna mic> _) {
226 initialCapacity = _INITIAL_CAPACITY; 226 }
227 } else if (!_isPowerOf2(initialCapacity)) { 227 ), DDC$RT.type((Iterable<E> _) {
228 initialCapacity = _nextPowerOf2(initialCapacity); 228 }
229 } 229 ), "CastDynamic", """line 402, column 40 of dart:collection/queue.dart: """, sou rceList is Iterable<E>, false), 0);
230 assert(_isPowerOf2(initialCapacity)); 230 queue._tail = length;
231 _table = new List<E>(initialCapacity); 231 return queue;
232 } 232 }
233 factory ListQueue.from(Iterable elements) { 233 else {
234 if (elements is List) { 234 int capacity = _INITIAL_CAPACITY;
235 int length = elements.length; 235 if (elements is EfficientLength) {
236 ListQueue<E> queue = ((__x35) => DDC$RT.cast(__x35, 236 capacity = elements.length;
237 DDC$RT.type((ListQueue<dynamic> _) {}), 237 }
238 DDC$RT.type((ListQueue<E> _) {}), "CastExact", 238 ListQueue<E> result = new ListQueue<E>(capacity);
239 """line 399, column 28 of dart:collection/queue.dart: """, 239 for (final E element in elements) {
240 __x35 is ListQueue<E>, false))(new ListQueue(length + 1)); 240 result.addLast(element);
241 assert(queue._table.length > length); 241 }
242 List sourceList = elements; 242 return result;
243 queue._table.setRange(0, length, DDC$RT.cast(sourceList, 243 }
244 DDC$RT.type((List<dynamic> _) {}), DDC$RT.type((Iterable<E> _) {}), 244 }
245 "CastDynamic", 245 Iterator<E> get iterator => new _ListQueueIterator<E>(this);
246 """line 402, column 40 of dart:collection/queue.dart: """, 246 void forEach(void action(E element)) {
247 sourceList is Iterable<E>, false), 0); 247 int modificationCount = _modificationCount;
248 queue._tail = length; 248 for (int i = _head;
249 return queue; 249 i != _tail;
250 } else { 250 i = (i + 1) & (_table.length - 1)) {
251 int capacity = _INITIAL_CAPACITY; 251 action(_table[i]);
252 if (elements is EfficientLength) { 252 _checkModification(modificationCount);
253 capacity = elements.length; 253 }
254 } 254 }
255 ListQueue<E> result = new ListQueue<E>(capacity); 255 bool get isEmpty => _head == _tail;
256 for (final E element in elements) { 256 int get length => (_tail - _head) & (_table.length - 1);
257 result.addLast(element); 257 E get first {
258 } 258 if (_head == _tail) throw IterableElementError.noElement();
259 return result; 259 return _table[_head];
260 } 260 }
261 } 261 E get last {
262 Iterator<E> get iterator => new _ListQueueIterator<E>(this); 262 if (_head == _tail) throw IterableElementError.noElement();
263 void forEach(void action(E element)) { 263 return _table[(_tail - 1) & (_table.length - 1)];
264 int modificationCount = _modificationCount; 264 }
265 for (int i = _head; i != _tail; i = (i + 1) & (_table.length - 1)) { 265 E get single {
266 action(_table[i]); 266 if (_head == _tail) throw IterableElementError.noElement();
267 _checkModification(modificationCount); 267 if (length > 1) throw IterableElementError.tooMany();
268 } 268 return _table[_head];
269 } 269 }
270 bool get isEmpty => _head == _tail; 270 E elementAt(int index) {
271 int get length => (_tail - _head) & (_table.length - 1); 271 RangeError.checkValidIndex(index, this);
272 E get first { 272 return _table[(_head + index) & (_table.length - 1)];
273 if (_head == _tail) throw IterableElementError.noElement(); 273 }
274 return _table[_head]; 274 List<E> toList({
275 } 275 bool growable : true}
276 E get last { 276 ) {
277 if (_head == _tail) throw IterableElementError.noElement(); 277 List<E> list;
278 return _table[(_tail - 1) & (_table.length - 1)]; 278 if (growable) {
279 } 279 list = new List<E>()..length = length;
280 E get single { 280 }
281 if (_head == _tail) throw IterableElementError.noElement(); 281 else {
282 if (length > 1) throw IterableElementError.tooMany(); 282 list = new List<E>(length);
283 return _table[_head]; 283 }
284 } 284 _writeToList(list);
285 E elementAt(int index) { 285 return list;
286 RangeError.checkValidIndex(index, this); 286 }
287 return _table[(_head + index) & (_table.length - 1)]; 287 void add(E element) {
288 } 288 _add(element);
289 List<E> toList({bool growable: true}) { 289 }
290 List<E> list; 290 void addAll(Iterable<E> elements) {
291 if (growable) { 291 if (elements is List) {
292 list = new List<E>()..length = length; 292 List list = DDC$RT.cast(elements, DDC$RT.type((Iterable<E> _) {
293 } else { 293 }
294 list = new List<E>(length); 294 ), DDC$RT.type((List<dynamic> _) {
295 } 295 }
296 _writeToList(list); 296 ), "CastGeneral", """line 474, column 19 of dart:collection/queue.dart: """, ele ments is List<dynamic>, true);
297 return list; 297 int addCount = list.length;
298 } 298 int length = this.length;
299 void add(E element) { 299 if (length + addCount >= _table.length) {
300 _add(element); 300 _preGrow(length + addCount);
301 } 301 _table.setRange(length, length + addCount, DDC$RT.cast(list, DDC$RT.type((List< dynamic> _) {
302 void addAll(Iterable<E> elements) { 302 }
303 if (elements is List) { 303 ), DDC$RT.type((Iterable<E> _) {
304 List list = DDC$RT.cast(elements, DDC$RT.type((Iterable<E> _) {}), 304 }
305 DDC$RT.type((List<dynamic> _) {}), "CastGeneral", 305 ), "CastDynamic", """line 480, column 52 of dart:collection/queue.dart: """, lis t is Iterable<E>, false), 0);
306 """line 474, column 19 of dart:collection/queue.dart: """, 306 _tail += addCount;
307 elements is List<dynamic>, true); 307 }
308 int addCount = list.length; 308 else {
309 int length = this.length; 309 int endSpace = _table.length - _tail;
310 if (length + addCount >= _table.length) { 310 if (addCount < endSpace) {
311 _preGrow(length + addCount); 311 _table.setRange(_tail, _tail + addCount, DDC$RT.cast(list, DDC$RT.type((List<dyn amic> _) {
312 _table.setRange(length, length + addCount, DDC$RT.cast(list, 312 }
313 DDC$RT.type((List<dynamic> _) {}), DDC$RT.type((Iterable<E> _) {}), 313 ), DDC$RT.type((Iterable<E> _) {
314 "CastDynamic", 314 }
315 """line 480, column 52 of dart:collection/queue.dart: """, 315 ), "CastDynamic", """line 486, column 52 of dart:collection/queue.dart: """, lis t is Iterable<E>, false), 0);
316 list is Iterable<E>, false), 0); 316 _tail += addCount;
317 _tail += addCount; 317 }
318 } else { 318 else {
319 int endSpace = _table.length - _tail; 319 int preSpace = addCount - endSpace;
320 if (addCount < endSpace) { 320 _table.setRange(_tail, _tail + endSpace, DDC$RT.cast(list, DDC$RT.type((List<dy namic> _) {
321 _table.setRange(_tail, _tail + addCount, DDC$RT.cast(list, 321 }
322 DDC$RT.type((List<dynamic> _) {}), 322 ), DDC$RT.type((Iterable<E> _) {
323 DDC$RT.type((Iterable<E> _) {}), "CastDynamic", 323 }
324 """line 486, column 52 of dart:collection/queue.dart: """, 324 ), "CastDynamic", """line 490, column 52 of dart:collection/queue.dart: """, lis t is Iterable<E>, false), 0);
325 list is Iterable<E>, false), 0); 325 _table.setRange(0, preSpace, DDC$RT.cast(list, DDC$RT.type((List<dynamic> _) {
326 _tail += addCount; 326 }
327 } else { 327 ), DDC$RT.type((Iterable<E> _) {
328 int preSpace = addCount - endSpace; 328 }
329 _table.setRange(_tail, _tail + endSpace, DDC$RT.cast(list, 329 ), "CastDynamic", """line 491, column 40 of dart:collection/queue.dart: """, lis t is Iterable<E>, false), endSpace);
330 DDC$RT.type((List<dynamic> _) {}), 330 _tail = preSpace;
331 DDC$RT.type((Iterable<E> _) {}), "CastDynamic", 331 }
332 """line 490, column 52 of dart:collection/queue.dart: """, 332 }
333 list is Iterable<E>, false), 0); 333 _modificationCount++;
334 _table.setRange(0, preSpace, DDC$RT.cast(list, 334 }
335 DDC$RT.type((List<dynamic> _) {}), 335 else {
336 DDC$RT.type((Iterable<E> _) {}), "CastDynamic", 336 for (E element in elements) _add(element);
337 """line 491, column 40 of dart:collection/queue.dart: """, 337 }
338 list is Iterable<E>, false), endSpace); 338 }
339 _tail = preSpace; 339 bool remove(Object object) {
340 } 340 for (int i = _head;
341 } 341 i != _tail;
342 _modificationCount++; 342 i = (i + 1) & (_table.length - 1)) {
343 } else { 343 E element = _table[i];
344 for (E element in elements) _add(element); 344 if (element == object) {
345 } 345 _remove(i);
346 } 346 _modificationCount++;
347 bool remove(Object object) { 347 return true;
348 for (int i = _head; i != _tail; i = (i + 1) & (_table.length - 1)) { 348 }
349 E element = _table[i]; 349 }
350 if (element == object) { 350 return false;
351 _remove(i); 351 }
352 _modificationCount++; 352 void _filterWhere(bool test(E element), bool removeMatching) {
353 return true; 353 int index = _head;
354 } 354 int modificationCount = _modificationCount;
355 } 355 int i = _head;
356 return false; 356 while (i != _tail) {
357 } 357 E element = _table[i];
358 void _filterWhere(bool test(E element), bool removeMatching) { 358 bool remove = identical(removeMatching, test(element));
359 int index = _head; 359 _checkModification(modificationCount);
360 int modificationCount = _modificationCount; 360 if (remove) {
361 int i = _head; 361 i = _remove(i);
362 while (i != _tail) { 362 modificationCount = ++_modificationCount;
363 E element = _table[i]; 363 }
364 bool remove = identical(removeMatching, test(element)); 364 else {
365 _checkModification(modificationCount); 365 i = (i + 1) & (_table.length - 1);
366 if (remove) { 366 }
367 i = _remove(i); 367 }
368 modificationCount = ++_modificationCount; 368 }
369 } else { 369 void removeWhere(bool test(E element)) {
370 i = (i + 1) & (_table.length - 1); 370 _filterWhere(test, true);
371 } 371 }
372 } 372 void retainWhere(bool test(E element)) {
373 } 373 _filterWhere(test, false);
374 void removeWhere(bool test(E element)) { 374 }
375 _filterWhere(test, true); 375 void clear() {
376 } 376 if (_head != _tail) {
377 void retainWhere(bool test(E element)) { 377 for (int i = _head;
378 _filterWhere(test, false); 378 i != _tail;
379 } 379 i = (i + 1) & (_table.length - 1)) {
380 void clear() { 380 _table[i] = ((__x36) => DDC$RT.cast(__x36, Null, E, "CastLiteral", """line 553, column 21 of dart:collection/queue.dart: """, __x36 is E, false))(null);
381 if (_head != _tail) { 381 }
382 for (int i = _head; i != _tail; i = (i + 1) & (_table.length - 1)) { 382 _head = _tail = 0;
383 _table[i] = ((__x36) => DDC$RT.cast(__x36, Null, E, "CastLiteral", 383 _modificationCount++;
384 """line 553, column 21 of dart:collection/queue.dart: """, 384 }
385 __x36 is E, false))(null); 385 }
386 } 386 String toString() => IterableBase.iterableToFullString(this, "{", "}");
387 _head = _tail = 0; 387 void addLast(E element) {
388 _modificationCount++; 388 _add(element);
389 } 389 }
390 } 390 void addFirst(E element) {
391 String toString() => IterableBase.iterableToFullString(this, "{", "}"); 391 _head = (_head - 1) & (_table.length - 1);
392 void addLast(E element) { 392 _table[_head] = element;
393 _add(element); 393 if (_head == _tail) _grow();
394 } 394 _modificationCount++;
395 void addFirst(E element) { 395 }
396 _head = (_head - 1) & (_table.length - 1); 396 E removeFirst() {
397 _table[_head] = element; 397 if (_head == _tail) throw IterableElementError.noElement();
398 if (_head == _tail) _grow(); 398 _modificationCount++;
399 _modificationCount++; 399 E result = _table[_head];
400 } 400 _table[_head] = ((__x37) => DDC$RT.cast(__x37, Null, E, "CastLiteral", """line 577, column 21 of dart:collection/queue.dart: """, __x37 is E, false))(null);
401 E removeFirst() { 401 _head = (_head + 1) & (_table.length - 1);
402 if (_head == _tail) throw IterableElementError.noElement(); 402 return result;
403 _modificationCount++; 403 }
404 E result = _table[_head]; 404 E removeLast() {
405 _table[_head] = ((__x37) => DDC$RT.cast(__x37, Null, E, "CastLiteral", 405 if (_head == _tail) throw IterableElementError.noElement();
406 """line 577, column 21 of dart:collection/queue.dart: """, __x37 is E, 406 _modificationCount++;
407 false))(null); 407 _tail = (_tail - 1) & (_table.length - 1);
408 _head = (_head + 1) & (_table.length - 1); 408 E result = _table[_tail];
409 return result; 409 _table[_tail] = ((__x38) => DDC$RT.cast(__x38, Null, E, "CastLiteral", """line 587, column 21 of dart:collection/queue.dart: """, __x38 is E, false))(null);
410 } 410 return result;
411 E removeLast() { 411 }
412 if (_head == _tail) throw IterableElementError.noElement(); 412 static bool _isPowerOf2(int number) => (number & (number - 1)) == 0;
413 _modificationCount++; 413 static int _nextPowerOf2(int number) {
414 _tail = (_tail - 1) & (_table.length - 1); 414 assert (number > 0); number = (number << 1) - 1;
415 E result = _table[_tail]; 415 for (;
416 _table[_tail] = ((__x38) => DDC$RT.cast(__x38, Null, E, "CastLiteral", 416 ;
417 """line 587, column 21 of dart:collection/queue.dart: """, __x38 is E, 417 ) {
418 false))(null); 418 int nextNumber = number & (number - 1);
419 return result; 419 if (nextNumber == 0) return number;
420 } 420 number = nextNumber;
421 static bool _isPowerOf2(int number) => (number & (number - 1)) == 0; 421 }
422 static int _nextPowerOf2(int number) { 422 }
423 assert(number > 0); 423 void _checkModification(int expectedModificationCount) {
424 number = (number << 1) - 1; 424 if (expectedModificationCount != _modificationCount) {
425 for (;;) { 425 throw new ConcurrentModificationError(this);
426 int nextNumber = number & (number - 1); 426 }
427 if (nextNumber == 0) return number; 427 }
428 number = nextNumber; 428 void _add(E element) {
429 } 429 _table[_tail] = element;
430 } 430 _tail = (_tail + 1) & (_table.length - 1);
431 void _checkModification(int expectedModificationCount) { 431 if (_head == _tail) _grow();
432 if (expectedModificationCount != _modificationCount) { 432 _modificationCount++;
433 throw new ConcurrentModificationError(this); 433 }
434 } 434 int _remove(int offset) {
435 } 435 int mask = _table.length - 1;
436 void _add(E element) { 436 int startDistance = (offset - _head) & mask;
437 _table[_tail] = element; 437 int endDistance = (_tail - offset) & mask;
438 _tail = (_tail + 1) & (_table.length - 1); 438 if (startDistance < endDistance) {
439 if (_head == _tail) _grow(); 439 int i = offset;
440 _modificationCount++; 440 while (i != _head) {
441 } 441 int prevOffset = (i - 1) & mask;
442 int _remove(int offset) { 442 _table[i] = _table[prevOffset];
443 int mask = _table.length - 1; 443 i = prevOffset;
444 int startDistance = (offset - _head) & mask; 444 }
445 int endDistance = (_tail - offset) & mask; 445 _table[_head] = ((__x39) => DDC$RT.cast(__x39, Null, E, "CastLiteral", """line 654, column 23 of dart:collection/queue.dart: """, __x39 is E, false))(null);
446 if (startDistance < endDistance) { 446 _head = (_head + 1) & mask;
447 int i = offset; 447 return (offset + 1) & mask;
448 while (i != _head) { 448 }
449 int prevOffset = (i - 1) & mask; 449 else {
450 _table[i] = _table[prevOffset]; 450 _tail = (_tail - 1) & mask;
451 i = prevOffset; 451 int i = offset;
452 } 452 while (i != _tail) {
453 _table[_head] = ((__x39) => DDC$RT.cast(__x39, Null, E, "CastLiteral", 453 int nextOffset = (i + 1) & mask;
454 """line 654, column 23 of dart:collection/queue.dart: """, __x39 is E, 454 _table[i] = _table[nextOffset];
455 false))(null); 455 i = nextOffset;
456 _head = (_head + 1) & mask; 456 }
457 return (offset + 1) & mask; 457 _table[_tail] = ((__x40) => DDC$RT.cast(__x40, Null, E, "CastLiteral", """line 665, column 23 of dart:collection/queue.dart: """, __x40 is E, false))(null);
458 } else { 458 return offset;
459 _tail = (_tail - 1) & mask; 459 }
460 int i = offset; 460 }
461 while (i != _tail) { 461 void _grow() {
462 int nextOffset = (i + 1) & mask; 462 List<E> newTable = new List<E>(_table.length * 2);
463 _table[i] = _table[nextOffset]; 463 int split = _table.length - _head;
464 i = nextOffset; 464 newTable.setRange(0, split, _table, _head);
465 } 465 newTable.setRange(split, split + _head, _table, 0);
466 _table[_tail] = ((__x40) => DDC$RT.cast(__x40, Null, E, "CastLiteral", 466 _head = 0;
467 """line 665, column 23 of dart:collection/queue.dart: """, __x40 is E, 467 _tail = _table.length;
468 false))(null); 468 _table = newTable;
469 return offset; 469 }
470 } 470 int _writeToList(List<E> target) {
471 } 471 assert (target.length >= length); if (_head <= _tail) {
472 void _grow() { 472 int length = _tail - _head;
473 List<E> newTable = new List<E>(_table.length * 2); 473 target.setRange(0, length, _table, _head);
474 int split = _table.length - _head; 474 return length;
475 newTable.setRange(0, split, _table, _head); 475 }
476 newTable.setRange(split, split + _head, _table, 0); 476 else {
477 _head = 0; 477 int firstPartSize = _table.length - _head;
478 _tail = _table.length; 478 target.setRange(0, firstPartSize, _table, _head);
479 _table = newTable; 479 target.setRange(firstPartSize, firstPartSize + _tail, _table, 0);
480 } 480 return _tail + firstPartSize;
481 int _writeToList(List<E> target) { 481 }
482 assert(target.length >= length); 482 }
483 if (_head <= _tail) { 483 void _preGrow(int newElementCount) {
484 int length = _tail - _head; 484 assert (newElementCount >= length); newElementCount += newElementCount >> 1;
485 target.setRange(0, length, _table, _head); 485 int newCapacity = _nextPowerOf2(newElementCount);
486 return length; 486 List<E> newTable = new List<E>(newCapacity);
487 } else { 487 _tail = _writeToList(newTable);
488 int firstPartSize = _table.length - _head; 488 _table = newTable;
489 target.setRange(0, firstPartSize, _table, _head); 489 _head = 0;
490 target.setRange(firstPartSize, firstPartSize + _tail, _table, 0); 490 }
491 return _tail + firstPartSize; 491 }
492 } 492 class _ListQueueIterator<E> implements Iterator<E> {final ListQueue _queue;
493 } 493 final int _end;
494 void _preGrow(int newElementCount) { 494 final int _modificationCount;
495 assert(newElementCount >= length); 495 int _position;
496 newElementCount += newElementCount >> 1; 496 E _current;
497 int newCapacity = _nextPowerOf2(newElementCount); 497 _ListQueueIterator(ListQueue queue) : _queue = queue, _end = queue._tail, _modi ficationCount = queue._modificationCount, _position = queue._head;
498 List<E> newTable = new List<E>(newCapacity); 498 E get current => _current;
499 _tail = _writeToList(newTable); 499 bool moveNext() {
500 _table = newTable; 500 _queue._checkModification(_modificationCount);
501 _head = 0; 501 if (_position == _end) {
502 } 502 _current = ((__x41) => DDC$RT.cast(__x41, Null, E, "CastLiteral", """line 735, c olumn 18 of dart:collection/queue.dart: """, __x41 is E, false))(null);
503 } 503 return false;
504 class _ListQueueIterator<E> implements Iterator<E> { 504 }
505 final ListQueue _queue; 505 _current = ((__x42) => DDC$RT.cast(__x42, dynamic, E, "CastGeneral", """line 73 8, column 16 of dart:collection/queue.dart: """, __x42 is E, false))(_queue._tab le[_position]);
506 final int _end; 506 _position = (_position + 1) & (_queue._table.length - 1);
507 final int _modificationCount; 507 return true;
508 int _position; 508 }
509 E _current; 509 }
510 _ListQueueIterator(ListQueue queue)
511 : _queue = queue,
512 _end = queue._tail,
513 _modificationCount = queue._modificationCount,
514 _position = queue._head;
515 E get current => _current;
516 bool moveNext() {
517 _queue._checkModification(_modificationCount);
518 if (_position == _end) {
519 _current = ((__x41) => DDC$RT.cast(__x41, Null, E, "CastLiteral",
520 """line 735, column 18 of dart:collection/queue.dart: """, __x41 is E,
521 false))(null);
522 return false;
523 }
524 _current = ((__x42) => DDC$RT.cast(__x42, dynamic, E, "CastGeneral",
525 """line 738, column 16 of dart:collection/queue.dart: """, __x42 is E,
526 false))(_queue._table[_position]);
527 _position = (_position + 1) & (_queue._table.length - 1);
528 return true;
529 }
530 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698