From db34abeb8589518896b82f52062b9fab4c2b1352 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 26 Mar 2020 16:10:01 +0100 Subject: Get rid of ItemOrMacro --- crates/ra_hir_def/src/body/lower.rs | 3 ++- crates/ra_hir_def/src/nameres/raw.rs | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir_def/src') diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 3cf0c66ea..e8443dde8 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -563,7 +563,8 @@ impl ExprCollector<'_> { ast::ModuleItem::ImplDef(_) | ast::ModuleItem::UseItem(_) | ast::ModuleItem::ExternCrateItem(_) - | ast::ModuleItem::Module(_) => continue, + | ast::ModuleItem::Module(_) + | ast::ModuleItem::MacroCall(_) => continue, }; self.body.item_scope.define_def(def); if let Some(name) = name { diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs index 1631e87b8..8f190e7f9 100644 --- a/crates/ra_hir_def/src/nameres/raw.rs +++ b/crates/ra_hir_def/src/nameres/raw.rs @@ -209,11 +209,8 @@ impl RawItemsCollector { current_module: Option>, body: impl ast::ModuleItemOwner, ) { - for item_or_macro in body.items_with_macros() { - match item_or_macro { - ast::ItemOrMacro::Macro(m) => self.add_macro(current_module, m), - ast::ItemOrMacro::Item(item) => self.add_item(current_module, item), - } + for item in body.items() { + self.add_item(current_module, item) } } @@ -265,6 +262,10 @@ impl RawItemsCollector { ast::ModuleItem::StaticDef(it) => { (DefKind::Static(self.source_ast_id_map.ast_id(&it)), it.name()) } + ast::ModuleItem::MacroCall(it) => { + self.add_macro(current_module, it); + return; + } }; if let Some(name) = name { let name = name.as_name(); -- cgit v1.2.3