summaryrefslogtreecommitdiff
path: root/embed.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-07-05 23:22:21 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-15 22:44:57 -0700
commit5027875589574a2ca6c9fb86193d4c8f720ef004 (patch)
tree3e9dd7504ca98c4a28c71ba1baf65747cc4d2e0d /embed.h
parentf37b842aabb9fad0fb5fe0a4803f30c6ead59c74 (diff)
downloadperl-5027875589574a2ca6c9fb86193d4c8f720ef004.tar.gz
Store state subs in the pad
In making ‘sub foo’ respect previous ‘our sub’ declarations in a recent commit, I actually made ‘state sub foo’ into a syntax error. (At the time, I patched up MYSUB in perly.y to keep the tests for ‘"my sub" not yet implemented’ still working.) Basically, it was creat- ing an empty pad entry, but returning something that perly.y was not expecting. This commit adjusts the grammar to allow the SUB branch of barestmt to accept a PRIVATEREF for its subname, in addition to a WORD. It reuses the subname rule that SUB used to use (before our subs were added), gutting it to remove the special block handling, which SUB now tokes care of. That means the MYSUB rule will no longer turn on CvSPECIAL on the PL_compcv that is going to be thrown away anyway. The code for special blocks (BEGIN, END, etc.) that turns on CvSPECIAL now checks for state subs and skips those. It only applies to our subs and package subs. newMYSUB has now actually been written. It basically duplicates newATTRSUB, except for GV-specific things. It does currently vivify a GV and set CvGV, but I am hoping to change that later. I also hope to merge some of the code later, too. I changed the prototype of newMYSUB to make it easier to use. It is not used anywhere on CPAN and has always simply died, so that should be all right.
Diffstat (limited to 'embed.h')
-rw-r--r--embed.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/embed.h b/embed.h
index def1f16d2a..655a0a1c5c 100644
--- a/embed.h
+++ b/embed.h
@@ -345,6 +345,7 @@
#define newLOGOP(a,b,c,d) Perl_newLOGOP(aTHX_ a,b,c,d)
#define newLOOPEX(a,b) Perl_newLOOPEX(aTHX_ a,b)
#define newLOOPOP(a,b,c,d) Perl_newLOOPOP(aTHX_ a,b,c,d)
+#define newMYSUB(a,b,c,d,e) Perl_newMYSUB(aTHX_ a,b,c,d,e)
#define newNULLLIST() Perl_newNULLLIST(aTHX)
#define newOP(a,b) Perl_newOP(aTHX_ a,b)
#define newPMOP(a,b) Perl_newPMOP(aTHX_ a,b)
@@ -715,7 +716,6 @@
#endif
#if !(defined(PERL_MAD))
#define newFORM(a,b,c) Perl_newFORM(aTHX_ a,b,c)
-#define newMYSUB(a,b,c,d,e) Perl_newMYSUB(aTHX_ a,b,c,d,e)
#endif
#if !defined(HAS_BZERO) && !defined(HAS_MEMSET)
#define my_bzero Perl_my_bzero
@@ -791,7 +791,6 @@
#endif
#if defined(PERL_MAD)
#define newFORM(a,b,c) Perl_newFORM(aTHX_ a,b,c)
-#define newMYSUB(a,b,c,d,e) Perl_newMYSUB(aTHX_ a,b,c,d,e)
#endif
#if defined(UNLINK_ALL_VERSIONS)
#define unlnk(a) Perl_unlnk(aTHX_ a)