Skip to content

Commit f510af8

Browse files
committed
patching
1 parent 10a6856 commit f510af8

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

module/core/former/patch

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--- a/module/core/former_meta/src/derive_former/former_enum/unit.rs
2+
+++ b/module/core/former_meta/src/derive_former/former_enum/unit.rs
3+
@@ -1,9 +1,9 @@
4+
// File: module/core/former_meta/src/derive_former/former_enum/unit.rs
5+
6+
-use macro_tools::{ Result, quote::quote, syn, diag };
7+
+use macro_tools::{ Result, quote::{ quote, format_ident }, syn, diag }; // <<< Added format_ident
8+
use convert_case::{ Case, Casing };
9+
use super::ident;
10+
-use syn::{ parse_quote }; // Keep parse_quote
11+
+// use syn::{ parse_quote }; // <<< Removed parse_quote
12+
use super::{ EnumVariantHandlerContext }; // Keep EnumVariantHandlerContext
13+
14+
15+
@@ -18,7 +18,8 @@
16+
let variant_ident = &ctx.variant.ident; // Access from context
17+
let variant_name_str = variant_ident.to_string();
18+
let method_name_snake_str = variant_name_str.to_case( Case::Snake );
19+
- let method_name_ident_temp = parse_quote!( #method_name_snake_str ); // <<< Potential issue: parse_quote might not be ideal for creating an ident from a string directly. format_ident! is usually preferred.
20+
+ // FIX: Use format_ident! instead of parse_quote! for robust identifier creation
21+
+ let method_name_ident_temp = format_ident!( "{}", method_name_snake_str, span = variant_ident.span() );
22+
let method_name = ident::ident_maybe_raw( &method_name_ident_temp );
23+
24+
// Check for #[subform_scalar] attribute

module/core/former/tests/inc/former_enum_tests/basic_derive.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// File: module/core/former/tests/inc/former_enum_tests/basic_derive.rs
12

23
use super::*;
34

@@ -18,13 +19,5 @@ enum FunctionStep
1819
Run( Run ),
1920
}
2021

21-
// xxx : generated code for debugging
22-
23-
//
24-
25-
26-
// xxx : generated code for debugging
27-
2822
// Include the test logic
29-
include!( "basic_only_test.rs" );
30-
// qqq : xxx : uncomment and make it working
23+
include!( "basic_only_test.rs" );

0 commit comments

Comments
 (0)