aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/lib.rs')
-rw-r--r--crates/hir_def/src/lib.rs54
1 files changed, 24 insertions, 30 deletions
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs
index 987485acc..303083c6d 100644
--- a/crates/hir_def/src/lib.rs
+++ b/crates/hir_def/src/lib.rs
@@ -731,13 +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 .into())
741 }; 739 };
742 Ok(res) 740 Ok(res)
743} 741}
@@ -756,17 +754,15 @@ fn derive_macro_as_call_id(
756 .segments() 754 .segments()
757 .last() 755 .last()
758 .ok_or_else(|| UnresolvedMacro { path: item_attr.path.clone() })?; 756 .ok_or_else(|| UnresolvedMacro { path: item_attr.path.clone() })?;
759 let res = def 757 let res = def.as_lazy_macro(
760 .as_lazy_macro( 758 db.upcast(),
761 db.upcast(), 759 krate,
762 krate, 760 MacroCallKind::Derive {
763 MacroCallKind::Derive { 761 ast_id: item_attr.ast_id,
764 ast_id: item_attr.ast_id, 762 derive_name: last_segment.to_string(),
765 derive_name: last_segment.to_string(), 763 derive_attr_index: derive_attr.ast_index,
766 derive_attr_index: derive_attr.ast_index, 764 },
767 }, 765 );
768 )
769 .into();
770 Ok(res) 766 Ok(res)
771} 767}
772 768
@@ -794,17 +790,15 @@ fn attr_macro_as_call_id(
794 // The parentheses are always disposed here. 790 // The parentheses are always disposed here.
795 arg.delimiter = None; 791 arg.delimiter = None;
796 792
797 let res = def 793 let res = def.as_lazy_macro(
798 .as_lazy_macro( 794 db.upcast(),
799 db.upcast(), 795 krate,
800 krate, 796 MacroCallKind::Attr {
801 MacroCallKind::Attr { 797 ast_id: item_attr.ast_id,
802 ast_id: item_attr.ast_id, 798 attr_name: last_segment.to_string(),
803 attr_name: last_segment.to_string(), 799 attr_args: arg,
804 attr_args: arg, 800 invoc_attr_index: macro_attr.id.ast_index,
805 invoc_attr_index: macro_attr.id.ast_index, 801 },
806 }, 802 );
807 )
808 .into();
809 Ok(res) 803 Ok(res)
810} 804}