aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/references.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/references.rs')
-rw-r--r--crates/ra_ide_api/src/references.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs
index 20bbf11a3..3e30e047c 100644
--- a/crates/ra_ide_api/src/references.rs
+++ b/crates/ra_ide_api/src/references.rs
@@ -1,5 +1,5 @@
1use relative_path::{RelativePath, RelativePathBuf}; 1use relative_path::{RelativePath, RelativePathBuf};
2use hir::{ModuleSource, source_binder}; 2use hir::{ModuleSource, source_binder, Either};
3use ra_db::{SourceDatabase}; 3use ra_db::{SourceDatabase};
4use ra_syntax::{ 4use ra_syntax::{
5 AstNode, SyntaxNode, SourceFile, 5 AstNode, SyntaxNode, SourceFile,
@@ -89,9 +89,12 @@ pub(crate) fn find_all_refs(
89 source_binder::function_from_child_node(db, position.file_id, name_ref.syntax())?; 89 source_binder::function_from_child_node(db, position.file_id, name_ref.syntax())?;
90 let scope = descr.scopes(db); 90 let scope = descr.scopes(db);
91 let resolved = scope.resolve_local_name(name_ref)?; 91 let resolved = scope.resolve_local_name(name_ref)?;
92 let resolved = resolved.ptr().to_node(source_file); 92 if let Either::A(ptr) = resolved.ptr() {
93 let binding = find_node_at_offset::<ast::BindPat>(syntax, resolved.range().end())?; 93 if let ast::PatKind::BindPat(binding) = ptr.to_node(source_file).kind() {
94 Some((binding, descr)) 94 return Some((binding, descr));
95 }
96 }
97 None
95 } 98 }
96} 99}
97 100