save-analysis: walk path expressions

This is actually kinda hard to hit, but it fixes missing the `foo` in `for _ in foo {}`.
This commit is contained in:
Nick Cameron
2017-01-25 16:46:34 +13:00
parent 83c2d95238
commit 659859c537
@@ -1369,6 +1369,7 @@ fn visit_ty(&mut self, t: &'l ast::Ty) {
}
fn visit_expr(&mut self, ex: &'l ast::Expr) {
debug!("visit_expr {:?}", ex.node);
self.process_macro_use(ex.span, ex.id);
match ex.node {
ast::ExprKind::Call(ref _f, ref _args) => {
@@ -1462,6 +1463,7 @@ fn visit_expr(&mut self, ex: &'l ast::Expr) {
ast::ExprKind::WhileLet(ref pattern, ref subexpression, ref block, _) => {
let value = self.span.snippet(subexpression.span);
self.process_var_decl(pattern, value);
debug!("for loop, walk sub-expr: {:?}", subexpression.node);
visit::walk_expr(self, subexpression);
visit::walk_block(self, block);
}
@@ -1556,6 +1558,10 @@ fn visit_arm(&mut self, arm: &'l ast::Arm) {
self.visit_expr(&arm.body);
}
fn visit_path(&mut self, p: &'l ast::Path, id: NodeId) {
self.process_path(id, p, None);
}
fn visit_stmt(&mut self, s: &'l ast::Stmt) {
self.process_macro_use(s.span, s.id);
visit::walk_stmt(self, s)