mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +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
|
@ -1144,12 +1144,15 @@ impl MacroDef {
|
|||
|
||||
/// XXX: this parses the file
|
||||
pub fn name(self, db: &dyn HirDatabase) -> Option<Name> {
|
||||
self.source(db)?.value.name().map(|it| it.as_name())
|
||||
match self.source(db)?.value {
|
||||
Either::Left(it) => it.name().map(|it| it.as_name()),
|
||||
Either::Right(it) => it.name().map(|it| it.as_name()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Indicate it is a proc-macro
|
||||
pub fn is_proc_macro(&self) -> bool {
|
||||
matches!(self.id.kind, MacroDefKind::ProcMacro(_))
|
||||
matches!(self.id.kind, MacroDefKind::ProcMacro(..))
|
||||
}
|
||||
|
||||
/// Indicate it is a derive macro
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue