This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Deparse: emit pragmas *before* each sub
authorDavid Mitchell <davem@iabyn.com>
Thu, 21 Jul 2016 14:11:50 +0000 (15:11 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Aug 2016 19:54:40 +0000 (20:54 +0100)
commite276dec7f3a8b7912cc237d41056ee43ff1c634d
tree2f672635b82c1c674d28f8ff5f5d970d5af089fd
parentc80ee1fe208b947785e026cdd77cc72a0ede5522
Deparse: emit pragmas *before* each sub

Before deparsing a sub, emit any pragma changes associated with the
first nextstate in the sub *before* emitting the sub itself.

So this:

    use strict;
    sub f { ...}

doesn't get deparsed as

    sub f { use strict; ...}

There was already a partial fix for this in pp_nextstate. Making
next_todo() always emit pragmas catches more cases and makes pp_nextstate
simpler.

This is in preparation for deparsing 'use feature "signatures"'.
lib/B/Deparse.pm
lib/B/Deparse.t