diff options
author | Edwin Cheng <[email protected]> | 2019-11-26 17:33:08 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-11-26 17:33:08 +0000 |
commit | 447268ceac497432822e8cf28525a6784f392020 (patch) | |
tree | f2c327eb94ff0306758b0dd83df10e713d4f0f61 /crates/ra_hir_expand | |
parent | 4d753fa6f514ea1105c25ace91201c5324ee0b92 (diff) |
Hide MacroCallLoc
Diffstat (limited to 'crates/ra_hir_expand')
-rw-r--r-- | crates/ra_hir_expand/src/lib.rs | 14 |
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 | ||
138 | impl 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)] |
139 | pub enum MacroDefKind { | 149 | pub 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)] |
145 | pub struct MacroCallLoc { | 155 | pub 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 | ||
150 | impl MacroCallId { | 160 | impl MacroCallId { |