Skip to content

Commit 80141c2

Browse files
committed
ParseXS: refactor: undef cur_xsub/xbody after use
Currently, the fields cur_xsub and cur_xbody of ExtUtils::ParseXS track the current xsub and body nodes during parsing. This commit undefs them immediately after use so that they can't be inadvertently used elsewhere. The fixups in the previous commit were all discovered by this undeffing.
1 parent 8a6fade commit 80141c2

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,7 @@ EOM
635635
$xsub->parse($self)
636636
or next PARAGRAPH;
637637
$_ = shift @{$self->{line}};
638+
undef $self->{cur_xsub};
638639

639640
$xsub->as_code($self);
640641
$self->{seen_an_XSUB} = 1; # encountered at least one XSUB

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ sub parse {
353353
my $xbody = ExtUtils::ParseXS::Node::xbody->new();
354354
$pxs->{cur_xbody} = $xbody;
355355
$xbody->parse($pxs);
356+
undef $pxs->{cur_xbody};
356357

357358
if (defined $case) {
358359
# make the xbody a child of the CASE

0 commit comments

Comments
 (0)