mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-23 19:22:40 +01:00
CGrammar: Fix functions taking function pointer as parameter
This commit is contained in:
parent
a501557d35
commit
c18af75b63
@ -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",
|
||||
};
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user