File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,10 +18,14 @@ class Function:
1818 def to_string (self ):
1919 """Returns the function as a string."""
2020 spacer = ",\n " + (" " * 8 )
21- returns = spacer .join ([param .to_str_return () for param in self .outputs ])
22- args = spacer .join ([param .to_str_arg () for param in self .inputs ])
21+ args = spacer .join ([param .to_str_arg () for param in sorted (self .inputs , key = lambda x : x .name )])
2322 params = spacer .join ([param .to_str_params () for param in self .inputs ])
2423 function_template = FUNCTION_TO_TEMPLATE_MAPPING [self .function_type ]
24+ if len (self .outputs ) > 1 :
25+ returns = spacer .join ([param .to_str_return () + f"[{ ix } ]" for ix , param in enumerate (self .outputs )])
26+ else :
27+ returns = spacer .join ([param .to_str_return () for param in self .outputs ])
28+
2529 return function_template .substitute (
2630 name = self .name if self .name != "" else "constructor" ,
2731 camel_name = self .camel_case_name if self .name != "" else "constructor" ,
You can’t perform that action at this time.
0 commit comments