This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #115066] Fix wrongly nested ‘use’ deparsing
authorFather Chrysostomos <sprout@cpan.org>
Sat, 15 Nov 2014 17:56:50 +0000 (09:56 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 15 Nov 2014 18:58:52 +0000 (10:58 -0800)
commitd88d1fe0d14de0ef0ec01efc190c3a77e59a1459
treec5e14b1502776a164a33b62f0272ca81b5c778cc
parentc62df97fd6a0ef53562060054f04dfeadb67f5f8
[perl #115066] Fix wrongly nested ‘use’ deparsing

B::Deparse was incorrectly putting ‘use’ statements and BEGIN blocks
inside other ‘use’ statements containing do-blocks, even if they were
originally outside.

Subroutines (except for cloned closures, which we don’t have to worry
about here) have an OUTSIDE pointer, pointing to the outer sub con-
taining the declaration of the sub in question.  So we can check that
to make sure we are putting the sub declaration in the right place.

Not only does this fix the reported case, but it also will allow
sequence numbers in inner subs to be reused by statements in outer
subs, which I may need in a future commit.
lib/B/Deparse.pm
lib/B/Deparse.t