aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_editor/src/scope
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_editor/src/scope')
-rw-r--r--crates/ra_editor/src/scope/fn_scope.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_editor/src/scope/fn_scope.rs b/crates/ra_editor/src/scope/fn_scope.rs
index 3ae5276a2..eddd87495 100644
--- a/crates/ra_editor/src/scope/fn_scope.rs
+++ b/crates/ra_editor/src/scope/fn_scope.rs
@@ -6,7 +6,7 @@ use std::{
6use ra_syntax::{ 6use ra_syntax::{
7 SyntaxNodeRef, SyntaxNode, SmolStr, AstNode, 7 SyntaxNodeRef, SyntaxNode, SmolStr, AstNode,
8 ast::{self, NameOwner, LoopBodyOwner, ArgListOwner}, 8 ast::{self, NameOwner, LoopBodyOwner, ArgListOwner},
9 algo::{ancestors, generate, walk::preorder} 9 algo::{generate}
10}; 10};
11 11
12type ScopeId = usize; 12type ScopeId = usize;
@@ -51,7 +51,7 @@ impl FnScopes {
51 res 51 res
52 } 52 }
53 fn add_bindings(&mut self, scope: ScopeId, pat: ast::Pat) { 53 fn add_bindings(&mut self, scope: ScopeId, pat: ast::Pat) {
54 let entries = preorder(pat.syntax()) 54 let entries = pat.syntax().descendants()
55 .filter_map(ast::BindPat::cast) 55 .filter_map(ast::BindPat::cast)
56 .filter_map(ScopeEntry::new); 56 .filter_map(ScopeEntry::new);
57 self.scopes[scope].entries.extend(entries); 57 self.scopes[scope].entries.extend(entries);
@@ -66,7 +66,7 @@ impl FnScopes {
66 self.scope_for.insert(node.owned(), scope); 66 self.scope_for.insert(node.owned(), scope);
67 } 67 }
68 fn scope_for(&self, node: SyntaxNodeRef) -> Option<ScopeId> { 68 fn scope_for(&self, node: SyntaxNodeRef) -> Option<ScopeId> {
69 ancestors(node) 69 node.ancestors()
70 .filter_map(|it| self.scope_for.get(&it.owned()).map(|&scope| scope)) 70 .filter_map(|it| self.scope_for.get(&it.owned()).map(|&scope| scope))
71 .next() 71 .next()
72 } 72 }