Skip to content

Commit

Permalink
Ensure SIP_OUT argument docs are always included as :returns: directi…
Browse files Browse the repository at this point in the history
…ves even when function returns void
  • Loading branch information
nyalldawson committed Oct 9, 2020
1 parent cddcbe0 commit 0001ec2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/sipify.pl
Expand Up @@ -1303,6 +1303,7 @@ sub detect_non_method_member{
else {
dbg_info('writing comment');
if ( $COMMENT !~ m/^\s*$/ ){
dbg_info('comment isnt empty');
my $doc_prepend = "";
$doc_prepend = "\@DOCSTRINGSTEMPLATE\@" if $COMMENT_TEMPLATE_DOCSTRING == 1;
write_output("CM1", "$doc_prepend%Docstring\n");
Expand All @@ -1311,6 +1312,20 @@ sub detect_non_method_member{
my @out_params = ();
my $waiting_for_return_to_end = 0;
foreach my $comment_line (@comment_lines) {

if ( ( $comment_line =~ m/versionadded:/ || $comment_line =~ m/deprecated:/ ) && $#out_params >= 0 ){
dbg_info('out style parameters remain to flush!');
# member has /Out/ parameters, but no return type, so flush out out_params docs now
my $first_out_param = shift(@out_params);
write_output("CM7", "$doc_prepend:return: - $first_out_param\n");

foreach my $out_param (@out_params) {
write_output("CM7", "$doc_prepend - $out_param\n");
}
write_output("CM7", "$doc_prepend\n");
@out_params = ();
}

# if ( $RETURN_TYPE ne '' && $comment_line =~ m/^\s*\.\. \w/ ){
# # return type must be added before any other paragraph-level markup
# write_output("CM5", ":rtype: $RETURN_TYPE\n\n");
Expand Down

0 comments on commit 0001ec2

Please sign in to comment.