diff options
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r-- | crates/ra_hir_def/src/nameres/collector.rs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 9c125f32f..9b46431cb 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -11,8 +11,8 @@ use hir_expand::{ | |||
11 | HirFileId, MacroCallId, MacroDefId, MacroDefKind, | 11 | HirFileId, MacroCallId, MacroDefId, MacroDefKind, |
12 | }; | 12 | }; |
13 | use ra_cfg::CfgOptions; | 13 | use ra_cfg::CfgOptions; |
14 | use ra_db::{CrateId, FileId}; | 14 | use ra_db::{CrateId, FileId, ProcMacroId}; |
15 | use ra_syntax::ast; | 15 | use ra_syntax::{ast, SmolStr}; |
16 | use rustc_hash::FxHashMap; | 16 | use rustc_hash::FxHashMap; |
17 | use test_utils::tested_by; | 17 | use test_utils::tested_by; |
18 | 18 | ||
@@ -53,6 +53,16 @@ pub(super) fn collect_defs(db: &dyn DefDatabase, mut def_map: CrateDefMap) -> Cr | |||
53 | } | 53 | } |
54 | 54 | ||
55 | let cfg_options = &crate_graph[def_map.krate].cfg_options; | 55 | let cfg_options = &crate_graph[def_map.krate].cfg_options; |
56 | let proc_macros = &crate_graph[def_map.krate].proc_macro; | ||
57 | let proc_macros = proc_macros | ||
58 | .iter() | ||
59 | .enumerate() | ||
60 | .map(|(idx, it)| { | ||
61 | // FIXME: a hacky way to create a Name from string. | ||
62 | let name = tt::Ident { text: SmolStr::new(&it.name()), id: tt::TokenId::unspecified() }; | ||
63 | (name.as_name(), ProcMacroExpander::new(def_map.krate, ProcMacroId(idx))) | ||
64 | }) | ||
65 | .collect(); | ||
56 | 66 | ||
57 | let mut collector = DefCollector { | 67 | let mut collector = DefCollector { |
58 | db, | 68 | db, |
@@ -65,9 +75,7 @@ pub(super) fn collect_defs(db: &dyn DefDatabase, mut def_map: CrateDefMap) -> Cr | |||
65 | unexpanded_attribute_macros: Vec::new(), | 75 | unexpanded_attribute_macros: Vec::new(), |
66 | mod_dirs: FxHashMap::default(), | 76 | mod_dirs: FxHashMap::default(), |
67 | cfg_options, | 77 | cfg_options, |
68 | 78 | proc_macros, | |
69 | // FIXME: pass proc-macro from crate-graph | ||
70 | proc_macros: Default::default(), | ||
71 | }; | 79 | }; |
72 | collector.collect(); | 80 | collector.collect(); |
73 | collector.finish() | 81 | collector.finish() |