@@ -345,30 +345,35 @@ pub(crate) fn generate_node_code(parsed: &ParsedNodeFn) -> syn::Result<TokenStre
345345
346346 let properties = & attributes. properties_string . as_ref ( ) . map ( |value| quote ! ( Some ( #value) ) ) . unwrap_or ( quote ! ( None ) ) ;
347347
348- let node_input_accessor = generate_node_input_references ( parsed, fn_generics, & field_idents, & graphene_core, & identifier) ;
348+ let cfg = if let Some ( cfg) = & attributes. cfg { quote ! ( #[ cfg( #cfg) ] ) } else { quote ! ( ) } ;
349+ let node_input_accessor = generate_node_input_references ( parsed, fn_generics, & field_idents, & graphene_core, & identifier, & cfg) ;
349350 Ok ( quote ! {
350351 /// Underlying implementation for [#struct_name]
351352 #[ inline]
352353 #[ allow( clippy:: too_many_arguments) ]
353354 #vis #async_keyword fn #fn_name <' n, #( #fn_generics, ) * > ( #input_ident: #input_type #( , #field_idents: #field_types) * ) -> #output_type #where_clause #body
354355
356+ #cfg
355357 #[ automatically_derived]
356358 impl <' n, #( #fn_generics, ) * #( #struct_generics, ) * #( #future_idents, ) * > #graphene_core:: Node <' n, #input_type> for #mod_name:: #struct_name<#( #struct_generics, ) * >
357359 #struct_where_clause
358360 {
359361 #eval_impl
360362 }
361363
364+ #cfg
362365 const fn #identifier( ) -> #graphene_core:: ProtoNodeIdentifier {
363366 #graphene_core:: ProtoNodeIdentifier :: new( std:: concat!( #identifier_path, "::" , std:: stringify!( #struct_name) ) )
364367 }
365368
369+ #cfg
366370 #[ doc( inline) ]
367371 pub use #mod_name:: #struct_name;
368372
369373 #[ doc( hidden) ]
370374 #node_input_accessor
371375
376+ #cfg
372377 #[ doc( hidden) ]
373378 mod #mod_name {
374379 use super :: * ;
@@ -434,7 +439,14 @@ pub(crate) fn generate_node_code(parsed: &ParsedNodeFn) -> syn::Result<TokenStre
434439}
435440
436441/// Generates strongly typed utilites to access inputs
437- fn generate_node_input_references ( parsed : & ParsedNodeFn , fn_generics : & [ crate :: GenericParam ] , field_idents : & [ & PatIdent ] , graphene_core : & TokenStream2 , identifier : & Ident ) -> TokenStream2 {
442+ fn generate_node_input_references (
443+ parsed : & ParsedNodeFn ,
444+ fn_generics : & [ crate :: GenericParam ] ,
445+ field_idents : & [ & PatIdent ] ,
446+ graphene_core : & TokenStream2 ,
447+ identifier : & Ident ,
448+ cfg : & TokenStream2 ,
449+ ) -> TokenStream2 {
438450 let inputs_module_name = format_ident ! ( "{}" , parsed. struct_name. to_string( ) . to_case( Case :: Snake ) ) ;
439451
440452 let mut generated_input_accessor = Vec :: new ( ) ;
@@ -479,6 +491,7 @@ fn generate_node_input_references(parsed: &ParsedNodeFn, fn_generics: &[crate::G
479491 }
480492
481493 quote ! {
494+ #cfg
482495 pub mod #inputs_module_name {
483496 use super :: * ;
484497
0 commit comments