@@ -572,15 +572,12 @@ impl Resolver {
572572 scope_id,
573573 } ) ) ;
574574 if let Some ( block) = expr_scopes. block ( scope_id) {
575- if let Some ( def_map) = db. block_def_map ( block) {
576- let root = def_map. root ( ) ;
577- resolver
578- . scopes
579- . push ( Scope :: BlockScope ( ModuleItemMap { def_map, module_id : root } ) ) ;
580- // FIXME: This adds as many module scopes as there are blocks, but resolving in each
581- // already traverses all parents, so this is O(n²). I think we could only store the
582- // innermost module scope instead?
583- }
575+ let def_map = db. block_def_map ( block) ;
576+ let root = def_map. root ( ) ;
577+ resolver. scopes . push ( Scope :: BlockScope ( ModuleItemMap { def_map, module_id : root } ) ) ;
578+ // FIXME: This adds as many module scopes as there are blocks, but resolving in each
579+ // already traverses all parents, so this is O(n²). I think we could only store the
580+ // innermost module scope instead?
584581 }
585582 }
586583
@@ -741,13 +738,12 @@ fn resolver_for_scope_(
741738
742739 for scope in scope_chain. into_iter ( ) . rev ( ) {
743740 if let Some ( block) = scopes. block ( scope) {
744- if let Some ( def_map) = db. block_def_map ( block) {
745- let root = def_map. root ( ) ;
746- r = r. push_block_scope ( def_map, root) ;
747- // FIXME: This adds as many module scopes as there are blocks, but resolving in each
748- // already traverses all parents, so this is O(n²). I think we could only store the
749- // innermost module scope instead?
750- }
741+ let def_map = db. block_def_map ( block) ;
742+ let root = def_map. root ( ) ;
743+ r = r. push_block_scope ( def_map, root) ;
744+ // FIXME: This adds as many module scopes as there are blocks, but resolving in each
745+ // already traverses all parents, so this is O(n²). I think we could only store the
746+ // innermost module scope instead?
751747 }
752748
753749 r = r. push_expr_scope ( owner, Arc :: clone ( & scopes) , scope) ;
0 commit comments