From 86a7ac2d31e97c42a9da8d8fd539b5a0de0fa795 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 8 Oct 2018 15:44:00 +0300 Subject: Simplify event processing --- crates/ra_editor/src/scope/fn_scope.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'crates/ra_editor/src/scope') 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 use std::collections::HashSet; let mut shadowed = HashSet::new(); - scopes.scope_chain(name_ref.syntax()) + let ret = scopes.scope_chain(name_ref.syntax()) .flat_map(|scope| scopes.entries(scope).iter()) .filter(|entry| shadowed.insert(entry.name())) .filter(|entry| entry.name() == name_ref.text()) - .nth(0) + .nth(0); + eprintln!("ret = {:?}", ret); + ret } #[cfg(test)] @@ -357,7 +359,6 @@ mod tests { let scopes = FnScopes::new(fn_def); let local_name = resolve_local_name(name_ref, &scopes).unwrap().ast().name().unwrap(); - let expected_name = find_node_at_offset::(file.syntax(), expected_offset.into()).unwrap(); assert_eq!(local_name.syntax().range(), expected_name.syntax().range()); } @@ -394,4 +395,4 @@ mod tests { }", 46); } -} \ No newline at end of file +} -- cgit v1.2.3