mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Thinner TokenMap
This commit is contained in:
parent
92d447f976
commit
98cfdde8ba
13 changed files with 123 additions and 259 deletions
|
@ -112,7 +112,7 @@ pub(super) type SourceToDefCache = FxHashMap<(ChildContainer, HirFileId), DynMap
|
|||
|
||||
pub(super) struct SourceToDefCtx<'a, 'b> {
|
||||
pub(super) db: &'b dyn HirDatabase,
|
||||
pub(super) cache: &'a mut SourceToDefCache,
|
||||
pub(super) dynmap_cache: &'a mut SourceToDefCache,
|
||||
}
|
||||
|
||||
impl SourceToDefCtx<'_, '_> {
|
||||
|
@ -300,7 +300,7 @@ impl SourceToDefCtx<'_, '_> {
|
|||
|
||||
fn cache_for(&mut self, container: ChildContainer, file_id: HirFileId) -> &DynMap {
|
||||
let db = self.db;
|
||||
self.cache
|
||||
self.dynmap_cache
|
||||
.entry((container, file_id))
|
||||
.or_insert_with(|| container.child_by_source(db, file_id))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue