diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-15 22:36:10 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-15 22:36:10 +0000 |
commit | 69f3b01dc5dd70d9bdf6de4d859ad593a689395d (patch) | |
tree | c847ded853cea83c2f64c6ffc20d1ad4138613fb /crates/ra_ide_api/src/references.rs | |
parent | ad10c4b8e2d81af7fc35a466cd434e2c3952bfd8 (diff) | |
parent | 06984ed1164d7607f89f9a6f4893dd05ec058a99 (diff) |
Merge #2268
2268: Handle ast::MacroCall in classify_name and impl FromSource for MacroDef r=matklad a=kjeremy
Fixes #2260
Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/references.rs')
-rw-r--r-- | crates/ra_ide_api/src/references.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs index 9cb9433e7..faa88d988 100644 --- a/crates/ra_ide_api/src/references.rs +++ b/crates/ra_ide_api/src/references.rs | |||
@@ -369,6 +369,21 @@ mod tests { | |||
369 | assert_eq!(refs.len(), 2); | 369 | assert_eq!(refs.len(), 2); |
370 | } | 370 | } |
371 | 371 | ||
372 | #[test] | ||
373 | fn test_find_all_refs_macro_def() { | ||
374 | let code = r#" | ||
375 | #[macro_export] | ||
376 | macro_rules! m1<|> { () => (()) } | ||
377 | |||
378 | fn foo() { | ||
379 | m1(); | ||
380 | m1(); | ||
381 | }"#; | ||
382 | |||
383 | let refs = get_all_refs(code); | ||
384 | assert_eq!(refs.len(), 3); | ||
385 | } | ||
386 | |||
372 | fn get_all_refs(text: &str) -> ReferenceSearchResult { | 387 | fn get_all_refs(text: &str) -> ReferenceSearchResult { |
373 | let (analysis, position) = single_file_with_position(text); | 388 | let (analysis, position) = single_file_with_position(text); |
374 | analysis.find_all_refs(position, None).unwrap().unwrap() | 389 | analysis.find_all_refs(position, None).unwrap().unwrap() |