diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-11-20 09:23:35 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-11-20 20:17:18 -0800 |
commit | 34b54951568575920f2307bea918f5549bd5a82f (patch) | |
tree | aea97f1e1778d7276ecf9b14e817a5f77965109d /ext/B | |
parent | 05be69bb15d7a722ee6bca574d29b98314e34918 (diff) | |
download | perl-34b54951568575920f2307bea918f5549bd5a82f.tar.gz |
[perl #77452] Deparse { ...; BEGIN{} } correctly
8635e3c2 (5.21.6) changed the COP sequence numbers for nested blocks,
such that most BEGIN blocks (incl. ‘use’ statements) and sub declara-
tions end up in the right place. However, it had the side effect of
causing declarations at the end of the enclosing scope to fall out of
it and appear below.
This commit fixes that by adding an extra nulled COP to the end of the
enclosing scope if that scope ends with a sub, so the final declara-
tion gets deparsed before it.
The frequency of sub declarations at the end of the enclosing scope is
sufficiently low (I’m guessing a bit here) that this slight increase
in run-time memory usage is probably acceptable.
I had to change B::Deparse to deparse nulled COPs the same way it does
live COPs, which means we get more extraneous semicolons than before.
I hope to fix that in a forthcoming commit. I also ran into a B bug,
in that null ops are not presented to Perl code with the right op
class (see the blessing in the patch). I plan to fix that in a separ-
ate commit, too.
Diffstat (limited to 'ext/B')
-rw-r--r-- | ext/B/t/concise-xs.t | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/B/t/concise-xs.t b/ext/B/t/concise-xs.t index 4959a4ae59..365951d0bc 100644 --- a/ext/B/t/concise-xs.t +++ b/ext/B/t/concise-xs.t @@ -158,7 +158,7 @@ my $testpkgs = { constant => [qw/ ASSIGN CVf_LVALUE CVf_METHOD LIST_CONTEXT OP_CONST OP_LIST OP_RV2SV - OP_AELEM OP_CUSTOM + OP_AELEM OP_CUSTOM OP_NEXTSTATE OP_DBSTATE OP_STRINGIFY OPf_KIDS OPf_MOD OPf_REF OPf_SPECIAL OPf_PARENS OPf_STACKED OPf_WANT OPf_WANT_LIST OPf_WANT_SCALAR |