mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
19 lines
531 B
Rust
19 lines
531 B
Rust
use proc_macro::TokenStream;
|
|
use quote::quote;
|
|
|
|
#[proc_macro_attribute]
|
|
pub fn add_suffix(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|
let suff = syn::parse_macro_input!(attr as syn::LitStr).value();
|
|
let mut ast = syn::parse_macro_input!(item as syn::ItemFn);
|
|
ast.sig.ident = syn::Ident::new(&format!("{}_{}", ast.sig.ident, suff), ast.sig.ident.span());
|
|
quote! {
|
|
#ast
|
|
}
|
|
.into()
|
|
}
|
|
|
|
#[proc_macro_attribute]
|
|
pub fn identity(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
|
item
|
|
}
|