work towards brining macros to nameres

This commit is contained in:
Aleksey Kladov
2019-01-01 20:17:10 +03:00
parent 7dc45745a3
commit 9d4af40995
2 changed files with 16 additions and 3 deletions
+3 -3
View File
@@ -16,9 +16,9 @@
#[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 {
+13
View File
@@ -31,6 +31,7 @@
Path, PathKind,
HirDatabase, Crate,
Name, AsName,
macros::{MacroCallId, MacroCallLoc},
module::{Module, ModuleId, ModuleTree},
};
@@ -354,6 +355,18 @@ fn populate_module(&mut self, module_id: ModuleId, input: &InputModuleItems) ->
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);