diff options
Diffstat (limited to 'crates/ra_editor/src/scope')
-rw-r--r-- | crates/ra_editor/src/scope/fn_scope.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ra_editor/src/scope/fn_scope.rs b/crates/ra_editor/src/scope/fn_scope.rs index a99bd1822..65d85279f 100644 --- a/crates/ra_editor/src/scope/fn_scope.rs +++ b/crates/ra_editor/src/scope/fn_scope.rs | |||
@@ -245,11 +245,13 @@ pub fn resolve_local_name<'a>(name_ref: ast::NameRef, scopes: &'a FnScopes) -> O | |||
245 | use std::collections::HashSet; | 245 | use std::collections::HashSet; |
246 | 246 | ||
247 | let mut shadowed = HashSet::new(); | 247 | let mut shadowed = HashSet::new(); |
248 | scopes.scope_chain(name_ref.syntax()) | 248 | let ret = scopes.scope_chain(name_ref.syntax()) |
249 | .flat_map(|scope| scopes.entries(scope).iter()) | 249 | .flat_map(|scope| scopes.entries(scope).iter()) |
250 | .filter(|entry| shadowed.insert(entry.name())) | 250 | .filter(|entry| shadowed.insert(entry.name())) |
251 | .filter(|entry| entry.name() == name_ref.text()) | 251 | .filter(|entry| entry.name() == name_ref.text()) |
252 | .nth(0) | 252 | .nth(0); |
253 | eprintln!("ret = {:?}", ret); | ||
254 | ret | ||
253 | } | 255 | } |
254 | 256 | ||
255 | #[cfg(test)] | 257 | #[cfg(test)] |
@@ -357,7 +359,6 @@ mod tests { | |||
357 | let scopes = FnScopes::new(fn_def); | 359 | let scopes = FnScopes::new(fn_def); |
358 | 360 | ||
359 | let local_name = resolve_local_name(name_ref, &scopes).unwrap().ast().name().unwrap(); | 361 | let local_name = resolve_local_name(name_ref, &scopes).unwrap().ast().name().unwrap(); |
360 | |||
361 | let expected_name = find_node_at_offset::<ast::Name>(file.syntax(), expected_offset.into()).unwrap(); | 362 | let expected_name = find_node_at_offset::<ast::Name>(file.syntax(), expected_offset.into()).unwrap(); |
362 | assert_eq!(local_name.syntax().range(), expected_name.syntax().range()); | 363 | assert_eq!(local_name.syntax().range(), expected_name.syntax().range()); |
363 | } | 364 | } |
@@ -394,4 +395,4 @@ mod tests { | |||
394 | }", | 395 | }", |
395 | 46); | 396 | 46); |
396 | } | 397 | } |
397 | } \ No newline at end of file | 398 | } |