@@ -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 }
@@ -438,7 +438,7 @@ impl<'hir> Map<'hir> {
438438 }
439439
440440 pub fn body ( & self , id : BodyId ) -> & ' hir Body {
441- self . read ( id. node_id ) ;
441+ self . read_by_hir_id ( id. hir_id ) ;
442442
443443 // N.B., intentionally bypass `self.forest.krate()` so that we
444444 // do not trigger a read of the whole krate here
@@ -462,9 +462,10 @@ impl<'hir> Map<'hir> {
462462 /// Returns the `NodeId` that corresponds to the definition of
463463 /// which this is the body of, i.e., a `fn`, `const` or `static`
464464 /// item (possibly associated), a closure, or a `hir::AnonConst`.
465- pub fn body_owner ( & self , BodyId { node_id } : BodyId ) -> NodeId {
465+ pub fn body_owner ( & self , BodyId { hir_id } : BodyId ) -> NodeId {
466+ let node_id = self . hir_to_node_id ( hir_id) ;
466467 let parent = self . get_parent_node ( node_id) ;
467- assert ! ( self . map[ parent. as_usize( ) ] . map_or( false , |e| e. is_body_owner( node_id ) ) ) ;
468+ assert ! ( self . map[ parent. as_usize( ) ] . map_or( false , |e| e. is_body_owner( hir_id ) ) ) ;
468469 parent
469470 }
470471
@@ -488,6 +489,12 @@ impl<'hir> Map<'hir> {
488489 }
489490 }
490491
492+ // FIXME(@ljedrz): replace the NodeId variant
493+ pub fn maybe_body_owned_by_by_hir_id ( & self , id : HirId ) -> Option < BodyId > {
494+ let node_id = self . hir_to_node_id ( id) ;
495+ self . maybe_body_owned_by ( node_id)
496+ }
497+
491498 /// Given a body owner's id, returns the `BodyId` associated with it.
492499 pub fn body_owned_by ( & self , id : NodeId ) -> BodyId {
493500 self . maybe_body_owned_by ( id) . unwrap_or_else ( || {
@@ -521,6 +528,12 @@ impl<'hir> Map<'hir> {
521528 }
522529 }
523530
531+ // FIXME(@ljedrz): replace the NodeId variant
532+ pub fn body_owner_kind_by_hir_id ( & self , id : HirId ) -> BodyOwnerKind {
533+ let node_id = self . hir_to_node_id ( id) ;
534+ self . body_owner_kind ( node_id)
535+ }
536+
524537 pub fn ty_param_owner ( & self , id : NodeId ) -> NodeId {
525538 match self . get ( id) {
526539 Node :: Item ( & Item { node : ItemKind :: Trait ( ..) , .. } ) => id,
@@ -837,6 +850,12 @@ impl<'hir> Map<'hir> {
837850 self . local_def_id ( self . get_module_parent_node ( id) )
838851 }
839852
853+ // FIXME(@ljedrz): replace the NodeId variant
854+ pub fn get_module_parent_by_hir_id ( & self , id : HirId ) -> DefId {
855+ let node_id = self . hir_to_node_id ( id) ;
856+ self . get_module_parent ( node_id)
857+ }
858+
840859 /// Returns the `NodeId` of `id`'s nearest module parent, or `id` itself if no
841860 /// module parent is in this map.
842861 pub fn get_module_parent_node ( & self , id : NodeId ) -> NodeId {
0 commit comments