diff options
Diffstat (limited to 'crates/ra_hir/src/macros.rs')
-rw-r--r-- | crates/ra_hir/src/macros.rs | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/crates/ra_hir/src/macros.rs b/crates/ra_hir/src/macros.rs index 288fbe3c6..71646b22d 100644 --- a/crates/ra_hir/src/macros.rs +++ b/crates/ra_hir/src/macros.rs | |||
@@ -1,44 +1,12 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | 2 | ||
3 | use ra_db::{SourceRootId, LocalSyntaxPtr, LocationIntener}; | 3 | use ra_db::LocalSyntaxPtr; |
4 | use ra_syntax::{ | 4 | use ra_syntax::{ |
5 | TextRange, TextUnit, SourceFileNode, AstNode, SyntaxNode, | 5 | TextRange, TextUnit, SourceFileNode, AstNode, SyntaxNode, |
6 | ast::{self, NameOwner}, | 6 | ast::{self, NameOwner}, |
7 | }; | 7 | }; |
8 | 8 | ||
9 | use crate::{module::ModuleId, SourceItemId, HirDatabase}; | 9 | use crate::{HirDatabase, MacroCallId}; |
10 | |||
11 | /// Def's are a core concept of hir. A `Def` is an Item (function, module, etc) | ||
12 | /// in a specific module. | ||
13 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | ||
14 | pub struct MacroCallId(u32); | ||
15 | ra_db::impl_numeric_id!(MacroCallId); | ||
16 | |||
17 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | ||
18 | pub struct MacroCallLoc { | ||
19 | pub(crate) source_root_id: SourceRootId, | ||
20 | pub(crate) module_id: ModuleId, | ||
21 | pub(crate) source_item_id: SourceItemId, | ||
22 | } | ||
23 | |||
24 | impl MacroCallId { | ||
25 | pub(crate) fn loc( | ||
26 | self, | ||
27 | db: &impl AsRef<LocationIntener<MacroCallLoc, MacroCallId>>, | ||
28 | ) -> MacroCallLoc { | ||
29 | db.as_ref().id2loc(self) | ||
30 | } | ||
31 | } | ||
32 | |||
33 | impl MacroCallLoc { | ||
34 | #[allow(unused)] | ||
35 | pub(crate) fn id( | ||
36 | &self, | ||
37 | db: &impl AsRef<LocationIntener<MacroCallLoc, MacroCallId>>, | ||
38 | ) -> MacroCallId { | ||
39 | db.as_ref().loc2id(&self) | ||
40 | } | ||
41 | } | ||
42 | 10 | ||
43 | // Hard-coded defs for now :-( | 11 | // Hard-coded defs for now :-( |
44 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 12 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |