From 947e3350e045aab1db9b232542425a3faa856907 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 4 Dec 2018 23:01:53 +0300 Subject: module-scoped defloc --- crates/ra_hir/src/module/mod.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'crates/ra_hir/src/module/mod.rs') diff --git a/crates/ra_hir/src/module/mod.rs b/crates/ra_hir/src/module/mod.rs index fa9ee94eb..08ce7c8d1 100644 --- a/crates/ra_hir/src/module/mod.rs +++ b/crates/ra_hir/src/module/mod.rs @@ -14,7 +14,7 @@ use ra_db::{SourceRootId, FileId, FilePosition, Cancelable}; use relative_path::RelativePathBuf; use crate::{ - DefLoc, DefId, Path, PathKind, HirDatabase, SourceItemId, SourceFileItemId, + DefKind, DefLoc, DefId, Path, PathKind, HirDatabase, SourceItemId, SourceFileItemId, arena::{Arena, Id}, }; @@ -127,9 +127,11 @@ impl Module { } pub fn def_id(&self, db: &impl HirDatabase) -> DefId { - let def_loc = DefLoc::Module { - id: self.module_id, - source_root: self.source_root_id, + let def_loc = DefLoc { + kind: DefKind::Module, + source_root_id: self.source_root_id, + module_id: self.module_id, + source_item_id: self.module_id.source(&self.tree).0, }; def_loc.id(db) } @@ -161,7 +163,12 @@ impl Module { let segments = path.segments; for name in segments.iter() { let module = match curr.loc(db) { - DefLoc::Module { id, source_root } => Module::new(db, source_root, id)?, + DefLoc { + kind: DefKind::Module, + source_root_id, + module_id, + .. + } => Module::new(db, source_root_id, module_id)?, _ => return Ok(None), }; let scope = module.scope(db)?; -- cgit v1.2.3