mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Slightly shrink DefMap
This commit is contained in:
parent
117f9b7752
commit
dc7c6d43c7
22 changed files with 130 additions and 92 deletions
|
@ -586,8 +586,9 @@ impl Resolver {
|
|||
}));
|
||||
if let Some(block) = expr_scopes.block(scope_id) {
|
||||
let def_map = db.block_def_map(block);
|
||||
let root = def_map.root();
|
||||
resolver.scopes.push(Scope::BlockScope(ModuleItemMap { def_map, module_id: root }));
|
||||
resolver
|
||||
.scopes
|
||||
.push(Scope::BlockScope(ModuleItemMap { def_map, module_id: DefMap::ROOT }));
|
||||
// FIXME: This adds as many module scopes as there are blocks, but resolving in each
|
||||
// already traverses all parents, so this is O(n²). I think we could only store the
|
||||
// innermost module scope instead?
|
||||
|
@ -753,8 +754,7 @@ fn resolver_for_scope_(
|
|||
for scope in scope_chain.into_iter().rev() {
|
||||
if let Some(block) = scopes.block(scope) {
|
||||
let def_map = db.block_def_map(block);
|
||||
let root = def_map.root();
|
||||
r = r.push_block_scope(def_map, root);
|
||||
r = r.push_block_scope(def_map, DefMap::ROOT);
|
||||
// FIXME: This adds as many module scopes as there are blocks, but resolving in each
|
||||
// already traverses all parents, so this is O(n²). I think we could only store the
|
||||
// innermost module scope instead?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue