diff options
author | Aleksey Kladov <[email protected]> | 2018-12-09 09:24:52 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-12-09 10:33:16 +0000 |
commit | 8b9ff46b378e37b256f6b93f1f6f3bb5bc122064 (patch) | |
tree | 214828c8e3aa2a397a56556af90775e4686cfb1e /crates/ra_hir/src | |
parent | 74fe581061be5175835efda69ee1fa3817716a59 (diff) |
make resolver fields private
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/module/nameres.rs | 25 | ||||
-rw-r--r-- | crates/ra_hir/src/query_definitions.rs | 9 |
2 files changed, 22 insertions, 12 deletions
diff --git a/crates/ra_hir/src/module/nameres.rs b/crates/ra_hir/src/module/nameres.rs index 6511359d0..c75c1bbea 100644 --- a/crates/ra_hir/src/module/nameres.rs +++ b/crates/ra_hir/src/module/nameres.rs | |||
@@ -200,17 +200,32 @@ impl ModuleItem { | |||
200 | } | 200 | } |
201 | 201 | ||
202 | pub(crate) struct Resolver<'a, DB> { | 202 | pub(crate) struct Resolver<'a, DB> { |
203 | pub(crate) db: &'a DB, | 203 | db: &'a DB, |
204 | pub(crate) input: &'a FxHashMap<ModuleId, Arc<InputModuleItems>>, | 204 | input: &'a FxHashMap<ModuleId, Arc<InputModuleItems>>, |
205 | pub(crate) source_root: SourceRootId, | 205 | source_root: SourceRootId, |
206 | pub(crate) module_tree: Arc<ModuleTree>, | 206 | module_tree: Arc<ModuleTree>, |
207 | pub(crate) result: ItemMap, | 207 | result: ItemMap, |
208 | } | 208 | } |
209 | 209 | ||
210 | impl<'a, DB> Resolver<'a, DB> | 210 | impl<'a, DB> Resolver<'a, DB> |
211 | where | 211 | where |
212 | DB: HirDatabase, | 212 | DB: HirDatabase, |
213 | { | 213 | { |
214 | pub(crate) fn new( | ||
215 | db: &'a DB, | ||
216 | input: &'a FxHashMap<ModuleId, Arc<InputModuleItems>>, | ||
217 | source_root: SourceRootId, | ||
218 | module_tree: Arc<ModuleTree>, | ||
219 | ) -> Resolver<'a, DB> { | ||
220 | Resolver { | ||
221 | db: db, | ||
222 | input: &input, | ||
223 | source_root, | ||
224 | module_tree, | ||
225 | result: ItemMap::default(), | ||
226 | } | ||
227 | } | ||
228 | |||
214 | pub(crate) fn resolve(mut self) -> Cancelable<ItemMap> { | 229 | pub(crate) fn resolve(mut self) -> Cancelable<ItemMap> { |
215 | for (&module_id, items) in self.input.iter() { | 230 | for (&module_id, items) in self.input.iter() { |
216 | self.populate_module(module_id, items) | 231 | self.populate_module(module_id, items) |
diff --git a/crates/ra_hir/src/query_definitions.rs b/crates/ra_hir/src/query_definitions.rs index bb4457d07..37c4f9e4f 100644 --- a/crates/ra_hir/src/query_definitions.rs +++ b/crates/ra_hir/src/query_definitions.rs | |||
@@ -141,13 +141,8 @@ pub(super) fn item_map( | |||
141 | Ok((id, items)) | 141 | Ok((id, items)) |
142 | }) | 142 | }) |
143 | .collect::<Cancelable<FxHashMap<_, _>>>()?; | 143 | .collect::<Cancelable<FxHashMap<_, _>>>()?; |
144 | let resolver = Resolver { | 144 | |
145 | db: db, | 145 | let resolver = Resolver::new(db, &input, source_root, module_tree); |
146 | input: &input, | ||
147 | source_root, | ||
148 | module_tree, | ||
149 | result: ItemMap::default(), | ||
150 | }; | ||
151 | let res = resolver.resolve()?; | 146 | let res = resolver.resolve()?; |
152 | let elapsed = start.elapsed(); | 147 | let elapsed = start.elapsed(); |
153 | log::info!("item_map: {:?}", elapsed); | 148 | log::info!("item_map: {:?}", elapsed); |