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

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

Issue 1038213003: Downward inference (Closed) Base URL: git@github.com:dart-lang/dart-dev-compiler.git@master
Patch Set: Address comments Created 5 years, 8 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 = ((__x17) => DEVC$RT.cast(__x17, DEVC$RT.type((DoubleLinkedQueue< dynamic> _) { 75 Queue<E> list = new DoubleLinkedQueue<E>();
76 }
77 ), DEVC$RT.type((Queue<E> _) {
78 }
79 ), "InferableAllocation", """line 207, column 21 of dart:collection/queue.dart: """, __x17 is Queue<E>, false))(new DoubleLinkedQueue());
80 for (final E e in elements) { 76 for (final E e in elements) {
81 list.addLast(e); 77 list.addLast(e);
82 } 78 }
83 return DEVC$RT.cast(list, DEVC$RT.type((Queue<E> _) { 79 return DEVC$RT.cast(list, DEVC$RT.type((Queue<E> _) {
84 } 80 }
85 ), DEVC$RT.type((DoubleLinkedQueue<E> _) { 81 ), DEVC$RT.type((DoubleLinkedQueue<E> _) {
86 } 82 }
87 ), "CompositeCast", """line 211, column 12 of dart:collection/queue.dart: """, l ist is DoubleLinkedQueue<E>, false); 83 ), "CompositeCast", """line 211, column 12 of dart:collection/queue.dart: """, l ist is DoubleLinkedQueue<E>, false);
88 } 84 }
89 int get length => _elementCount; 85 int get length => _elementCount;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 initialCapacity = _INITIAL_CAPACITY; 205 initialCapacity = _INITIAL_CAPACITY;
210 } 206 }
211 else if (!_isPowerOf2(initialCapacity)) { 207 else if (!_isPowerOf2(initialCapacity)) {
212 initialCapacity = _nextPowerOf2(initialCapacity); 208 initialCapacity = _nextPowerOf2(initialCapacity);
213 } 209 }
214 assert (_isPowerOf2(initialCapacity)); _table = new List<E>(initialCapacity); 210 assert (_isPowerOf2(initialCapacity)); _table = new List<E>(initialCapacity);
215 } 211 }
216 factory ListQueue.from(Iterable elements) { 212 factory ListQueue.from(Iterable elements) {
217 if (elements is List) { 213 if (elements is List) {
218 int length = elements.length; 214 int length = elements.length;
219 ListQueue<E> queue = ((__x18) => DEVC$RT.cast(__x18, DEVC$RT.type((ListQueue<dy namic> _) { 215 ListQueue<E> queue = new ListQueue<E>(length + 1);
220 }
221 ), DEVC$RT.type((ListQueue<E> _) {
222 }
223 ), "InferableAllocation", """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; 216 assert (queue._table.length > length); List sourceList = elements;
225 queue._table.setRange(0, length, DEVC$RT.cast(sourceList, DEVC$RT.type((List<dy namic> _) { 217 queue._table.setRange(0, length, DEVC$RT.cast(sourceList, DEVC$RT.type((List<dy namic> _) {
226 } 218 }
227 ), DEVC$RT.type((Iterable<E> _) { 219 ), DEVC$RT.type((Iterable<E> _) {
228 } 220 }
229 ), "CompositeCast", """line 402, column 40 of dart:collection/queue.dart: """, s ourceList is Iterable<E>, false), 0); 221 ), "CompositeCast", """line 402, column 40 of dart:collection/queue.dart: """, s ourceList is Iterable<E>, false), 0);
230 queue._tail = length; 222 queue._tail = length;
231 return queue; 223 return queue;
232 } 224 }
233 else { 225 else {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 int _position; 479 int _position;
488 E _current; 480 E _current;
489 _ListQueueIterator(ListQueue queue) : _queue = queue, _end = queue._tail, _modi ficationCount = queue._modificationCount, _position = queue._head; 481 _ListQueueIterator(ListQueue queue) : _queue = queue, _end = queue._tail, _modi ficationCount = queue._modificationCount, _position = queue._head;
490 E get current => _current; 482 E get current => _current;
491 bool moveNext() { 483 bool moveNext() {
492 _queue._checkModification(_modificationCount); 484 _queue._checkModification(_modificationCount);
493 if (_position == _end) { 485 if (_position == _end) {
494 _current = null; 486 _current = null;
495 return false; 487 return false;
496 } 488 }
497 _current = ((__x19) => DEVC$RT.cast(__x19, dynamic, E, "CompositeCast", """line 738, column 16 of dart:collection/queue.dart: """, __x19 is E, false))(_queue._ table[_position]); 489 _current = ((__x17) => DEVC$RT.cast(__x17, dynamic, E, "CompositeCast", """line 738, column 16 of dart:collection/queue.dart: """, __x17 is E, false))(_queue._ table[_position]);
498 _position = (_position + 1) & (_queue._table.length - 1); 490 _position = (_position + 1) & (_queue._table.length - 1);
499 return true; 491 return true;
500 } 492 }
501 } 493 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698