@@ -2379,6 +2379,7 @@ impl ComplexDataContent<'_> {
23792379 }
23802380
23812381 fn deserializer_field_decl ( & self , ctx : & Context < ' _ , ' _ > ) -> TokenStream {
2382+ let field_ident = & self . field_ident ;
23822383 let target_type = ctx. resolve_type_for_deserialize_module ( & self . target_type ) ;
23832384
23842385 let target_type = match self . occurs {
@@ -2396,60 +2397,64 @@ impl ComplexDataContent<'_> {
23962397 } ;
23972398
23982399 quote ! {
2399- content : #target_type,
2400+ #field_ident : #target_type,
24002401 }
24012402 }
24022403
24032404 fn deserializer_struct_field_init ( & self , ctx : & Context < ' _ , ' _ > ) -> TokenStream {
2405+ let field_ident = & self . field_ident ;
2406+
24042407 match self . occurs {
24052408 Occurs :: None => quote ! ( ) ,
2406- Occurs :: Single | Occurs :: Optional => quote ! ( content : None , ) ,
2409+ Occurs :: Single | Occurs :: Optional => quote ! ( #field_ident : None , ) ,
24072410 Occurs :: DynamicList | Occurs :: StaticList ( _) => {
24082411 let vec = resolve_build_in ! ( ctx, "::alloc::vec::Vec" ) ;
24092412
2410- quote ! ( content : #vec:: new( ) , )
2413+ quote ! ( #field_ident : #vec:: new( ) , )
24112414 }
24122415 }
24132416 }
24142417
24152418 fn deserializer_struct_field_finish ( & self , ctx : & mut Context < ' _ , ' _ > ) -> TokenStream {
2419+ let field_ident = & self . field_ident ;
24162420 let convert = match self . occurs {
24172421 Occurs :: None => crate :: unreachable!( ) ,
24182422 Occurs :: Single => {
24192423 if ctx. has_defaultable_content ( ) {
2420- quote ! ( helper. finish_default( self . content ) ?)
2424+ quote ! ( helper. finish_default( self . #field_ident ) ?)
24212425 } else {
2422- quote ! ( helper. finish_content( self . content ) ?)
2426+ quote ! ( helper. finish_content( self . #field_ident ) ?)
24232427 }
24242428 }
24252429 Occurs :: Optional => {
2426- quote ! { self . content }
2430+ quote ! { self . #field_ident }
24272431 }
24282432 Occurs :: DynamicList => {
24292433 let min = self . min_occurs ;
24302434 let max = self . max_occurs . render_opt ( ) ;
24312435
24322436 if ctx. has_defaultable_content ( ) {
2433- quote ! ( helper. finish_vec_default( #min, self . content ) ?)
2437+ quote ! ( helper. finish_vec_default( #min, self . #field_ident ) ?)
24342438 } else {
2435- quote ! ( helper. finish_vec( #min, #max, self . content ) ?)
2439+ quote ! ( helper. finish_vec( #min, #max, self . #field_ident ) ?)
24362440 }
24372441 }
24382442 Occurs :: StaticList ( sz) => {
24392443 if ctx. has_defaultable_content ( ) {
2440- quote ! ( helper. finish_arr_default:: <_, #sz>( self . content ) ?)
2444+ quote ! ( helper. finish_arr_default:: <_, #sz>( self . #field_ident ) ?)
24412445 } else {
2442- quote ! ( helper. finish_arr:: <_, #sz>( self . content ) ?)
2446+ quote ! ( helper. finish_arr:: <_, #sz>( self . #field_ident ) ?)
24432447 }
24442448 }
24452449 } ;
24462450
24472451 quote ! {
2448- content : #convert,
2452+ #field_ident : #convert,
24492453 }
24502454 }
24512455
24522456 fn deserializer_struct_field_fn_store ( & self , ctx : & Context < ' _ , ' _ > ) -> TokenStream {
2457+ let field_ident = & self . field_ident ;
24532458 let target_type = ctx. resolve_type_for_deserialize_module ( & self . target_type ) ;
24542459
24552460 let body = match self . occurs {
@@ -2459,15 +2464,15 @@ impl ComplexDataContent<'_> {
24592464 resolve_quick_xml_ident ! ( ctx, "::xsd_parser_types::quick_xml::ErrorKind" ) ;
24602465
24612466 quote ! {
2462- if self . content . is_some( ) {
2467+ if self . #field_ident . is_some( ) {
24632468 Err ( #error_kind:: DuplicateContent ) ?;
24642469 }
24652470
2466- self . content = Some ( value) ;
2471+ self . #field_ident = Some ( value) ;
24672472 }
24682473 }
24692474 Occurs :: DynamicList | Occurs :: StaticList ( _) => quote ! {
2470- self . content . push( value) ;
2475+ self . #field_ident . push( value) ;
24712476 } ,
24722477 } ;
24732478
0 commit comments