mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Add ImplId
This commit is contained in:
parent
aeb5e061a8
commit
080dd31f84
2 changed files with 22 additions and 9 deletions
|
@ -12,26 +12,27 @@ use crate::{
|
|||
raw::{ImportSourceMap, RawItems},
|
||||
CrateDefMap,
|
||||
},
|
||||
DefWithBodyId, EnumId, StructOrUnionId,
|
||||
DefWithBodyId, EnumId, ItemLoc, StructOrUnionId,
|
||||
};
|
||||
|
||||
#[salsa::query_group(InternDatabaseStorage)]
|
||||
pub trait InternDatabase: SourceDatabase {
|
||||
#[salsa::interned]
|
||||
fn intern_function(&self, loc: crate::ItemLoc<ast::FnDef>) -> crate::FunctionId;
|
||||
fn intern_function(&self, loc: ItemLoc<ast::FnDef>) -> crate::FunctionId;
|
||||
#[salsa::interned]
|
||||
fn intern_struct_or_union(&self, loc: crate::ItemLoc<ast::StructDef>)
|
||||
-> crate::StructOrUnionId;
|
||||
fn intern_struct_or_union(&self, loc: ItemLoc<ast::StructDef>) -> crate::StructOrUnionId;
|
||||
#[salsa::interned]
|
||||
fn intern_enum(&self, loc: crate::ItemLoc<ast::EnumDef>) -> crate::EnumId;
|
||||
fn intern_enum(&self, loc: ItemLoc<ast::EnumDef>) -> crate::EnumId;
|
||||
#[salsa::interned]
|
||||
fn intern_const(&self, loc: crate::ItemLoc<ast::ConstDef>) -> crate::ConstId;
|
||||
fn intern_const(&self, loc: ItemLoc<ast::ConstDef>) -> crate::ConstId;
|
||||
#[salsa::interned]
|
||||
fn intern_static(&self, loc: crate::ItemLoc<ast::StaticDef>) -> crate::StaticId;
|
||||
fn intern_static(&self, loc: ItemLoc<ast::StaticDef>) -> crate::StaticId;
|
||||
#[salsa::interned]
|
||||
fn intern_trait(&self, loc: crate::ItemLoc<ast::TraitDef>) -> crate::TraitId;
|
||||
fn intern_trait(&self, loc: ItemLoc<ast::TraitDef>) -> crate::TraitId;
|
||||
#[salsa::interned]
|
||||
fn intern_type_alias(&self, loc: crate::ItemLoc<ast::TypeAliasDef>) -> crate::TypeAliasId;
|
||||
fn intern_type_alias(&self, loc: ItemLoc<ast::TypeAliasDef>) -> crate::TypeAliasId;
|
||||
#[salsa::interned]
|
||||
fn intern_impl(&self, loc: ItemLoc<ast::ImplBlock>) -> crate::ImplId;
|
||||
}
|
||||
|
||||
#[salsa::query_group(DefDatabase2Storage)]
|
||||
|
|
|
@ -321,6 +321,18 @@ impl AstItemDef<ast::TypeAliasDef> for TypeAliasId {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct ImplId(salsa::InternId);
|
||||
impl_intern_key!(ImplId);
|
||||
impl AstItemDef<ast::ImplBlock> for ImplId {
|
||||
fn intern(db: &impl InternDatabase, loc: ItemLoc<ast::ImplBlock>) -> Self {
|
||||
db.intern_impl(loc)
|
||||
}
|
||||
fn lookup_intern(self, db: &impl InternDatabase) -> ItemLoc<ast::ImplBlock> {
|
||||
db.lookup_intern_impl(self)
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_froms {
|
||||
($e:ident: $($v:ident $(($($sv:ident),*))?),*) => {
|
||||
$(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue