@@ -127,9 +127,9 @@ impl<'hir> Entry<'hir> {
127127 }
128128 }
129129
130- fn is_body_owner ( self , node_id : NodeId ) -> bool {
130+ fn is_body_owner ( self , hir_id : HirId ) -> bool {
131131 match self . associated_body ( ) {
132- Some ( b) => b. node_id == node_id ,
132+ Some ( b) => b. hir_id == hir_id ,
133133 None => false ,
134134 }
135135 }
@@ -436,7 +436,7 @@ impl<'hir> Map<'hir> {
436436 }
437437
438438 pub fn body ( & self , id : BodyId ) -> & ' hir Body {
439- self . read ( id. node_id ) ;
439+ self . read_by_hir_id ( id. hir_id ) ;
440440
441441 // N.B., intentionally bypass `self.forest.krate()` so that we
442442 // do not trigger a read of the whole krate here
@@ -460,9 +460,10 @@ impl<'hir> Map<'hir> {
460460 /// Returns the `NodeId` that corresponds to the definition of
461461 /// which this is the body of, i.e., a `fn`, `const` or `static`
462462 /// item (possibly associated), a closure, or a `hir::AnonConst`.
463- pub fn body_owner ( & self , BodyId { node_id } : BodyId ) -> NodeId {
463+ pub fn body_owner ( & self , BodyId { hir_id } : BodyId ) -> NodeId {
464+ let node_id = self . hir_to_node_id ( hir_id) ;
464465 let parent = self . get_parent_node ( node_id) ;
465- assert ! ( self . map[ parent. as_usize( ) ] . map_or( false , |e| e. is_body_owner( node_id ) ) ) ;
466+ assert ! ( self . map[ parent. as_usize( ) ] . map_or( false , |e| e. is_body_owner( hir_id ) ) ) ;
466467 parent
467468 }
468469
@@ -486,6 +487,12 @@ impl<'hir> Map<'hir> {
486487 }
487488 }
488489
490+ // FIXME(@ljedrz): replace the NodeId variant
491+ pub fn maybe_body_owned_by_by_hir_id ( & self , id : HirId ) -> Option < BodyId > {
492+ let node_id = self . hir_to_node_id ( id) ;
493+ self . maybe_body_owned_by ( node_id)
494+ }
495+
489496 /// Given a body owner's id, returns the `BodyId` associated with it.
490497 pub fn body_owned_by ( & self , id : NodeId ) -> BodyId {
491498 self . maybe_body_owned_by ( id) . unwrap_or_else ( || {
@@ -519,6 +526,12 @@ impl<'hir> Map<'hir> {
519526 }
520527 }
521528
529+ // FIXME(@ljedrz): replace the NodeId variant
530+ pub fn body_owner_kind_by_hir_id ( & self , id : HirId ) -> BodyOwnerKind {
531+ let node_id = self . hir_to_node_id ( id) ;
532+ self . body_owner_kind ( node_id)
533+ }
534+
522535 pub fn ty_param_owner ( & self , id : NodeId ) -> NodeId {
523536 match self . get ( id) {
524537 Node :: Item ( & Item { node : ItemKind :: Trait ( ..) , .. } ) => id,
@@ -836,6 +849,12 @@ impl<'hir> Map<'hir> {
836849 self . local_def_id ( self . get_module_parent_node ( id) )
837850 }
838851
852+ // FIXME(@ljedrz): replace the NodeId variant
853+ pub fn get_module_parent_by_hir_id ( & self , id : HirId ) -> DefId {
854+ let node_id = self . hir_to_node_id ( id) ;
855+ self . get_module_parent ( node_id)
856+ }
857+
839858 /// Returns the `NodeId` of `id`'s nearest module parent, or `id` itself if no
840859 /// module parent is in this map.
841860 pub fn get_module_parent_node ( & self , id : NodeId ) -> NodeId {
0 commit comments