diff options
author | Aleksey Kladov <[email protected]> | 2019-01-01 17:17:10 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-01 19:15:35 +0000 |
commit | 9d4af40995b4d01ad9b75dee0a000dd57b8bd87f (patch) | |
tree | 9d19b31673b031921bed71e5dce0bd9a6affe18a | |
parent | 7dc45745a378c6feb6af524e8bd40e89bab7a822 (diff) |
work towards brining macros to nameres
-rw-r--r-- | crates/ra_hir/src/macros.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/module/nameres.rs | 13 |
2 files changed, 16 insertions, 3 deletions
diff --git a/crates/ra_hir/src/macros.rs b/crates/ra_hir/src/macros.rs index 932e2b574..3eedd9e2d 100644 --- a/crates/ra_hir/src/macros.rs +++ b/crates/ra_hir/src/macros.rs | |||
@@ -16,9 +16,9 @@ ra_db::impl_numeric_id!(MacroCallId); | |||
16 | 16 | ||
17 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 17 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
18 | pub struct MacroCallLoc { | 18 | pub struct MacroCallLoc { |
19 | source_root_id: SourceRootId, | 19 | pub(crate) source_root_id: SourceRootId, |
20 | module_id: ModuleId, | 20 | pub(crate) module_id: ModuleId, |
21 | source_item_id: SourceItemId, | 21 | pub(crate) source_item_id: SourceItemId, |
22 | } | 22 | } |
23 | 23 | ||
24 | impl MacroCallId { | 24 | impl MacroCallId { |
diff --git a/crates/ra_hir/src/module/nameres.rs b/crates/ra_hir/src/module/nameres.rs index 68eb02a98..46b1dc0b1 100644 --- a/crates/ra_hir/src/module/nameres.rs +++ b/crates/ra_hir/src/module/nameres.rs | |||
@@ -31,6 +31,7 @@ use crate::{ | |||
31 | Path, PathKind, | 31 | Path, PathKind, |
32 | HirDatabase, Crate, | 32 | HirDatabase, Crate, |
33 | Name, AsName, | 33 | Name, AsName, |
34 | macros::{MacroCallId, MacroCallLoc}, | ||
34 | module::{Module, ModuleId, ModuleTree}, | 35 | module::{Module, ModuleId, ModuleTree}, |
35 | }; | 36 | }; |
36 | 37 | ||
@@ -354,6 +355,18 @@ where | |||
354 | if item.kind == MODULE { | 355 | if item.kind == MODULE { |
355 | continue; | 356 | continue; |
356 | } | 357 | } |
358 | if item.kind == MACRO_CALL { | ||
359 | let loc = MacroCallLoc { | ||
360 | source_root_id: self.source_root, | ||
361 | module_id, | ||
362 | source_item_id: SourceItemId { | ||
363 | file_id, | ||
364 | item_id: Some(item.id), | ||
365 | }, | ||
366 | }; | ||
367 | let id = loc.id(self.db); | ||
368 | continue; | ||
369 | } | ||
357 | // depending on the item kind, the location can define something in | 370 | // depending on the item kind, the location can define something in |
358 | // the values namespace, the types namespace, or both | 371 | // the values namespace, the types namespace, or both |
359 | let kind = DefKind::for_syntax_kind(item.kind); | 372 | let kind = DefKind::for_syntax_kind(item.kind); |