diff options
author | David Lattimore <[email protected]> | 2020-08-01 08:41:42 +0100 |
---|---|---|
committer | David Lattimore <[email protected]> | 2020-08-01 08:41:42 +0100 |
commit | 6bbeffc8c56893548f5667844f59ce5a76f9fd98 (patch) | |
tree | 446162072916f99a3c9b4c5e1734fbcc56cbd3f1 /crates/ra_ssr/src/lib.rs | |
parent | 5af32aeb2b83c7ae8adf3e088bf4f3691aa45eb1 (diff) |
SSR: Allow `self` in patterns.
It's now consistent with other variables in that if the pattern
references self, only the `self` in scope where the rule is invoked will
be accepted. Since `self` doesn't work the same as other paths, this is
implemented by restricting the search to just the current function.
Prior to this change (since path resolution was implemented), having
self in a pattern would just result in no matches.
Diffstat (limited to 'crates/ra_ssr/src/lib.rs')
-rw-r--r-- | crates/ra_ssr/src/lib.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/crates/ra_ssr/src/lib.rs b/crates/ra_ssr/src/lib.rs index 73abfecb2..c780b460a 100644 --- a/crates/ra_ssr/src/lib.rs +++ b/crates/ra_ssr/src/lib.rs | |||
@@ -66,12 +66,7 @@ impl<'db> MatchFinder<'db> { | |||
66 | restrict_ranges.retain(|range| !range.range.is_empty()); | 66 | restrict_ranges.retain(|range| !range.range.is_empty()); |
67 | let sema = Semantics::new(db); | 67 | let sema = Semantics::new(db); |
68 | let resolution_scope = resolving::ResolutionScope::new(&sema, lookup_context); | 68 | let resolution_scope = resolving::ResolutionScope::new(&sema, lookup_context); |
69 | MatchFinder { | 69 | MatchFinder { sema, rules: Vec::new(), resolution_scope, restrict_ranges } |
70 | sema: Semantics::new(db), | ||
71 | rules: Vec::new(), | ||
72 | resolution_scope, | ||
73 | restrict_ranges, | ||
74 | } | ||
75 | } | 70 | } |
76 | 71 | ||
77 | /// Constructs an instance using the start of the first file in `db` as the lookup context. | 72 | /// Constructs an instance using the start of the first file in `db` as the lookup context. |