diff options
Diffstat (limited to 'crates/hir_expand/src/lib.rs')
-rw-r--r-- | crates/hir_expand/src/lib.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs index 3edcadf0d..1a9428514 100644 --- a/crates/hir_expand/src/lib.rs +++ b/crates/hir_expand/src/lib.rs | |||
@@ -457,17 +457,15 @@ impl<'a> InFile<&'a SyntaxNode> { | |||
457 | return FileRange { file_id: range.file_id.original_file(db), range: range.value }; | 457 | return FileRange { file_id: range.file_id.original_file(db), range: range.value }; |
458 | } | 458 | } |
459 | 459 | ||
460 | // Fall back to whole macro call | 460 | // Fall back to whole macro call. |
461 | if let Some(expansion) = self.file_id.expansion_info(db) { | 461 | let mut node = self.cloned(); |
462 | if let Some(call_node) = expansion.call_node() { | 462 | while let Some(call_node) = node.file_id.call_node(db) { |
463 | return FileRange { | 463 | node = call_node; |
464 | file_id: call_node.file_id.original_file(db), | ||
465 | range: call_node.value.text_range(), | ||
466 | }; | ||
467 | } | ||
468 | } | 464 | } |
469 | 465 | ||
470 | FileRange { file_id: self.file_id.original_file(db), range: self.value.text_range() } | 466 | let orig_file = node.file_id.original_file(db); |
467 | assert_eq!(node.file_id, orig_file.into()); | ||
468 | FileRange { file_id: orig_file, range: node.value.text_range() } | ||
471 | } | 469 | } |
472 | } | 470 | } |
473 | 471 | ||