chore(els): remove AnalysisResultCache

This commit is contained in:
Shunsuke Shibayama 2023-09-14 13:59:42 +09:00
parent d92e3f5425
commit 94b5fc27e9
13 changed files with 198 additions and 282 deletions

View file

@ -269,6 +269,10 @@ impl SharedModuleCache {
self.0.borrow_mut().register(path.into(), ast, hir, ctx);
}
pub fn insert(&self, path: NormalizedPathBuf, entry: ModuleEntry) {
self.0.borrow_mut().cache.insert(path, entry);
}
pub fn remove<Q: Eq + Hash + ?Sized>(&self, path: &Q) -> Option<ModuleEntry>
where
NormalizedPathBuf: Borrow<Q>,

View file

@ -1,3 +1,6 @@
use std::path::Path;
use erg_common::pathutil::NormalizedPathBuf;
use erg_common::shared::Shared;
use erg_common::traits::Stream;
@ -26,6 +29,19 @@ impl SharedCompileErrors {
pub fn clear(&self) {
self.0.borrow_mut().clear();
}
pub fn remove(&self, path: &Path) {
let path = NormalizedPathBuf::from(path);
self.0
.borrow_mut()
.retain(|e| NormalizedPathBuf::from(e.input.path()) != path);
}
pub fn raw_iter(&self) -> impl Iterator<Item = &CompileError> {
let _ref = self.0.borrow();
let ref_ = unsafe { self.0.as_ptr().as_ref().unwrap() };
ref_.iter()
}
}
pub type SharedCompileWarnings = SharedCompileErrors;

View file

@ -76,8 +76,8 @@ impl SharedCompilerResource {
self.index.remove_path(path);
self.graph.remove(path);
self.promises.remove(path);
// self.errors.remove(path);
// self.warns.remove(path);
self.errors.remove(path);
self.warns.remove(path);
}
pub fn rename_path(&self, old: &Path, new: PathBuf) {