From fb21a215be0968d1102aba842c0fdedcd401cb15 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 7 Dec 2020 17:06:14 +0100 Subject: Retain types of proc macros and allow attr. macros --- crates/base_db/src/input.rs | 13 +++++++++---- crates/base_db/src/lib.rs | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'crates/base_db') 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 { #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct ProcMacroId(pub u32); +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +pub enum ProcMacroKind { + CustomDerive, + FuncLike, + Attr, +} + #[derive(Debug, Clone)] pub struct ProcMacro { pub name: SmolStr, + pub kind: ProcMacroKind, pub expander: Arc, } @@ -198,11 +206,8 @@ impl CrateGraph { display_name: Option, cfg_options: CfgOptions, env: Env, - proc_macro: Vec<(SmolStr, Arc)>, + proc_macro: Vec, ) -> CrateId { - let proc_macro = - proc_macro.into_iter().map(|(name, it)| ProcMacro { name, expander: it }).collect(); - let data = CrateData { root_file_id: file_id, 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::{ change::Change, input::{ CrateData, CrateDisplayName, CrateGraph, CrateId, CrateName, Dependency, Edition, Env, - ProcMacroId, SourceRoot, SourceRootId, + ProcMacro, ProcMacroId, ProcMacroKind, SourceRoot, SourceRootId, }, }; pub use salsa; -- cgit v1.2.3