@@ -685,26 +685,28 @@ def dyn_declare(self, lut: SymbolLUT, union: ir.Param[ir.Param.StructUnion]) ->
685685 for s in union .body .alts
686686 if s .has_outputs_deep ()
687687 ]
688- func_get_build_outputs = GenericFunc (
689- name = lut .fn_dyn_union_fn_struct_make_outputs [union .base .id_ ],
690- return_type = "typing.Any" ,
691- docstring_body = "Get build outputs function by command type." ,
692- return_descr = "Build outputs function." ,
693- args = [
694- GenericArg (
695- name = "t" ,
696- docstring = "Command type" ,
697- type = "str" ,
698- )
699- ],
700- body = ["return {" , * indent ([f"{ key } : { value } ," for key , value in items ]), "}.get(t)" ],
701- )
688+ func_get_build_outputs = None
689+ if len (items ):
690+ func_get_build_outputs = GenericFunc (
691+ name = lut .fn_dyn_union_fn_struct_make_outputs [union .base .id_ ],
692+ return_type = "typing.Any" ,
693+ docstring_body = "Get build outputs function by command type." ,
694+ return_descr = "Build outputs function." ,
695+ args = [
696+ GenericArg (
697+ name = "t" ,
698+ docstring = "Command type" ,
699+ type = "str" ,
700+ )
701+ ],
702+ body = ["return {" , * indent ([f"{ key } : { value } ," for key , value in items ]), "}.get(t)" ],
703+ )
702704
703705 # Validate params function lookup
704706 items = [
705707 (self .expr_str (s .body .public_name ), lut .fn_struct_validate_params [s .base .id_ ]) for s in union .body .alts
706708 ]
707- func_get_build_outputs = GenericFunc (
709+ func_struct_validate_params = GenericFunc (
708710 name = lut .fn_dyn_union_fn_struct_validate_params [union .base .id_ ],
709711 return_type = "typing.Any" ,
710712 docstring_body = "Get validate params function by command type." ,
@@ -721,7 +723,8 @@ def dyn_declare(self, lut: SymbolLUT, union: ir.Param[ir.Param.StructUnion]) ->
721723
722724 return [
723725 func_get_build_cargs ,
724- func_get_build_outputs ,
726+ * ([func_get_build_outputs ] if func_get_build_outputs else []),
727+ func_struct_validate_params ,
725728 ]
726729
727730 def _make_typed_dict (self , symbol : ExprType , items : list [tuple [ExprType , ExprType ]]) -> LineBuffer :
0 commit comments