diff options
Diffstat (limited to 'crates/hir_def/src/lib.rs')
-rw-r--r-- | crates/hir_def/src/lib.rs | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs index 3e7d496d5..303083c6d 100644 --- a/crates/hir_def/src/lib.rs +++ b/crates/hir_def/src/lib.rs | |||
@@ -731,12 +731,11 @@ fn macro_call_as_call_id( | |||
731 | ) | 731 | ) |
732 | .map(MacroCallId::from) | 732 | .map(MacroCallId::from) |
733 | } else { | 733 | } else { |
734 | Ok(def | 734 | Ok(def.as_lazy_macro( |
735 | .as_lazy_macro( | 735 | db.upcast(), |
736 | db.upcast(), | 736 | krate, |
737 | krate, | 737 | MacroCallKind::FnLike { ast_id: call.ast_id, fragment }, |
738 | MacroCallKind::FnLike { ast_id: call.ast_id, fragment }, | 738 | )) |
739 | )) | ||
740 | }; | 739 | }; |
741 | Ok(res) | 740 | Ok(res) |
742 | } | 741 | } |
@@ -755,16 +754,15 @@ fn derive_macro_as_call_id( | |||
755 | .segments() | 754 | .segments() |
756 | .last() | 755 | .last() |
757 | .ok_or_else(|| UnresolvedMacro { path: item_attr.path.clone() })?; | 756 | .ok_or_else(|| UnresolvedMacro { path: item_attr.path.clone() })?; |
758 | let res = def | 757 | let res = def.as_lazy_macro( |
759 | .as_lazy_macro( | 758 | db.upcast(), |
760 | db.upcast(), | 759 | krate, |
761 | krate, | 760 | MacroCallKind::Derive { |
762 | MacroCallKind::Derive { | 761 | ast_id: item_attr.ast_id, |
763 | ast_id: item_attr.ast_id, | 762 | derive_name: last_segment.to_string(), |
764 | derive_name: last_segment.to_string(), | 763 | derive_attr_index: derive_attr.ast_index, |
765 | derive_attr_index: derive_attr.ast_index, | 764 | }, |
766 | }, | 765 | ); |
767 | ); | ||
768 | Ok(res) | 766 | Ok(res) |
769 | } | 767 | } |
770 | 768 | ||
@@ -792,16 +790,15 @@ fn attr_macro_as_call_id( | |||
792 | // The parentheses are always disposed here. | 790 | // The parentheses are always disposed here. |
793 | arg.delimiter = None; | 791 | arg.delimiter = None; |
794 | 792 | ||
795 | let res = def | 793 | let res = def.as_lazy_macro( |
796 | .as_lazy_macro( | 794 | db.upcast(), |
797 | db.upcast(), | 795 | krate, |
798 | krate, | 796 | MacroCallKind::Attr { |
799 | MacroCallKind::Attr { | 797 | ast_id: item_attr.ast_id, |
800 | ast_id: item_attr.ast_id, | 798 | attr_name: last_segment.to_string(), |
801 | attr_name: last_segment.to_string(), | 799 | attr_args: arg, |
802 | attr_args: arg, | 800 | invoc_attr_index: macro_attr.id.ast_index, |
803 | invoc_attr_index: macro_attr.id.ast_index, | 801 | }, |
804 | }, | 802 | ); |
805 | ); | ||
806 | Ok(res) | 803 | Ok(res) |
807 | } | 804 | } |