Store all the data in the Salsa Database

This commit is contained in:
Aleksey Kladov 2018-10-25 10:57:55 +03:00
parent 2cb2074c4b
commit ee4d904cfb
11 changed files with 337 additions and 199 deletions

View file

@ -7,12 +7,12 @@ use ra_syntax::{ast::{self, NameOwner, AstNode}, SmolStr, SyntaxNode};
use crate::{
FileId, Cancelable,
db::SyntaxDatabase,
db::{SyntaxDatabase, input::SourceRootId},
};
salsa::query_group! {
pub(crate) trait ModulesDatabase: SyntaxDatabase {
fn module_tree() -> Cancelable<Arc<ModuleTree>> {
fn module_tree(source_root_id: SourceRootId) -> Cancelable<Arc<ModuleTree>> {
type ModuleTreeQuery;
use fn imp::module_tree;
}
@ -110,15 +110,9 @@ impl ModuleId {
}
impl LinkId {
pub(crate) fn name(self, tree: &ModuleTree) -> SmolStr {
tree.link(self).name.clone()
}
pub(crate) fn owner(self, tree: &ModuleTree) -> ModuleId {
tree.link(self).owner
}
fn points_to(self, tree: &ModuleTree) -> &[ModuleId] {
&tree.link(self).points_to
}
pub(crate) fn bind_source<'a>(
self,
tree: &ModuleTree,