mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
remove query_definitions
This commit is contained in:
parent
6596793c0c
commit
28fd228c70
@ -6,7 +6,6 @@ use ra_db::{SourceDatabase, salsa};
|
|||||||
use crate::{
|
use crate::{
|
||||||
MacroCallId, HirFileId,
|
MacroCallId, HirFileId,
|
||||||
SourceFileItems, SourceItemId, Crate, Module, HirInterner,
|
SourceFileItems, SourceItemId, Crate, Module, HirInterner,
|
||||||
query_definitions,
|
|
||||||
Function, FnSignature, ExprScopes,
|
Function, FnSignature, ExprScopes,
|
||||||
Struct, Enum, StructField,
|
Struct, Enum, StructField,
|
||||||
macros::MacroExpansion,
|
macros::MacroExpansion,
|
||||||
@ -33,10 +32,10 @@ pub trait PersistentHirDatabase: SourceDatabase + AsRef<HirInterner> {
|
|||||||
#[salsa::invoke(crate::adt::EnumData::enum_data_query)]
|
#[salsa::invoke(crate::adt::EnumData::enum_data_query)]
|
||||||
fn enum_data(&self, e: Enum) -> Arc<EnumData>;
|
fn enum_data(&self, e: Enum) -> Arc<EnumData>;
|
||||||
|
|
||||||
#[salsa::invoke(query_definitions::file_items)]
|
#[salsa::invoke(crate::ids::SourceFileItems::file_items_query)]
|
||||||
fn file_items(&self, file_id: HirFileId) -> Arc<SourceFileItems>;
|
fn file_items(&self, file_id: HirFileId) -> Arc<SourceFileItems>;
|
||||||
|
|
||||||
#[salsa::invoke(query_definitions::file_item)]
|
#[salsa::invoke(crate::ids::SourceFileItems::file_item_query)]
|
||||||
fn file_item(&self, source_item_id: SourceItemId) -> TreeArc<SyntaxNode>;
|
fn file_item(&self, source_item_id: SourceItemId) -> TreeArc<SyntaxNode>;
|
||||||
|
|
||||||
#[salsa::invoke(crate::module_tree::Submodule::submodules_query)]
|
#[salsa::invoke(crate::module_tree::Submodule::submodules_query)]
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use std::{
|
use std::{
|
||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
hash::{Hash, Hasher},
|
hash::{Hash, Hasher},
|
||||||
|
sync::Arc,
|
||||||
};
|
};
|
||||||
|
|
||||||
use ra_db::{LocationIntener, FileId};
|
use ra_db::{LocationIntener, FileId};
|
||||||
@ -301,10 +302,24 @@ pub struct SourceFileItems {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SourceFileItems {
|
impl SourceFileItems {
|
||||||
pub(crate) fn new(file_id: HirFileId, source_file: &SourceFile) -> SourceFileItems {
|
pub(crate) fn file_items_query(
|
||||||
|
db: &impl PersistentHirDatabase,
|
||||||
|
file_id: HirFileId,
|
||||||
|
) -> Arc<SourceFileItems> {
|
||||||
|
let source_file = db.hir_parse(file_id);
|
||||||
let mut res = SourceFileItems { file_id, arena: Arena::default() };
|
let mut res = SourceFileItems { file_id, arena: Arena::default() };
|
||||||
res.init(source_file);
|
res.init(&source_file);
|
||||||
res
|
Arc::new(res)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn file_item_query(
|
||||||
|
db: &impl PersistentHirDatabase,
|
||||||
|
source_item_id: SourceItemId,
|
||||||
|
) -> TreeArc<SyntaxNode> {
|
||||||
|
let source_file = db.hir_parse(source_item_id.file_id);
|
||||||
|
db.file_items(source_item_id.file_id)[source_item_id.item_id]
|
||||||
|
.to_node(&source_file)
|
||||||
|
.to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init(&mut self, source_file: &SourceFile) {
|
fn init(&mut self, source_file: &SourceFile) {
|
||||||
|
@ -20,7 +20,6 @@ macro_rules! impl_froms {
|
|||||||
pub mod db;
|
pub mod db;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod mock;
|
pub mod mock;
|
||||||
mod query_definitions;
|
|
||||||
mod path;
|
mod path;
|
||||||
pub mod source_binder;
|
pub mod source_binder;
|
||||||
|
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use ra_syntax::{
|
|
||||||
SyntaxNode, TreeArc,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
|
||||||
SourceFileItems, SourceItemId, HirFileId,
|
|
||||||
PersistentHirDatabase,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub(super) fn file_items(
|
|
||||||
db: &impl PersistentHirDatabase,
|
|
||||||
file_id: HirFileId,
|
|
||||||
) -> Arc<SourceFileItems> {
|
|
||||||
let source_file = db.hir_parse(file_id);
|
|
||||||
let res = SourceFileItems::new(file_id, &source_file);
|
|
||||||
Arc::new(res)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn file_item(
|
|
||||||
db: &impl PersistentHirDatabase,
|
|
||||||
source_item_id: SourceItemId,
|
|
||||||
) -> TreeArc<SyntaxNode> {
|
|
||||||
let source_file = db.hir_parse(source_item_id.file_id);
|
|
||||||
db.file_items(source_item_id.file_id)[source_item_id.item_id].to_node(&source_file).to_owned()
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user