Filter out macro calls by file id in when building DynMap

This commit is contained in:
Lukas Wirth 2022-01-07 21:31:08 +01:00
parent 41a0e95d61
commit 0c9268c1ee

View File

@ -114,15 +114,23 @@ fn child_by_source_to(&self, db: &dyn DefDatabase, res: &mut DynMap, file_id: Hi
}
});
self.unnamed_consts().for_each(|konst| {
let src = konst.lookup(db).source(db);
let loc = konst.lookup(db);
if loc.id.file_id() == file_id {
let src = loc.source(db);
res[keys::CONST].insert(src, konst);
}
});
self.impls().for_each(|imp| add_impl(db, file_id, res, imp));
self.attr_macro_invocs().for_each(|(ast_id, call_id)| {
if ast_id.file_id == file_id {
let item = ast_id.with_value(ast_id.to_node(db.upcast()));
res[keys::ATTR_MACRO_CALL].insert(item, call_id);
}
});
self.derive_macro_invocs().for_each(|(ast_id, calls)| {
if ast_id.file_id != file_id {
return;
}
let adt = ast_id.to_node(db.upcast());
for (attr_id, calls) in calls {
if let Some(Either::Right(attr)) =