aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/db.rs
blob: ba43a4502c4354843d82f82d5ca7ea0018f01b8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
use std::sync::Arc;

use ra_syntax::{
    SmolStr,
    SyntaxNode,
};
use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase, FileId, Cancelable};

use crate::{
    DefLoc, DefId,
    SourceFileItems, SourceItemId,
    query_definitions,
    FnScopes,
    module::{ModuleId, ModuleTree, ModuleSource,
    nameres::{ItemMap, InputModuleItems}},
    ty::{InferenceResult, Ty},
    adt::{StructData, EnumData},
};

salsa::query_group! {

pub trait HirDatabase: SyntaxDatabase
    + AsRef<LocationIntener<DefLoc, DefId>>
{
    fn fn_scopes(def_id: DefId) -> Arc<FnScopes> {
        type FnScopesQuery;
        use fn query_definitions::fn_scopes;
    }

    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;
    }

    fn infer(def_id: DefId) -> Cancelable<Arc<InferenceResult>> {
        type InferQuery;
        use fn query_definitions::infer;
    }

    fn type_for_def(def_id: DefId) -> Cancelable<Ty> {
        type TypeForDefQuery;
        use fn query_definitions::type_for_def;
    }

    fn type_for_field(def_id: DefId, field: SmolStr) -> Cancelable<Ty> {
        type TypeForFieldQuery;
        use fn query_definitions::type_for_field;
    }

    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;
    }
}

}