From 05daa86634b41aa3f311a1ac0b02bf7fed7ed569 Mon Sep 17 00:00:00 2001 From: Jan Jansen Date: Thu, 27 Dec 2018 21:45:16 +0100 Subject: Make modules with tests runnable Fixes #154 --- crates/ra_hir/src/module.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/src/module.rs b/crates/ra_hir/src/module.rs index 24c346984..87e30191f 100644 --- a/crates/ra_hir/src/module.rs +++ b/crates/ra_hir/src/module.rs @@ -75,6 +75,11 @@ impl Module { Some(Crate::new(crate_id)) } + /// Returns the all modulkes on the way to the root. + pub fn path_to_root(&self) -> Vec { + generate(Some(self.clone()), move |it| it.parent()).collect::>() + } + /// The root of the tree this module is part of pub fn crate_root(&self) -> Module { let root_id = self.module_id.crate_root(&self.tree); -- cgit v1.2.3