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