aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/descriptors/module/imp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/descriptors/module/imp.rs')
-rw-r--r--crates/ra_analysis/src/descriptors/module/imp.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/crates/ra_analysis/src/descriptors/module/imp.rs b/crates/ra_analysis/src/descriptors/module/imp.rs
index 5fdaad137..dae3a356d 100644
--- a/crates/ra_analysis/src/descriptors/module/imp.rs
+++ b/crates/ra_analysis/src/descriptors/module/imp.rs
@@ -10,14 +10,15 @@ use ra_syntax::{
10use crate::{ 10use crate::{
11 FileId, Cancelable, FileResolverImp, db, 11 FileId, Cancelable, FileResolverImp, db,
12 input::{SourceRoot, SourceRootId}, 12 input::{SourceRoot, SourceRootId},
13 descriptors::DescriptorDatabase,
13}; 14};
14 15
15use super::{ 16use super::{
16 ModuleData, ModuleTree, ModuleId, LinkId, LinkData, Problem, ModulesDatabase, ModuleScope 17 ModuleData, ModuleTree, ModuleId, LinkId, LinkData, Problem, ModuleScope
17}; 18};
18 19
19 20
20pub(super) fn submodules(db: &impl ModulesDatabase, file_id: FileId) -> Cancelable<Arc<Vec<SmolStr>>> { 21pub(crate) fn submodules(db: &impl DescriptorDatabase, file_id: FileId) -> Cancelable<Arc<Vec<SmolStr>>> {
21 db::check_canceled(db)?; 22 db::check_canceled(db)?;
22 let file = db.file_syntax(file_id); 23 let file = db.file_syntax(file_id);
23 let root = file.ast(); 24 let root = file.ast();
@@ -25,7 +26,7 @@ pub(super) fn submodules(db: &impl ModulesDatabase, file_id: FileId) -> Cancelab
25 Ok(Arc::new(submodules)) 26 Ok(Arc::new(submodules))
26} 27}
27 28
28pub(super) fn modules(root: ast::Root<'_>) -> impl Iterator<Item = (SmolStr, ast::Module<'_>)> { 29pub(crate) fn modules(root: ast::Root<'_>) -> impl Iterator<Item = (SmolStr, ast::Module<'_>)> {
29 root.modules().filter_map(|module| { 30 root.modules().filter_map(|module| {
30 let name = module.name()?.text(); 31 let name = module.name()?.text();
31 if !module.has_semi() { 32 if !module.has_semi() {
@@ -35,8 +36,8 @@ pub(super) fn modules(root: ast::Root<'_>) -> impl Iterator<Item = (SmolStr, ast
35 }) 36 })
36} 37}
37 38
38pub(super) fn module_scope( 39pub(crate) fn module_scope(
39 db: &impl ModulesDatabase, 40 db: &impl DescriptorDatabase,
40 source_root_id: SourceRootId, 41 source_root_id: SourceRootId,
41 module_id: ModuleId, 42 module_id: ModuleId,
42) -> Cancelable<Arc<ModuleScope>> { 43) -> Cancelable<Arc<ModuleScope>> {
@@ -47,8 +48,8 @@ pub(super) fn module_scope(
47 Ok(Arc::new(res)) 48 Ok(Arc::new(res))
48} 49}
49 50
50pub(super) fn module_tree( 51pub(crate) fn module_tree(
51 db: &impl ModulesDatabase, 52 db: &impl DescriptorDatabase,
52 source_root: SourceRootId, 53 source_root: SourceRootId,
53) -> Cancelable<Arc<ModuleTree>> { 54) -> Cancelable<Arc<ModuleTree>> {
54 db::check_canceled(db)?; 55 db::check_canceled(db)?;
@@ -64,7 +65,7 @@ pub struct Submodule {
64 65
65 66
66fn create_module_tree<'a>( 67fn create_module_tree<'a>(
67 db: &impl ModulesDatabase, 68 db: &impl DescriptorDatabase,
68 source_root: SourceRootId, 69 source_root: SourceRootId,
69) -> Cancelable<ModuleTree> { 70) -> Cancelable<ModuleTree> {
70 let mut tree = ModuleTree { 71 let mut tree = ModuleTree {
@@ -88,7 +89,7 @@ fn create_module_tree<'a>(
88} 89}
89 90
90fn build_subtree( 91fn build_subtree(
91 db: &impl ModulesDatabase, 92 db: &impl DescriptorDatabase,
92 source_root: &SourceRoot, 93 source_root: &SourceRoot,
93 tree: &mut ModuleTree, 94 tree: &mut ModuleTree,
94 visited: &mut FxHashSet<FileId>, 95 visited: &mut FxHashSet<FileId>,