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

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

Issue 1010893004: Allow S->T <: dynamic->T (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Add comment 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 abstract class Queue<E> implements Iterable<E>, EfficientLength {factory Queue( ) = ListQueue<E>; 2 abstract class Queue<E> implements Iterable<E>, EfficientLength {factory Queue( ) = ListQueue<E>;
3 factory Queue.from(Iterable elements) = ListQueue<E>.from; 3 factory Queue.from(Iterable elements) = ListQueue<E>.from;
4 E removeFirst(); 4 E removeFirst();
5 E removeLast(); 5 E removeLast();
6 void addFirst(E value); 6 void addFirst(E value);
7 void addLast(E value); 7 void addLast(E value);
8 void add(E value); 8 void add(E value);
9 bool remove(Object object); 9 bool remove(Object object);
10 void addAll(Iterable<E> iterable); 10 void addAll(Iterable<E> iterable);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 E get element { 65 E get element {
66 throw IterableElementError.noElement(); 66 throw IterableElementError.noElement();
67 } 67 }
68 } 68 }
69 class DoubleLinkedQueue<E> extends IterableBase<E> implements Queue<E> {_Double LinkedQueueEntrySentinel<E> _sentinel; 69 class DoubleLinkedQueue<E> extends IterableBase<E> implements Queue<E> {_Double LinkedQueueEntrySentinel<E> _sentinel;
70 int _elementCount = 0; 70 int _elementCount = 0;
71 DoubleLinkedQueue() { 71 DoubleLinkedQueue() {
72 _sentinel = new _DoubleLinkedQueueEntrySentinel<E>(); 72 _sentinel = new _DoubleLinkedQueueEntrySentinel<E>();
73 } 73 }
74 factory DoubleLinkedQueue.from(Iterable elements) { 74 factory DoubleLinkedQueue.from(Iterable elements) {
75 Queue<E> list = ((__x30) => DEVC$RT.cast(__x30, DEVC$RT.type((DoubleLinkedQueue< dynamic> _) { 75 Queue<E> list = ((__x17) => DEVC$RT.cast(__x17, DEVC$RT.type((DoubleLinkedQueue< dynamic> _) {
76 } 76 }
77 ), DEVC$RT.type((Queue<E> _) { 77 ), DEVC$RT.type((Queue<E> _) {
78 } 78 }
79 ), "CastExact", """line 207, column 21 of dart:collection/queue.dart: """, __x30 is Queue<E>, false))(new DoubleLinkedQueue()); 79 ), "CastExact", """line 207, column 21 of dart:collection/queue.dart: """, __x17 is Queue<E>, false))(new DoubleLinkedQueue());
80 for (final E e in elements) { 80 for (final E e in elements) {
81 list.addLast(e); 81 list.addLast(e);
82 } 82 }
83 return DEVC$RT.cast(list, DEVC$RT.type((Queue<E> _) { 83 return DEVC$RT.cast(list, DEVC$RT.type((Queue<E> _) {
84 } 84 }
85 ), DEVC$RT.type((DoubleLinkedQueue<E> _) { 85 ), DEVC$RT.type((DoubleLinkedQueue<E> _) {
86 } 86 }
87 ), "CastGeneral", """line 211, column 12 of dart:collection/queue.dart: """, lis t is DoubleLinkedQueue<E>, false); 87 ), "CastGeneral", """line 211, column 12 of dart:collection/queue.dart: """, lis t is DoubleLinkedQueue<E>, false);
88 } 88 }
89 int get length => _elementCount; 89 int get length => _elementCount;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 initialCapacity = _INITIAL_CAPACITY; 209 initialCapacity = _INITIAL_CAPACITY;
210 } 210 }
211 else if (!_isPowerOf2(initialCapacity)) { 211 else if (!_isPowerOf2(initialCapacity)) {
212 initialCapacity = _nextPowerOf2(initialCapacity); 212 initialCapacity = _nextPowerOf2(initialCapacity);
213 } 213 }
214 assert (_isPowerOf2(initialCapacity)); _table = new List<E>(initialCapacity); 214 assert (_isPowerOf2(initialCapacity)); _table = new List<E>(initialCapacity);
215 } 215 }
216 factory ListQueue.from(Iterable elements) { 216 factory ListQueue.from(Iterable elements) {
217 if (elements is List) { 217 if (elements is List) {
218 int length = elements.length; 218 int length = elements.length;
219 ListQueue<E> queue = ((__x31) => DEVC$RT.cast(__x31, DEVC$RT.type((ListQueue<dy namic> _) { 219 ListQueue<E> queue = ((__x18) => DEVC$RT.cast(__x18, DEVC$RT.type((ListQueue<dy namic> _) {
220 } 220 }
221 ), DEVC$RT.type((ListQueue<E> _) { 221 ), DEVC$RT.type((ListQueue<E> _) {
222 } 222 }
223 ), "CastExact", """line 399, column 28 of dart:collection/queue.dart: """, __x31 is ListQueue<E>, false))(new ListQueue(length + 1)); 223 ), "CastExact", """line 399, column 28 of dart:collection/queue.dart: """, __x18 is ListQueue<E>, false))(new ListQueue(length + 1));
224 assert (queue._table.length > length); List sourceList = elements; 224 assert (queue._table.length > length); List sourceList = elements;
225 queue._table.setRange(0, length, DEVC$RT.cast(sourceList, DEVC$RT.type((List<dy namic> _) { 225 queue._table.setRange(0, length, DEVC$RT.cast(sourceList, DEVC$RT.type((List<dy namic> _) {
226 } 226 }
227 ), DEVC$RT.type((Iterable<E> _) { 227 ), DEVC$RT.type((Iterable<E> _) {
228 } 228 }
229 ), "CastDynamic", """line 402, column 40 of dart:collection/queue.dart: """, sou rceList is Iterable<E>, false), 0); 229 ), "CastDynamic", """line 402, column 40 of dart:collection/queue.dart: """, sou rceList is Iterable<E>, false), 0);
230 queue._tail = length; 230 queue._tail = length;
231 return queue; 231 return queue;
232 } 232 }
233 else { 233 else {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 int _position; 487 int _position;
488 E _current; 488 E _current;
489 _ListQueueIterator(ListQueue queue) : _queue = queue, _end = queue._tail, _modi ficationCount = queue._modificationCount, _position = queue._head; 489 _ListQueueIterator(ListQueue queue) : _queue = queue, _end = queue._tail, _modi ficationCount = queue._modificationCount, _position = queue._head;
490 E get current => _current; 490 E get current => _current;
491 bool moveNext() { 491 bool moveNext() {
492 _queue._checkModification(_modificationCount); 492 _queue._checkModification(_modificationCount);
493 if (_position == _end) { 493 if (_position == _end) {
494 _current = null; 494 _current = null;
495 return false; 495 return false;
496 } 496 }
497 _current = ((__x32) => DEVC$RT.cast(__x32, dynamic, E, "CastGeneral", """line 7 38, column 16 of dart:collection/queue.dart: """, __x32 is E, false))(_queue._ta ble[_position]); 497 _current = ((__x19) => DEVC$RT.cast(__x19, dynamic, E, "CastGeneral", """line 7 38, column 16 of dart:collection/queue.dart: """, __x19 is E, false))(_queue._ta ble[_position]);
498 _position = (_position + 1) & (_queue._table.length - 1); 498 _position = (_position + 1) & (_queue._table.length - 1);
499 return true; 499 return true;
500 } 500 }
501 } 501 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698