Change ChildBySource to allow reusing DynMap

This commit is contained in:
Jonas Schievink 2021-03-05 14:06:09 +01:00 committed by Jonas Schievink
parent c45ac6effe
commit 8da50c9077
2 changed files with 18 additions and 32 deletions

View file

@ -421,8 +421,7 @@ impl HasChildSource<LocalConstParamId> for GenericDefId {
}
impl ChildBySource for GenericDefId {
fn child_by_source(&self, db: &dyn DefDatabase) -> DynMap {
let mut res = DynMap::default();
fn child_by_source_to(&self, db: &dyn DefDatabase, res: &mut DynMap) {
let (_, sm) = GenericParams::new(db, *self);
let sm = sm.as_ref();
@ -440,6 +439,5 @@ impl ChildBySource for GenericDefId {
let id = ConstParamId { parent: *self, local_id };
res[keys::CONST_PARAM].insert(sm.with_value(src.clone()), id);
}
res
}
}