sum_tree: Store context on cursor (#34904)
This gets rid of the need to pass context to all cursor functions. In practice context is always immutable when interacting with cursors. A nicety of this is in the follow-up PR we will be able to implement Iterator for all Cursors/filter cursors (hell, we may be able to get rid of filter cursor altogether, as it is just a custom `filter` impl on iterator trait). Release Notes: - N/A
This commit is contained in:
parent
fa3e1ccc37
commit
64d0fec699
23 changed files with 749 additions and 876 deletions
|
@ -158,17 +158,17 @@ impl DiagnosticSet {
|
|||
});
|
||||
|
||||
if reversed {
|
||||
cursor.prev(buffer);
|
||||
cursor.prev();
|
||||
} else {
|
||||
cursor.next(buffer);
|
||||
cursor.next();
|
||||
}
|
||||
iter::from_fn({
|
||||
move || {
|
||||
if let Some(diagnostic) = cursor.item() {
|
||||
if reversed {
|
||||
cursor.prev(buffer);
|
||||
cursor.prev();
|
||||
} else {
|
||||
cursor.next(buffer);
|
||||
cursor.next();
|
||||
}
|
||||
Some(diagnostic.resolve(buffer))
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue