diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/B/Deparse.pm | 5 | ||||
-rw-r--r-- | lib/B/Deparse.t | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm index 31ad998b10..f620db48c1 100644 --- a/lib/B/Deparse.pm +++ b/lib/B/Deparse.pm @@ -3698,8 +3698,9 @@ sub check_proto { my @reals; # An unbackslashed @ or % gobbles up the rest of the args 1 while $proto =~ s/(?<!\\)([@%])[^\]]+$/$1/; + $proto =~ s/^\s*//; while ($proto) { - $proto =~ s/^(\\?[\$\@&%*_]|\\\[[\$\@&%*]+\]|;)//; + $proto =~ s/^(\\?[\$\@&%*_]|\\\[[\$\@&%*]+\]|;)\s*//; my $chr = $1; if ($chr eq "") { return "&" if @args; @@ -3856,7 +3857,7 @@ sub pp_entersub { my $dproto = defined($proto) ? $proto : "undefined"; if (!$declared) { return "$kid(" . $args . ")"; - } elsif ($dproto eq "") { + } elsif ($dproto =~ /^\s*\z/) { return $kid; } elsif ($dproto eq "\$" and is_scalar($exprs[0])) { # is_scalar is an excessively conservative test here: diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index b0ecf395b3..c7af6a0bf6 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -1428,3 +1428,12 @@ print f(); #### # Elements of %# should not be confused with $#{ array } () = ${#}{'foo'}; +#### +# [perl #121050] Prototypes with whitespace +sub _121050(\$ \$) { } +_121050($a,$b); +sub _121050empty( ) {} +() = _121050empty() + 1; +>>>> +_121050 $a, $b; +() = _121050empty + 1; |