mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 17:28:09 +00:00
work towards brining macros to nameres
This commit is contained in:
parent
7dc45745a3
commit
9d4af40995
2 changed files with 16 additions and 3 deletions
|
@ -16,9 +16,9 @@ ra_db::impl_numeric_id!(MacroCallId);
|
|||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct MacroCallLoc {
|
||||
source_root_id: SourceRootId,
|
||||
module_id: ModuleId,
|
||||
source_item_id: SourceItemId,
|
||||
pub(crate) source_root_id: SourceRootId,
|
||||
pub(crate) module_id: ModuleId,
|
||||
pub(crate) source_item_id: SourceItemId,
|
||||
}
|
||||
|
||||
impl MacroCallId {
|
||||
|
|
|
@ -31,6 +31,7 @@ use crate::{
|
|||
Path, PathKind,
|
||||
HirDatabase, Crate,
|
||||
Name, AsName,
|
||||
macros::{MacroCallId, MacroCallLoc},
|
||||
module::{Module, ModuleId, ModuleTree},
|
||||
};
|
||||
|
||||
|
@ -354,6 +355,18 @@ where
|
|||
if item.kind == MODULE {
|
||||
continue;
|
||||
}
|
||||
if item.kind == MACRO_CALL {
|
||||
let loc = MacroCallLoc {
|
||||
source_root_id: self.source_root,
|
||||
module_id,
|
||||
source_item_id: SourceItemId {
|
||||
file_id,
|
||||
item_id: Some(item.id),
|
||||
},
|
||||
};
|
||||
let id = loc.id(self.db);
|
||||
continue;
|
||||
}
|
||||
// depending on the item kind, the location can define something in
|
||||
// the values namespace, the types namespace, or both
|
||||
let kind = DefKind::for_syntax_kind(item.kind);
|
||||
|
|
Loading…
Reference in a new issue