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

Side by Side Diff: sdk/lib/collection/splay_tree.dart

Issue 12390010: Make sure field initializers have access to the type variables. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.collection; 5 part of dart.collection;
6 6
7 /** 7 /**
8 * A node in a splay tree. It holds the sorting key and the left 8 * A node in a splay tree. It holds the sorting key and the left
9 * and right children in the tree. 9 * and right children in the tree.
10 */ 10 */
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 * 220 *
221 * The map is based on a self-balancing binary tree. It allows most operations 221 * The map is based on a self-balancing binary tree. It allows most operations
222 * in amortized logarithmic time. 222 * in amortized logarithmic time.
223 * 223 *
224 * Keys of the map are compared using the `compare` function passed in 224 * Keys of the map are compared using the `compare` function passed in
225 * the constructor. If that is omitted, the objects are assumed to be 225 * the constructor. If that is omitted, the objects are assumed to be
226 * [Comparable], and are compared using their [Comparable.compareTo] 226 * [Comparable], and are compared using their [Comparable.compareTo]
227 * method. 227 * method.
228 */ 228 */
229 class SplayTreeMap<K, V> extends _SplayTree<K> implements Map<K, V> { 229 class SplayTreeMap<K, V> extends _SplayTree<K> implements Map<K, V> {
230 Comparator<K> _comparator; 230 // TODO(ngeoffray): Restore type when feature is implemented in dart2js
231 // checked mode. http://dartbug.com/7733
232 Function /* Comparator<K> */_comparator;
231 233
232 SplayTreeMap([int compare(K key1, K key2)]) 234 SplayTreeMap([int compare(K key1, K key2)])
233 : _comparator = (compare == null) ? Comparable.compare : compare; 235 : _comparator = (compare == null) ? Comparable.compare : compare;
234 236
235 int _compare(K key1, K key2) => _comparator(key1, key2); 237 int _compare(K key1, K key2) => _comparator(key1, key2);
236 238
237 SplayTreeMap._internal(); 239 SplayTreeMap._internal();
238 240
239 V operator [](K key) { 241 V operator [](K key) {
240 if (_root != null) { 242 if (_root != null) {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 class _SplayTreeValueIterator<K, V> extends _SplayTreeIterator<V> { 493 class _SplayTreeValueIterator<K, V> extends _SplayTreeIterator<V> {
492 _SplayTreeValueIterator(SplayTreeMap<K, V> map): super(map); 494 _SplayTreeValueIterator(SplayTreeMap<K, V> map): super(map);
493 V _getValue(_SplayTreeMapNode node) => node.value; 495 V _getValue(_SplayTreeMapNode node) => node.value;
494 } 496 }
495 497
496 class _SplayTreeNodeIterator<K> 498 class _SplayTreeNodeIterator<K>
497 extends _SplayTreeIterator<_SplayTreeNode<K>> { 499 extends _SplayTreeIterator<_SplayTreeNode<K>> {
498 _SplayTreeNodeIterator(_SplayTree<K> map): super(map); 500 _SplayTreeNodeIterator(_SplayTree<K> map): super(map);
499 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => node; 501 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => node;
500 } 502 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698