From b2de95879a8d48cc4077895376b0aaed1e972169 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 28 Nov 2018 02:49:28 +0300 Subject: generalize location interner --- crates/ra_analysis/src/hir/module/mod.rs | 4 ++-- crates/ra_analysis/src/hir/module/nameres.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ra_analysis/src/hir/module') diff --git a/crates/ra_analysis/src/hir/module/mod.rs b/crates/ra_analysis/src/hir/module/mod.rs index 83f176b32..893ec3a10 100644 --- a/crates/ra_analysis/src/hir/module/mod.rs +++ b/crates/ra_analysis/src/hir/module/mod.rs @@ -134,7 +134,7 @@ impl Module { id: self.module_id, source_root: self.source_root_id, }; - db.id_maps().def_id(def_loc) + def_loc.id(db) } /// Finds a child module with the specified name. @@ -167,7 +167,7 @@ impl Module { let segments = path.segments; for name in segments.iter() { - let module = match db.id_maps().def_loc(curr) { + let module = match curr.loc(db) { DefLoc::Module { id, source_root } => Module::new(db, source_root, id)?, _ => return Ok(None), }; diff --git a/crates/ra_analysis/src/hir/module/nameres.rs b/crates/ra_analysis/src/hir/module/nameres.rs index f22832eda..f48f51c8d 100644 --- a/crates/ra_analysis/src/hir/module/nameres.rs +++ b/crates/ra_analysis/src/hir/module/nameres.rs @@ -256,7 +256,7 @@ where item_id: item.id, }, }; - let def_id = self.db.id_maps().def_id(def_loc); + let def_id = def_loc.id(self.db); let resolution = Resolution { def_id: Some(def_id), import: None, @@ -269,7 +269,7 @@ where id: mod_id, source_root: self.source_root, }; - let def_id = self.db.id_maps().def_id(def_loc); + let def_id = def_loc.id(self.db); let resolution = Resolution { def_id: Some(def_id), import: None, @@ -318,7 +318,7 @@ where }; if !is_last { - curr = match self.db.id_maps().def_loc(def_id) { + curr = match def_id.loc(self.db) { DefLoc::Module { id, .. } => id, _ => return, } -- cgit v1.2.3