Refactor the HIR so that items are stored in a map in the `Crate`,
rather being stored inline. Refactor (and rename) the visitor so that (by default) it only visits the interior content of an item not nested items. This is a [breaking-change] for anyone who uses the HIR visitor. Besides changing `visit::` to `intravisit::`, you need to refactor your visitor in one of two ways, depending on what it requires: 1. If you just want to visit all items (most common), you should call `krate.visit_all_items(&mut visitor)`. 2. If you need to visit nested items in the middle of the parent items, you should override `visit_nested_item` with something like: `self.visit_item(self.tcx.map.expect_item(item.id))`, presuming you have access to a tcx (or at least a HIR map).
Showing
想要评论请 注册 或 登录