diff options
author | Jonas Schievink <[email protected]> | 2021-05-31 12:37:11 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-06-03 17:09:21 +0100 |
commit | e5a2c6596ddd11b0d57042224ac7c1d7691ec33b (patch) | |
tree | f0476ad40103b5d3dea60f81fca32c63fe9618d7 /crates/hir_expand/src/db.rs | |
parent | 7f9c4a59d9a84cd8c734286937439b5cd215be27 (diff) |
Expand procedural attribute macros
Diffstat (limited to 'crates/hir_expand/src/db.rs')
-rw-r--r-- | crates/hir_expand/src/db.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs index e8f4af309..3ebe194e4 100644 --- a/crates/hir_expand/src/db.rs +++ b/crates/hir_expand/src/db.rs | |||
@@ -13,8 +13,8 @@ use syntax::{ | |||
13 | 13 | ||
14 | use crate::{ | 14 | use crate::{ |
15 | ast_id_map::AstIdMap, hygiene::HygieneFrame, input::process_macro_input, BuiltinDeriveExpander, | 15 | ast_id_map::AstIdMap, hygiene::HygieneFrame, input::process_macro_input, BuiltinDeriveExpander, |
16 | BuiltinFnLikeExpander, HirFileId, HirFileIdRepr, MacroCallId, MacroCallLoc, MacroDefId, | 16 | BuiltinFnLikeExpander, HirFileId, HirFileIdRepr, MacroCallId, MacroCallKind, MacroCallLoc, |
17 | MacroDefKind, MacroFile, ProcMacroExpander, | 17 | MacroDefId, MacroDefKind, MacroFile, ProcMacroExpander, |
18 | }; | 18 | }; |
19 | 19 | ||
20 | /// Total limit on the number of tokens produced by any macro invocation. | 20 | /// Total limit on the number of tokens produced by any macro invocation. |
@@ -377,7 +377,12 @@ fn expand_proc_macro( | |||
377 | _ => unreachable!(), | 377 | _ => unreachable!(), |
378 | }; | 378 | }; |
379 | 379 | ||
380 | expander.expand(db, loc.krate, ¯o_arg.0) | 380 | let attr_arg = match &loc.kind { |
381 | MacroCallKind::Attr { attr_args, .. } => Some(attr_args), | ||
382 | _ => None, | ||
383 | }; | ||
384 | |||
385 | expander.expand(db, loc.krate, ¯o_arg.0, attr_arg) | ||
381 | } | 386 | } |
382 | 387 | ||
383 | fn is_self_replicating(from: &SyntaxNode, to: &SyntaxNode) -> bool { | 388 | fn is_self_replicating(from: &SyntaxNode, to: &SyntaxNode) -> bool { |