33mod lower;
44mod pretty;
55pub mod scope;
6+
67#[ cfg( test) ]
78mod tests;
89
@@ -92,11 +93,9 @@ pub struct Body {
9293 binding_hygiene : FxHashMap < BindingId , HygieneId > ,
9394 /// A map from an variable usages to their hygiene ID.
9495 ///
95- /// Expressions that can be recorded here are single segment path, although not all single segments path refer
96+ /// Expressions (and destructuing patterns) that can be recorded here are single segment path, although not all single segments path refer
9697 /// to variables and have hygiene (some refer to items, we don't know at this stage).
97- expr_hygiene : FxHashMap < ExprId , HygieneId > ,
98- /// A map from a destructuring assignment possible variable usages to their hygiene ID.
99- pat_hygiene : FxHashMap < PatId , HygieneId > ,
98+ ident_hygiene : FxHashMap < ExprOrPatId , HygieneId > ,
10099}
101100
102101pub type ExprPtr = AstPtr < ast:: Expr > ;
@@ -317,8 +316,7 @@ impl Body {
317316 bindings,
318317 binding_owners,
319318 binding_hygiene,
320- expr_hygiene,
321- pat_hygiene,
319+ ident_hygiene,
322320 types,
323321 } = self ;
324322 block_scopes. shrink_to_fit ( ) ;
@@ -328,8 +326,7 @@ impl Body {
328326 bindings. shrink_to_fit ( ) ;
329327 binding_owners. shrink_to_fit ( ) ;
330328 binding_hygiene. shrink_to_fit ( ) ;
331- expr_hygiene. shrink_to_fit ( ) ;
332- pat_hygiene. shrink_to_fit ( ) ;
329+ ident_hygiene. shrink_to_fit ( ) ;
333330 types. shrink_to_fit ( ) ;
334331 }
335332
@@ -658,11 +655,11 @@ impl Body {
658655 }
659656
660657 pub fn expr_path_hygiene ( & self , expr : ExprId ) -> HygieneId {
661- self . expr_hygiene . get ( & expr) . copied ( ) . unwrap_or ( HygieneId :: ROOT )
658+ self . ident_hygiene . get ( & expr. into ( ) ) . copied ( ) . unwrap_or ( HygieneId :: ROOT )
662659 }
663660
664661 pub fn pat_path_hygiene ( & self , pat : PatId ) -> HygieneId {
665- self . pat_hygiene . get ( & pat) . copied ( ) . unwrap_or ( HygieneId :: ROOT )
662+ self . ident_hygiene . get ( & pat. into ( ) ) . copied ( ) . unwrap_or ( HygieneId :: ROOT )
666663 }
667664
668665 pub fn expr_or_pat_path_hygiene ( & self , id : ExprOrPatId ) -> HygieneId {
@@ -686,8 +683,7 @@ impl Default for Body {
686683 binding_owners : Default :: default ( ) ,
687684 self_param : Default :: default ( ) ,
688685 binding_hygiene : Default :: default ( ) ,
689- expr_hygiene : Default :: default ( ) ,
690- pat_hygiene : Default :: default ( ) ,
686+ ident_hygiene : Default :: default ( ) ,
691687 types : Default :: default ( ) ,
692688 }
693689 }
0 commit comments