Macros to use path instead of ident (#1474)

This commit is contained in:
Juan
2023-10-14 08:26:19 +02:00
committed by GitHub
parent 1f28cddd6f
commit 7c87d61f5a
26 changed files with 489 additions and 134 deletions
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use frame_support_procedural_tools::generate_crate_access_2018;
use frame_support_procedural_tools::generate_access_from_frame_or_crate;
use quote::ToTokens;
// Derive `PalletError`
@@ -25,7 +25,7 @@ pub fn derive_pallet_error(input: proc_macro::TokenStream) -> proc_macro::TokenS
Err(e) => return e.to_compile_error().into(),
};
let frame_support = match generate_crate_access_2018("frame-support") {
let frame_support = match generate_access_from_frame_or_crate("frame-support") {
Ok(c) => c,
Err(e) => return e.into_compile_error().into(),
};
@@ -111,7 +111,7 @@ pub fn derive_pallet_error(input: proc_macro::TokenStream) -> proc_macro::TokenS
fn generate_field_types(
field: &syn::Field,
scrate: &syn::Ident,
scrate: &syn::Path,
) -> syn::Result<Option<proc_macro2::TokenStream>> {
let attrs = &field.attrs;
@@ -143,7 +143,7 @@ fn generate_field_types(
fn generate_variant_field_types(
variant: &syn::Variant,
scrate: &syn::Ident,
scrate: &syn::Path,
) -> syn::Result<Option<Vec<proc_macro2::TokenStream>>> {
let attrs = &variant.attrs;