2018-11-28 00:42:26 +00:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
use ra_syntax::{
|
|
|
|
SyntaxNode,
|
|
|
|
ast::FnDefNode,
|
|
|
|
};
|
|
|
|
use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase, FileId, Cancelable};
|
|
|
|
|
|
|
|
use crate::{
|
2018-12-04 20:44:00 +00:00
|
|
|
DefLoc, DefId,
|
2018-11-28 00:42:26 +00:00
|
|
|
SourceFileItems, SourceItemId,
|
|
|
|
query_definitions,
|
2018-11-28 01:09:44 +00:00
|
|
|
FnScopes,
|
2018-12-04 20:44:00 +00:00
|
|
|
function::FnId,
|
2018-11-28 00:42:26 +00:00
|
|
|
module::{ModuleId, ModuleTree, ModuleSource,
|
|
|
|
nameres::{ItemMap, InputModuleItems}},
|
|
|
|
};
|
|
|
|
|
|
|
|
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>>
|
|
|
|
{
|
|
|
|
fn fn_scopes(fn_id: FnId) -> Arc<FnScopes> {
|
|
|
|
type FnScopesQuery;
|
|
|
|
use fn query_definitions::fn_scopes;
|
|
|
|
}
|
|
|
|
fn fn_syntax(fn_id: FnId) -> FnDefNode {
|
|
|
|
type FnSyntaxQuery;
|
|
|
|
use fn query_definitions::fn_syntax;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn file_items(file_id: FileId) -> Arc<SourceFileItems> {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|