From 80bb7d86ec6e7560ec6880a20eb8c5b984b2af52 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 2 Mar 2019 16:49:06 +0300 Subject: [PATCH] align lower module query names --- crates/ra_hir/src/code_model_api.rs | 2 +- crates/ra_hir/src/code_model_impl/module.rs | 2 +- crates/ra_hir/src/db.rs | 14 +++++++------- crates/ra_hir/src/nameres.rs | 2 +- crates/ra_hir/src/nameres/lower.rs | 13 +++---------- crates/ra_hir/src/source_binder.rs | 2 +- crates/ra_ide_api/src/change.rs | 3 +-- 7 files changed, 15 insertions(+), 23 deletions(-) diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index e362cc05f23..3ac14695095 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs @@ -191,7 +191,7 @@ pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { } pub fn declarations(self, db: &impl HirDatabase) -> Vec { - let (lowered_module, _) = db.lower_module(self); + let lowered_module = db.lower_module(self); lowered_module .declarations .values() diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index 2d3058afdd0..437f96942d8 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs @@ -47,7 +47,7 @@ pub(crate) fn import_source_impl( db: &impl HirDatabase, import: ImportId, ) -> TreeArc { - let source_map = db.lower_module_source_map(*self); + let (_, source_map) = db.lower_module_with_source_map(*self); let (_, source) = self.definition_source(db); source_map.get(&source, import) } diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index a669dc9b0e1..21d22aa7fb8 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs @@ -48,14 +48,14 @@ fn submodules( delc_id: Option, ) -> Arc>; + #[salsa::invoke(crate::nameres::lower::LoweredModule::lower_module_with_source_map_query)] + fn lower_module_with_source_map( + &self, + module: Module, + ) -> (Arc, Arc); + #[salsa::invoke(crate::nameres::lower::LoweredModule::lower_module_query)] - fn lower_module(&self, module: Module) -> (Arc, Arc); - - #[salsa::invoke(crate::nameres::lower::LoweredModule::lower_module_module_query)] - fn lower_module_module(&self, module: Module) -> Arc; - - #[salsa::invoke(crate::nameres::lower::LoweredModule::lower_module_source_map_query)] - fn lower_module_source_map(&self, module: Module) -> Arc; + fn lower_module(&self, module: Module) -> Arc; #[salsa::invoke(crate::nameres::ItemMap::item_map_query)] fn item_map(&self, krate: Crate) -> Arc; diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs index ac390c5db66..73919ee37a6 100644 --- a/crates/ra_hir/src/nameres.rs +++ b/crates/ra_hir/src/nameres.rs @@ -481,7 +481,7 @@ pub(crate) fn item_map_query(db: &impl PersistentHirDatabase, krate: Crate) -> A let module_tree = db.module_tree(krate); let input = module_tree .modules() - .map(|module_id| (module_id, db.lower_module_module(Module { krate, module_id }))) + .map(|module_id| (module_id, db.lower_module(Module { krate, module_id }))) .collect::>(); let resolver = Resolver::new(db, &input, krate); diff --git a/crates/ra_hir/src/nameres/lower.rs b/crates/ra_hir/src/nameres/lower.rs index 2bc3eb60c2b..56262ad6d70 100644 --- a/crates/ra_hir/src/nameres/lower.rs +++ b/crates/ra_hir/src/nameres/lower.rs @@ -60,21 +60,14 @@ pub fn get(&self, source: &ModuleSource, import: ImportId) -> TreeArc Arc { - db.lower_module(module).0 + db.lower_module_with_source_map(module).0 } - pub(crate) fn lower_module_source_map_query( - db: &impl PersistentHirDatabase, - module: Module, - ) -> Arc { - db.lower_module(module).1 - } - - pub(crate) fn lower_module_query( + pub(crate) fn lower_module_with_source_map_query( db: &impl PersistentHirDatabase, module: Module, ) -> (Arc, Arc) { diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 625a2ce45a9..ea20cd15a24 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs @@ -157,7 +157,7 @@ pub fn macro_symbols(db: &impl HirDatabase, file_id: FileId) -> Vec<(SmolStr, Te Some(it) => it, None => return Vec::new(), }; - let items = db.lower_module_module(module); + let items = db.lower_module(module); let mut res = Vec::new(); for macro_call_id in items diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs index 4c35ce0503e..0c90ed5b571 100644 --- a/crates/ra_ide_api/src/change.rs +++ b/crates/ra_ide_api/src/change.rs @@ -223,8 +223,7 @@ pub(crate) fn collect_garbage(&mut self) { self.query(hir::db::FileItemsQuery).sweep(sweep); self.query(hir::db::FileItemQuery).sweep(sweep); - self.query(hir::db::LowerModuleQuery).sweep(sweep); - self.query(hir::db::LowerModuleSourceMapQuery).sweep(sweep); + self.query(hir::db::LowerModuleWithSourceMapQuery).sweep(sweep); self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep); } }