aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src/semantics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir/src/semantics.rs')
-rw-r--r--crates/hir/src/semantics.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 945638cc5..519339c0c 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -259,6 +259,10 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
259 } 259 }
260 260
261 pub fn to_module_def(&self, file: FileId) -> Option<Module> { 261 pub fn to_module_def(&self, file: FileId) -> Option<Module> {
262 self.imp.to_module_def(file).next()
263 }
264
265 pub fn to_module_defs(&self, file: FileId) -> impl Iterator<Item = Module> {
262 self.imp.to_module_def(file) 266 self.imp.to_module_def(file)
263 } 267 }
264 268
@@ -537,8 +541,8 @@ impl<'db> SemanticsImpl<'db> {
537 f(&mut ctx) 541 f(&mut ctx)
538 } 542 }
539 543
540 fn to_module_def(&self, file: FileId) -> Option<Module> { 544 fn to_module_def(&self, file: FileId) -> impl Iterator<Item = Module> {
541 self.with_ctx(|ctx| ctx.file_to_def(file)).map(Module::from) 545 self.with_ctx(|ctx| ctx.file_to_def(file)).into_iter().map(Module::from)
542 } 546 }
543 547
544 fn scope(&self, node: &SyntaxNode) -> SemanticsScope<'db> { 548 fn scope(&self, node: &SyntaxNode) -> SemanticsScope<'db> {