aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-03-05 13:08:36 +0000
committerJonas Schievink <[email protected]>2021-03-09 17:27:23 +0000
commitc12f7be8d33f9ddfd69f72fb75acc5b12d149527 (patch)
treebb568dc7782ff9f43a1f87f176504a28275f8f31 /crates
parent13f4356d2f05c79a01e55b1bdd91d9a2dcf9c6f2 (diff)
Use `body.block_scopes` in `ChildBySource`
Diffstat (limited to 'crates')
-rw-r--r--crates/hir_def/src/child_by_source.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/hir_def/src/child_by_source.rs b/crates/hir_def/src/child_by_source.rs
index 6dde74138..2a331dcaf 100644
--- a/crates/hir_def/src/child_by_source.rs
+++ b/crates/hir_def/src/child_by_source.rs
@@ -160,6 +160,10 @@ impl ChildBySource for EnumId {
160impl ChildBySource for DefWithBodyId { 160impl ChildBySource for DefWithBodyId {
161 fn child_by_source_to(&self, db: &dyn DefDatabase, res: &mut DynMap) { 161 fn child_by_source_to(&self, db: &dyn DefDatabase, res: &mut DynMap) {
162 let body = db.body(*self); 162 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 }
164 } 168 }
165} 169}