diff options
author | Jonas Schievink <[email protected]> | 2020-12-15 17:43:19 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2020-12-15 17:43:34 +0000 |
commit | c31c3246a8c87a3639623c30b692a57e728bb046 (patch) | |
tree | e66cdc459e249767c69c1b29b13e85fe30bdc935 /crates/hir_expand/src/lib.rs | |
parent | bd4c352831662762ee7a66da77ec9adf623b0a0a (diff) |
Basic support for decl macros 2.0
Diffstat (limited to 'crates/hir_expand/src/lib.rs')
-rw-r--r-- | crates/hir_expand/src/lib.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs index ae3086a95..55f026c7b 100644 --- a/crates/hir_expand/src/lib.rs +++ b/crates/hir_expand/src/lib.rs | |||
@@ -145,7 +145,10 @@ impl HirFileId { | |||
145 | let arg_tt = loc.kind.arg(db)?; | 145 | let arg_tt = loc.kind.arg(db)?; |
146 | 146 | ||
147 | let def = loc.def.ast_id.and_then(|id| { | 147 | let def = loc.def.ast_id.and_then(|id| { |
148 | let def_tt = id.to_node(db).token_tree()?; | 148 | let def_tt = match id.to_node(db) { |
149 | ast::Macro::MacroRules(mac) => mac.token_tree()?, | ||
150 | ast::Macro::MacroDef(_) => return None, | ||
151 | }; | ||
149 | Some(InFile::new(id.file_id, def_tt)) | 152 | Some(InFile::new(id.file_id, def_tt)) |
150 | }); | 153 | }); |
151 | 154 | ||
@@ -228,7 +231,7 @@ pub struct MacroDefId { | |||
228 | // (which will probably require touching this code), we can instead use | 231 | // (which will probably require touching this code), we can instead use |
229 | // that (and also remove the hacks for resolving built-in derives). | 232 | // that (and also remove the hacks for resolving built-in derives). |
230 | pub krate: Option<CrateId>, | 233 | pub krate: Option<CrateId>, |
231 | pub ast_id: Option<AstId<ast::MacroRules>>, | 234 | pub ast_id: Option<AstId<ast::Macro>>, |
232 | pub kind: MacroDefKind, | 235 | pub kind: MacroDefKind, |
233 | 236 | ||
234 | pub local_inner: bool, | 237 | pub local_inner: bool, |