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

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: Rebase 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 DEVC$RT.cast(elements, DEVC$RT.type((Iterable<dynamic> _) { 76 for (final E e in DEVC$RT.cast(elements, DEVC$RT.type((Iterable<dynamic> _) {
81 } 77 }
82 ), DEVC$RT.type((Iterable<E> _) { 78 ), DEVC$RT.type((Iterable<E> _) {
83 } 79 }
84 ), "CompositeCast", """line 208, column 23 of dart:collection/queue.dart: """, e lements is Iterable<E>, false)) { 80 ), "CompositeCast", """line 208, column 23 of dart:collection/queue.dart: """, e lements is Iterable<E>, false)) {
85 list.addLast(e); 81 list.addLast(e);
86 } 82 }
87 return DEVC$RT.cast(list, DEVC$RT.type((Queue<E> _) { 83 return DEVC$RT.cast(list, DEVC$RT.type((Queue<E> _) {
88 } 84 }
89 ), DEVC$RT.type((DoubleLinkedQueue<E> _) { 85 ), DEVC$RT.type((DoubleLinkedQueue<E> _) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 initialCapacity = _INITIAL_CAPACITY; 209 initialCapacity = _INITIAL_CAPACITY;
214 } 210 }
215 else if (!_isPowerOf2(initialCapacity)) { 211 else if (!_isPowerOf2(initialCapacity)) {
216 initialCapacity = _nextPowerOf2(initialCapacity); 212 initialCapacity = _nextPowerOf2(initialCapacity);
217 } 213 }
218 assert (_isPowerOf2(initialCapacity)); _table = new List<E>(initialCapacity); 214 assert (_isPowerOf2(initialCapacity)); _table = new List<E>(initialCapacity);
219 } 215 }
220 factory ListQueue.from(Iterable elements) { 216 factory ListQueue.from(Iterable elements) {
221 if (elements is List) { 217 if (elements is List) {
222 int length = elements.length; 218 int length = elements.length;
223 ListQueue<E> queue = ((__x18) => DEVC$RT.cast(__x18, DEVC$RT.type((ListQueue<dy namic> _) { 219 ListQueue<E> queue = new ListQueue<E>(length + 1);
224 }
225 ), DEVC$RT.type((ListQueue<E> _) {
226 }
227 ), "InferableAllocation", """line 399, column 28 of dart:collection/queue.dart: """, __x18 is ListQueue<E>, false))(new ListQueue(length + 1));
228 assert (queue._table.length > length); List sourceList = elements; 220 assert (queue._table.length > length); List sourceList = elements;
229 queue._table.setRange(0, length, DEVC$RT.cast(sourceList, DEVC$RT.type((List<dy namic> _) { 221 queue._table.setRange(0, length, DEVC$RT.cast(sourceList, DEVC$RT.type((List<dy namic> _) {
230 } 222 }
231 ), DEVC$RT.type((Iterable<E> _) { 223 ), DEVC$RT.type((Iterable<E> _) {
232 } 224 }
233 ), "CompositeCast", """line 402, column 40 of dart:collection/queue.dart: """, s ourceList is Iterable<E>, false), 0); 225 ), "CompositeCast", """line 402, column 40 of dart:collection/queue.dart: """, s ourceList is Iterable<E>, false), 0);
234 queue._tail = length; 226 queue._tail = length;
235 return queue; 227 return queue;
236 } 228 }
237 else { 229 else {
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 int _position; 487 int _position;
496 E _current; 488 E _current;
497 _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;
498 E get current => _current; 490 E get current => _current;
499 bool moveNext() { 491 bool moveNext() {
500 _queue._checkModification(_modificationCount); 492 _queue._checkModification(_modificationCount);
501 if (_position == _end) { 493 if (_position == _end) {
502 _current = null; 494 _current = null;
503 return false; 495 return false;
504 } 496 }
505 _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]); 497 _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]);
506 _position = (_position + 1) & (_queue._table.length - 1); 498 _position = (_position + 1) & (_queue._table.length - 1);
507 return true; 499 return true;
508 } 500 }
509 } 501 }
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/async/zone.dart ('k') | test/dart_codegen/expect/collection/splay_tree.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698