@@ -339,7 +339,7 @@ impl CodeGenerator for ShopifyFunctionCodeGenerator {
339339 let field_type = Self :: type_for_field ( executable_struct, field. r#type ( ) , true ) ;
340340
341341 let properly_referenced_value =
342- Self :: reference_variable_for_type ( field. r#type ( ) , & format_ident ! ( "value " ) ) ;
342+ Self :: reference_variable_for_type ( field. r#type ( ) , & format_ident ! ( "value_ref " ) ) ;
343343
344344 let description: Option < syn:: Attribute > = field. description ( ) . map ( |description| {
345345 let description_lit_str = syn:: LitStr :: new ( description, Span :: mixed_site ( ) ) ;
@@ -356,6 +356,7 @@ impl CodeGenerator for ShopifyFunctionCodeGenerator {
356356 let value = self . __wasm_value. get_interned_obj_prop( interned_string_id) ;
357357 shopify_function:: wasm_api:: Deserialize :: deserialize( & value) . unwrap( )
358358 } ) ;
359+ let value_ref = & value;
359360 #properly_referenced_value
360361 }
361362 }
@@ -693,12 +694,16 @@ impl ShopifyFunctionCodeGenerator {
693694 variable : & syn:: Ident ,
694695 ) -> syn:: Expr {
695696 match r#type {
696- WrappedExecutableType :: Base ( _) | WrappedExecutableType :: Vec ( _) => {
697- parse_quote ! { & #variable }
697+ WrappedExecutableType :: Base ( _) => {
698+ parse_quote ! { #variable }
699+ }
700+ WrappedExecutableType :: Vec ( _) => {
701+ parse_quote ! { #variable. as_slice( ) }
698702 }
699703 WrappedExecutableType :: Optional ( inner) => {
700- let inner_reference = Self :: reference_variable_for_type ( inner, variable) ;
701- parse_quote ! { :: std:: option:: Option :: as_ref( #inner_reference) }
704+ let inner_variable = format_ident ! ( "v_inner" ) ;
705+ let inner_reference = Self :: reference_variable_for_type ( inner, & inner_variable) ;
706+ parse_quote ! { :: std:: option:: Option :: as_ref( #variable) . map( |#inner_variable| #inner_reference) }
702707 }
703708 }
704709 }
0 commit comments