use crate::hir::map;
use crate::hir::{Expr, FnDecl, Node};
use crate::hir::intravisit::FnKind;
-use syntax::ast::{Attribute, Ident, NodeId};
+use syntax::ast::{Attribute, Ident};
use syntax_pos::Span;
/// An FnLikeNode is a Node that is like a fn, in that it has a decl
}
/// Attempts to construct a Code from presumed FnLike or Expr node input.
- pub fn from_node(map: &map::Map<'a>, id: NodeId) -> Option<Code<'a>> {
- match map.get(id) {
+ pub fn from_node(map: &map::Map<'a>, id: ast::HirId) -> Option<Code<'a>> {
+ match map.get_by_hir_id(id) {
map::Node::Block(_) => {
// Use the parent, hopefully an expression node.
- Code::from_node(map, map.get_parent_node(id))
+ Code::from_node(map, map.get_parent_node_by_hir_id(id))
}
map::Node::Expr(expr) => Some(Code::Expr(expr)),
node => FnLikeNode::from_node(node).map(Code::FnLike)
tcx.sess.fatal(&format!("--pretty flowgraph couldn't find id: {}", nodeid))
});
- match blocks::Code::from_node(&tcx.hir(), nodeid) {
+ let hir_id = tcx.hir().node_to_hir_id(nodeid);
+ match blocks::Code::from_node(&tcx.hir(), hir_id) {
Some(code) => {
let variants = gather_flowgraph_variants(tcx.sess);