From e0f305a6bf710f64f789f909da93a8c362823b67 Mon Sep 17 00:00:00 2001 From: uHOOCCOOHu Date: Sat, 7 Sep 2019 00:55:58 +0800 Subject: Support textual scoped macros --- crates/ra_hir/src/nameres/raw.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir/src/nameres/raw.rs') diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs index 7963736e0..c646d3d00 100644 --- a/crates/ra_hir/src/nameres/raw.rs +++ b/crates/ra_hir/src/nameres/raw.rs @@ -134,12 +134,14 @@ pub(super) enum ModuleData { name: Name, ast_id: FileAstId, attr_path: Option, + is_macro_use: bool, }, Definition { name: Name, ast_id: FileAstId, items: Vec, attr_path: Option, + is_macro_use: bool, }, } @@ -267,10 +269,15 @@ impl RawItemsCollector { }; let ast_id = self.source_ast_id_map.ast_id(&module); + let is_macro_use = module.has_atom_attr("macro_use"); if module.has_semi() { let attr_path = extract_mod_path_attribute(&module); - let item = - self.raw_items.modules.alloc(ModuleData::Declaration { name, ast_id, attr_path }); + let item = self.raw_items.modules.alloc(ModuleData::Declaration { + name, + ast_id, + attr_path, + is_macro_use, + }); self.push_item(current_module, RawItem::Module(item)); return; } @@ -282,6 +289,7 @@ impl RawItemsCollector { ast_id, items: Vec::new(), attr_path, + is_macro_use, }); self.process_module(Some(item), item_list); self.push_item(current_module, RawItem::Module(item)); -- cgit v1.2.3