From cc8163439f65138c0945c37d6bddc64ced2d2143 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 20 Nov 2018 21:50:22 +0300 Subject: populate modules --- crates/ra_analysis/src/descriptors/module/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'crates/ra_analysis/src/descriptors/module/mod.rs') diff --git a/crates/ra_analysis/src/descriptors/module/mod.rs b/crates/ra_analysis/src/descriptors/module/mod.rs index 958487541..f49e7f909 100644 --- a/crates/ra_analysis/src/descriptors/module/mod.rs +++ b/crates/ra_analysis/src/descriptors/module/mod.rs @@ -214,6 +214,13 @@ impl ModuleId { .find(|it| it.name == name)?; Some(*link.points_to.first()?) } + fn children<'a>(self, tree: &'a ModuleTree) -> impl Iterator + 'a { + tree.module(self).children.iter().filter_map(move |&it| { + let link = tree.link(it); + let module = *link.points_to.first()?; + Some((link.name.clone(), module)) + }) + } fn problems(self, tree: &ModuleTree, db: &impl SyntaxDatabase) -> Vec<(SyntaxNode, Problem)> { tree.module(self) .children -- cgit v1.2.3