ProcMacroProcessExpander: support attribute macros

This commit is contained in:
Jonas Schievink 2020-12-07 13:55:41 +01:00
parent 403ed489ff
commit e42e6f9ab9
2 changed files with 11 additions and 21 deletions

View file

@ -42,9 +42,17 @@ impl tt::TokenExpander for ProcMacroProcessExpander {
fn expand(
&self,
subtree: &Subtree,
_attr: Option<&Subtree>,
attr: Option<&Subtree>,
) -> Result<Subtree, tt::ExpansionError> {
self.process.custom_derive(&self.dylib_path, subtree, &self.name)
let task = ExpansionTask {
macro_body: subtree.clone(),
macro_name: self.name.to_string(),
attributes: attr.cloned(),
lib: self.dylib_path.to_path_buf(),
};
let result: ExpansionResult = self.process.send_task(msg::Request::ExpansionMacro(task))?;
Ok(result.expansion)
}
}