aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorJan Jansen <[email protected]>2018-12-27 20:45:16 +0000
committerJan Jansen <[email protected]>2018-12-31 14:00:04 +0000
commit05daa86634b41aa3f311a1ac0b02bf7fed7ed569 (patch)
treeb703cfe2fc7788631703141d9f4be63b0f5d7fe5 /crates/ra_hir
parent690826871202c77326836a895a38532ebd83c54b (diff)
Make modules with tests runnable
Fixes #154
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/module.rs5
1 files changed, 5 insertions, 0 deletions
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 {
75 Some(Crate::new(crate_id)) 75 Some(Crate::new(crate_id))
76 } 76 }
77 77
78 /// Returns the all modulkes on the way to the root.
79 pub fn path_to_root(&self) -> Vec<Module> {
80 generate(Some(self.clone()), move |it| it.parent()).collect::<Vec<Module>>()
81 }
82
78 /// The root of the tree this module is part of 83 /// The root of the tree this module is part of
79 pub fn crate_root(&self) -> Module { 84 pub fn crate_root(&self) -> Module {
80 let root_id = self.module_id.crate_root(&self.tree); 85 let root_id = self.module_id.crate_root(&self.tree);