aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/source_binder.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r--crates/ra_hir/src/source_binder.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 9dae4c3d1..54dc27399 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -9,7 +9,7 @@ use ra_db::{FileId, FilePosition};
9use ra_syntax::{ 9use ra_syntax::{
10 SyntaxNode, 10 SyntaxNode,
11 ast::{self, AstNode, NameOwner}, 11 ast::{self, AstNode, NameOwner},
12 algo::{find_node_at_offset, find_leaf_at_offset}, 12 algo::{find_node_at_offset, find_token_at_offset},
13}; 13};
14 14
15use crate::{ 15use crate::{
@@ -155,9 +155,9 @@ pub fn trait_from_module(
155pub fn resolver_for_position(db: &impl HirDatabase, position: FilePosition) -> Resolver { 155pub fn resolver_for_position(db: &impl HirDatabase, position: FilePosition) -> Resolver {
156 let file_id = position.file_id; 156 let file_id = position.file_id;
157 let file = db.parse(file_id); 157 let file = db.parse(file_id);
158 find_leaf_at_offset(file.syntax(), position.offset) 158 find_token_at_offset(file.syntax(), position.offset)
159 .find_map(|node| { 159 .find_map(|token| {
160 node.ancestors().find_map(|node| { 160 token.parent().ancestors().find_map(|node| {
161 if ast::Expr::cast(node).is_some() || ast::Block::cast(node).is_some() { 161 if ast::Expr::cast(node).is_some() || ast::Block::cast(node).is_some() {
162 if let Some(func) = function_from_child_node(db, file_id, node) { 162 if let Some(func) = function_from_child_node(db, file_id, node) {
163 let scopes = func.scopes(db); 163 let scopes = func.scopes(db);