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

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

Issue 1038583004: Rationalize coercions (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase 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 class LinkedList<E extends LinkedListEntry<E>> extends IterableBase<E> implemen ts _LinkedListLink {int _modificationCount = 0; 2 class LinkedList<E extends LinkedListEntry<E>> extends IterableBase<E> implemen ts _LinkedListLink {int _modificationCount = 0;
3 int _length = 0; 3 int _length = 0;
4 _LinkedListLink _next; 4 _LinkedListLink _next;
5 _LinkedListLink _previous; 5 _LinkedListLink _previous;
6 LinkedList() { 6 LinkedList() {
7 _next = _previous = this; 7 _next = _previous = this;
8 } 8 }
9 void addFirst(E entry) { 9 void addFirst(E entry) {
10 _insertAfter(this, entry); 10 _insertAfter(this, entry);
11 } 11 }
12 void add(E entry) { 12 void add(E entry) {
13 _insertAfter(_previous, entry); 13 _insertAfter(_previous, entry);
14 } 14 }
15 void addAll(Iterable<E> entries) { 15 void addAll(Iterable<E> entries) {
16 entries.forEach(((__x10) => DEVC$RT.wrap((void f(dynamic __u5)) { 16 entries.forEach(((__x10) => DEVC$RT.wrap((void f(dynamic __u5)) {
17 void c(dynamic x0) => f(x0); 17 void c(dynamic x0) => f(x0);
18 return f == null ? null : c; 18 return f == null ? null : c;
19 } 19 }
20 , __x10, __t8, DEVC$RT.type((__t6<E> _) { 20 , __x10, __t8, DEVC$RT.type((__t6<E> _) {
21 } 21 }
22 ), "WrapLiteral", """line 65, column 21 of dart:collection/linked_list.dart: " "", __x10 is __t6<E>))((entry) => _insertAfter(_previous, DEVC$RT.cast(entry, dy namic, E, "CastGeneral", """line 65, column 56 of dart:collection/linked_list.da rt: """, entry is E, false)))); 22 ), "WrapLiteral", """line 65, column 21 of dart:collection/linked_list.dart: " "", __x10 is __t6<E>))((entry) => _insertAfter(_previous, DEVC$RT.cast(entry, dy namic, E, "CompositeCast", """line 65, column 56 of dart:collection/linked_list. dart: """, entry is E, false))));
23 } 23 }
24 bool remove(E entry) { 24 bool remove(E entry) {
25 if (entry._list != this) return false; 25 if (entry._list != this) return false;
26 _unlink(entry); 26 _unlink(entry);
27 return true; 27 return true;
28 } 28 }
29 Iterator<E> get iterator => new _LinkedListIterator<E>(this); 29 Iterator<E> get iterator => new _LinkedListIterator<E>(this);
30 int get length => _length; 30 int get length => _length;
31 void clear() { 31 void clear() {
32 _modificationCount++; 32 _modificationCount++;
33 _LinkedListLink next = _next; 33 _LinkedListLink next = _next;
34 while (!identical(next, this)) { 34 while (!identical(next, this)) {
35 E entry = DEVC$RT.cast(next, _LinkedListLink, E, "CastGeneral", """line 93, column 17 of dart:collection/linked_list.dart: """, next is E, false); 35 E entry = DEVC$RT.cast(next, _LinkedListLink, E, "CompositeCast", """line 93 , column 17 of dart:collection/linked_list.dart: """, next is E, false);
36 next = entry._next; 36 next = entry._next;
37 entry._next = entry._previous = entry._list = null; 37 entry._next = entry._previous = entry._list = null;
38 } 38 }
39 _next = _previous = this; 39 _next = _previous = this;
40 _length = 0; 40 _length = 0;
41 } 41 }
42 E get first { 42 E get first {
43 if (identical(_next, this)) { 43 if (identical(_next, this)) {
44 throw new StateError('No such element'); 44 throw new StateError('No such element');
45 } 45 }
46 return DEVC$RT.cast(_next, _LinkedListLink, E, "CastGeneral", """line 105, co lumn 12 of dart:collection/linked_list.dart: """, _next is E, false); 46 return DEVC$RT.cast(_next, _LinkedListLink, E, "CompositeCast", """line 105, column 12 of dart:collection/linked_list.dart: """, _next is E, false);
47 } 47 }
48 E get last { 48 E get last {
49 if (identical(_previous, this)) { 49 if (identical(_previous, this)) {
50 throw new StateError('No such element'); 50 throw new StateError('No such element');
51 } 51 }
52 return DEVC$RT.cast(_previous, _LinkedListLink, E, "CastGeneral", """line 112 , column 12 of dart:collection/linked_list.dart: """, _previous is E, false); 52 return DEVC$RT.cast(_previous, _LinkedListLink, E, "CompositeCast", """line 1 12, column 12 of dart:collection/linked_list.dart: """, _previous is E, false);
53 } 53 }
54 E get single { 54 E get single {
55 if (identical(_previous, this)) { 55 if (identical(_previous, this)) {
56 throw new StateError('No such element'); 56 throw new StateError('No such element');
57 } 57 }
58 if (!identical(_previous, _next)) { 58 if (!identical(_previous, _next)) {
59 throw new StateError('Too many elements'); 59 throw new StateError('Too many elements');
60 } 60 }
61 return DEVC$RT.cast(_next, _LinkedListLink, E, "CastGeneral", """line 122, co lumn 12 of dart:collection/linked_list.dart: """, _next is E, false); 61 return DEVC$RT.cast(_next, _LinkedListLink, E, "CompositeCast", """line 122, column 12 of dart:collection/linked_list.dart: """, _next is E, false);
62 } 62 }
63 void forEach(void action(E entry)) { 63 void forEach(void action(E entry)) {
64 int modificationCount = _modificationCount; 64 int modificationCount = _modificationCount;
65 _LinkedListLink current = _next; 65 _LinkedListLink current = _next;
66 while (!identical(current, this)) { 66 while (!identical(current, this)) {
67 action(DEVC$RT.cast(current, _LinkedListLink, E, "CastGeneral", """line 134, column 14 of dart:collection/linked_list.dart: """, current is E, false)); 67 action(DEVC$RT.cast(current, _LinkedListLink, E, "CompositeCast", """line 13 4, column 14 of dart:collection/linked_list.dart: """, current is E, false));
68 if (modificationCount != _modificationCount) { 68 if (modificationCount != _modificationCount) {
69 throw new ConcurrentModificationError(this); 69 throw new ConcurrentModificationError(this);
70 } 70 }
71 current = current._next; 71 current = current._next;
72 } 72 }
73 } 73 }
74 bool get isEmpty => _length == 0; 74 bool get isEmpty => _length == 0;
75 void _insertAfter(_LinkedListLink entry, E newEntry) { 75 void _insertAfter(_LinkedListLink entry, E newEntry) {
76 if (newEntry.list != null) { 76 if (newEntry.list != null) {
77 throw new StateError('LinkedListEntry is already in a LinkedList'); 77 throw new StateError('LinkedListEntry is already in a LinkedList');
(...skipping 23 matching lines...) Expand all
101 _LinkedListIterator(LinkedList<E> list) : _list = list, _modificationCount = li st._modificationCount, _next = list._next; 101 _LinkedListIterator(LinkedList<E> list) : _list = list, _modificationCount = li st._modificationCount, _next = list._next;
102 E get current => _current; 102 E get current => _current;
103 bool moveNext() { 103 bool moveNext() {
104 if (identical(_next, _list)) { 104 if (identical(_next, _list)) {
105 _current = null; 105 _current = null;
106 return false; 106 return false;
107 } 107 }
108 if (_modificationCount != _list._modificationCount) { 108 if (_modificationCount != _list._modificationCount) {
109 throw new ConcurrentModificationError(this); 109 throw new ConcurrentModificationError(this);
110 } 110 }
111 _current = DEVC$RT.cast(_next, _LinkedListLink, E, "CastGeneral", """line 192, column 16 of dart:collection/linked_list.dart: """, _next is E, false); 111 _current = DEVC$RT.cast(_next, _LinkedListLink, E, "CompositeCast", """line 192 , column 16 of dart:collection/linked_list.dart: """, _next is E, false);
112 _next = _next._next; 112 _next = _next._next;
113 return true; 113 return true;
114 } 114 }
115 } 115 }
116 class _LinkedListLink {_LinkedListLink _next; 116 class _LinkedListLink {_LinkedListLink _next;
117 _LinkedListLink _previous; 117 _LinkedListLink _previous;
118 } 118 }
119 abstract class LinkedListEntry<E extends LinkedListEntry<E>> implements _Linked ListLink {LinkedList<E> _list; 119 abstract class LinkedListEntry<E extends LinkedListEntry<E>> implements _Linked ListLink {LinkedList<E> _list;
120 _LinkedListLink _next; 120 _LinkedListLink _next;
121 _LinkedListLink _previous; 121 _LinkedListLink _previous;
122 LinkedList<E> get list => _list; 122 LinkedList<E> get list => _list;
123 void unlink() { 123 void unlink() {
124 _list._unlink(this); 124 _list._unlink(this);
125 } 125 }
126 E get next { 126 E get next {
127 if (identical(_next, _list)) return null; 127 if (identical(_next, _list)) return null;
128 E result = DEVC$RT.cast(_next, _LinkedListLink, E, "CastGeneral", """line 249, column 16 of dart:collection/linked_list.dart: """, _next is E, false); 128 E result = DEVC$RT.cast(_next, _LinkedListLink, E, "CompositeCast", """line 249 , column 16 of dart:collection/linked_list.dart: """, _next is E, false);
129 return result; 129 return result;
130 } 130 }
131 E get previous { 131 E get previous {
132 if (identical(_previous, _list)) return null; 132 if (identical(_previous, _list)) return null;
133 return DEVC$RT.cast(_previous, _LinkedListLink, E, "CastUser", """line 261, col umn 12 of dart:collection/linked_list.dart: """, _previous is E, false); 133 return DEVC$RT.cast(_previous, _LinkedListLink, E, "CastUser", """line 261, col umn 12 of dart:collection/linked_list.dart: """, _previous is E, false);
134 } 134 }
135 void insertAfter(E entry) { 135 void insertAfter(E entry) {
136 _list._insertAfter(this, entry); 136 _list._insertAfter(this, entry);
137 } 137 }
138 void insertBefore(E entry) { 138 void insertBefore(E entry) {
139 _list._insertAfter(_previous, entry); 139 _list._insertAfter(_previous, entry);
140 } 140 }
141 } 141 }
142 typedef void __t6<E>(E __u7); 142 typedef void __t6<E>(E __u7);
143 typedef void __t8(dynamic __u9); 143 typedef void __t8(dynamic __u9);
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/collection/linked_hash_map.dart ('k') | test/dart_codegen/expect/collection/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698