From 12433a78871610edfccc82442846615872747e06 Mon Sep 17 00:00:00 2001 From: csmoe Date: Thu, 31 Jan 2019 22:28:31 +0800 Subject: split hirdatabase --- crates/ra_hir/src/db.rs | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'crates/ra_hir/src/db.rs') diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index 189649841..7183b1630 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs @@ -19,8 +19,8 @@ use crate::{ ids::SourceFileItemId, }; -#[salsa::query_group(HirDatabaseStorage)] -pub trait HirDatabase: SourceDatabase + AsRef { +#[salsa::query_group(PersistentHirDatabaseStorage)] +pub trait PersistentHirDatabase: SourceDatabase + AsRef { #[salsa::invoke(HirFileId::hir_parse)] fn hir_parse(&self, file_id: HirFileId) -> TreeArc; @@ -36,21 +36,9 @@ pub trait HirDatabase: SourceDatabase + AsRef { #[salsa::invoke(crate::adt::EnumData::enum_data_query)] fn enum_data(&self, e: Enum) -> Arc; - #[salsa::invoke(crate::ty::infer)] - fn infer(&self, func: Function) -> Arc; - - #[salsa::invoke(crate::ty::type_for_def)] - fn type_for_def(&self, def: TypableDef) -> Ty; - - #[salsa::invoke(crate::ty::type_for_field)] - fn type_for_field(&self, field: StructField) -> Ty; - #[salsa::invoke(query_definitions::file_items)] fn file_items(&self, file_id: HirFileId) -> Arc; - #[salsa::invoke(query_definitions::file_item)] - fn file_item(&self, source_item_id: SourceItemId) -> TreeArc; - #[salsa::invoke(crate::module_tree::Submodule::submodules_query)] fn submodules( &self, @@ -88,15 +76,33 @@ pub trait HirDatabase: SourceDatabase + AsRef { #[salsa::invoke(crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query)] fn impls_in_crate(&self, krate: Crate) -> Arc; - #[salsa::invoke(crate::expr::body_hir)] - fn body_hir(&self, func: Function) -> Arc; - - #[salsa::invoke(crate::expr::body_syntax_mapping)] - fn body_syntax_mapping(&self, func: Function) -> Arc; - #[salsa::invoke(crate::generics::GenericParams::generic_params_query)] fn generic_params(&self, def: GenericDef) -> Arc; #[salsa::invoke(crate::FnSignature::fn_signature_query)] fn fn_signature(&self, func: Function) -> Arc; } + +#[salsa::query_group(HirDatabaseStorage)] +pub trait HirDatabase: PersistentHirDatabase { + #[salsa::invoke(query_definitions::fn_scopes)] + fn fn_scopes(&self, func: Function) -> Arc; + + #[salsa::invoke(query_definitions::file_item)] + fn file_item(&self, source_item_id: SourceItemId) -> TreeArc; + + #[salsa::invoke(crate::ty::infer)] + fn infer(&self, func: Function) -> Arc; + + #[salsa::invoke(crate::ty::type_for_def)] + fn type_for_def(&self, def: TypableDef) -> Ty; + + #[salsa::invoke(crate::ty::type_for_field)] + fn type_for_field(&self, field: StructField) -> Ty; + + #[salsa::invoke(crate::expr::body_hir)] + fn body_hir(&self, func: Function) -> Arc; + + #[salsa::invoke(crate::expr::body_syntax_mapping)] + fn body_syntax_mapping(&self, func: Function) -> Arc; +} -- cgit v1.2.3 From 4dffdcf14abe0c79f9d7a9702be77958be1f75b1 Mon Sep 17 00:00:00 2001 From: csmoe Date: Fri, 1 Feb 2019 18:33:41 +0800 Subject: split HirDatabase api --- crates/ra_hir/src/db.rs | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'crates/ra_hir/src/db.rs') diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index 7183b1630..6b21fe744 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs @@ -27,9 +27,6 @@ pub trait PersistentHirDatabase: SourceDatabase + AsRef { #[salsa::invoke(crate::macros::expand_macro_invocation)] fn expand_macro_invocation(&self, invoc: MacroCallId) -> Option>; - #[salsa::invoke(ExprScopes::expr_scopes_query)] - fn expr_scopes(&self, func: Function) -> Arc; - #[salsa::invoke(crate::adt::StructData::struct_data_query)] fn struct_data(&self, s: Struct) -> Arc; @@ -39,6 +36,9 @@ pub trait PersistentHirDatabase: SourceDatabase + AsRef { #[salsa::invoke(query_definitions::file_items)] fn file_items(&self, file_id: HirFileId) -> Arc; + #[salsa::invoke(query_definitions::file_item)] + fn file_item(&self, source_item_id: SourceItemId) -> TreeArc; + #[salsa::invoke(crate::module_tree::Submodule::submodules_query)] fn submodules( &self, @@ -61,20 +61,17 @@ pub trait PersistentHirDatabase: SourceDatabase + AsRef { #[salsa::invoke(crate::module_tree::ModuleTree::module_tree_query)] fn module_tree(&self, krate: Crate) -> Arc; - #[salsa::invoke(crate::impl_block::impls_in_module_with_source_map_query)] - fn impls_in_module_with_source_map( - &self, - module: Module, - ) -> (Arc, Arc); - #[salsa::invoke(crate::impl_block::impls_in_module)] fn impls_in_module(&self, module: Module) -> Arc; #[salsa::invoke(crate::impl_block::impls_in_module_source_map_query)] fn impls_in_module_source_map(&self, module: Module) -> Arc; - #[salsa::invoke(crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query)] - fn impls_in_crate(&self, krate: Crate) -> Arc; + #[salsa::invoke(crate::impl_block::impls_in_module_with_source_map_query)] + fn impls_in_module_with_source_map( + &self, + module: Module, + ) -> (Arc, Arc); #[salsa::invoke(crate::generics::GenericParams::generic_params_query)] fn generic_params(&self, def: GenericDef) -> Arc; @@ -85,11 +82,8 @@ pub trait PersistentHirDatabase: SourceDatabase + AsRef { #[salsa::query_group(HirDatabaseStorage)] pub trait HirDatabase: PersistentHirDatabase { - #[salsa::invoke(query_definitions::fn_scopes)] - fn fn_scopes(&self, func: Function) -> Arc; - - #[salsa::invoke(query_definitions::file_item)] - fn file_item(&self, source_item_id: SourceItemId) -> TreeArc; + #[salsa::invoke(ExprScopes::expr_scopes_query)] + fn expr_scopes(&self, func: Function) -> Arc; #[salsa::invoke(crate::ty::infer)] fn infer(&self, func: Function) -> Arc; @@ -105,4 +99,7 @@ pub trait HirDatabase: PersistentHirDatabase { #[salsa::invoke(crate::expr::body_syntax_mapping)] fn body_syntax_mapping(&self, func: Function) -> Arc; + + #[salsa::invoke(crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query)] + fn impls_in_crate(&self, krate: Crate) -> Arc; } -- cgit v1.2.3