From 447268ceac497432822e8cf28525a6784f392020 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 27 Nov 2019 01:33:08 +0800 Subject: Hide MacroCallLoc --- crates/ra_hir_expand/src/lib.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_expand') diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs index 4f3ccf1d0..b6a739cda 100644 --- a/crates/ra_hir_expand/src/lib.rs +++ b/crates/ra_hir_expand/src/lib.rs @@ -135,6 +135,16 @@ pub struct MacroDefId { pub kind: MacroDefKind, } +impl MacroDefId { + pub fn as_call_id( + self, + db: &dyn db::AstDatabase, + ast_id: AstId, + ) -> MacroCallId { + db.intern_macro(MacroCallLoc { def: self, ast_id }) + } +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum MacroDefKind { Declarative, @@ -143,8 +153,8 @@ pub enum MacroDefKind { #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MacroCallLoc { - pub def: MacroDefId, - pub ast_id: AstId, + pub(crate) def: MacroDefId, + pub(crate) ast_id: AstId, } impl MacroCallId { -- cgit v1.2.3