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

Unified Diff: sdk/lib/collection/splay_tree.dart

Issue 148523006: Fix bug in internal SplayTreeIterator constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added test. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/corelib/splay_tree_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/collection/splay_tree.dart
diff --git a/sdk/lib/collection/splay_tree.dart b/sdk/lib/collection/splay_tree.dart
index 12cfac36441b38a4d0579e31760eba8f181b42cb..4674f8c27c3bee32872ce8247044d723601088ce 100644
--- a/sdk/lib/collection/splay_tree.dart
+++ b/sdk/lib/collection/splay_tree.dart
@@ -525,7 +525,12 @@ abstract class _SplayTreeIterator<T> implements Iterator<T> {
_modificationCount = tree._modificationCount {
int compare = tree._splay(startKey);
_splayCount = tree._splayCount;
- _findLeftMostDescendent(compare < 0 ? tree._root.right : tree._root);
+ if (compare < 0) {
+ // Don't include the root, start at the next element after the root.
+ _findLeftMostDescendent(tree._root.right);
+ } else {
+ _workList.add(tree._root);
+ }
}
T get current {
@@ -533,10 +538,6 @@ abstract class _SplayTreeIterator<T> implements Iterator<T> {
return _getValue(_currentNode);
}
- _SplayTreeNode _findStartNode(T key) {
-
- }
-
void _findLeftMostDescendent(_SplayTreeNode node) {
while (node != null) {
_workList.add(node);
« no previous file with comments | « no previous file | tests/corelib/splay_tree_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698