From 8b9ff46b378e37b256f6b93f1f6f3bb5bc122064 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 9 Dec 2018 12:24:52 +0300 Subject: make resolver fields private --- crates/ra_hir/src/module/nameres.rs | 25 ++++++++++++++++++++----- crates/ra_hir/src/query_definitions.rs | 9 ++------- 2 files changed, 22 insertions(+), 12 deletions(-) (limited to 'crates/ra_hir/src') 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 { } pub(crate) struct Resolver<'a, DB> { - pub(crate) db: &'a DB, - pub(crate) input: &'a FxHashMap>, - pub(crate) source_root: SourceRootId, - pub(crate) module_tree: Arc, - pub(crate) result: ItemMap, + db: &'a DB, + input: &'a FxHashMap>, + source_root: SourceRootId, + module_tree: Arc, + result: ItemMap, } impl<'a, DB> Resolver<'a, DB> where DB: HirDatabase, { + pub(crate) fn new( + db: &'a DB, + input: &'a FxHashMap>, + source_root: SourceRootId, + module_tree: Arc, + ) -> Resolver<'a, DB> { + Resolver { + db: db, + input: &input, + source_root, + module_tree, + result: ItemMap::default(), + } + } + pub(crate) fn resolve(mut self) -> Cancelable { for (&module_id, items) in self.input.iter() { 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( Ok((id, items)) }) .collect::>>()?; - let resolver = Resolver { - db: db, - input: &input, - source_root, - module_tree, - result: ItemMap::default(), - }; + + let resolver = Resolver::new(db, &input, source_root, module_tree); let res = resolver.resolve()?; let elapsed = start.elapsed(); log::info!("item_map: {:?}", elapsed); -- cgit v1.2.3