Switch to the new location for impls

This commit is contained in:
Aleksey Kladov 2019-12-12 14:09:13 +01:00
parent b0739d5a26
commit 7b0644d81e
16 changed files with 69 additions and 32 deletions

View file

@ -107,8 +107,10 @@ impl FromSource for MacroDef {
impl FromSource for ImplBlock {
type Ast = ast::ImplBlock;
fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
let id = from_source(db, src)?;
Some(ImplBlock { id })
// XXX: use `.parent()` to avoid finding ourselves
let parent = src.value.syntax().parent()?;
let container = Container::find(db, src.with_value(parent).as_ref())?;
container.child_by_source(db)[keys::IMPL].get(&src).copied().map(ImplBlock::from)
}
}