mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user