diff options
author | Marcus Klaas de Vries <[email protected]> | 2019-01-17 12:40:45 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-19 12:37:26 +0000 |
commit | 44e9a9605b2b3916669182ba091599d59653c497 (patch) | |
tree | 0bdeef63c2a1523ca69dda856226979f9a78f606 /crates/ra_hir/src/code_model_impl/function/scope.rs | |
parent | d48d5b8b6ca59b462b3a84dad9868daff2eddb6d (diff) |
Fixup annotated bindings
Diffstat (limited to 'crates/ra_hir/src/code_model_impl/function/scope.rs')
-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 | } |