mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-18 08:15:41 +00:00
Macros to use path instead of ident (#1474)
This commit is contained in:
@@ -42,9 +42,9 @@ pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
macro_rules! #error_token_unique_id {
|
||||
{
|
||||
$caller:tt
|
||||
frame_support = [{ $($frame_support:ident)::* }]
|
||||
your_tt_return = [{ $my_tt_return:path }]
|
||||
} => {
|
||||
$($frame_support::)*__private::tt_return! {
|
||||
$my_tt_return! {
|
||||
$caller
|
||||
}
|
||||
};
|
||||
@@ -170,9 +170,9 @@ pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
macro_rules! #error_token_unique_id {
|
||||
{
|
||||
$caller:tt
|
||||
frame_support = [{ $($frame_support:ident)::* }]
|
||||
your_tt_return = [{ $my_tt_return:path }]
|
||||
} => {
|
||||
$($frame_support::)*__private::tt_return! {
|
||||
$my_tt_return! {
|
||||
$caller
|
||||
error = [{ #error_ident }]
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
use crate::{pallet::Def, COUNTER};
|
||||
use frame_support_procedural_tools::get_doc_literals;
|
||||
use quote::ToTokens;
|
||||
use syn::{spanned::Spanned, Ident};
|
||||
|
||||
///
|
||||
@@ -79,7 +80,7 @@ pub fn expand_genesis_config(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
let genesis_config_item =
|
||||
&mut def.item.content.as_mut().expect("Checked by def parser").1[genesis_config.index];
|
||||
|
||||
let serde_crate = format!("{}::__private::serde", frame_support);
|
||||
let serde_crate = format!("{}::__private::serde", frame_support.to_token_stream());
|
||||
|
||||
match genesis_config_item {
|
||||
syn::Item::Enum(syn::ItemEnum { attrs, .. }) |
|
||||
|
||||
@@ -85,18 +85,16 @@ pub fn expand_tt_default_parts(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
// wrapped inside of braces and finally prepended with double colons, to the caller inside
|
||||
// of a key named `tokens`.
|
||||
//
|
||||
// We need to accept a frame_support argument here, because this macro gets expanded on the
|
||||
// crate that called the `construct_runtime!` macro, and said crate may have renamed
|
||||
// frame-support, and so we need to pass in the frame-support path that said crate
|
||||
// recognizes.
|
||||
// We need to accept a path argument here, because this macro gets expanded on the
|
||||
// crate that called the `construct_runtime!` macro, and the actual path is unknown.
|
||||
#[macro_export]
|
||||
#[doc(hidden)]
|
||||
macro_rules! #default_parts_unique_id {
|
||||
{
|
||||
$caller:tt
|
||||
frame_support = [{ $($frame_support:ident)::* }]
|
||||
your_tt_return = [{ $my_tt_return:path }]
|
||||
} => {
|
||||
$($frame_support)*::__private::tt_return! {
|
||||
$my_tt_return! {
|
||||
$caller
|
||||
tokens = [{
|
||||
expanded::{
|
||||
@@ -112,7 +110,7 @@ pub fn expand_tt_default_parts(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
pub use #default_parts_unique_id as tt_default_parts;
|
||||
|
||||
|
||||
// This macro is similar to the `tt_default_parts!`. It expands the pallets thare are declared
|
||||
// This macro is similar to the `tt_default_parts!`. It expands the pallets that are declared
|
||||
// explicitly (`System: frame_system::{Pallet, Call}`) with extra parts.
|
||||
//
|
||||
// For example, after expansion an explicit pallet would look like:
|
||||
@@ -124,9 +122,9 @@ pub fn expand_tt_default_parts(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
macro_rules! #extra_parts_unique_id {
|
||||
{
|
||||
$caller:tt
|
||||
frame_support = [{ $($frame_support:ident)::* }]
|
||||
your_tt_return = [{ $my_tt_return:path }]
|
||||
} => {
|
||||
$($frame_support)*::__private::tt_return! {
|
||||
$my_tt_return! {
|
||||
$caller
|
||||
tokens = [{
|
||||
expanded::{
|
||||
|
||||
Reference in New Issue
Block a user