aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-15 07:26:31 +0000
committerAleksey Kladov <[email protected]>2019-11-15 07:26:31 +0000
commit9c7a2aef30cb35347af646dea5a5611af1224676 (patch)
tree6134c1475e717ef72cc7b5542485f7bfbd11eb14 /crates/ra_hir_def/src
parentbbb022d3999b3038549ec6c309efb065231c896a (diff)
Refactor Module::from_source to properly descend from root file
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r--crates/ra_hir_def/src/nameres.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs
index d3ecabb9b..1331fbe30 100644
--- a/crates/ra_hir_def/src/nameres.rs
+++ b/crates/ra_hir_def/src/nameres.rs
@@ -258,6 +258,13 @@ impl CrateDefMap {
258 let res = self.resolve_path_fp_with_macro(db, ResolveMode::Other, original_module, path); 258 let res = self.resolve_path_fp_with_macro(db, ResolveMode::Other, original_module, path);
259 (res.resolved_def, res.segment_index) 259 (res.resolved_def, res.segment_index)
260 } 260 }
261
262 pub fn modules_for_file(&self, file_id: FileId) -> impl Iterator<Item = CrateModuleId> + '_ {
263 self.modules
264 .iter()
265 .filter(move |(_id, data)| data.definition == Some(file_id))
266 .map(|(id, _data)| id)
267 }
261} 268}
262 269
263mod diagnostics { 270mod diagnostics {