diff options
author | Jonas Schievink <[email protected]> | 2020-12-07 16:06:14 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2020-12-07 16:06:14 +0000 |
commit | fb21a215be0968d1102aba842c0fdedcd401cb15 (patch) | |
tree | bb81f3307fc8abfbb5c217b043df6ed3099edc10 /crates/base_db | |
parent | e8a19e24eaa214d982fa8316a21dacb08ce50ec5 (diff) |
Retain types of proc macros and allow attr. macros
Diffstat (limited to 'crates/base_db')
-rw-r--r-- | crates/base_db/src/input.rs | 13 | ||||
-rw-r--r-- | crates/base_db/src/lib.rs | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/crates/base_db/src/input.rs b/crates/base_db/src/input.rs index 98ba372ad..cda5e57dc 100644 --- a/crates/base_db/src/input.rs +++ b/crates/base_db/src/input.rs | |||
@@ -143,9 +143,17 @@ impl CrateDisplayName { | |||
143 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] | 143 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] |
144 | pub struct ProcMacroId(pub u32); | 144 | pub struct ProcMacroId(pub u32); |
145 | 145 | ||
146 | #[derive(Copy, Clone, Eq, PartialEq, Debug)] | ||
147 | pub enum ProcMacroKind { | ||
148 | CustomDerive, | ||
149 | FuncLike, | ||
150 | Attr, | ||
151 | } | ||
152 | |||
146 | #[derive(Debug, Clone)] | 153 | #[derive(Debug, Clone)] |
147 | pub struct ProcMacro { | 154 | pub struct ProcMacro { |
148 | pub name: SmolStr, | 155 | pub name: SmolStr, |
156 | pub kind: ProcMacroKind, | ||
149 | pub expander: Arc<dyn TokenExpander>, | 157 | pub expander: Arc<dyn TokenExpander>, |
150 | } | 158 | } |
151 | 159 | ||
@@ -198,11 +206,8 @@ impl CrateGraph { | |||
198 | display_name: Option<CrateDisplayName>, | 206 | display_name: Option<CrateDisplayName>, |
199 | cfg_options: CfgOptions, | 207 | cfg_options: CfgOptions, |
200 | env: Env, | 208 | env: Env, |
201 | proc_macro: Vec<(SmolStr, Arc<dyn tt::TokenExpander>)>, | 209 | proc_macro: Vec<ProcMacro>, |
202 | ) -> CrateId { | 210 | ) -> CrateId { |
203 | let proc_macro = | ||
204 | proc_macro.into_iter().map(|(name, it)| ProcMacro { name, expander: it }).collect(); | ||
205 | |||
206 | let data = CrateData { | 211 | let data = CrateData { |
207 | root_file_id: file_id, | 212 | root_file_id: file_id, |
208 | edition, | 213 | edition, |
diff --git a/crates/base_db/src/lib.rs b/crates/base_db/src/lib.rs index ce75a5337..5571af495 100644 --- a/crates/base_db/src/lib.rs +++ b/crates/base_db/src/lib.rs | |||
@@ -14,7 +14,7 @@ pub use crate::{ | |||
14 | change::Change, | 14 | change::Change, |
15 | input::{ | 15 | input::{ |
16 | CrateData, CrateDisplayName, CrateGraph, CrateId, CrateName, Dependency, Edition, Env, | 16 | CrateData, CrateDisplayName, CrateGraph, CrateId, CrateName, Dependency, Edition, Env, |
17 | ProcMacroId, SourceRoot, SourceRootId, | 17 | ProcMacro, ProcMacroId, ProcMacroKind, SourceRoot, SourceRootId, |
18 | }, | 18 | }, |
19 | }; | 19 | }; |
20 | pub use salsa; | 20 | pub use salsa; |