use super::super::GroupRecord;
use super::SlotTable;
use crate::{AnchorId, ScopeId};
impl SlotTable {
pub(in crate::slot) fn refresh_group_indexes_from(&mut self, start: usize) {
self.refresh_group_indexes_in_range(start, self.groups.len());
}
pub(in crate::slot) fn refresh_group_indexes_in_range(&mut self, start: usize, end: usize) {
assert!(start <= end, "group index refresh range must be ordered");
assert!(
end <= self.groups.len(),
"group index refresh range must stay inside groups"
);
let span = end - start;
self.diagnostics.record_group_index_refresh(span);
for index in start..end {
self.anchors.set_active(self.groups[index].anchor, index);
}
}
pub(in crate::slot) fn clear_group_indexes(&mut self, groups: &[GroupRecord]) {
self.anchors.mark_detached_groups(groups);
}
pub(in crate::slot) fn clear_scope_index_for_groups(&mut self, groups: &[GroupRecord]) {
self.scope_index.remove_groups(groups);
}
pub(in crate::slot) fn restore_scope_index_entries(
&mut self,
entries: impl IntoIterator<Item = (ScopeId, AnchorId)>,
) {
self.scope_index.restore_entries(entries);
}
}