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

Side by Side Diff: test/dart_codegen/expect/collection/splay_tree.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 typedef bool _Predicate<T>(T value); 2 typedef bool _Predicate<T>(T value);
3 class _SplayTreeNode<K> {final K key; 3 class _SplayTreeNode<K> {final K key;
4 _SplayTreeNode<K> left; 4 _SplayTreeNode<K> left;
5 _SplayTreeNode<K> right; 5 _SplayTreeNode<K> right;
6 _SplayTreeNode(K this.key); 6 _SplayTreeNode(K this.key);
7 } 7 }
8 class _SplayTreeMapNode<K, V> extends _SplayTreeNode<K> {V value; 8 class _SplayTreeMapNode<K, V> extends _SplayTreeNode<K> {V value;
9 _SplayTreeMapNode(K key, V this.value) : super(key); 9 _SplayTreeMapNode(K key, V this.value) : super(key);
10 } 10 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 while (current.left != null) { 69 while (current.left != null) {
70 _SplayTreeNode left = current.left; 70 _SplayTreeNode left = current.left;
71 current.left = left.right; 71 current.left = left.right;
72 left.right = current; 72 left.right = current;
73 current = left; 73 current = left;
74 } 74 }
75 return DEVC$RT.cast(current, DEVC$RT.type((_SplayTreeNode<dynamic> _) { 75 return DEVC$RT.cast(current, DEVC$RT.type((_SplayTreeNode<dynamic> _) {
76 } 76 }
77 ), DEVC$RT.type((_SplayTreeNode<K> _) { 77 ), DEVC$RT.type((_SplayTreeNode<K> _) {
78 } 78 }
79 ), "CastDynamic", """line 151, column 12 of dart:collection/splay_tree.dart: """ , current is _SplayTreeNode<K>, false); 79 ), "CompositeCast", """line 151, column 12 of dart:collection/splay_tree.dart: " "", current is _SplayTreeNode<K>, false);
80 } 80 }
81 _SplayTreeNode<K> _splayMax(_SplayTreeNode<K> node) { 81 _SplayTreeNode<K> _splayMax(_SplayTreeNode<K> node) {
82 _SplayTreeNode current = node; 82 _SplayTreeNode current = node;
83 while (current.right != null) { 83 while (current.right != null) {
84 _SplayTreeNode right = current.right; 84 _SplayTreeNode right = current.right;
85 current.right = right.left; 85 current.right = right.left;
86 right.left = current; 86 right.left = current;
87 current = right; 87 current = right;
88 } 88 }
89 return DEVC$RT.cast(current, DEVC$RT.type((_SplayTreeNode<dynamic> _) { 89 return DEVC$RT.cast(current, DEVC$RT.type((_SplayTreeNode<dynamic> _) {
90 } 90 }
91 ), DEVC$RT.type((_SplayTreeNode<K> _) { 91 ), DEVC$RT.type((_SplayTreeNode<K> _) {
92 } 92 }
93 ), "CastDynamic", """line 167, column 12 of dart:collection/splay_tree.dart: """ , current is _SplayTreeNode<K>, false); 93 ), "CompositeCast", """line 167, column 12 of dart:collection/splay_tree.dart: " "", current is _SplayTreeNode<K>, false);
94 } 94 }
95 _SplayTreeNode _remove(K key) { 95 _SplayTreeNode _remove(K key) {
96 if (_root == null) return null; 96 if (_root == null) return null;
97 int comp = _splay(key); 97 int comp = _splay(key);
98 if (comp != 0) return null; 98 if (comp != 0) return null;
99 _SplayTreeNode result = _root; 99 _SplayTreeNode result = _root;
100 _count--; 100 _count--;
101 if (_root.left == null) { 101 if (_root.left == null) {
102 _root = _root.right; 102 _root = _root.right;
103 } 103 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 _count = 0; 142 _count = 0;
143 _modificationCount++; 143 _modificationCount++;
144 } 144 }
145 } 145 }
146 class _TypeTest<T> {bool test(v) => v is T; 146 class _TypeTest<T> {bool test(v) => v is T;
147 } 147 }
148 class SplayTreeMap<K, V> extends _SplayTree<K> implements Map<K, V> {Comparator <K> _comparator; 148 class SplayTreeMap<K, V> extends _SplayTree<K> implements Map<K, V> {Comparator <K> _comparator;
149 _Predicate _validKey; 149 _Predicate _validKey;
150 SplayTreeMap([int compare(K key1, K key2), bool isValidKey(potentialKey)]) : _c omparator = ((__x23) => DEVC$RT.cast(__x23, dynamic, DEVC$RT.type((__t20<K> _) { 150 SplayTreeMap([int compare(K key1, K key2), bool isValidKey(potentialKey)]) : _c omparator = ((__x23) => DEVC$RT.cast(__x23, dynamic, DEVC$RT.type((__t20<K> _) {
151 } 151 }
152 ), "CastGeneral", """line 268, column 23 of dart:collection/splay_tree.dart: """ , __x23 is __t20<K>, false))((compare == null) ? Comparable.compare : compare), _validKey = ((__x26) => DEVC$RT.cast(__x26, dynamic, __t24, "CastGeneral", """li ne 269, column 21 of dart:collection/splay_tree.dart: """, __x26 is __t24, false ))((isValidKey != null) ? isValidKey : ((v) => v is K)); 152 ), "CompositeCast", """line 268, column 23 of dart:collection/splay_tree.dart: " "", __x23 is __t20<K>, false))((compare == null) ? Comparable.compare : compare) , _validKey = ((__x26) => DEVC$RT.cast(__x26, dynamic, __t24, "CompositeCast", " ""line 269, column 21 of dart:collection/splay_tree.dart: """, __x26 is __t24, f alse))((isValidKey != null) ? isValidKey : ((v) => v is K));
153 factory SplayTreeMap.from(Map other, [int compare(K key1, K key2), bool isValid Key(potentialKey)]) { 153 factory SplayTreeMap.from(Map other, [int compare(K key1, K key2), bool isValid Key(potentialKey)]) {
154 SplayTreeMap<K, V> result = new SplayTreeMap<K, V>(); 154 SplayTreeMap<K, V> result = new SplayTreeMap<K, V>();
155 other.forEach((k, v) { 155 other.forEach((k, v) {
156 result[k] = DEVC$RT.cast(v, dynamic, V, "CastGeneral", """line 278, column 40 of dart:collection/splay_tree.dart: """, v is V, false); 156 result[k] = DEVC$RT.cast(v, dynamic, V, "CompositeCast", """line 278, column 40 of dart:collection/splay_tree.dart: """, v is V, false);
157 } 157 }
158 ); 158 );
159 return result; 159 return result;
160 } 160 }
161 factory SplayTreeMap.fromIterable(Iterable iterable, { 161 factory SplayTreeMap.fromIterable(Iterable iterable, {
162 K key(element), V value(element), int compare(K key1, K key2), bool isValidKey(p otentialKey)} 162 K key(element), V value(element), int compare(K key1, K key2), bool isValidKey(p otentialKey)}
163 ) { 163 ) {
164 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); 164 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey);
165 Maps._fillMapWithMappedIterable(map, iterable, key, value); 165 Maps._fillMapWithMappedIterable(map, iterable, key, value);
166 return map; 166 return map;
167 } 167 }
168 factory SplayTreeMap.fromIterables(Iterable<K> keys, Iterable<V> values, [int c ompare(K key1, K key2), bool isValidKey(potentialKey)]) { 168 factory SplayTreeMap.fromIterables(Iterable<K> keys, Iterable<V> values, [int c ompare(K key1, K key2), bool isValidKey(potentialKey)]) {
169 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); 169 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey);
170 Maps._fillMapWithIterables(map, keys, values); 170 Maps._fillMapWithIterables(map, keys, values);
171 return map; 171 return map;
172 } 172 }
173 int _compare(K key1, K key2) => _comparator(key1, key2); 173 int _compare(K key1, K key2) => _comparator(key1, key2);
174 SplayTreeMap._internal(); 174 SplayTreeMap._internal();
175 V operator [](Object key) { 175 V operator [](Object key) {
176 if (key == null) throw new ArgumentError(key); 176 if (key == null) throw new ArgumentError(key);
177 if (!_validKey(key)) return null; 177 if (!_validKey(key)) return null;
178 if (_root != null) { 178 if (_root != null) {
179 int comp = _splay(DEVC$RT.cast(key, Object, K, "CastGeneral", """line 331, colum n 25 of dart:collection/splay_tree.dart: """, key is K, false)); 179 int comp = _splay(DEVC$RT.cast(key, Object, K, "CompositeCast", """line 331, col umn 25 of dart:collection/splay_tree.dart: """, key is K, false));
180 if (comp == 0) { 180 if (comp == 0) {
181 _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K> _) { 181 _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K> _) {
182 } 182 }
183 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { 183 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {
184 } 184 }
185 ), "CastGeneral", """line 333, column 37 of dart:collection/splay_tree.dart: """ , _root is _SplayTreeMapNode<dynamic, dynamic>, true); 185 ), "AssignmentCast", """line 333, column 37 of dart:collection/splay_tree.dart: """, _root is _SplayTreeMapNode<dynamic, dynamic>, true);
186 return DEVC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral", """line 334, colu mn 16 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); 186 return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeCast", """line 334, co lumn 16 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false);
187 } 187 }
188 } 188 }
189 return null; 189 return null;
190 } 190 }
191 V remove(Object key) { 191 V remove(Object key) {
192 if (!_validKey(key)) return null; 192 if (!_validKey(key)) return null;
193 _SplayTreeMapNode mapRoot = ((__x27) => DEVC$RT.cast(__x27, DEVC$RT.type((_Spla yTreeNode<dynamic> _) { 193 _SplayTreeMapNode mapRoot = ((__x27) => DEVC$RT.cast(__x27, DEVC$RT.type((_Spla yTreeNode<dynamic> _) {
194 } 194 }
195 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { 195 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {
196 } 196 }
197 ), "CastGeneral", """line 342, column 33 of dart:collection/splay_tree.dart: """ , __x27 is _SplayTreeMapNode<dynamic, dynamic>, true))(_remove(DEVC$RT.cast(key, Object, K, "CastGeneral", """line 342, column 41 of dart:collection/splay_tree. dart: """, key is K, false))); 197 ), "AssignmentCast", """line 342, column 33 of dart:collection/splay_tree.dart: """, __x27 is _SplayTreeMapNode<dynamic, dynamic>, true))(_remove(DEVC$RT.cast(k ey, Object, K, "CompositeCast", """line 342, column 41 of dart:collection/splay_ tree.dart: """, key is K, false)));
198 if (mapRoot != null) return DEVC$RT.cast(mapRoot.value, dynamic, V, "CastGenera l", """line 343, column 33 of dart:collection/splay_tree.dart: """, mapRoot.valu e is V, false); 198 if (mapRoot != null) return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeC ast", """line 343, column 33 of dart:collection/splay_tree.dart: """, mapRoot.va lue is V, false);
199 return null; 199 return null;
200 } 200 }
201 void operator []=(K key, V value) { 201 void operator []=(K key, V value) {
202 if (key == null) throw new ArgumentError(key); 202 if (key == null) throw new ArgumentError(key);
203 int comp = _splay(key); 203 int comp = _splay(key);
204 if (comp == 0) { 204 if (comp == 0) {
205 _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K> _) { 205 _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K> _) {
206 } 206 }
207 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { 207 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {
208 } 208 }
209 ), "CastGeneral", """line 353, column 35 of dart:collection/splay_tree.dart: """ , _root is _SplayTreeMapNode<dynamic, dynamic>, true); 209 ), "AssignmentCast", """line 353, column 35 of dart:collection/splay_tree.dart: """, _root is _SplayTreeMapNode<dynamic, dynamic>, true);
210 mapRoot.value = value; 210 mapRoot.value = value;
211 return;} 211 return;}
212 _addNewRoot(((__x28) => DEVC$RT.cast(__x28, DEVC$RT.type((_SplayTreeMapNode<dyn amic, dynamic> _) { 212 _addNewRoot(((__x28) => DEVC$RT.cast(__x28, DEVC$RT.type((_SplayTreeMapNode<dyn amic, dynamic> _) {
213 } 213 }
214 ), DEVC$RT.type((_SplayTreeNode<K> _) { 214 ), DEVC$RT.type((_SplayTreeNode<K> _) {
215 } 215 }
216 ), "CastExact", """line 357, column 17 of dart:collection/splay_tree.dart: """, __x28 is _SplayTreeNode<K>, false))(new _SplayTreeMapNode(key, value)), comp); 216 ), "InferableAllocation", """line 357, column 17 of dart:collection/splay_tree.d art: """, __x28 is _SplayTreeNode<K>, false))(new _SplayTreeMapNode(key, value)) , comp);
217 } 217 }
218 V putIfAbsent(K key, V ifAbsent()) { 218 V putIfAbsent(K key, V ifAbsent()) {
219 if (key == null) throw new ArgumentError(key); 219 if (key == null) throw new ArgumentError(key);
220 int comp = _splay(key); 220 int comp = _splay(key);
221 if (comp == 0) { 221 if (comp == 0) {
222 _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K> _) { 222 _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K> _) {
223 } 223 }
224 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { 224 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {
225 } 225 }
226 ), "CastGeneral", """line 365, column 35 of dart:collection/splay_tree.dart: """ , _root is _SplayTreeMapNode<dynamic, dynamic>, true); 226 ), "AssignmentCast", """line 365, column 35 of dart:collection/splay_tree.dart: """, _root is _SplayTreeMapNode<dynamic, dynamic>, true);
227 return DEVC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral", """line 366, colu mn 14 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); 227 return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeCast", """line 366, co lumn 14 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false);
228 } 228 }
229 int modificationCount = _modificationCount; 229 int modificationCount = _modificationCount;
230 int splayCount = _splayCount; 230 int splayCount = _splayCount;
231 V value = ifAbsent(); 231 V value = ifAbsent();
232 if (modificationCount != _modificationCount) { 232 if (modificationCount != _modificationCount) {
233 throw new ConcurrentModificationError(this); 233 throw new ConcurrentModificationError(this);
234 } 234 }
235 if (splayCount != _splayCount) { 235 if (splayCount != _splayCount) {
236 comp = _splay(key); 236 comp = _splay(key);
237 assert (comp != 0);} 237 assert (comp != 0);}
238 _addNewRoot(((__x29) => DEVC$RT.cast(__x29, DEVC$RT.type((_SplayTreeMapNode<dyn amic, dynamic> _) { 238 _addNewRoot(((__x29) => DEVC$RT.cast(__x29, DEVC$RT.type((_SplayTreeMapNode<dyn amic, dynamic> _) {
239 } 239 }
240 ), DEVC$RT.type((_SplayTreeNode<K> _) { 240 ), DEVC$RT.type((_SplayTreeNode<K> _) {
241 } 241 }
242 ), "CastExact", """line 379, column 17 of dart:collection/splay_tree.dart: """, __x29 is _SplayTreeNode<K>, false))(new _SplayTreeMapNode(key, value)), comp); 242 ), "InferableAllocation", """line 379, column 17 of dart:collection/splay_tree.d art: """, __x29 is _SplayTreeNode<K>, false))(new _SplayTreeMapNode(key, value)) , comp);
243 return value; 243 return value;
244 } 244 }
245 void addAll(Map<K, V> other) { 245 void addAll(Map<K, V> other) {
246 other.forEach((K key, V value) { 246 other.forEach((K key, V value) {
247 this[key] = value; 247 this[key] = value;
248 } 248 }
249 ); 249 );
250 } 250 }
251 bool get isEmpty { 251 bool get isEmpty {
252 return (_root == null); 252 return (_root == null);
253 } 253 }
254 bool get isNotEmpty => !isEmpty; 254 bool get isNotEmpty => !isEmpty;
255 void forEach(void f(K key, V value)) { 255 void forEach(void f(K key, V value)) {
256 Iterator<_SplayTreeNode<K>> nodes = new _SplayTreeNodeIterator<K>(this); 256 Iterator<_SplayTreeNode<K>> nodes = new _SplayTreeNodeIterator<K>(this);
257 while (nodes.moveNext()) { 257 while (nodes.moveNext()) {
258 _SplayTreeMapNode<K, V> node = DEVC$RT.cast(nodes.current, DEVC$RT.type((_SplayT reeNode<K> _) { 258 _SplayTreeMapNode<K, V> node = DEVC$RT.cast(nodes.current, DEVC$RT.type((_SplayT reeNode<K> _) {
259 } 259 }
260 ), DEVC$RT.type((_SplayTreeMapNode<K, V> _) { 260 ), DEVC$RT.type((_SplayTreeMapNode<K, V> _) {
261 } 261 }
262 ), "CastGeneral", """line 397, column 38 of dart:collection/splay_tree.dart: """ , nodes.current is _SplayTreeMapNode<K, V>, false); 262 ), "CompositeCast", """line 397, column 38 of dart:collection/splay_tree.dart: " "", nodes.current is _SplayTreeMapNode<K, V>, false);
263 f(node.key, node.value); 263 f(node.key, node.value);
264 } 264 }
265 } 265 }
266 int get length { 266 int get length {
267 return _count; 267 return _count;
268 } 268 }
269 void clear() { 269 void clear() {
270 _clear(); 270 _clear();
271 } 271 }
272 bool containsKey(Object key) { 272 bool containsKey(Object key) {
273 return _validKey(key) && _splay(DEVC$RT.cast(key, Object, K, "CastGeneral", """l ine 411, column 37 of dart:collection/splay_tree.dart: """, key is K, false)) == 0; 273 return _validKey(key) && _splay(DEVC$RT.cast(key, Object, K, "CompositeCast", "" "line 411, column 37 of dart:collection/splay_tree.dart: """, key is K, false)) == 0;
274 } 274 }
275 bool containsValue(Object value) { 275 bool containsValue(Object value) {
276 bool found = false; 276 bool found = false;
277 int initialSplayCount = _splayCount; 277 int initialSplayCount = _splayCount;
278 bool visit(_SplayTreeMapNode node) { 278 bool visit(_SplayTreeMapNode node) {
279 while (node != null) { 279 while (node != null) {
280 if (node.value == value) return true; 280 if (node.value == value) return true;
281 if (initialSplayCount != _splayCount) { 281 if (initialSplayCount != _splayCount) {
282 throw new ConcurrentModificationError(this); 282 throw new ConcurrentModificationError(this);
283 } 283 }
284 if (node.right != null && visit(DEVC$RT.cast(node.right, DEVC$RT.type((_SplayTr eeNode<dynamic> _) { 284 if (node.right != null && visit(DEVC$RT.cast(node.right, DEVC$RT.type((_SplayTr eeNode<dynamic> _) {
285 } 285 }
286 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { 286 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {
287 } 287 }
288 ), "CastGeneral", """line 423, column 41 of dart:collection/splay_tree.dart: """ , node.right is _SplayTreeMapNode<dynamic, dynamic>, true))) return true; 288 ), "ImplicitCast", """line 423, column 41 of dart:collection/splay_tree.dart: "" ", node.right is _SplayTreeMapNode<dynamic, dynamic>, true))) return true;
289 node = DEVC$RT.cast(node.left, DEVC$RT.type((_SplayTreeNode<dynamic> _) { 289 node = DEVC$RT.cast(node.left, DEVC$RT.type((_SplayTreeNode<dynamic> _) {
290 } 290 }
291 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { 291 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {
292 } 292 }
293 ), "CastGeneral", """line 424, column 16 of dart:collection/splay_tree.dart: """ , node.left is _SplayTreeMapNode<dynamic, dynamic>, true); 293 ), "ImplicitCast", """line 424, column 16 of dart:collection/splay_tree.dart: "" ", node.left is _SplayTreeMapNode<dynamic, dynamic>, true);
294 } 294 }
295 return false; 295 return false;
296 } 296 }
297 return visit(DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K> _) { 297 return visit(DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K> _) {
298 } 298 }
299 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { 299 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {
300 } 300 }
301 ), "CastGeneral", """line 428, column 18 of dart:collection/splay_tree.dart: """ , _root is _SplayTreeMapNode<dynamic, dynamic>, true)); 301 ), "ImplicitCast", """line 428, column 18 of dart:collection/splay_tree.dart: "" ", _root is _SplayTreeMapNode<dynamic, dynamic>, true));
302 } 302 }
303 Iterable<K> get keys => new _SplayTreeKeyIterable<K>(this); 303 Iterable<K> get keys => new _SplayTreeKeyIterable<K>(this);
304 Iterable<V> get values => new _SplayTreeValueIterable<K, V>(this); 304 Iterable<V> get values => new _SplayTreeValueIterable<K, V>(this);
305 String toString() { 305 String toString() {
306 return Maps.mapToString(this); 306 return Maps.mapToString(this);
307 } 307 }
308 K firstKey() { 308 K firstKey() {
309 if (_root == null) return null; 309 if (_root == null) return null;
310 return DEVC$RT.cast(_first.key, dynamic, K, "CastGeneral", """line 444, column 12 of dart:collection/splay_tree.dart: """, _first.key is K, false); 310 return DEVC$RT.cast(_first.key, dynamic, K, "CompositeCast", """line 444, colum n 12 of dart:collection/splay_tree.dart: """, _first.key is K, false);
311 } 311 }
312 K lastKey() { 312 K lastKey() {
313 if (_root == null) return null; 313 if (_root == null) return null;
314 return DEVC$RT.cast(_last.key, dynamic, K, "CastGeneral", """line 452, column 1 2 of dart:collection/splay_tree.dart: """, _last.key is K, false); 314 return DEVC$RT.cast(_last.key, dynamic, K, "CompositeCast", """line 452, column 12 of dart:collection/splay_tree.dart: """, _last.key is K, false);
315 } 315 }
316 K lastKeyBefore(K key) { 316 K lastKeyBefore(K key) {
317 if (key == null) throw new ArgumentError(key); 317 if (key == null) throw new ArgumentError(key);
318 if (_root == null) return null; 318 if (_root == null) return null;
319 int comp = _splay(key); 319 int comp = _splay(key);
320 if (comp < 0) return _root.key; 320 if (comp < 0) return _root.key;
321 _SplayTreeNode<K> node = _root.left; 321 _SplayTreeNode<K> node = _root.left;
322 if (node == null) return null; 322 if (node == null) return null;
323 while (node.right != null) { 323 while (node.right != null) {
324 node = node.right; 324 node = node.right;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 395 }
396 class _SplayTreeKeyIterable<K> extends IterableBase<K> implements EfficientLeng th {_SplayTree<K> _tree; 396 class _SplayTreeKeyIterable<K> extends IterableBase<K> implements EfficientLeng th {_SplayTree<K> _tree;
397 _SplayTreeKeyIterable(this._tree); 397 _SplayTreeKeyIterable(this._tree);
398 int get length => _tree._count; 398 int get length => _tree._count;
399 bool get isEmpty => _tree._count == 0; 399 bool get isEmpty => _tree._count == 0;
400 Iterator<K> get iterator => new _SplayTreeKeyIterator<K>(_tree); 400 Iterator<K> get iterator => new _SplayTreeKeyIterator<K>(_tree);
401 Set<K> toSet() { 401 Set<K> toSet() {
402 var setOrMap = _tree; 402 var setOrMap = _tree;
403 SplayTreeSet<K> set = new SplayTreeSet<K>(DEVC$RT.cast(setOrMap._comparator, dy namic, DEVC$RT.type((__t30<K> _) { 403 SplayTreeSet<K> set = new SplayTreeSet<K>(DEVC$RT.cast(setOrMap._comparator, dy namic, DEVC$RT.type((__t30<K> _) {
404 } 404 }
405 ), "CastGeneral", """line 613, column 29 of dart:collection/splay_tree.dart: """ , setOrMap._comparator is __t30<K>, false), DEVC$RT.cast(setOrMap._validKey, dyn amic, __t24, "CastGeneral", """line 613, column 51 of dart:collection/splay_tree .dart: """, setOrMap._validKey is __t24, false)); 405 ), "CompositeCast", """line 613, column 29 of dart:collection/splay_tree.dart: " "", setOrMap._comparator is __t30<K>, false), DEVC$RT.cast(setOrMap._validKey, d ynamic, __t24, "CompositeCast", """line 613, column 51 of dart:collection/splay_ tree.dart: """, setOrMap._validKey is __t24, false));
406 set._count = _tree._count; 406 set._count = _tree._count;
407 set._root = set._copyNode(_tree._root); 407 set._root = set._copyNode(_tree._root);
408 return set; 408 return set;
409 } 409 }
410 } 410 }
411 class _SplayTreeValueIterable<K, V> extends IterableBase<V> implements Efficien tLength {SplayTreeMap<K, V> _map; 411 class _SplayTreeValueIterable<K, V> extends IterableBase<V> implements Efficien tLength {SplayTreeMap<K, V> _map;
412 _SplayTreeValueIterable(this._map); 412 _SplayTreeValueIterable(this._map);
413 int get length => _map._count; 413 int get length => _map._count;
414 bool get isEmpty => _map._count == 0; 414 bool get isEmpty => _map._count == 0;
415 Iterator<V> get iterator => new _SplayTreeValueIterator<K, V>(_map); 415 Iterator<V> get iterator => new _SplayTreeValueIterator<K, V>(_map);
416 } 416 }
417 class _SplayTreeKeyIterator<K> extends _SplayTreeIterator<K> {_SplayTreeKeyIter ator(_SplayTree<K> map) : super(map); 417 class _SplayTreeKeyIterator<K> extends _SplayTreeIterator<K> {_SplayTreeKeyIter ator(_SplayTree<K> map) : super(map);
418 K _getValue(_SplayTreeNode node) => DEVC$RT.cast(node.key, dynamic, K, "CastGen eral", """line 631, column 39 of dart:collection/splay_tree.dart: """, node.key is K, false); 418 K _getValue(_SplayTreeNode node) => DEVC$RT.cast(node.key, dynamic, K, "Composi teCast", """line 631, column 39 of dart:collection/splay_tree.dart: """, node.ke y is K, false);
419 } 419 }
420 class _SplayTreeValueIterator<K, V> extends _SplayTreeIterator<V> {_SplayTreeVa lueIterator(SplayTreeMap<K, V> map) : super(map); 420 class _SplayTreeValueIterator<K, V> extends _SplayTreeIterator<V> {_SplayTreeVa lueIterator(SplayTreeMap<K, V> map) : super(map);
421 V _getValue(_SplayTreeMapNode node) => DEVC$RT.cast(node.value, dynamic, V, "Ca stGeneral", """line 636, column 42 of dart:collection/splay_tree.dart: """, node .value is V, false); 421 V _getValue(_SplayTreeMapNode node) => DEVC$RT.cast(node.value, dynamic, V, "Co mpositeCast", """line 636, column 42 of dart:collection/splay_tree.dart: """, no de.value is V, false);
422 } 422 }
423 class _SplayTreeNodeIterator<K> extends _SplayTreeIterator<_SplayTreeNode<K>> { _SplayTreeNodeIterator(_SplayTree<K> tree) : super(tree); 423 class _SplayTreeNodeIterator<K> extends _SplayTreeIterator<_SplayTreeNode<K>> { _SplayTreeNodeIterator(_SplayTree<K> tree) : super(tree);
424 _SplayTreeNodeIterator.startAt(_SplayTree<K> tree, var startKey) : super.startA t(tree, startKey); 424 _SplayTreeNodeIterator.startAt(_SplayTree<K> tree, var startKey) : super.startA t(tree, startKey);
425 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => DEVC$RT.cast(node, DEVC$RT. type((_SplayTreeNode<dynamic> _) { 425 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => DEVC$RT.cast(node, DEVC$RT. type((_SplayTreeNode<dynamic> _) {
426 } 426 }
427 ), DEVC$RT.type((_SplayTreeNode<K> _) { 427 ), DEVC$RT.type((_SplayTreeNode<K> _) {
428 } 428 }
429 ), "CastDynamic", """line 644, column 55 of dart:collection/splay_tree.dart: """ , node is _SplayTreeNode<K>, false); 429 ), "CompositeCast", """line 644, column 55 of dart:collection/splay_tree.dart: " "", node is _SplayTreeNode<K>, false);
430 } 430 }
431 class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>, SetMixin<E> {Comparator _comparator; 431 class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>, SetMixin<E> {Comparator _comparator;
432 _Predicate _validKey; 432 _Predicate _validKey;
433 SplayTreeSet([int compare(E key1, E key2), bool isValidKey(potentialKey)]) : _c omparator = ((__x36) => DEVC$RT.cast(__x36, dynamic, __t33, "CastGeneral", """li ne 693, column 23 of dart:collection/splay_tree.dart: """, __x36 is __t33, false ))((compare == null) ? Comparable.compare : compare), _validKey = ((__x37) => DE VC$RT.cast(__x37, dynamic, __t24, "CastGeneral", """line 694, column 21 of dart: collection/splay_tree.dart: """, __x37 is __t24, false))((isValidKey != null) ? isValidKey : ((v) => v is E)); 433 SplayTreeSet([int compare(E key1, E key2), bool isValidKey(potentialKey)]) : _c omparator = ((__x36) => DEVC$RT.cast(__x36, dynamic, __t33, "CompositeCast", """ line 693, column 23 of dart:collection/splay_tree.dart: """, __x36 is __t33, fal se))((compare == null) ? Comparable.compare : compare), _validKey = ((__x37) => DEVC$RT.cast(__x37, dynamic, __t24, "CompositeCast", """line 694, column 21 of d art:collection/splay_tree.dart: """, __x37 is __t24, false))((isValidKey != null ) ? isValidKey : ((v) => v is E));
434 factory SplayTreeSet.from(Iterable elements, [int compare(E key1, E key2), bool isValidKey(potentialKey)]) { 434 factory SplayTreeSet.from(Iterable elements, [int compare(E key1, E key2), bool isValidKey(potentialKey)]) {
435 SplayTreeSet<E> result = new SplayTreeSet<E>(compare, isValidKey); 435 SplayTreeSet<E> result = new SplayTreeSet<E>(compare, isValidKey);
436 for (final E element in elements) { 436 for (final E element in elements) {
437 result.add(element); 437 result.add(element);
438 } 438 }
439 return result; 439 return result;
440 } 440 }
441 int _compare(E e1, E e2) => _comparator(e1, e2); 441 int _compare(E e1, E e2) => _comparator(e1, e2);
442 Iterator<E> get iterator => new _SplayTreeKeyIterator<E>(this); 442 Iterator<E> get iterator => new _SplayTreeKeyIterator<E>(this);
443 int get length => _count; 443 int get length => _count;
444 bool get isEmpty => _root == null; 444 bool get isEmpty => _root == null;
445 bool get isNotEmpty => _root != null; 445 bool get isNotEmpty => _root != null;
446 E get first { 446 E get first {
447 if (_count == 0) throw IterableElementError.noElement(); 447 if (_count == 0) throw IterableElementError.noElement();
448 return DEVC$RT.cast(_first.key, dynamic, E, "CastGeneral", """line 725, column 12 of dart:collection/splay_tree.dart: """, _first.key is E, false); 448 return DEVC$RT.cast(_first.key, dynamic, E, "CompositeCast", """line 725, colum n 12 of dart:collection/splay_tree.dart: """, _first.key is E, false);
449 } 449 }
450 E get last { 450 E get last {
451 if (_count == 0) throw IterableElementError.noElement(); 451 if (_count == 0) throw IterableElementError.noElement();
452 return DEVC$RT.cast(_last.key, dynamic, E, "CastGeneral", """line 730, column 1 2 of dart:collection/splay_tree.dart: """, _last.key is E, false); 452 return DEVC$RT.cast(_last.key, dynamic, E, "CompositeCast", """line 730, column 12 of dart:collection/splay_tree.dart: """, _last.key is E, false);
453 } 453 }
454 E get single { 454 E get single {
455 if (_count == 0) throw IterableElementError.noElement(); 455 if (_count == 0) throw IterableElementError.noElement();
456 if (_count > 1) throw IterableElementError.tooMany(); 456 if (_count > 1) throw IterableElementError.tooMany();
457 return _root.key; 457 return _root.key;
458 } 458 }
459 bool contains(Object object) { 459 bool contains(Object object) {
460 return _validKey(object) && _splay(DEVC$RT.cast(object, Object, E, "CastGeneral" , """line 741, column 40 of dart:collection/splay_tree.dart: """, object is E, f alse)) == 0; 460 return _validKey(object) && _splay(DEVC$RT.cast(object, Object, E, "CompositeCas t", """line 741, column 40 of dart:collection/splay_tree.dart: """, object is E, false)) == 0;
461 } 461 }
462 bool add(E element) { 462 bool add(E element) {
463 int compare = _splay(element); 463 int compare = _splay(element);
464 if (compare == 0) return false; 464 if (compare == 0) return false;
465 _addNewRoot(((__x38) => DEVC$RT.cast(__x38, DEVC$RT.type((_SplayTreeNode<dynami c> _) { 465 _addNewRoot(((__x38) => DEVC$RT.cast(__x38, DEVC$RT.type((_SplayTreeNode<dynami c> _) {
466 } 466 }
467 ), DEVC$RT.type((_SplayTreeNode<E> _) { 467 ), DEVC$RT.type((_SplayTreeNode<E> _) {
468 } 468 }
469 ), "CastExact", """line 747, column 17 of dart:collection/splay_tree.dart: """, __x38 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); 469 ), "InferableAllocation", """line 747, column 17 of dart:collection/splay_tree.d art: """, __x38 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), comp are);
470 return true; 470 return true;
471 } 471 }
472 bool remove(Object object) { 472 bool remove(Object object) {
473 if (!_validKey(object)) return false; 473 if (!_validKey(object)) return false;
474 return _remove(DEVC$RT.cast(object, Object, E, "CastGeneral", """line 753, colu mn 20 of dart:collection/splay_tree.dart: """, object is E, false)) != null; 474 return _remove(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 753, co lumn 20 of dart:collection/splay_tree.dart: """, object is E, false)) != null;
475 } 475 }
476 void addAll(Iterable<E> elements) { 476 void addAll(Iterable<E> elements) {
477 for (E element in elements) { 477 for (E element in elements) {
478 int compare = _splay(element); 478 int compare = _splay(element);
479 if (compare != 0) { 479 if (compare != 0) {
480 _addNewRoot(((__x39) => DEVC$RT.cast(__x39, DEVC$RT.type((_SplayTreeNode<dynamic > _) { 480 _addNewRoot(((__x39) => DEVC$RT.cast(__x39, DEVC$RT.type((_SplayTreeNode<dynamic > _) {
481 } 481 }
482 ), DEVC$RT.type((_SplayTreeNode<E> _) { 482 ), DEVC$RT.type((_SplayTreeNode<E> _) {
483 } 483 }
484 ), "CastExact", """line 760, column 21 of dart:collection/splay_tree.dart: """, __x39 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); 484 ), "InferableAllocation", """line 760, column 21 of dart:collection/splay_tree.d art: """, __x39 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), comp are);
485 } 485 }
486 } 486 }
487 } 487 }
488 void removeAll(Iterable<Object> elements) { 488 void removeAll(Iterable<Object> elements) {
489 for (Object element in elements) { 489 for (Object element in elements) {
490 if (_validKey(element)) _remove(DEVC$RT.cast(element, Object, E, "CastGeneral", """line 767, column 39 of dart:collection/splay_tree.dart: """, element is E, fa lse)); 490 if (_validKey(element)) _remove(DEVC$RT.cast(element, Object, E, "CompositeCast" , """line 767, column 39 of dart:collection/splay_tree.dart: """, element is E, false));
491 } 491 }
492 } 492 }
493 void retainAll(Iterable<Object> elements) { 493 void retainAll(Iterable<Object> elements) {
494 SplayTreeSet<E> retainSet = new SplayTreeSet<E>(DEVC$RT.wrap((int f(dynamic __u4 0, dynamic __u41)) { 494 SplayTreeSet<E> retainSet = new SplayTreeSet<E>(DEVC$RT.wrap((int f(dynamic __u4 0, dynamic __u41)) {
495 int c(dynamic x0, dynamic x1) => f(x0, x1); 495 int c(dynamic x0, dynamic x1) => f(x0, x1);
496 return f == null ? null : c; 496 return f == null ? null : c;
497 } 497 }
498 , _comparator, __t33, DEVC$RT.type((__t42<E> _) { 498 , _comparator, __t33, DEVC$RT.type((__t42<E> _) {
499 } 499 }
500 ), "Wrap", """line 773, column 53 of dart:collection/splay_tree.dart: """, _comp arator is __t42<E>), _validKey); 500 ), "Wrap", """line 773, column 53 of dart:collection/splay_tree.dart: """, _comp arator is __t42<E>), _validKey);
501 int modificationCount = _modificationCount; 501 int modificationCount = _modificationCount;
502 for (Object object in elements) { 502 for (Object object in elements) {
503 if (modificationCount != _modificationCount) { 503 if (modificationCount != _modificationCount) {
504 throw new ConcurrentModificationError(this); 504 throw new ConcurrentModificationError(this);
505 } 505 }
506 if (_validKey(object) && _splay(DEVC$RT.cast(object, Object, E, "CastGeneral", """line 781, column 39 of dart:collection/splay_tree.dart: """, object is E, fal se)) == 0) retainSet.add(_root.key); 506 if (_validKey(object) && _splay(DEVC$RT.cast(object, Object, E, "CompositeCast" , """line 781, column 39 of dart:collection/splay_tree.dart: """, object is E, f alse)) == 0) retainSet.add(_root.key);
507 } 507 }
508 if (retainSet._count != _count) { 508 if (retainSet._count != _count) {
509 _root = retainSet._root; 509 _root = retainSet._root;
510 _count = retainSet._count; 510 _count = retainSet._count;
511 _modificationCount++; 511 _modificationCount++;
512 } 512 }
513 } 513 }
514 E lookup(Object object) { 514 E lookup(Object object) {
515 if (!_validKey(object)) return null; 515 if (!_validKey(object)) return null;
516 int comp = _splay(DEVC$RT.cast(object, Object, E, "CastGeneral", """line 793, c olumn 23 of dart:collection/splay_tree.dart: """, object is E, false)); 516 int comp = _splay(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 793, column 23 of dart:collection/splay_tree.dart: """, object is E, false));
517 if (comp != 0) return null; 517 if (comp != 0) return null;
518 return _root.key; 518 return _root.key;
519 } 519 }
520 Set<E> intersection(Set<E> other) { 520 Set<E> intersection(Set<E> other) {
521 Set<E> result = new SplayTreeSet<E>(DEVC$RT.wrap((int f(dynamic __u45, dynamic _ _u46)) { 521 Set<E> result = new SplayTreeSet<E>(DEVC$RT.wrap((int f(dynamic __u45, dynamic _ _u46)) {
522 int c(dynamic x0, dynamic x1) => f(x0, x1); 522 int c(dynamic x0, dynamic x1) => f(x0, x1);
523 return f == null ? null : c; 523 return f == null ? null : c;
524 } 524 }
525 , _comparator, __t33, DEVC$RT.type((__t42<E> _) { 525 , _comparator, __t33, DEVC$RT.type((__t42<E> _) {
526 } 526 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 _clear(); 566 _clear();
567 } 567 }
568 Set<E> toSet() => _clone(); 568 Set<E> toSet() => _clone();
569 String toString() => IterableBase.iterableToFullString(this, '{', '}'); 569 String toString() => IterableBase.iterableToFullString(this, '{', '}');
570 } 570 }
571 typedef int __t20<K>(K __u21, K __u22); 571 typedef int __t20<K>(K __u21, K __u22);
572 typedef bool __t24(dynamic __u25); 572 typedef bool __t24(dynamic __u25);
573 typedef int __t30<K>(K __u31, K __u32); 573 typedef int __t30<K>(K __u31, K __u32);
574 typedef int __t33(dynamic __u34, dynamic __u35); 574 typedef int __t33(dynamic __u34, dynamic __u35);
575 typedef int __t42<E>(E __u43, E __u44); 575 typedef int __t42<E>(E __u43, E __u44);
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/collection/set.dart ('k') | test/dart_codegen/expect/convert/ascii.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698