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') 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