diff options
Diffstat (limited to 'crates/ra_hir/src/code_model_impl')
-rw-r--r-- | crates/ra_hir/src/code_model_impl/function/scope.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/crates/ra_hir/src/code_model_impl/function/scope.rs b/crates/ra_hir/src/code_model_impl/function/scope.rs index 7e8eb7704..220c71f74 100644 --- a/crates/ra_hir/src/code_model_impl/function/scope.rs +++ b/crates/ra_hir/src/code_model_impl/function/scope.rs | |||
@@ -88,10 +88,17 @@ impl FnScopes { | |||
88 | 88 | ||
89 | fn add_bindings(&mut self, body: &Body, scope: ScopeId, pat: PatId) { | 89 | fn add_bindings(&mut self, body: &Body, scope: ScopeId, pat: PatId) { |
90 | match &body[pat] { | 90 | match &body[pat] { |
91 | Pat::Bind { name, .. } => self.scopes[scope].entries.push(ScopeEntry { | 91 | Pat::Bind { name, .. } => { |
92 | name: name.clone(), | 92 | // bind can have a subpattern, but it's actually not allowed |
93 | pat, | 93 | // to bind to things in there |
94 | }), | 94 | let entry = ScopeEntry { |
95 | name: name.clone(), | ||
96 | pat, | ||
97 | }; | ||
98 | self.scopes[scope].entries.push(entry) | ||
99 | } | ||
100 | // FIXME: isn't every call to add_binding starting an entirely new | ||
101 | // tree walk!? | ||
95 | p => p.walk_child_pats(|pat| self.add_bindings(body, scope, pat)), | 102 | p => p.walk_child_pats(|pat| self.add_bindings(body, scope, pat)), |
96 | } | 103 | } |
97 | } | 104 | } |