From 80bb7d86ec6e7560ec6880a20eb8c5b984b2af52 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 2 Mar 2019 16:49:06 +0300 Subject: 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 e362cc05f..3ac146950 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs @@ -191,7 +191,7 @@ impl Module { } 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 2d3058afd..437f96942 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 @@ impl Module { 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 a669dc9b0..21d22aa7f 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs @@ -48,14 +48,14 @@ pub trait PersistentHirDatabase: SourceDatabase + AsRef { delc_id: Option, ) -> 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_with_source_map_query)] + fn lower_module_with_source_map( + &self, + module: Module, + ) -> (Arc, Arc); - #[salsa::invoke(crate::nameres::lower::LoweredModule::lower_module_source_map_query)] - fn lower_module_source_map(&self, module: Module) -> Arc; + #[salsa::invoke(crate::nameres::lower::LoweredModule::lower_module_query)] + 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 ac390c5db..73919ee37 100644 --- a/crates/ra_hir/src/nameres.rs +++ b/crates/ra_hir/src/nameres.rs @@ -481,7 +481,7 @@ impl ItemMap { 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 2bc3eb60c..56262ad6d 100644 --- a/crates/ra_hir/src/nameres/lower.rs +++ b/crates/ra_hir/src/nameres/lower.rs @@ -60,21 +60,14 @@ impl ImportSourceMap { } impl LoweredModule { - pub(crate) fn lower_module_module_query( + pub(crate) fn lower_module_query( db: &impl PersistentHirDatabase, module: Module, ) -> Arc { - db.lower_module(module).0 - } - - pub(crate) fn lower_module_source_map_query( - db: &impl PersistentHirDatabase, - module: Module, - ) -> Arc { - db.lower_module(module).1 + db.lower_module_with_source_map(module).0 } - 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 625a2ce45..ea20cd15a 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 4c35ce050..0c90ed5b5 100644 --- a/crates/ra_ide_api/src/change.rs +++ b/crates/ra_ide_api/src/change.rs @@ -223,8 +223,7 @@ impl RootDatabase { 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); } } -- cgit v1.2.3