save-analysis: fix issue with sub-exprs in for loops

Fixes https://github.com/nrc/rls-analysis/issues/78
This commit is contained in:
Nick Cameron 2017-11-02 14:35:39 +13:00
parent 20c64e8155
commit 5d3be12a4d

View File

@ -1415,15 +1415,15 @@ fn visit_expr(&mut self, ex: &'l ast::Expr) {
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);
self.visit_expr(subexpression);
visit::walk_block(self, block);
}
ast::ExprKind::IfLet(ref pattern, ref subexpression, ref block, ref opt_else) => {
let value = self.span.snippet(subexpression.span);
self.process_var_decl(pattern, value);
visit::walk_expr(self, subexpression);
self.visit_expr(subexpression);
visit::walk_block(self, block);
opt_else.as_ref().map(|el| visit::walk_expr(self, el));
opt_else.as_ref().map(|el| self.visit_expr(el));
}
ast::ExprKind::Repeat(ref element, ref count) => {
self.visit_expr(element);