diff options
author | David Lattimore <[email protected]> | 2020-06-22 09:15:51 +0100 |
---|---|---|
committer | David Lattimore <[email protected]> | 2020-06-22 22:42:34 +0100 |
commit | 467af611fb5b1add25b36a2127b172240bc141cf (patch) | |
tree | 099d64f5095a74fd118266f0f96efa31412910d4 /crates/ra_ssr/src/lib.rs | |
parent | d8842e89e9053b62c081d2995cbf43b8fd5c51b2 (diff) |
SSR: Allow matching of whole macro calls
Matching within macro calls is to come later and matching of macro calls within macro calls later still.
Diffstat (limited to 'crates/ra_ssr/src/lib.rs')
-rw-r--r-- | crates/ra_ssr/src/lib.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/crates/ra_ssr/src/lib.rs b/crates/ra_ssr/src/lib.rs index fc716ae82..da26ee669 100644 --- a/crates/ra_ssr/src/lib.rs +++ b/crates/ra_ssr/src/lib.rs | |||
@@ -91,14 +91,16 @@ impl<'db> MatchFinder<'db> { | |||
91 | if let Ok(mut m) = matching::get_match(false, rule, &code, restrict_range, &self.sema) { | 91 | if let Ok(mut m) = matching::get_match(false, rule, &code, restrict_range, &self.sema) { |
92 | // Continue searching in each of our placeholders. | 92 | // Continue searching in each of our placeholders. |
93 | for placeholder_value in m.placeholder_values.values_mut() { | 93 | for placeholder_value in m.placeholder_values.values_mut() { |
94 | // Don't search our placeholder if it's the entire matched node, otherwise we'd | 94 | if let Some(placeholder_node) = &placeholder_value.node { |
95 | // find the same match over and over until we got a stack overflow. | 95 | // Don't search our placeholder if it's the entire matched node, otherwise we'd |
96 | if placeholder_value.node != *code { | 96 | // find the same match over and over until we got a stack overflow. |
97 | self.find_matches( | 97 | if placeholder_node != code { |
98 | &placeholder_value.node, | 98 | self.find_matches( |
99 | restrict_range, | 99 | placeholder_node, |
100 | &mut placeholder_value.inner_matches, | 100 | restrict_range, |
101 | ); | 101 | &mut placeholder_value.inner_matches, |
102 | ); | ||
103 | } | ||
102 | } | 104 | } |
103 | } | 105 | } |
104 | matches_out.matches.push(m); | 106 | matches_out.matches.push(m); |