move walk_expr outside of every match branch
This commit is contained in:
parent
ca9ff83f1b
commit
4bb7a122bb
1 changed files with 2 additions and 8 deletions
|
@ -405,7 +405,6 @@ impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {
|
||||||
if let Res::Local(_var_hir_id) = path.res {
|
if let Res::Local(_var_hir_id) = path.res {
|
||||||
self.add_live_node_for_node(expr.hir_id, ExprNode(expr.span, expr.hir_id));
|
self.add_live_node_for_node(expr.hir_id, ExprNode(expr.span, expr.hir_id));
|
||||||
}
|
}
|
||||||
intravisit::walk_expr(self, expr);
|
|
||||||
}
|
}
|
||||||
hir::ExprKind::Closure(closure) => {
|
hir::ExprKind::Closure(closure) => {
|
||||||
// Interesting control flow (for loops can contain labeled
|
// Interesting control flow (for loops can contain labeled
|
||||||
|
@ -425,12 +424,10 @@ impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
self.set_captures(expr.hir_id, call_caps);
|
self.set_captures(expr.hir_id, call_caps);
|
||||||
intravisit::walk_expr(self, expr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hir::ExprKind::Let(let_expr) => {
|
hir::ExprKind::Let(let_expr) => {
|
||||||
self.add_from_pat(let_expr.pat);
|
self.add_from_pat(let_expr.pat);
|
||||||
intravisit::walk_expr(self, expr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// live nodes required for interesting control flow:
|
// live nodes required for interesting control flow:
|
||||||
|
@ -439,11 +436,9 @@ impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {
|
||||||
| hir::ExprKind::Loop(..)
|
| hir::ExprKind::Loop(..)
|
||||||
| hir::ExprKind::Yield(..) => {
|
| hir::ExprKind::Yield(..) => {
|
||||||
self.add_live_node_for_node(expr.hir_id, ExprNode(expr.span, expr.hir_id));
|
self.add_live_node_for_node(expr.hir_id, ExprNode(expr.span, expr.hir_id));
|
||||||
intravisit::walk_expr(self, expr);
|
|
||||||
}
|
}
|
||||||
hir::ExprKind::Binary(op, ..) if op.node.is_lazy() => {
|
hir::ExprKind::Binary(op, ..) if op.node.is_lazy() => {
|
||||||
self.add_live_node_for_node(expr.hir_id, ExprNode(expr.span, expr.hir_id));
|
self.add_live_node_for_node(expr.hir_id, ExprNode(expr.span, expr.hir_id));
|
||||||
intravisit::walk_expr(self, expr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise, live nodes are not required:
|
// otherwise, live nodes are not required:
|
||||||
|
@ -474,12 +469,11 @@ impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {
|
||||||
| hir::ExprKind::Type(..)
|
| hir::ExprKind::Type(..)
|
||||||
| hir::ExprKind::Err(_)
|
| hir::ExprKind::Err(_)
|
||||||
| hir::ExprKind::Path(hir::QPath::TypeRelative(..))
|
| hir::ExprKind::Path(hir::QPath::TypeRelative(..))
|
||||||
| hir::ExprKind::Path(hir::QPath::LangItem(..)) => {
|
| hir::ExprKind::Path(hir::QPath::LangItem(..)) => {}
|
||||||
|
}
|
||||||
intravisit::walk_expr(self, expr);
|
intravisit::walk_expr(self, expr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ______________________________________________________________________
|
// ______________________________________________________________________
|
||||||
// Computing liveness sets
|
// Computing liveness sets
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue