aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/module
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-11-28 13:24:06 +0000
committerAleksey Kladov <[email protected]>2018-11-28 13:24:06 +0000
commitd30bbfda74346c5007174d8bda93e9583c166a4c (patch)
tree939ad7d280946d7547424fc273c356f5fdf9bb72 /crates/ra_hir/src/module
parente89700f9678d3797c09f0a397b7b67fe9c6f5e9f (diff)
make a bunch of stuff private
Diffstat (limited to 'crates/ra_hir/src/module')
-rw-r--r--crates/ra_hir/src/module/mod.rs8
-rw-r--r--crates/ra_hir/src/module/nameres.rs12
2 files changed, 9 insertions, 11 deletions
diff --git a/crates/ra_hir/src/module/mod.rs b/crates/ra_hir/src/module/mod.rs
index a011fd53e..3ae83d8cb 100644
--- a/crates/ra_hir/src/module/mod.rs
+++ b/crates/ra_hir/src/module/mod.rs
@@ -26,8 +26,7 @@ pub use self::nameres::ModuleScope;
26pub struct Module { 26pub struct Module {
27 tree: Arc<ModuleTree>, 27 tree: Arc<ModuleTree>,
28 source_root_id: SourceRootId, 28 source_root_id: SourceRootId,
29 //TODO: make private 29 module_id: ModuleId,
30 pub module_id: ModuleId,
31} 30}
32 31
33impl Module { 32impl Module {
@@ -122,7 +121,6 @@ impl Module {
122 } 121 }
123 122
124 /// `name` is `None` for the crate's root module 123 /// `name` is `None` for the crate's root module
125 #[allow(unused)]
126 pub fn name(&self) -> Option<SmolStr> { 124 pub fn name(&self) -> Option<SmolStr> {
127 let link = self.module_id.parent_link(&self.tree)?; 125 let link = self.module_id.parent_link(&self.tree)?;
128 Some(link.name(&self.tree)) 126 Some(link.name(&self.tree))
@@ -218,7 +216,7 @@ pub enum ModuleSource {
218 216
219/// An owned syntax node for a module. Unlike `ModuleSource`, 217/// An owned syntax node for a module. Unlike `ModuleSource`,
220/// this holds onto the AST for the whole file. 218/// this holds onto the AST for the whole file.
221pub enum ModuleSourceNode { 219pub(crate) enum ModuleSourceNode {
222 SourceFile(ast::SourceFileNode), 220 SourceFile(ast::SourceFileNode),
223 Module(ast::ModuleNode), 221 Module(ast::ModuleNode),
224} 222}
@@ -338,7 +336,7 @@ impl ModuleSource {
338 } 336 }
339 } 337 }
340 338
341 pub fn resolve(self, db: &impl HirDatabase) -> ModuleSourceNode { 339 pub(crate) fn resolve(self, db: &impl HirDatabase) -> ModuleSourceNode {
342 match self { 340 match self {
343 ModuleSource::SourceFile(file_id) => { 341 ModuleSource::SourceFile(file_id) => {
344 let syntax = db.source_file(file_id); 342 let syntax = db.source_file(file_id);
diff --git a/crates/ra_hir/src/module/nameres.rs b/crates/ra_hir/src/module/nameres.rs
index de13835b2..6445d5349 100644
--- a/crates/ra_hir/src/module/nameres.rs
+++ b/crates/ra_hir/src/module/nameres.rs
@@ -44,7 +44,7 @@ pub struct ItemMap {
44 44
45#[derive(Debug, Default, PartialEq, Eq, Clone)] 45#[derive(Debug, Default, PartialEq, Eq, Clone)]
46pub struct ModuleScope { 46pub struct ModuleScope {
47 pub items: FxHashMap<SmolStr, Resolution>, 47 items: FxHashMap<SmolStr, Resolution>,
48} 48}
49 49
50impl ModuleScope { 50impl ModuleScope {
@@ -200,11 +200,11 @@ impl ModuleItem {
200} 200}
201 201
202pub(crate) struct Resolver<'a, DB> { 202pub(crate) struct Resolver<'a, DB> {
203 pub db: &'a DB, 203 pub(crate) db: &'a DB,
204 pub input: &'a FxHashMap<ModuleId, Arc<InputModuleItems>>, 204 pub(crate) input: &'a FxHashMap<ModuleId, Arc<InputModuleItems>>,
205 pub source_root: SourceRootId, 205 pub(crate) source_root: SourceRootId,
206 pub module_tree: Arc<ModuleTree>, 206 pub(crate) module_tree: Arc<ModuleTree>,
207 pub result: ItemMap, 207 pub(crate) result: ItemMap,
208} 208}
209 209
210impl<'a, DB> Resolver<'a, DB> 210impl<'a, DB> Resolver<'a, DB>