mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-29 19:17:12 +00:00
Implement HasResolver and HasModule for FieldId
This commit is contained in:
parent
b4d4d02db8
commit
ce9da90630
2 changed files with 20 additions and 19 deletions
|
|
@ -1357,6 +1357,12 @@ impl HasModule for VariantId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl HasModule for FieldId {
|
||||||
|
fn module(&self, db: &dyn DefDatabase) -> ModuleId {
|
||||||
|
self.parent.module(db)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl HasModule for MacroId {
|
impl HasModule for MacroId {
|
||||||
fn module(&self, db: &dyn DefDatabase) -> ModuleId {
|
fn module(&self, db: &dyn DefDatabase) -> ModuleId {
|
||||||
match *self {
|
match *self {
|
||||||
|
|
@ -1380,11 +1386,7 @@ impl HasModule for TypeOwnerId {
|
||||||
TypeOwnerId::ImplId(it) => it.module(db),
|
TypeOwnerId::ImplId(it) => it.module(db),
|
||||||
TypeOwnerId::EnumVariantId(it) => it.module(db),
|
TypeOwnerId::EnumVariantId(it) => it.module(db),
|
||||||
TypeOwnerId::InTypeConstId(it) => it.lookup(db).owner.module(db),
|
TypeOwnerId::InTypeConstId(it) => it.lookup(db).owner.module(db),
|
||||||
TypeOwnerId::FieldId(it) => match it.parent {
|
TypeOwnerId::FieldId(it) => it.module(db),
|
||||||
VariantId::EnumVariantId(it) => it.module(db),
|
|
||||||
VariantId::StructId(it) => it.module(db),
|
|
||||||
VariantId::UnionId(it) => it.module(db),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,11 @@ use crate::{
|
||||||
type_ref::{LifetimeRef, TypesMap},
|
type_ref::{LifetimeRef, TypesMap},
|
||||||
visibility::{RawVisibility, Visibility},
|
visibility::{RawVisibility, Visibility},
|
||||||
AdtId, ConstId, ConstParamId, CrateRootModuleId, DefWithBodyId, EnumId, EnumVariantId,
|
AdtId, ConstId, ConstParamId, CrateRootModuleId, DefWithBodyId, EnumId, EnumVariantId,
|
||||||
ExternBlockId, ExternCrateId, FunctionId, FxIndexMap, GenericDefId, GenericParamId, HasModule,
|
ExternBlockId, ExternCrateId, FieldId, FunctionId, FxIndexMap, GenericDefId, GenericParamId,
|
||||||
ImplId, ItemContainerId, ItemTreeLoc, LifetimeParamId, LocalModuleId, Lookup, Macro2Id,
|
HasModule, ImplId, ItemContainerId, ItemTreeLoc, LifetimeParamId, LocalModuleId, Lookup,
|
||||||
MacroId, MacroRulesId, ModuleDefId, ModuleId, ProcMacroId, StaticId, StructId, TraitAliasId,
|
Macro2Id, MacroId, MacroRulesId, ModuleDefId, ModuleId, ProcMacroId, StaticId, StructId,
|
||||||
TraitId, TypeAliasId, TypeOrConstParamId, TypeOwnerId, TypeParamId, UseId, VariantId,
|
TraitAliasId, TraitId, TypeAliasId, TypeOrConstParamId, TypeOwnerId, TypeParamId, UseId,
|
||||||
|
VariantId,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|
@ -1227,11 +1228,7 @@ impl HasResolver for TypeOwnerId {
|
||||||
TypeOwnerId::TypeAliasId(it) => it.resolver(db),
|
TypeOwnerId::TypeAliasId(it) => it.resolver(db),
|
||||||
TypeOwnerId::ImplId(it) => it.resolver(db),
|
TypeOwnerId::ImplId(it) => it.resolver(db),
|
||||||
TypeOwnerId::EnumVariantId(it) => it.resolver(db),
|
TypeOwnerId::EnumVariantId(it) => it.resolver(db),
|
||||||
TypeOwnerId::FieldId(it) => match it.parent {
|
TypeOwnerId::FieldId(it) => it.resolver(db),
|
||||||
VariantId::EnumVariantId(it) => it.resolver(db),
|
|
||||||
VariantId::StructId(it) => it.resolver(db),
|
|
||||||
VariantId::UnionId(it) => it.resolver(db),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1244,11 +1241,7 @@ impl HasResolver for DefWithBodyId {
|
||||||
DefWithBodyId::StaticId(s) => s.resolver(db),
|
DefWithBodyId::StaticId(s) => s.resolver(db),
|
||||||
DefWithBodyId::VariantId(v) => v.resolver(db),
|
DefWithBodyId::VariantId(v) => v.resolver(db),
|
||||||
DefWithBodyId::InTypeConstId(c) => c.lookup(db).owner.resolver(db),
|
DefWithBodyId::InTypeConstId(c) => c.lookup(db).owner.resolver(db),
|
||||||
DefWithBodyId::FieldId(f) => match f.parent {
|
DefWithBodyId::FieldId(f) => f.resolver(db),
|
||||||
VariantId::EnumVariantId(it) => it.resolver(db),
|
|
||||||
VariantId::StructId(it) => it.resolver(db),
|
|
||||||
VariantId::UnionId(it) => it.resolver(db),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1295,6 +1288,12 @@ impl HasResolver for VariantId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl HasResolver for FieldId {
|
||||||
|
fn resolver(self, db: &dyn DefDatabase) -> Resolver {
|
||||||
|
self.parent.resolver(db)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl HasResolver for MacroId {
|
impl HasResolver for MacroId {
|
||||||
fn resolver(self, db: &dyn DefDatabase) -> Resolver {
|
fn resolver(self, db: &dyn DefDatabase) -> Resolver {
|
||||||
match self {
|
match self {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue