From c18af75b630921c8bf6144c3c5be1886dfff55c1 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Fri, 20 Jun 2014 23:16:04 +0000 Subject: [PATCH] CGrammar: Fix functions taking function pointer as parameter --- PBot/VERSION.pm | 2 +- modules/c2english/CGrammar.pm | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 178d2b4e..b5efc12b 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,7 +13,7 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 660, + BUILD_REVISION => 661, BUILD_DATE => "2014-06-20", }; diff --git a/modules/c2english/CGrammar.pm b/modules/c2english/CGrammar.pm index 3ad5e98c..df0fff3a 100644 --- a/modules/c2english/CGrammar.pm +++ b/modules/c2english/CGrammar.pm @@ -1112,17 +1112,22 @@ parameter_list: for(my $i = 0; $i < @parameter_list; $i++) { $return .= $comma; if(ref $parameter_list[$i] eq 'ARRAY') { - my @list = @{$parameter_list[$i]}; + my @list = ::flatten @{$parameter_list[$i]}; if(@list == 0) { $return = "no parameters"; } elsif (@list == 1) { $return .= $list[0]; } else { + if(grep { /function.*returning/ } @list) { + push @list, shift @list; + push @list, shift @list; + } $return .= join(' ', @list); } } else { $return .= $parameter_list[$i]; } + if($i == $#parameter_list - 1) { $comma = ' and '; } else {