mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Store an AstId
for procedural macros
This commit is contained in:
parent
3ab9b39dd4
commit
c05a1a6e37
11 changed files with 47 additions and 26 deletions
|
@ -157,7 +157,7 @@ fn macro_def(db: &dyn AstDatabase, id: MacroDefId) -> Option<Arc<(TokenExpander,
|
|||
Some(Arc::new((TokenExpander::BuiltinDerive(expander), mbe::TokenMap::default())))
|
||||
}
|
||||
MacroDefKind::BuiltInEager(..) => None,
|
||||
MacroDefKind::ProcMacro(expander) => {
|
||||
MacroDefKind::ProcMacro(expander, ..) => {
|
||||
Some(Arc::new((TokenExpander::ProcMacro(expander), mbe::TokenMap::default())))
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ fn expand_proc_macro(
|
|||
};
|
||||
|
||||
let expander = match loc.def.kind {
|
||||
MacroDefKind::ProcMacro(expander) => expander,
|
||||
MacroDefKind::ProcMacro(expander, ..) => expander,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ fn eager_macro_recur(
|
|||
MacroDefKind::Declarative(_)
|
||||
| MacroDefKind::BuiltIn(..)
|
||||
| MacroDefKind::BuiltInDerive(..)
|
||||
| MacroDefKind::ProcMacro(_) => {
|
||||
| MacroDefKind::ProcMacro(..) => {
|
||||
let res = lazy_expand(db, &def, curr.with_value(child.clone()), krate);
|
||||
let val = diagnostic_sink.expand_result_option(res)?;
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ impl HygieneFrame {
|
|||
MacroDefKind::BuiltIn(..) => (info, Some(loc.def.krate), false),
|
||||
MacroDefKind::BuiltInDerive(..) => (info, None, false),
|
||||
MacroDefKind::BuiltInEager(..) => (info, None, false),
|
||||
MacroDefKind::ProcMacro(_) => (info, None, false),
|
||||
MacroDefKind::ProcMacro(..) => (info, None, false),
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -245,7 +245,7 @@ impl MacroDefId {
|
|||
MacroDefKind::BuiltIn(_, id) => id,
|
||||
MacroDefKind::BuiltInDerive(_, id) => id,
|
||||
MacroDefKind::BuiltInEager(_, id) => id,
|
||||
MacroDefKind::ProcMacro(_) => return None,
|
||||
MacroDefKind::ProcMacro(..) => return None,
|
||||
};
|
||||
Some(*id)
|
||||
}
|
||||
|
@ -258,7 +258,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),
|
||||
ProcMacro(ProcMacroExpander, AstId<ast::Fn>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue