diff options
author | Jonas Schievink <[email protected]> | 2021-05-10 21:54:17 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-05-10 21:54:17 +0100 |
commit | 8ea9d939d2c44feb71e2d1c8ec390a9471b75e57 (patch) | |
tree | 3c7eff71e1778213524d57f4aee14bfaf9e35a68 /crates/hir_expand/src/lib.rs | |
parent | da08198bc94b9c51338cd94aeadc73324b373011 (diff) |
Rewrite `#[derive]` removal to be based on AST
Diffstat (limited to 'crates/hir_expand/src/lib.rs')
-rw-r--r-- | crates/hir_expand/src/lib.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs index 57e08eeb0..5df11856e 100644 --- a/crates/hir_expand/src/lib.rs +++ b/crates/hir_expand/src/lib.rs | |||
@@ -14,6 +14,7 @@ pub mod builtin_macro; | |||
14 | pub mod proc_macro; | 14 | pub mod proc_macro; |
15 | pub mod quote; | 15 | pub mod quote; |
16 | pub mod eager; | 16 | pub mod eager; |
17 | mod input; | ||
17 | 18 | ||
18 | use either::Either; | 19 | use either::Either; |
19 | 20 | ||
@@ -292,8 +293,19 @@ pub struct MacroCallLoc { | |||
292 | 293 | ||
293 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 294 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
294 | pub enum MacroCallKind { | 295 | pub enum MacroCallKind { |
295 | FnLike { ast_id: AstId<ast::MacroCall>, fragment: FragmentKind }, | 296 | FnLike { |
296 | Derive { ast_id: AstId<ast::Item>, derive_name: String, derive_attr_index: u32 }, | 297 | ast_id: AstId<ast::MacroCall>, |
298 | fragment: FragmentKind, | ||
299 | }, | ||
300 | Derive { | ||
301 | ast_id: AstId<ast::Item>, | ||
302 | derive_name: String, | ||
303 | /// Syntactical index of the invoking `#[derive]` attribute. | ||
304 | /// | ||
305 | /// Outer attributes are counted first, then inner attributes. This does not support | ||
306 | /// out-of-line modules, which may have attributes spread across 2 files! | ||
307 | derive_attr_index: u32, | ||
308 | }, | ||
297 | } | 309 | } |
298 | 310 | ||
299 | impl MacroCallKind { | 311 | impl MacroCallKind { |