aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ssr/src/matching.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ssr/src/matching.rs')
-rw-r--r--crates/ra_ssr/src/matching.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_ssr/src/matching.rs b/crates/ra_ssr/src/matching.rs
index 4862622bd..0f72fea69 100644
--- a/crates/ra_ssr/src/matching.rs
+++ b/crates/ra_ssr/src/matching.rs
@@ -209,7 +209,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
209 // Some kinds of nodes have special handling. For everything else, we fall back to default 209 // Some kinds of nodes have special handling. For everything else, we fall back to default
210 // matching. 210 // matching.
211 match code.kind() { 211 match code.kind() {
212 SyntaxKind::RECORD_FIELD_LIST => { 212 SyntaxKind::RECORD_EXPR_FIELD_LIST => {
213 self.attempt_match_record_field_list(phase, pattern, code) 213 self.attempt_match_record_field_list(phase, pattern, code)
214 } 214 }
215 SyntaxKind::TOKEN_TREE => self.attempt_match_token_tree(phase, pattern, code), 215 SyntaxKind::TOKEN_TREE => self.attempt_match_token_tree(phase, pattern, code),
@@ -348,8 +348,8 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
348 // separately via comparing what the path resolves to below. 348 // separately via comparing what the path resolves to below.
349 self.attempt_match_opt( 349 self.attempt_match_opt(
350 phase, 350 phase,
351 pattern_segment.type_arg_list(), 351 pattern_segment.generic_arg_list(),
352 code_segment.type_arg_list(), 352 code_segment.generic_arg_list(),
353 )?; 353 )?;
354 self.attempt_match_opt( 354 self.attempt_match_opt(
355 phase, 355 phase,
@@ -399,7 +399,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
399 // Build a map keyed by field name. 399 // Build a map keyed by field name.
400 let mut fields_by_name = FxHashMap::default(); 400 let mut fields_by_name = FxHashMap::default();
401 for child in code.children() { 401 for child in code.children() {
402 if let Some(record) = ast::RecordField::cast(child.clone()) { 402 if let Some(record) = ast::RecordExprField::cast(child.clone()) {
403 if let Some(name) = record.field_name() { 403 if let Some(name) = record.field_name() {
404 fields_by_name.insert(name.text().clone(), child.clone()); 404 fields_by_name.insert(name.text().clone(), child.clone());
405 } 405 }
@@ -706,8 +706,8 @@ mod tests {
706 let rule: SsrRule = "foo($x) ==>> bar($x)".parse().unwrap(); 706 let rule: SsrRule = "foo($x) ==>> bar($x)".parse().unwrap();
707 let input = "fn foo() {} fn bar() {} fn main() { foo(1+2); }"; 707 let input = "fn foo() {} fn bar() {} fn main() { foo(1+2); }";
708 708
709 let (db, position) = crate::tests::single_file(input); 709 let (db, position, selections) = crate::tests::single_file(input);
710 let mut match_finder = MatchFinder::in_context(&db, position); 710 let mut match_finder = MatchFinder::in_context(&db, position, selections);
711 match_finder.add_rule(rule).unwrap(); 711 match_finder.add_rule(rule).unwrap();
712 let matches = match_finder.matches(); 712 let matches = match_finder.matches();
713 assert_eq!(matches.matches.len(), 1); 713 assert_eq!(matches.matches.len(), 1);