Perl-Critic / PPI

54 stars 44 forks source link

Lexical subroutine doesn't return correct name #260

Closed nanto closed 2 years ago

nanto commented 2 years ago

PPI can parse lexical subroutines but its name is incorrect. Run the following code:

use PPI;
use feature qw(say);

my $doc = PPI::Document->new(\'my sub foo {}');
say $doc->schild(0)->name;

Actual output: sub

Expected output: foo

nanto commented 2 years ago

This problem causes Perl-Critic's problem Perl-Critic/Perl-Critic#955.

oalders commented 2 years ago

Fixed via #261