Make save-analysis work for `if let` etc.
This commit is contained in:
parent
08f3752270
commit
ce80094632
|
@ -1132,12 +1132,20 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
|
||||||
// walk the body
|
// walk the body
|
||||||
self.nest(ex.id, |v| v.visit_block(&**body));
|
self.nest(ex.id, |v| v.visit_block(&**body));
|
||||||
}
|
}
|
||||||
ast::ExprForLoop(ref pattern, ref subexpression, ref block, _) => {
|
ast::ExprForLoop(ref pattern, ref subexpression, ref block, _) |
|
||||||
|
ast::ExprWhileLet(ref pattern, ref subexpression, ref block, _) => {
|
||||||
let value = self.span.snippet(mk_sp(ex.span.lo, subexpression.span.hi));
|
let value = self.span.snippet(mk_sp(ex.span.lo, subexpression.span.hi));
|
||||||
self.process_var_decl(pattern, value);
|
self.process_var_decl(pattern, value);
|
||||||
visit::walk_expr(self, subexpression);
|
visit::walk_expr(self, subexpression);
|
||||||
visit::walk_block(self, block);
|
visit::walk_block(self, block);
|
||||||
}
|
}
|
||||||
|
ast::ExprIfLet(ref pattern, ref subexpression, ref block, ref opt_else) => {
|
||||||
|
let value = self.span.snippet(mk_sp(ex.span.lo, subexpression.span.hi));
|
||||||
|
self.process_var_decl(pattern, value);
|
||||||
|
visit::walk_expr(self, subexpression);
|
||||||
|
visit::walk_block(self, block);
|
||||||
|
opt_else.as_ref().map(|el| visit::walk_expr(self, el));
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
visit::walk_expr(self, ex)
|
visit::walk_expr(self, ex)
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,8 +339,27 @@ fn main() { // foo
|
||||||
if let SomeEnum::Strings(..) = s7 {
|
if let SomeEnum::Strings(..) = s7 {
|
||||||
println!("hello!");
|
println!("hello!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for i in 0..5 {
|
||||||
|
foo_foo(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(x) = None {
|
||||||
|
foo_foo(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
if false {
|
||||||
|
} else if let Some(y) = None {
|
||||||
|
foo_foo(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
while let Some(z) = None {
|
||||||
|
foo_foo(z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn foo_foo(_: i32) {}
|
||||||
|
|
||||||
impl Iterator for nofields {
|
impl Iterator for nofields {
|
||||||
type Item = (usize, usize);
|
type Item = (usize, usize);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue