mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
fix(els): caching bugs
This commit is contained in:
parent
f2ad45878a
commit
82792aca80
8 changed files with 68 additions and 6 deletions
|
@ -61,6 +61,15 @@ impl TraitImpls {
|
|||
self.cache.remove(path)
|
||||
}
|
||||
|
||||
pub fn rename<Q: Eq + Hash + ?Sized>(&mut self, old: &Q, new: Str)
|
||||
where
|
||||
Str: Borrow<Q>,
|
||||
{
|
||||
if let Some(impls) = self.remove(old) {
|
||||
self.register(new, impls);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn initialize(&mut self) {
|
||||
self.cache.clear();
|
||||
}
|
||||
|
@ -123,6 +132,13 @@ impl SharedTraitImpls {
|
|||
self.0.borrow_mut().remove(path)
|
||||
}
|
||||
|
||||
pub fn rename<Q: Eq + Hash + ?Sized>(&self, old: &Q, new: Str)
|
||||
where
|
||||
Str: Borrow<Q>,
|
||||
{
|
||||
self.0.borrow_mut().rename(old, new);
|
||||
}
|
||||
|
||||
pub fn ref_inner(&self) -> MappedRwLockReadGuard<Dict<Str, Set<TraitImpl>>> {
|
||||
RwLockReadGuard::map(self.0.borrow(), |tis| &tis.cache)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue