diff options
author | Aleksey Kladov <[email protected]> | 2019-11-15 07:26:31 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-15 07:26:31 +0000 |
commit | 9c7a2aef30cb35347af646dea5a5611af1224676 (patch) | |
tree | 6134c1475e717ef72cc7b5542485f7bfbd11eb14 /crates/ra_hir_def | |
parent | bbb022d3999b3038549ec6c309efb065231c896a (diff) |
Refactor Module::from_source to properly descend from root file
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r-- | crates/ra_hir_def/src/nameres.rs | 7 |
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 | ||
263 | mod diagnostics { | 270 | mod diagnostics { |