aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand/src/proc_macro.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_expand/src/proc_macro.rs')
-rw-r--r--crates/hir_expand/src/proc_macro.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/hir_expand/src/proc_macro.rs b/crates/hir_expand/src/proc_macro.rs
index d5643393a..dbe1b446e 100644
--- a/crates/hir_expand/src/proc_macro.rs
+++ b/crates/hir_expand/src/proc_macro.rs
@@ -28,11 +28,16 @@ impl ProcMacroExpander {
28 Self { krate, proc_macro_id: None } 28 Self { krate, proc_macro_id: None }
29 } 29 }
30 30
31 pub fn is_dummy(&self) -> bool {
32 self.proc_macro_id.is_none()
33 }
34
31 pub fn expand( 35 pub fn expand(
32 self, 36 self,
33 db: &dyn AstDatabase, 37 db: &dyn AstDatabase,
34 calling_crate: CrateId, 38 calling_crate: CrateId,
35 tt: &tt::Subtree, 39 tt: &tt::Subtree,
40 attr_arg: Option<&tt::Subtree>,
36 ) -> Result<tt::Subtree, mbe::ExpandError> { 41 ) -> Result<tt::Subtree, mbe::ExpandError> {
37 match self.proc_macro_id { 42 match self.proc_macro_id {
38 Some(id) => { 43 Some(id) => {
@@ -46,7 +51,7 @@ impl ProcMacroExpander {
46 // Proc macros have access to the environment variables of the invoking crate. 51 // Proc macros have access to the environment variables of the invoking crate.
47 let env = &krate_graph[calling_crate].env; 52 let env = &krate_graph[calling_crate].env;
48 53
49 proc_macro.expander.expand(&tt, None, &env).map_err(mbe::ExpandError::from) 54 proc_macro.expander.expand(&tt, attr_arg, &env).map_err(mbe::ExpandError::from)
50 } 55 }
51 None => Err(mbe::ExpandError::UnresolvedProcMacro), 56 None => Err(mbe::ExpandError::UnresolvedProcMacro),
52 } 57 }