aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/nameres.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/nameres.rs')
-rw-r--r--crates/ra_hir_def/src/nameres.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs
index e5b073a0f..c01e020ef 100644
--- a/crates/ra_hir_def/src/nameres.rs
+++ b/crates/ra_hir_def/src/nameres.rs
@@ -165,6 +165,14 @@ impl ModuleScope {
165 self.items.iter().chain(BUILTIN_SCOPE.iter()) 165 self.items.iter().chain(BUILTIN_SCOPE.iter())
166 } 166 }
167 167
168 pub fn declarations(&self) -> impl Iterator<Item = ModuleDefId> + '_ {
169 self.entries()
170 .filter_map(|(_name, res)| if res.import.is_none() { Some(res.def) } else { None })
171 .flat_map(|per_ns| {
172 per_ns.take_types().into_iter().chain(per_ns.take_values().into_iter())
173 })
174 }
175
168 /// Iterate over all module scoped macros 176 /// Iterate over all module scoped macros
169 pub fn macros<'a>(&'a self) -> impl Iterator<Item = (&'a Name, MacroDefId)> + 'a { 177 pub fn macros<'a>(&'a self) -> impl Iterator<Item = (&'a Name, MacroDefId)> + 'a {
170 self.items 178 self.items