mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Basic support for decl macros 2.0
This commit is contained in:
parent
bd4c352831
commit
c31c3246a8
15 changed files with 195 additions and 28 deletions
|
@ -145,7 +145,10 @@ impl HirFileId {
|
|||
let arg_tt = loc.kind.arg(db)?;
|
||||
|
||||
let def = loc.def.ast_id.and_then(|id| {
|
||||
let def_tt = id.to_node(db).token_tree()?;
|
||||
let def_tt = match id.to_node(db) {
|
||||
ast::Macro::MacroRules(mac) => mac.token_tree()?,
|
||||
ast::Macro::MacroDef(_) => return None,
|
||||
};
|
||||
Some(InFile::new(id.file_id, def_tt))
|
||||
});
|
||||
|
||||
|
@ -228,7 +231,7 @@ pub struct MacroDefId {
|
|||
// (which will probably require touching this code), we can instead use
|
||||
// that (and also remove the hacks for resolving built-in derives).
|
||||
pub krate: Option<CrateId>,
|
||||
pub ast_id: Option<AstId<ast::MacroRules>>,
|
||||
pub ast_id: Option<AstId<ast::Macro>>,
|
||||
pub kind: MacroDefKind,
|
||||
|
||||
pub local_inner: bool,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue