Make ‘sub foo{}’ respect ‘our foo’
authorFather Chrysostomos <sprout@cpan.org>
Wed, 4 Jul 2012 16:13:17 +0000 (09:13 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 16 Sep 2012 05:44:55 +0000 (22:44 -0700)
commit4210d3f17cf9d854c0cbf0e1afb06e737174f8ea
treeefc39119656264c3e86de28179261818b5c201e9
parent60ac52eb5d5157fbe18e603a2d72ef6249b62083
Make ‘sub foo{}’ respect ‘our foo’

This commit switches all sub definitions, whether with ‘our’ or not,
to using S_force_ident_maybe_lex (formerly known as S_pending_ident).

This means that an unqualified (no our/my/state or package prefix)
‘sub foo’ declaration does a pad lookup, just like $foo.

It turns out that the vivification that I added to the then
S_pending_ident for CVs was unnecessary and actually buggy.  We
*don’t* want to autovivify GVs for CVs, because they might be con-
stants or forward declarations, which are stored in a simpler form.

I also had to change the subname rule used by MYSUB in perly.y, since
it can now be fed a PRIVATEREF, which it does not expect.  This may
prove to be temporary, but it keeps current tests passing.
perly.act
perly.h
perly.tab
perly.y
t/cmd/lexsub.t
toke.c