Thread proc-macro types through the HIR

This commit is contained in:
Jonas Schievink 2021-05-29 20:32:57 +02:00
parent f6da603c7f
commit 8c639a87bd
5 changed files with 34 additions and 10 deletions

View file

@ -15,6 +15,7 @@ pub mod quote;
pub mod eager;
mod input;
use base_db::ProcMacroKind;
use either::Either;
pub use mbe::{ExpandError, ExpandResult};
@ -207,7 +208,7 @@ impl MacroDefId {
MacroDefKind::BuiltIn(_, id) => id,
MacroDefKind::BuiltInDerive(_, id) => id,
MacroDefKind::BuiltInEager(_, id) => id,
MacroDefKind::ProcMacro(_, id) => return Either::Right(*id),
MacroDefKind::ProcMacro(.., id) => return Either::Right(*id),
};
Either::Left(*id)
}
@ -224,7 +225,7 @@ pub enum MacroDefKind {
// FIXME: maybe just Builtin and rename BuiltinFnLikeExpander to BuiltinExpander
BuiltInDerive(BuiltinDeriveExpander, AstId<ast::Macro>),
BuiltInEager(EagerExpander, AstId<ast::Macro>),
ProcMacro(ProcMacroExpander, AstId<ast::Fn>),
ProcMacro(ProcMacroExpander, ProcMacroKind, AstId<ast::Fn>),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]