aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/nameres/mod_resolution.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/nameres/mod_resolution.rs')
-rw-r--r--crates/ra_hir_def/src/nameres/mod_resolution.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/crates/ra_hir_def/src/nameres/mod_resolution.rs b/crates/ra_hir_def/src/nameres/mod_resolution.rs
index f6b0b8fb1..b3b1379d0 100644
--- a/crates/ra_hir_def/src/nameres/mod_resolution.rs
+++ b/crates/ra_hir_def/src/nameres/mod_resolution.rs
@@ -6,7 +6,7 @@ use ra_syntax::SmolStr;
6use crate::{db::DefDatabase2, HirFileId}; 6use crate::{db::DefDatabase2, HirFileId};
7 7
8#[derive(Clone, Debug)] 8#[derive(Clone, Debug)]
9pub struct ModDir { 9pub(super) struct ModDir {
10 /// `.` for `mod.rs`, `lib.rs` 10 /// `.` for `mod.rs`, `lib.rs`
11 /// `./foo` for `foo.rs` 11 /// `./foo` for `foo.rs`
12 /// `./foo/bar` for `mod bar { mod x; }` nested in `foo.rs` 12 /// `./foo/bar` for `mod bar { mod x; }` nested in `foo.rs`
@@ -16,11 +16,15 @@ pub struct ModDir {
16} 16}
17 17
18impl ModDir { 18impl ModDir {
19 pub fn root() -> ModDir { 19 pub(super) fn root() -> ModDir {
20 ModDir { path: RelativePathBuf::default(), root_non_dir_owner: false } 20 ModDir { path: RelativePathBuf::default(), root_non_dir_owner: false }
21 } 21 }
22 22
23 pub fn descend_into_definition(&self, name: &Name, attr_path: Option<&SmolStr>) -> ModDir { 23 pub(super) fn descend_into_definition(
24 &self,
25 name: &Name,
26 attr_path: Option<&SmolStr>,
27 ) -> ModDir {
24 let mut path = self.path.clone(); 28 let mut path = self.path.clone();
25 match attr_to_path(attr_path) { 29 match attr_to_path(attr_path) {
26 None => path.push(&name.to_string()), 30 None => path.push(&name.to_string()),
@@ -34,7 +38,7 @@ impl ModDir {
34 ModDir { path, root_non_dir_owner: false } 38 ModDir { path, root_non_dir_owner: false }
35 } 39 }
36 40
37 pub fn resolve_declaration( 41 pub(super) fn resolve_declaration(
38 &self, 42 &self,
39 db: &impl DefDatabase2, 43 db: &impl DefDatabase2,
40 file_id: HirFileId, 44 file_id: HirFileId,