diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-23 12:44:47 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-23 12:44:47 +0000 |
commit | bce55c749a65f268a156606fa7e8dc15821ee631 (patch) | |
tree | 2b9ba6289fc865889775dab7c6b029faea7161ab /crates/ra_hir/src/code_model_impl/module.rs | |
parent | 331220fee2c8c6d9f6e87c371ab101baace205dc (diff) | |
parent | 3f0cf6ebe1a42c3a38f3ab8a7b2e10110ed91ee1 (diff) |
Merge #1026
1026: rename persistent hir database -> def database r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/code_model_impl/module.rs')
-rw-r--r-- | crates/ra_hir/src/code_model_impl/module.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index f7d15c55e..52a33e981 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs | |||
@@ -4,13 +4,13 @@ use ra_syntax::{ast, SyntaxNode, TreeArc, AstNode}; | |||
4 | use crate::{ | 4 | use crate::{ |
5 | Module, ModuleSource, Problem, Name, | 5 | Module, ModuleSource, Problem, Name, |
6 | nameres::{CrateModuleId, ImportId}, | 6 | nameres::{CrateModuleId, ImportId}, |
7 | HirDatabase, PersistentHirDatabase, | 7 | HirDatabase, DefDatabase, |
8 | HirFileId, SourceItemId, | 8 | HirFileId, SourceItemId, |
9 | }; | 9 | }; |
10 | 10 | ||
11 | impl ModuleSource { | 11 | impl ModuleSource { |
12 | pub(crate) fn new( | 12 | pub(crate) fn new( |
13 | db: &impl PersistentHirDatabase, | 13 | db: &impl DefDatabase, |
14 | file_id: Option<FileId>, | 14 | file_id: Option<FileId>, |
15 | decl_id: Option<SourceItemId>, | 15 | decl_id: Option<SourceItemId>, |
16 | ) -> ModuleSource { | 16 | ) -> ModuleSource { |
@@ -49,7 +49,7 @@ impl Module { | |||
49 | 49 | ||
50 | pub(crate) fn definition_source_impl( | 50 | pub(crate) fn definition_source_impl( |
51 | &self, | 51 | &self, |
52 | db: &impl PersistentHirDatabase, | 52 | db: &impl DefDatabase, |
53 | ) -> (HirFileId, ModuleSource) { | 53 | ) -> (HirFileId, ModuleSource) { |
54 | let def_map = db.crate_def_map(self.krate); | 54 | let def_map = db.crate_def_map(self.krate); |
55 | let decl_id = def_map[self.module_id].declaration; | 55 | let decl_id = def_map[self.module_id].declaration; |
@@ -80,7 +80,7 @@ impl Module { | |||
80 | source_map.get(&source, import) | 80 | source_map.get(&source, import) |
81 | } | 81 | } |
82 | 82 | ||
83 | pub(crate) fn crate_root_impl(&self, db: &impl PersistentHirDatabase) -> Module { | 83 | pub(crate) fn crate_root_impl(&self, db: &impl DefDatabase) -> Module { |
84 | let def_map = db.crate_def_map(self.krate); | 84 | let def_map = db.crate_def_map(self.krate); |
85 | self.with_module_id(def_map.root()) | 85 | self.with_module_id(def_map.root()) |
86 | } | 86 | } |
@@ -93,10 +93,7 @@ impl Module { | |||
93 | } | 93 | } |
94 | 94 | ||
95 | /// Iterates over all child modules. | 95 | /// Iterates over all child modules. |
96 | pub(crate) fn children_impl( | 96 | pub(crate) fn children_impl(&self, db: &impl DefDatabase) -> impl Iterator<Item = Module> { |
97 | &self, | ||
98 | db: &impl PersistentHirDatabase, | ||
99 | ) -> impl Iterator<Item = Module> { | ||
100 | let def_map = db.crate_def_map(self.krate); | 97 | let def_map = db.crate_def_map(self.krate); |
101 | let children = def_map[self.module_id] | 98 | let children = def_map[self.module_id] |
102 | .children | 99 | .children |
@@ -106,7 +103,7 @@ impl Module { | |||
106 | children.into_iter() | 103 | children.into_iter() |
107 | } | 104 | } |
108 | 105 | ||
109 | pub(crate) fn parent_impl(&self, db: &impl PersistentHirDatabase) -> Option<Module> { | 106 | pub(crate) fn parent_impl(&self, db: &impl DefDatabase) -> Option<Module> { |
110 | let def_map = db.crate_def_map(self.krate); | 107 | let def_map = db.crate_def_map(self.krate); |
111 | let parent_id = def_map[self.module_id].parent?; | 108 | let parent_id = def_map[self.module_id].parent?; |
112 | Some(self.with_module_id(parent_id)) | 109 | Some(self.with_module_id(parent_id)) |