From be1a005ebd02298feb8d272278354411d16acdee Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 26 Jan 2019 11:09:39 +0300 Subject: fold syntax database into files database --- crates/ra_hir/src/db.rs | 4 ++-- crates/ra_hir/src/mock.rs | 10 +++------- crates/ra_hir/src/ty/tests.rs | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index dfbf41bd6..1bb9e0305 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use ra_syntax::{SyntaxNode, TreeArc, SourceFile}; -use ra_db::{SyntaxDatabase, CrateId, salsa}; +use ra_db::{FilesDatabase, CrateId, salsa}; use crate::{ MacroCallId, HirFileId, @@ -19,7 +19,7 @@ use crate::{ }; #[salsa::query_group(HirDatabaseStorage)] -pub trait HirDatabase: SyntaxDatabase + AsRef { +pub trait HirDatabase: FilesDatabase + AsRef { #[salsa::invoke(HirFileId::hir_source_file)] fn hir_source_file(&self, file_id: HirFileId) -> TreeArc; diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs index 2dc252b1e..4af4dd096 100644 --- a/crates/ra_hir/src/mock.rs +++ b/crates/ra_hir/src/mock.rs @@ -2,7 +2,7 @@ use std::{sync::Arc, panic}; use parking_lot::Mutex; use ra_db::{ - BaseDatabase, FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId, FilesDatabase, salsa, + CheckCanceled, FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId, FilesDatabase, salsa, }; use relative_path::RelativePathBuf; use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset}; @@ -11,11 +11,7 @@ use crate::{db, HirInterner}; pub const WORKSPACE: SourceRootId = SourceRootId(0); -#[salsa::database( - ra_db::FilesDatabaseStorage, - ra_db::SyntaxDatabaseStorage, - db::HirDatabaseStorage -)] +#[salsa::database(ra_db::FilesDatabaseStorage, db::HirDatabaseStorage)] #[derive(Debug)] pub(crate) struct MockDatabase { events: Mutex>>>, @@ -161,7 +157,7 @@ impl salsa::ParallelDatabase for MockDatabase { } } -impl BaseDatabase for MockDatabase {} +impl CheckCanceled for MockDatabase {} impl AsRef for MockDatabase { fn as_ref(&self) -> &HirInterner { diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 389bdaf23..a56783b6e 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use std::fmt::Write; -use ra_db::{SyntaxDatabase, salsa::Database}; +use ra_db::{FilesDatabase, salsa::Database}; use ra_syntax::ast::{self, AstNode}; use crate::{ -- cgit v1.2.3 From 3223de59765cae816099e8684a2caf13bc69bb2e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 26 Jan 2019 11:17:05 +0300 Subject: move ide queries to ide db --- crates/ra_hir/src/mock.rs | 2 -- 1 file changed, 2 deletions(-) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs index 4af4dd096..cfbe652b0 100644 --- a/crates/ra_hir/src/mock.rs +++ b/crates/ra_hir/src/mock.rs @@ -140,8 +140,6 @@ impl Default for MockDatabase { file_counter: 0, }; db.set_crate_graph(Default::default()); - db.set_local_roots(Default::default()); - db.set_library_roots(Default::default()); db } } -- cgit v1.2.3 From 4711cbcace33e34d43f880d30c2778c843240f27 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 26 Jan 2019 11:20:30 +0300 Subject: rename FilesDatabase -> SourceDatabase --- crates/ra_hir/src/db.rs | 4 ++-- crates/ra_hir/src/mock.rs | 4 ++-- crates/ra_hir/src/nameres/tests.rs | 2 +- crates/ra_hir/src/ty/tests.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index 1bb9e0305..9b5b79d38 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use ra_syntax::{SyntaxNode, TreeArc, SourceFile}; -use ra_db::{FilesDatabase, CrateId, salsa}; +use ra_db::{SourceDatabase, CrateId, salsa}; use crate::{ MacroCallId, HirFileId, @@ -19,7 +19,7 @@ use crate::{ }; #[salsa::query_group(HirDatabaseStorage)] -pub trait HirDatabase: FilesDatabase + AsRef { +pub trait HirDatabase: SourceDatabase + AsRef { #[salsa::invoke(HirFileId::hir_source_file)] fn hir_source_file(&self, file_id: HirFileId) -> TreeArc; diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs index cfbe652b0..7da15eca0 100644 --- a/crates/ra_hir/src/mock.rs +++ b/crates/ra_hir/src/mock.rs @@ -2,7 +2,7 @@ use std::{sync::Arc, panic}; use parking_lot::Mutex; use ra_db::{ - CheckCanceled, FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId, FilesDatabase, salsa, + CheckCanceled, FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId, SourceDatabase, salsa, }; use relative_path::RelativePathBuf; use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset}; @@ -11,7 +11,7 @@ use crate::{db, HirInterner}; pub const WORKSPACE: SourceRootId = SourceRootId(0); -#[salsa::database(ra_db::FilesDatabaseStorage, db::HirDatabaseStorage)] +#[salsa::database(ra_db::SourceDatabaseStorage, db::HirDatabaseStorage)] #[derive(Debug)] pub(crate) struct MockDatabase { events: Mutex>>>, diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 24936976c..e72781f51 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use ra_db::{CrateGraph, SourceRootId, FilesDatabase}; +use ra_db::{CrateGraph, SourceRootId, SourceDatabase}; use relative_path::RelativePath; use test_utils::{assert_eq_text, covers}; diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index a56783b6e..0eb4da06e 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use std::fmt::Write; -use ra_db::{FilesDatabase, salsa::Database}; +use ra_db::{SourceDatabase, salsa::Database}; use ra_syntax::ast::{self, AstNode}; use crate::{ -- cgit v1.2.3