aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model_impl
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-01-13 10:58:41 +0000
committerFlorian Diebold <[email protected]>2019-01-19 15:02:06 +0000
commitfa7f9d696f5863dbf28b3d0ef14c1bc9143b2d21 (patch)
tree6dbf221c3ccb3474fd37ff241961359169abae71 /crates/ra_hir/src/code_model_impl
parent5862542dedd5aca9bbdcba19c5f8cd895591005d (diff)
Make Module impl methods crate-private, update some comments
Diffstat (limited to 'crates/ra_hir/src/code_model_impl')
-rw-r--r--crates/ra_hir/src/code_model_impl/module.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs
index 2014f1090..73c212de8 100644
--- a/crates/ra_hir/src/code_model_impl/module.rs
+++ b/crates/ra_hir/src/code_model_impl/module.rs
@@ -95,7 +95,7 @@ impl Module {
95 } 95 }
96 96
97 /// Finds a child module with the specified name. 97 /// Finds a child module with the specified name.
98 pub fn child_impl(&self, db: &impl HirDatabase, name: &Name) -> Option<Module> { 98 pub(crate) fn child_impl(&self, db: &impl HirDatabase, name: &Name) -> Option<Module> {
99 let loc = self.def_id.loc(db); 99 let loc = self.def_id.loc(db);
100 let module_tree = db.module_tree(loc.source_root_id); 100 let module_tree = db.module_tree(loc.source_root_id);
101 let child_id = loc.module_id.child(&module_tree, name)?; 101 let child_id = loc.module_id.child(&module_tree, name)?;
@@ -103,7 +103,7 @@ impl Module {
103 } 103 }
104 104
105 /// Iterates over all child modules. 105 /// Iterates over all child modules.
106 pub fn children_impl(&self, db: &impl HirDatabase) -> impl Iterator<Item = Module> { 106 pub(crate) fn children_impl(&self, db: &impl HirDatabase) -> impl Iterator<Item = Module> {
107 // FIXME this should be implementable without collecting into a vec, but 107 // FIXME this should be implementable without collecting into a vec, but
108 // it's kind of hard since the iterator needs to keep a reference to the 108 // it's kind of hard since the iterator needs to keep a reference to the
109 // module tree. 109 // module tree.
@@ -117,7 +117,7 @@ impl Module {
117 children.into_iter() 117 children.into_iter()
118 } 118 }
119 119
120 pub fn parent_impl(&self, db: &impl HirDatabase) -> Option<Module> { 120 pub(crate) fn parent_impl(&self, db: &impl HirDatabase) -> Option<Module> {
121 let loc = self.def_id.loc(db); 121 let loc = self.def_id.loc(db);
122 let module_tree = db.module_tree(loc.source_root_id); 122 let module_tree = db.module_tree(loc.source_root_id);
123 let parent_id = loc.module_id.parent(&module_tree)?; 123 let parent_id = loc.module_id.parent(&module_tree)?;
@@ -125,13 +125,13 @@ impl Module {
125 } 125 }
126 126
127 /// Returns a `ModuleScope`: a set of items, visible in this module. 127 /// Returns a `ModuleScope`: a set of items, visible in this module.
128 pub fn scope_impl(&self, db: &impl HirDatabase) -> ModuleScope { 128 pub(crate) fn scope_impl(&self, db: &impl HirDatabase) -> ModuleScope {
129 let loc = self.def_id.loc(db); 129 let loc = self.def_id.loc(db);
130 let item_map = db.item_map(loc.source_root_id); 130 let item_map = db.item_map(loc.source_root_id);
131 item_map.per_module[&loc.module_id].clone() 131 item_map.per_module[&loc.module_id].clone()
132 } 132 }
133 133
134 pub fn resolve_path_impl(&self, db: &impl HirDatabase, path: &Path) -> PerNs<DefId> { 134 pub(crate) fn resolve_path_impl(&self, db: &impl HirDatabase, path: &Path) -> PerNs<DefId> {
135 let mut curr_per_ns = PerNs::types( 135 let mut curr_per_ns = PerNs::types(
136 match path.kind { 136 match path.kind {
137 PathKind::Crate => self.crate_root(db), 137 PathKind::Crate => self.crate_root(db),
@@ -191,7 +191,10 @@ impl Module {
191 curr_per_ns 191 curr_per_ns
192 } 192 }
193 193
194 pub fn problems_impl(&self, db: &impl HirDatabase) -> Vec<(TreeArc<SyntaxNode>, Problem)> { 194 pub(crate) fn problems_impl(
195 &self,
196 db: &impl HirDatabase,
197 ) -> Vec<(TreeArc<SyntaxNode>, Problem)> {
195 let loc = self.def_id.loc(db); 198 let loc = self.def_id.loc(db);
196 let module_tree = db.module_tree(loc.source_root_id); 199 let module_tree = db.module_tree(loc.source_root_id);
197 loc.module_id.problems(&module_tree, db) 200 loc.module_id.problems(&module_tree, db)