Derive block attributes from block item tree

This commit is contained in:
Lukas Wirth 2023-08-10 18:52:27 +02:00
parent 05b0612051
commit e5b23e3bc1
8 changed files with 41 additions and 27 deletions

View file

@ -431,12 +431,10 @@ impl AttrsWithOwner {
.item_tree(db)
.raw_attrs(AttrOwner::ModItem(definition_tree_id.value.into()))
.clone(),
ModuleOrigin::BlockExpr { block } => RawAttrs::from_attrs_owner(
db.upcast(),
InFile::new(block.file_id, block.to_node(db.upcast()))
.as_ref()
.map(|it| it as &dyn ast::HasAttrs),
),
ModuleOrigin::BlockExpr { id, block } => {
let tree = db.block_item_tree_query(id);
tree.raw_attrs(AttrOwner::TopLevel).clone()
}
}
}
AttrDefId::FieldId(it) => {