2018-11-27 18:42:26 -06:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
2019-01-01 11:59:00 -06:00
|
|
|
use ra_syntax::{SyntaxNode, SourceFileNode};
|
2019-01-01 12:01:05 -06:00
|
|
|
use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase, Cancelable};
|
2018-11-27 18:42:26 -06:00
|
|
|
|
|
|
|
use crate::{
|
2018-12-28 07:34:00 -06:00
|
|
|
Crate, DefLoc, DefId, MacroCallLoc, MacroCallId, Name, HirFileId,
|
2018-11-27 18:42:26 -06:00
|
|
|
SourceFileItems, SourceItemId,
|
|
|
|
query_definitions,
|
2018-11-27 19:09:44 -06:00
|
|
|
FnScopes,
|
2019-01-01 15:37:36 -06:00
|
|
|
macros::MacroExpansion,
|
2018-11-27 18:42:26 -06:00
|
|
|
module::{ModuleId, ModuleTree, ModuleSource,
|
|
|
|
nameres::{ItemMap, InputModuleItems}},
|
2018-12-23 10:13:11 -06:00
|
|
|
ty::{InferenceResult, Ty},
|
2018-12-24 12:07:48 -06:00
|
|
|
adt::{StructData, EnumData},
|
2018-12-28 07:34:00 -06:00
|
|
|
impl_block::CrateImplBlocks,
|
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-01 14:21:16 -06:00
|
|
|
fn hir_source_file(file_id: HirFileId) -> SourceFileNode {
|
|
|
|
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-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;
|
|
|
|
}
|
|
|
|
|
2018-12-27 14:51:44 -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;
|
|
|
|
}
|
|
|
|
|
2018-12-24 12:07:48 -06:00
|
|
|
fn struct_data(def_id: DefId) -> Cancelable<Arc<StructData>> {
|
|
|
|
type StructDataQuery;
|
|
|
|
use fn query_definitions::struct_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn enum_data(def_id: DefId) -> Cancelable<Arc<EnumData>> {
|
|
|
|
type EnumDataQuery;
|
|
|
|
use fn query_definitions::enum_data;
|
|
|
|
}
|
|
|
|
|
2018-12-27 14:51:44 -06:00
|
|
|
fn infer(def_id: DefId) -> Cancelable<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
|
|
|
}
|
|
|
|
|
2018-12-23 10:13:11 -06:00
|
|
|
fn type_for_def(def_id: DefId) -> Cancelable<Ty> {
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2018-12-28 12:34:58 -06:00
|
|
|
fn type_for_field(def_id: DefId, field: Name) -> Cancelable<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;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn file_item(source_item_id: SourceItemId) -> SyntaxNode {
|
|
|
|
type FileItemQuery;
|
|
|
|
use fn query_definitions::file_item;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn submodules(source: ModuleSource) -> Cancelable<Arc<Vec<crate::module::imp::Submodule>>> {
|
|
|
|
type SubmodulesQuery;
|
|
|
|
use fn query_definitions::submodules;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn input_module_items(source_root_id: SourceRootId, module_id: ModuleId) -> Cancelable<Arc<InputModuleItems>> {
|
|
|
|
type InputModuleItemsQuery;
|
|
|
|
use fn query_definitions::input_module_items;
|
|
|
|
}
|
|
|
|
fn item_map(source_root_id: SourceRootId) -> Cancelable<Arc<ItemMap>> {
|
|
|
|
type ItemMapQuery;
|
|
|
|
use fn query_definitions::item_map;
|
|
|
|
}
|
|
|
|
fn module_tree(source_root_id: SourceRootId) -> Cancelable<Arc<ModuleTree>> {
|
|
|
|
type ModuleTreeQuery;
|
|
|
|
use fn crate::module::imp::module_tree;
|
|
|
|
}
|
2018-12-28 07:34:00 -06:00
|
|
|
|
|
|
|
fn impls_in_crate(krate: Crate) -> Cancelable<Arc<CrateImplBlocks>> {
|
|
|
|
type ImplsInCrateQuery;
|
|
|
|
use fn crate::impl_block::impls_in_crate;
|
|
|
|
}
|
2018-11-27 18:42:26 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|