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 /perly.h | |
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 'perly.h')
-rw-r--r-- | perly.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -256,6 +256,6 @@ typedef union YYSTYPE /* Generated from: - * aa8cc2f0979e92f76ac0fbc21000e975a6a443beed009e907eddb57f3d8dbe6a perly.y + * 20fd9dcde08a4a26833ba7bf337260d78986b6542a0f55c00d7a9245af45faf5 perly.y * d1d4df7b8e30ac9dede664af9179e6e5e7ddc7f2ad9c4eff9e2e5b32c9e16a6e regen_perly.pl * ex: set ro: */ |