This commit is contained in:
Aleksey Kladov 2020-02-29 18:34:34 +01:00
parent 28332d9b63
commit 14ea21617a
2 changed files with 4 additions and 5 deletions

View file

@ -778,8 +778,7 @@ impl GenericDef {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct Local { pub struct Local {
// TODO: ID, pub(crate) parent: DefWithBodyId,
pub(crate) parent: DefWithBody,
pub(crate) pat_id: PatId, pub(crate) pat_id: PatId,
} }
@ -808,11 +807,11 @@ impl Local {
} }
pub fn parent(self, _db: &impl HirDatabase) -> DefWithBody { pub fn parent(self, _db: &impl HirDatabase) -> DefWithBody {
self.parent self.parent.into()
} }
pub fn module(self, db: &impl HirDatabase) -> Module { pub fn module(self, db: &impl HirDatabase) -> Module {
self.parent.module(db) self.parent(db).module(db)
} }
pub fn ty(self, db: &impl HirDatabase) -> Type { pub fn ty(self, db: &impl HirDatabase) -> Type {

View file

@ -225,6 +225,6 @@ impl From<AssocItem> for GenericDefId {
impl From<(DefWithBodyId, PatId)> for Local { impl From<(DefWithBodyId, PatId)> for Local {
fn from((parent, pat_id): (DefWithBodyId, PatId)) -> Self { fn from((parent, pat_id): (DefWithBodyId, PatId)) -> Self {
Local { parent: parent.into(), pat_id } Local { parent, pat_id }
} }
} }