Skip to content

Commit c12f7be

Browse files
jonas-schievinkJonas Schievink
authored andcommitted
Use body.block_scopes in ChildBySource
1 parent 13f4356 commit c12f7be

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/hir_def/src/child_by_source.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ impl ChildBySource for EnumId {
160160
impl ChildBySource for DefWithBodyId {
161161
fn child_by_source_to(&self, db: &dyn DefDatabase, res: &mut DynMap) {
162162
let body = db.body(*self);
163-
body.item_scope.child_by_source_to(db, res);
163+
for def_map in body.block_scopes.iter().filter_map(|block| db.block_def_map(*block)) {
164+
// All block expressions are merged into the same map, because they logically all add
165+
// inner items to the containing `DefWithBodyId`.
166+
def_map[def_map.root()].scope.child_by_source_to(db, res);
167+
}
164168
}
165169
}

0 commit comments

Comments
 (0)