2018-11-27 18:42:26 -06:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
2019-01-11 10:59:06 -06:00
|
|
|
use ra_syntax::{SyntaxNode, TreeArc, SourceFile};
|
2019-01-15 11:54:18 -06:00
|
|
|
use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase};
|
2018-11-27 18:42:26 -06:00
|
|
|
|
|
|
|
use crate::{
|
2019-01-04 12:29:53 -06:00
|
|
|
DefLoc, DefId, MacroCallLoc, MacroCallId, Name, HirFileId,
|
2019-01-07 06:44:54 -06:00
|
|
|
SourceFileItems, SourceItemId, Crate,
|
2018-11-27 18:42:26 -06:00
|
|
|
query_definitions,
|
2019-01-05 18:00:34 -06:00
|
|
|
FnSignature, FnScopes,
|
2019-01-01 15:37:36 -06:00
|
|
|
macros::MacroExpansion,
|
2019-01-06 10:58:10 -06:00
|
|
|
module_tree::{ModuleId, ModuleTree},
|
2019-01-06 08:33:27 -06:00
|
|
|
nameres::{ItemMap, InputModuleItems},
|
2019-01-07 06:44:54 -06:00
|
|
|
ty::{InferenceResult, Ty, method_resolution::CrateImplBlocks},
|
2019-01-08 09:01:19 -06:00
|
|
|
adt::{StructData, EnumData, EnumVariantData},
|
2019-01-04 12:29:53 -06:00
|
|
|
impl_block::ModuleImplBlocks,
|
2018-11-27 18:42:26 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
salsa::query_group! {
|
|
|
|
|
2018-11-27 19:09:44 -06:00
|
|
|
pub trait HirDatabase: SyntaxDatabase
|
2018-11-27 18:42:26 -06:00
|
|
|
+ AsRef<LocationIntener<DefLoc, DefId>>
|
2019-01-01 09:12:31 -06:00
|
|
|
+ AsRef<LocationIntener<MacroCallLoc, MacroCallId>>
|
2018-11-27 18:42:26 -06:00
|
|
|
{
|
2019-01-11 10:59:06 -06:00
|
|
|
fn hir_source_file(file_id: HirFileId) -> TreeArc<SourceFile> {
|
2019-01-01 14:21:16 -06:00
|
|
|
type HirSourceFileQuery;
|
2019-01-02 03:49:09 -06:00
|
|
|
use fn HirFileId::hir_source_file;
|
2019-01-01 11:59:00 -06:00
|
|
|
}
|
2019-01-08 17:47:12 -06:00
|
|
|
|
2019-01-01 09:12:31 -06:00
|
|
|
fn expand_macro_invocation(invoc: MacroCallId) -> Option<Arc<MacroExpansion>> {
|
|
|
|
type ExpandMacroCallQuery;
|
2019-01-01 09:11:04 -06:00
|
|
|
use fn crate::macros::expand_macro_invocation;
|
|
|
|
}
|
|
|
|
|
2019-01-15 10:04:49 -06:00
|
|
|
fn fn_scopes(def_id: DefId) -> Arc<FnScopes> {
|
2018-11-27 18:42:26 -06:00
|
|
|
type FnScopesQuery;
|
|
|
|
use fn query_definitions::fn_scopes;
|
|
|
|
}
|
|
|
|
|
2019-01-15 09:43:25 -06:00
|
|
|
fn struct_data(def_id: DefId) -> Arc<StructData> {
|
2018-12-24 12:07:48 -06:00
|
|
|
type StructDataQuery;
|
2019-01-08 06:38:29 -06:00
|
|
|
use fn crate::adt::StructData::struct_data_query;
|
2018-12-24 12:07:48 -06:00
|
|
|
}
|
|
|
|
|
2019-01-15 09:43:25 -06:00
|
|
|
fn enum_data(def_id: DefId) -> Arc<EnumData> {
|
2018-12-24 12:07:48 -06:00
|
|
|
type EnumDataQuery;
|
2019-01-08 06:38:29 -06:00
|
|
|
use fn crate::adt::EnumData::enum_data_query;
|
2018-12-24 12:07:48 -06:00
|
|
|
}
|
|
|
|
|
2019-01-15 09:43:25 -06:00
|
|
|
fn enum_variant_data(def_id: DefId) -> Arc<EnumVariantData> {
|
2019-01-08 09:01:19 -06:00
|
|
|
type EnumVariantDataQuery;
|
|
|
|
use fn crate::adt::EnumVariantData::enum_variant_data_query;
|
|
|
|
}
|
|
|
|
|
2019-01-15 11:54:18 -06:00
|
|
|
fn infer(def_id: DefId) -> Arc<InferenceResult> {
|
2018-12-20 14:56:28 -06:00
|
|
|
type InferQuery;
|
2018-12-29 13:27:13 -06:00
|
|
|
use fn crate::ty::infer;
|
2018-12-20 14:56:28 -06:00
|
|
|
}
|
|
|
|
|
2019-01-15 11:43:37 -06:00
|
|
|
fn type_for_def(def_id: DefId) -> Ty {
|
2018-12-23 10:13:11 -06:00
|
|
|
type TypeForDefQuery;
|
2018-12-29 13:27:13 -06:00
|
|
|
use fn crate::ty::type_for_def;
|
2018-12-23 10:13:11 -06:00
|
|
|
}
|
|
|
|
|
2019-01-15 11:43:37 -06:00
|
|
|
fn type_for_field(def_id: DefId, field: Name) -> Option<Ty> {
|
2018-12-25 14:40:33 -06:00
|
|
|
type TypeForFieldQuery;
|
2018-12-29 13:27:13 -06:00
|
|
|
use fn crate::ty::type_for_field;
|
2018-12-25 14:40:33 -06:00
|
|
|
}
|
|
|
|
|
2019-01-01 14:21:16 -06:00
|
|
|
fn file_items(file_id: HirFileId) -> Arc<SourceFileItems> {
|
2018-11-27 18:42:26 -06:00
|
|
|
type SourceFileItemsQuery;
|
|
|
|
use fn query_definitions::file_items;
|
|
|
|
}
|
|
|
|
|
2019-01-11 10:59:06 -06:00
|
|
|
fn file_item(source_item_id: SourceItemId) -> TreeArc<SyntaxNode> {
|
2018-11-27 18:42:26 -06:00
|
|
|
type FileItemQuery;
|
|
|
|
use fn query_definitions::file_item;
|
|
|
|
}
|
|
|
|
|
2019-01-15 08:55:15 -06:00
|
|
|
fn submodules(source: SourceItemId) -> Arc<Vec<crate::module_tree::Submodule>> {
|
2018-11-27 18:42:26 -06:00
|
|
|
type SubmodulesQuery;
|
2019-01-06 08:44:50 -06:00
|
|
|
use fn crate::module_tree::Submodule::submodules_query;
|
2018-11-27 18:42:26 -06:00
|
|
|
}
|
|
|
|
|
2019-01-15 09:13:11 -06:00
|
|
|
fn input_module_items(source_root_id: SourceRootId, module_id: ModuleId) -> Arc<InputModuleItems> {
|
2018-11-27 18:42:26 -06:00
|
|
|
type InputModuleItemsQuery;
|
|
|
|
use fn query_definitions::input_module_items;
|
|
|
|
}
|
2019-01-08 17:47:12 -06:00
|
|
|
|
2019-01-15 10:15:01 -06:00
|
|
|
fn item_map(source_root_id: SourceRootId) -> Arc<ItemMap> {
|
2018-11-27 18:42:26 -06:00
|
|
|
type ItemMapQuery;
|
|
|
|
use fn query_definitions::item_map;
|
|
|
|
}
|
2019-01-08 17:47:12 -06:00
|
|
|
|
2019-01-15 08:55:15 -06:00
|
|
|
fn module_tree(source_root_id: SourceRootId) -> Arc<ModuleTree> {
|
2018-11-27 18:42:26 -06:00
|
|
|
type ModuleTreeQuery;
|
2019-01-06 08:33:27 -06:00
|
|
|
use fn crate::module_tree::ModuleTree::module_tree_query;
|
2018-11-27 18:42:26 -06:00
|
|
|
}
|
2018-12-28 07:34:00 -06:00
|
|
|
|
2019-01-15 10:18:52 -06:00
|
|
|
fn impls_in_module(source_root_id: SourceRootId, module_id: ModuleId) -> Arc<ModuleImplBlocks> {
|
2019-01-04 12:52:07 -06:00
|
|
|
type ImplsInModuleQuery;
|
2019-01-04 12:29:53 -06:00
|
|
|
use fn crate::impl_block::impls_in_module;
|
2018-12-28 07:34:00 -06:00
|
|
|
}
|
2019-01-05 09:32:07 -06:00
|
|
|
|
2019-01-15 11:54:18 -06:00
|
|
|
fn impls_in_crate(krate: Crate) -> Arc<CrateImplBlocks> {
|
2019-01-07 06:44:54 -06:00
|
|
|
type ImplsInCrateQuery;
|
2019-01-12 14:51:56 -06:00
|
|
|
use fn crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query;
|
2019-01-07 06:44:54 -06:00
|
|
|
}
|
|
|
|
|
2019-01-15 10:01:59 -06:00
|
|
|
fn body_hir(def_id: DefId) -> Arc<crate::expr::Body> {
|
2019-01-05 09:32:07 -06:00
|
|
|
type BodyHirQuery;
|
|
|
|
use fn crate::expr::body_hir;
|
|
|
|
}
|
|
|
|
|
2019-01-15 10:01:59 -06:00
|
|
|
fn body_syntax_mapping(def_id: DefId) -> Arc<crate::expr::BodySyntaxMapping> {
|
2019-01-05 09:32:07 -06:00
|
|
|
type BodySyntaxMappingQuery;
|
|
|
|
use fn crate::expr::body_syntax_mapping;
|
|
|
|
}
|
2019-01-05 18:00:34 -06:00
|
|
|
|
|
|
|
fn fn_signature(def_id: DefId) -> Arc<FnSignature> {
|
|
|
|
type FnSignatureQuery;
|
2019-01-08 11:11:13 -06:00
|
|
|
use fn crate::FnSignature::fn_signature_query;
|
2019-01-05 18:00:34 -06:00
|
|
|
}
|
2018-11-27 18:42:26 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|