1
1
//! Name resolution for expressions.
2
2
use hir_expand:: name:: Name ;
3
- use la_arena:: { Arena , Idx , IdxRange , RawIdx } ;
4
- use rustc_hash:: FxHashMap ;
3
+ use la_arena:: { Arena , ArenaMap , Idx , IdxRange , RawIdx } ;
5
4
use triomphe:: Arc ;
6
5
7
6
use crate :: {
@@ -17,7 +16,7 @@ pub type ScopeId = Idx<ScopeData>;
17
16
pub struct ExprScopes {
18
17
scopes : Arena < ScopeData > ,
19
18
scope_entries : Arena < ScopeEntry > ,
20
- scope_by_expr : FxHashMap < ExprId , ScopeId > ,
19
+ scope_by_expr : ArenaMap < ExprId , ScopeId > ,
21
20
}
22
21
23
22
#[ derive( Debug , PartialEq , Eq ) ]
@@ -77,10 +76,10 @@ impl ExprScopes {
77
76
}
78
77
79
78
pub fn scope_for ( & self , expr : ExprId ) -> Option < ScopeId > {
80
- self . scope_by_expr . get ( & expr) . copied ( )
79
+ self . scope_by_expr . get ( expr) . copied ( )
81
80
}
82
81
83
- pub fn scope_by_expr ( & self ) -> & FxHashMap < ExprId , ScopeId > {
82
+ pub fn scope_by_expr ( & self ) -> & ArenaMap < ExprId , ScopeId > {
84
83
& self . scope_by_expr
85
84
}
86
85
}
@@ -94,7 +93,7 @@ impl ExprScopes {
94
93
let mut scopes = ExprScopes {
95
94
scopes : Arena :: default ( ) ,
96
95
scope_entries : Arena :: default ( ) ,
97
- scope_by_expr : FxHashMap :: default ( ) ,
96
+ scope_by_expr : ArenaMap :: with_capacity ( body . exprs . len ( ) ) ,
98
97
} ;
99
98
let mut root = scopes. root_scope ( ) ;
100
99
scopes. add_params_bindings ( body, root, & body. params ) ;
0 commit comments