aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_expand/src/lib.rs')
-rw-r--r--crates/ra_hir_expand/src/lib.rs14
1 files changed, 12 insertions, 2 deletions
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 {
135 pub kind: MacroDefKind, 135 pub kind: MacroDefKind,
136} 136}
137 137
138impl MacroDefId {
139 pub fn as_call_id(
140 self,
141 db: &dyn db::AstDatabase,
142 ast_id: AstId<ast::MacroCall>,
143 ) -> MacroCallId {
144 db.intern_macro(MacroCallLoc { def: self, ast_id })
145 }
146}
147
138#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 148#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
139pub enum MacroDefKind { 149pub enum MacroDefKind {
140 Declarative, 150 Declarative,
@@ -143,8 +153,8 @@ pub enum MacroDefKind {
143 153
144#[derive(Debug, Clone, PartialEq, Eq, Hash)] 154#[derive(Debug, Clone, PartialEq, Eq, Hash)]
145pub struct MacroCallLoc { 155pub struct MacroCallLoc {
146 pub def: MacroDefId, 156 pub(crate) def: MacroDefId,
147 pub ast_id: AstId<ast::MacroCall>, 157 pub(crate) ast_id: AstId<ast::MacroCall>,
148} 158}
149 159
150impl MacroCallId { 160impl MacroCallId {