aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/source_binder.rs22
1 files changed, 7 insertions, 15 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 649c5b684..5bb6d64ff 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -139,21 +139,13 @@ fn resolver_for_node(
139 node.ancestors() 139 node.ancestors()
140 .find_map(|node| { 140 .find_map(|node| {
141 if ast::Expr::cast(node).is_some() || ast::Block::cast(node).is_some() { 141 if ast::Expr::cast(node).is_some() || ast::Block::cast(node).is_some() {
142 if let Some(func) = node 142 let def = def_with_body_from_child_node(db, file_id, node)?;
143 .ancestors() 143 let scopes = def.scopes(db);
144 .find_map(ast::FnDef::cast) 144 let scope = match offset {
145 .and_then(|it| function_from_source(db, file_id, it)) 145 None => scopes.scope_for(&node),
146 { 146 Some(offset) => scopes.scope_for_offset(offset),
147 let scopes = func.scopes(db); 147 };
148 let scope = match offset { 148 Some(expr::resolver_for_scope(def.body(db), db, scope))
149 None => scopes.scope_for(&node),
150 Some(offset) => scopes.scope_for_offset(offset),
151 };
152 Some(expr::resolver_for_scope(func.body(db), db, scope))
153 } else {
154 // FIXME const/static/array length
155 None
156 }
157 } else { 149 } else {
158 try_get_resolver_for_node(db, file_id, node) 150 try_get_resolver_for_node(db, file_id, node)
159 } 151 }