mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
Make transactional attribute less scope dependent (#7112)
* Make `transactional` attribute less scope dependent The old implementation expected that `frame-support` wasn't imported under a different name. Besides that the pr removes some whitespaces. * Update frame/support/procedural/src/lib.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -46,6 +46,25 @@ pub fn generate_crate_access(unique_id: &str, def_crate: &str) -> TokenStream {
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate the crate access for the `frame-support` crate using 2018 syntax.
|
||||
///
|
||||
/// Output will for example be `frame_support`.
|
||||
pub fn generate_crate_access_2018() -> Result<TokenStream, Error> {
|
||||
if std::env::var("CARGO_PKG_NAME").unwrap() == "frame-support" {
|
||||
Ok(quote::quote!( frame_support ))
|
||||
} else {
|
||||
match crate_name("frame-support") {
|
||||
Ok(name) => {
|
||||
let name = Ident::new(&name, Span::call_site());
|
||||
Ok(quote!( #name ))
|
||||
},
|
||||
Err(e) => {
|
||||
Err(Error::new(Span::call_site(), &e))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Generates the hidden includes that are required to make the macro independent from its scope.
|
||||
pub fn generate_hidden_includes(unique_id: &str, def_crate: &str) -> TokenStream {
|
||||
if std::env::var("CARGO_PKG_NAME").unwrap() == def_crate {
|
||||
|
||||
Reference in New Issue
Block a user