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

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

Issue 977613002: Make int and double nullable by default (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: actually upload changes 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 }
11 abstract class _SplayTree<K> {_SplayTreeNode<K> _root; 11 abstract class _SplayTree<K> {_SplayTreeNode<K> _root;
12 _SplayTreeNode<K> _dummy = new _SplayTreeNode<K>(((__x51) => DDC$RT.cast(__x51, Null, K, "CastLiteral", """line 46, column 52 of dart:collection/splay_tree.dar t: """, __x51 is K, false))(null)); 12 _SplayTreeNode<K> _dummy = new _SplayTreeNode<K>(null);
13 int _count = 0; 13 int _count = 0;
14 int _modificationCount = 0; 14 int _modificationCount = 0;
15 int _splayCount = 0; 15 int _splayCount = 0;
16 int _compare(K key1, K key2); 16 int _compare(K key1, K key2);
17 int _splay(K key) { 17 int _splay(K key) {
18 if (_root == null) return -1; 18 if (_root == null) return -1;
19 _SplayTreeNode<K> left = _dummy; 19 _SplayTreeNode<K> left = _dummy;
20 _SplayTreeNode<K> right = _dummy; 20 _SplayTreeNode<K> right = _dummy;
21 _SplayTreeNode<K> current = _root; 21 _SplayTreeNode<K> current = _root;
22 int comp; 22 int comp;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 void _clear() { 140 void _clear() {
141 _root = null; 141 _root = null;
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 = ((__x55) => DDC$RT.cast(__x55, dynamic, DDC$RT.type((__t52<K> _) { 150 SplayTreeMap([int compare(K key1, K key2), bool isValidKey(potentialKey)]) : _c omparator = ((__x36) => DDC$RT.cast(__x36, dynamic, DDC$RT.type((__t33<K> _) {
151 } 151 }
152 ), "CastGeneral", """line 268, column 23 of dart:collection/splay_tree.dart: """ , __x55 is __t52<K>, false))((compare == null) ? Comparable.compare : compare), _validKey = ((__x58) => DDC$RT.cast(__x58, dynamic, __t56, "CastGeneral", """lin e 269, column 21 of dart:collection/splay_tree.dart: """, __x58 is __t56, false) )((isValidKey != null) ? isValidKey : ((v) => v is K)); 152 ), "CastGeneral", """line 268, column 23 of dart:collection/splay_tree.dart: """ , __x36 is __t33<K>, false))((compare == null) ? Comparable.compare : compare), _validKey = ((__x39) => DDC$RT.cast(__x39, dynamic, __t37, "CastGeneral", """lin e 269, column 21 of dart:collection/splay_tree.dart: """, __x39 is __t37, false) )((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] = DDC$RT.cast(v, dynamic, V, "CastGeneral", """line 278, column 40 of dart:collection/splay_tree.dart: """, v is V, false); 156 result[k] = DDC$RT.cast(v, dynamic, V, "CastGeneral", """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 ((__x59) => DDC$RT.cast(__x59, Null, V, "CastLitera l", """line 329, column 33 of dart:collection/splay_tree.dart: """, __x59 is V, false))(null); 177 if (!_validKey(key)) return null;
178 if (_root != null) { 178 if (_root != null) {
179 int comp = _splay(DDC$RT.cast(key, Object, K, "CastGeneral", """line 331, column 25 of dart:collection/splay_tree.dart: """, key is K, false)); 179 int comp = _splay(DDC$RT.cast(key, Object, K, "CastGeneral", """line 331, column 25 of dart:collection/splay_tree.dart: """, key is K, false));
180 if (comp == 0) { 180 if (comp == 0) {
181 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _) { 181 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _) {
182 } 182 }
183 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { 183 ), DDC$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 ), "CastGeneral", """line 333, column 37 of dart:collection/splay_tree.dart: """ , _root is _SplayTreeMapNode<dynamic, dynamic>, true);
186 return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral", """line 334, colum n 16 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); 186 return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral", """line 334, colum n 16 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false);
187 } 187 }
188 } 188 }
189 return ((__x60) => DDC$RT.cast(__x60, Null, V, "CastLiteral", """line 337, colu mn 12 of dart:collection/splay_tree.dart: """, __x60 is V, false))(null); 189 return null;
190 } 190 }
191 V remove(Object key) { 191 V remove(Object key) {
192 if (!_validKey(key)) return ((__x61) => DDC$RT.cast(__x61, Null, V, "CastLiteral ", """line 341, column 33 of dart:collection/splay_tree.dart: """, __x61 is V, f alse))(null); 192 if (!_validKey(key)) return null;
193 _SplayTreeMapNode mapRoot = ((__x62) => DDC$RT.cast(__x62, DDC$RT.type((_SplayT reeNode<dynamic> _) { 193 _SplayTreeMapNode mapRoot = ((__x40) => DDC$RT.cast(__x40, DDC$RT.type((_SplayT reeNode<dynamic> _) {
194 } 194 }
195 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { 195 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {
196 } 196 }
197 ), "CastGeneral", """line 342, column 33 of dart:collection/splay_tree.dart: """ , __x62 is _SplayTreeMapNode<dynamic, dynamic>, true))(_remove(DDC$RT.cast(key, Object, K, "CastGeneral", """line 342, column 41 of dart:collection/splay_tree.d art: """, key is K, false))); 197 ), "CastGeneral", """line 342, column 33 of dart:collection/splay_tree.dart: """ , __x40 is _SplayTreeMapNode<dynamic, dynamic>, true))(_remove(DDC$RT.cast(key, Object, K, "CastGeneral", """line 342, column 41 of dart:collection/splay_tree.d art: """, key is K, false)));
198 if (mapRoot != null) return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral ", """line 343, column 33 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); 198 if (mapRoot != null) return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral ", """line 343, column 33 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false);
199 return ((__x63) => DDC$RT.cast(__x63, Null, V, "CastLiteral", """line 344, colu mn 12 of dart:collection/splay_tree.dart: """, __x63 is V, false))(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 = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _) { 205 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _) {
206 } 206 }
207 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { 207 ), DDC$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 ), "CastGeneral", """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(((__x64) => DDC$RT.cast(__x64, DDC$RT.type((_SplayTreeMapNode<dynam ic, dynamic> _) { 212 _addNewRoot(((__x41) => DDC$RT.cast(__x41, DDC$RT.type((_SplayTreeMapNode<dynam ic, dynamic> _) {
213 } 213 }
214 ), DDC$RT.type((_SplayTreeNode<K> _) { 214 ), DDC$RT.type((_SplayTreeNode<K> _) {
215 } 215 }
216 ), "CastExact", """line 357, column 17 of dart:collection/splay_tree.dart: """, __x64 is _SplayTreeNode<K>, false))(new _SplayTreeMapNode(key, value)), comp); 216 ), "CastExact", """line 357, column 17 of dart:collection/splay_tree.dart: """, __x41 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 = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _) { 222 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _) {
223 } 223 }
224 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { 224 ), DDC$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 ), "CastGeneral", """line 365, column 35 of dart:collection/splay_tree.dart: """ , _root is _SplayTreeMapNode<dynamic, dynamic>, true);
227 return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral", """line 366, colum n 14 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); 227 return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral", """line 366, colum n 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(((__x65) => DDC$RT.cast(__x65, DDC$RT.type((_SplayTreeMapNode<dynam ic, dynamic> _) { 238 _addNewRoot(((__x42) => DDC$RT.cast(__x42, DDC$RT.type((_SplayTreeMapNode<dynam ic, dynamic> _) {
239 } 239 }
240 ), DDC$RT.type((_SplayTreeNode<K> _) { 240 ), DDC$RT.type((_SplayTreeNode<K> _) {
241 } 241 }
242 ), "CastExact", """line 379, column 17 of dart:collection/splay_tree.dart: """, __x65 is _SplayTreeNode<K>, false))(new _SplayTreeMapNode(key, value)), comp); 242 ), "CastExact", """line 379, column 17 of dart:collection/splay_tree.dart: """, __x42 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);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { 299 ), DDC$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 ), "CastGeneral", """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 ((__x66) => DDC$RT.cast(__x66, Null, K, "CastLiteral", """line 443, column 31 of dart:collection/splay_tree.dart: """, __x66 is K, fal se))(null); 309 if (_root == null) return null;
310 return DDC$RT.cast(_first.key, dynamic, K, "CastGeneral", """line 444, column 1 2 of dart:collection/splay_tree.dart: """, _first.key is K, false); 310 return DDC$RT.cast(_first.key, dynamic, K, "CastGeneral", """line 444, column 1 2 of dart:collection/splay_tree.dart: """, _first.key is K, false);
311 } 311 }
312 K lastKey() { 312 K lastKey() {
313 if (_root == null) return ((__x67) => DDC$RT.cast(__x67, Null, K, "CastLiteral", """line 451, column 31 of dart:collection/splay_tree.dart: """, __x67 is K, fal se))(null); 313 if (_root == null) return null;
314 return DDC$RT.cast(_last.key, dynamic, K, "CastGeneral", """line 452, column 12 of dart:collection/splay_tree.dart: """, _last.key is K, false); 314 return DDC$RT.cast(_last.key, dynamic, K, "CastGeneral", """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 ((__x68) => DDC$RT.cast(__x68, Null, K, "CastLiteral" , """line 461, column 31 of dart:collection/splay_tree.dart: """, __x68 is K, fa lse))(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 ((__x69) => DDC$RT.cast(__x69, Null, K, "CastLiteral", """line 465, column 30 of dart:collection/splay_tree.dart: """, __x69 is K, fal se))(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;
325 } 325 }
326 return node.key; 326 return node.key;
327 } 327 }
328 K firstKeyAfter(K key) { 328 K firstKeyAfter(K key) {
329 if (key == null) throw new ArgumentError(key); 329 if (key == null) throw new ArgumentError(key);
330 if (_root == null) return ((__x70) => DDC$RT.cast(__x70, Null, K, "CastLiteral" , """line 478, column 31 of dart:collection/splay_tree.dart: """, __x70 is K, fa lse))(null); 330 if (_root == null) return null;
331 int comp = _splay(key); 331 int comp = _splay(key);
332 if (comp > 0) return _root.key; 332 if (comp > 0) return _root.key;
333 _SplayTreeNode<K> node = _root.right; 333 _SplayTreeNode<K> node = _root.right;
334 if (node == null) return ((__x71) => DDC$RT.cast(__x71, Null, K, "CastLiteral", """line 482, column 30 of dart:collection/splay_tree.dart: """, __x71 is K, fal se))(null); 334 if (node == null) return null;
335 while (node.left != null) { 335 while (node.left != null) {
336 node = node.left; 336 node = node.left;
337 } 337 }
338 return node.key; 338 return node.key;
339 } 339 }
340 } 340 }
341 abstract class _SplayTreeIterator<T> implements Iterator<T> {final _SplayTree _ tree; 341 abstract class _SplayTreeIterator<T> implements Iterator<T> {final _SplayTree _ tree;
342 final List<_SplayTreeNode> _workList = <_SplayTreeNode> []; 342 final List<_SplayTreeNode> _workList = <_SplayTreeNode> [];
343 int _modificationCount; 343 int _modificationCount;
344 int _splayCount; 344 int _splayCount;
345 _SplayTreeNode _currentNode; 345 _SplayTreeNode _currentNode;
346 _SplayTreeIterator(_SplayTree tree) : _tree = tree, _modificationCount = tree._ modificationCount, _splayCount = tree._splayCount { 346 _SplayTreeIterator(_SplayTree tree) : _tree = tree, _modificationCount = tree._ modificationCount, _splayCount = tree._splayCount {
347 _findLeftMostDescendent(tree._root); 347 _findLeftMostDescendent(tree._root);
348 } 348 }
349 _SplayTreeIterator.startAt(_SplayTree tree, var startKey) : _tree = tree, _modi ficationCount = tree._modificationCount { 349 _SplayTreeIterator.startAt(_SplayTree tree, var startKey) : _tree = tree, _modi ficationCount = tree._modificationCount {
350 if (tree._root == null) return; int compare = tree._splay(startKey); 350 if (tree._root == null) return; int compare = tree._splay(startKey);
351 _splayCount = tree._splayCount; 351 _splayCount = tree._splayCount;
352 if (compare < 0) { 352 if (compare < 0) {
353 _findLeftMostDescendent(tree._root.right); 353 _findLeftMostDescendent(tree._root.right);
354 } 354 }
355 else { 355 else {
356 _workList.add(tree._root); 356 _workList.add(tree._root);
357 } 357 }
358 } 358 }
359 T get current { 359 T get current {
360 if (_currentNode == null) return ((__x72) => DDC$RT.cast(__x72, Null, T, "CastLi teral", """line 547, column 38 of dart:collection/splay_tree.dart: """, __x72 is T, false))(null); 360 if (_currentNode == null) return null;
361 return _getValue(_currentNode); 361 return _getValue(_currentNode);
362 } 362 }
363 void _findLeftMostDescendent(_SplayTreeNode node) { 363 void _findLeftMostDescendent(_SplayTreeNode node) {
364 while (node != null) { 364 while (node != null) {
365 _workList.add(node); 365 _workList.add(node);
366 node = node.left; 366 node = node.left;
367 } 367 }
368 } 368 }
369 void _rebuildWorkList(_SplayTreeNode currentNode) { 369 void _rebuildWorkList(_SplayTreeNode currentNode) {
370 assert (!_workList.isEmpty); _workList.clear(); 370 assert (!_workList.isEmpty); _workList.clear();
(...skipping 22 matching lines...) Expand all
393 } 393 }
394 T _getValue(_SplayTreeNode node); 394 T _getValue(_SplayTreeNode node);
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>(DDC$RT.cast(setOrMap._comparator, dyn amic, DDC$RT.type((__t73<K> _) { 403 SplayTreeSet<K> set = new SplayTreeSet<K>(DDC$RT.cast(setOrMap._comparator, dyn amic, DDC$RT.type((__t43<K> _) {
404 } 404 }
405 ), "CastGeneral", """line 613, column 29 of dart:collection/splay_tree.dart: """ , setOrMap._comparator is __t73<K>, false), DDC$RT.cast(setOrMap._validKey, dyna mic, __t56, "CastGeneral", """line 613, column 51 of dart:collection/splay_tree. dart: """, setOrMap._validKey is __t56, false)); 405 ), "CastGeneral", """line 613, column 29 of dart:collection/splay_tree.dart: """ , setOrMap._comparator is __t43<K>, false), DDC$RT.cast(setOrMap._validKey, dyna mic, __t37, "CastGeneral", """line 613, column 51 of dart:collection/splay_tree. dart: """, setOrMap._validKey is __t37, 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) => DDC$RT.cast(node.key, dynamic, K, "CastGene ral", """line 631, column 39 of dart:collection/splay_tree.dart: """, node.key i s K, false); 418 K _getValue(_SplayTreeNode node) => DDC$RT.cast(node.key, dynamic, K, "CastGene ral", """line 631, column 39 of dart:collection/splay_tree.dart: """, node.key i s 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) => DDC$RT.cast(node.value, dynamic, V, "Cas tGeneral", """line 636, column 42 of dart:collection/splay_tree.dart: """, node. value is V, false); 421 V _getValue(_SplayTreeMapNode node) => DDC$RT.cast(node.value, dynamic, V, "Cas tGeneral", """line 636, column 42 of dart:collection/splay_tree.dart: """, node. 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) => DDC$RT.cast(node, DDC$RT.ty pe((_SplayTreeNode<dynamic> _) { 425 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => DDC$RT.cast(node, DDC$RT.ty pe((_SplayTreeNode<dynamic> _) {
426 } 426 }
427 ), DDC$RT.type((_SplayTreeNode<K> _) { 427 ), DDC$RT.type((_SplayTreeNode<K> _) {
428 } 428 }
429 ), "CastDynamic", """line 644, column 55 of dart:collection/splay_tree.dart: """ , node is _SplayTreeNode<K>, false); 429 ), "CastDynamic", """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 = ((__x79) => DDC$RT.cast(__x79, dynamic, __t76, "CastGeneral", """lin e 693, column 23 of dart:collection/splay_tree.dart: """, __x79 is __t76, false) )((compare == null) ? Comparable.compare : compare), _validKey = ((__x80) => DDC $RT.cast(__x80, dynamic, __t56, "CastGeneral", """line 694, column 21 of dart:co llection/splay_tree.dart: """, __x80 is __t56, false))((isValidKey != null) ? is ValidKey : ((v) => v is E)); 433 SplayTreeSet([int compare(E key1, E key2), bool isValidKey(potentialKey)]) : _c omparator = ((__x49) => DDC$RT.cast(__x49, dynamic, __t46, "CastGeneral", """lin e 693, column 23 of dart:collection/splay_tree.dart: """, __x49 is __t46, false) )((compare == null) ? Comparable.compare : compare), _validKey = ((__x50) => DDC $RT.cast(__x50, dynamic, __t37, "CastGeneral", """line 694, column 21 of dart:co llection/splay_tree.dart: """, __x50 is __t37, false))((isValidKey != null) ? is ValidKey : ((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;
(...skipping 11 matching lines...) Expand all
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(DDC$RT.cast(object, Object, E, "CastGeneral", """line 741, column 40 of dart:collection/splay_tree.dart: """, object is E, fa lse)) == 0; 460 return _validKey(object) && _splay(DDC$RT.cast(object, Object, E, "CastGeneral", """line 741, column 40 of dart:collection/splay_tree.dart: """, object is E, fa lse)) == 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(((__x81) => DDC$RT.cast(__x81, DDC$RT.type((_SplayTreeNode<dynamic> _) { 465 _addNewRoot(((__x51) => DDC$RT.cast(__x51, DDC$RT.type((_SplayTreeNode<dynamic> _) {
466 } 466 }
467 ), DDC$RT.type((_SplayTreeNode<E> _) { 467 ), DDC$RT.type((_SplayTreeNode<E> _) {
468 } 468 }
469 ), "CastExact", """line 747, column 17 of dart:collection/splay_tree.dart: """, __x81 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); 469 ), "CastExact", """line 747, column 17 of dart:collection/splay_tree.dart: """, __x51 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare);
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(DDC$RT.cast(object, Object, E, "CastGeneral", """line 753, colum n 20 of dart:collection/splay_tree.dart: """, object is E, false)) != null; 474 return _remove(DDC$RT.cast(object, Object, E, "CastGeneral", """line 753, colum n 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(((__x82) => DDC$RT.cast(__x82, DDC$RT.type((_SplayTreeNode<dynamic> _) { 480 _addNewRoot(((__x52) => DDC$RT.cast(__x52, DDC$RT.type((_SplayTreeNode<dynamic> _) {
481 } 481 }
482 ), DDC$RT.type((_SplayTreeNode<E> _) { 482 ), DDC$RT.type((_SplayTreeNode<E> _) {
483 } 483 }
484 ), "CastExact", """line 760, column 21 of dart:collection/splay_tree.dart: """, __x82 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); 484 ), "CastExact", """line 760, column 21 of dart:collection/splay_tree.dart: """, __x52 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare);
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(DDC$RT.cast(element, Object, E, "CastGeneral", " ""line 767, column 39 of dart:collection/splay_tree.dart: """, element is E, fal se)); 490 if (_validKey(element)) _remove(DDC$RT.cast(element, Object, E, "CastGeneral", " ""line 767, column 39 of dart:collection/splay_tree.dart: """, element is E, fal se));
491 } 491 }
492 } 492 }
493 void retainAll(Iterable<Object> elements) { 493 void retainAll(Iterable<Object> elements) {
494 SplayTreeSet<E> retainSet = new SplayTreeSet<E>(_comparator, _validKey); 494 SplayTreeSet<E> retainSet = new SplayTreeSet<E>(_comparator, _validKey);
495 int modificationCount = _modificationCount; 495 int modificationCount = _modificationCount;
496 for (Object object in elements) { 496 for (Object object in elements) {
497 if (modificationCount != _modificationCount) { 497 if (modificationCount != _modificationCount) {
498 throw new ConcurrentModificationError(this); 498 throw new ConcurrentModificationError(this);
499 } 499 }
500 if (_validKey(object) && _splay(DDC$RT.cast(object, Object, E, "CastGeneral", " ""line 781, column 39 of dart:collection/splay_tree.dart: """, object is E, fals e)) == 0) retainSet.add(_root.key); 500 if (_validKey(object) && _splay(DDC$RT.cast(object, Object, E, "CastGeneral", " ""line 781, column 39 of dart:collection/splay_tree.dart: """, object is E, fals e)) == 0) retainSet.add(_root.key);
501 } 501 }
502 if (retainSet._count != _count) { 502 if (retainSet._count != _count) {
503 _root = retainSet._root; 503 _root = retainSet._root;
504 _count = retainSet._count; 504 _count = retainSet._count;
505 _modificationCount++; 505 _modificationCount++;
506 } 506 }
507 } 507 }
508 E lookup(Object object) { 508 E lookup(Object object) {
509 if (!_validKey(object)) return ((__x83) => DDC$RT.cast(__x83, Null, E, "CastLite ral", """line 792, column 36 of dart:collection/splay_tree.dart: """, __x83 is E , false))(null); 509 if (!_validKey(object)) return null;
510 int comp = _splay(DDC$RT.cast(object, Object, E, "CastGeneral", """line 793, co lumn 23 of dart:collection/splay_tree.dart: """, object is E, false)); 510 int comp = _splay(DDC$RT.cast(object, Object, E, "CastGeneral", """line 793, co lumn 23 of dart:collection/splay_tree.dart: """, object is E, false));
511 if (comp != 0) return ((__x84) => DDC$RT.cast(__x84, Null, E, "CastLiteral", "" "line 794, column 27 of dart:collection/splay_tree.dart: """, __x84 is E, false) )(null); 511 if (comp != 0) return null;
512 return _root.key; 512 return _root.key;
513 } 513 }
514 Set<E> intersection(Set<E> other) { 514 Set<E> intersection(Set<E> other) {
515 Set<E> result = new SplayTreeSet<E>(_comparator, _validKey); 515 Set<E> result = new SplayTreeSet<E>(_comparator, _validKey);
516 for (E element in this) { 516 for (E element in this) {
517 if (other.contains(element)) result.add(element); 517 if (other.contains(element)) result.add(element);
518 } 518 }
519 return result; 519 return result;
520 } 520 }
521 Set<E> difference(Set<E> other) { 521 Set<E> difference(Set<E> other) {
(...skipping 15 matching lines...) Expand all
537 _SplayTreeNode<E> _copyNode(_SplayTreeNode<E> node) { 537 _SplayTreeNode<E> _copyNode(_SplayTreeNode<E> node) {
538 if (node == null) return null; 538 if (node == null) return null;
539 return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left)..right = _c opyNode(node.right); 539 return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left)..right = _c opyNode(node.right);
540 } 540 }
541 void clear() { 541 void clear() {
542 _clear(); 542 _clear();
543 } 543 }
544 Set<E> toSet() => _clone(); 544 Set<E> toSet() => _clone();
545 String toString() => IterableBase.iterableToFullString(this, '{', '}'); 545 String toString() => IterableBase.iterableToFullString(this, '{', '}');
546 } 546 }
547 typedef int __t52<K>(K __u53, K __u54); 547 typedef int __t33<K>(K __u34, K __u35);
548 typedef bool __t56(dynamic __u57); 548 typedef bool __t37(dynamic __u38);
549 typedef int __t73<K>(K __u74, K __u75); 549 typedef int __t43<K>(K __u44, K __u45);
550 typedef int __t76(dynamic __u77, dynamic __u78); 550 typedef int __t46(dynamic __u47, dynamic __u48);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698