diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-02 16:51:39 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-02 16:51:39 +0100 |
commit | 248ee0c3fe333f9180f8c9d9dfd4efcc6886b5bc (patch) | |
tree | f94bb3a8bd47e3612ef29e815532c07d7871fa0f /crates/ra_editor/src/scope | |
parent | 7ffc114dab6d1e25ead195a5937cd4f9ca51ef2c (diff) | |
parent | 1a2a8dec14ec04ea8eeccae99fd885e7a280e45b (diff) |
Merge #90
90: Inherent traversal r=matklad a=matklad
bors r+
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_editor/src/scope')
-rw-r--r-- | crates/ra_editor/src/scope/fn_scope.rs | 6 |
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::{ | |||
6 | use ra_syntax::{ | 6 | use 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 | ||
12 | type ScopeId = usize; | 12 | type 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 | } |