summaryrefslogtreecommitdiff
path: root/perly.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-06-30 23:20:25 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-15 22:44:53 -0700
commit764212cf73683dc2fdc86061a1e2cf4193b89919 (patch)
treecb60c2baba72a0945a0aa44120d8b17d9f2f226d /perly.h
parent9ccb8d54fdbdc68755020d2a7cce3b889106c1e1 (diff)
downloadperl-764212cf73683dc2fdc86061a1e2cf4193b89919.tar.gz
Allocate ‘our sub’ in the pad
Currently the name is only allocated there. Nothing fetches it yet. Notes on the implementation: S_pending_ident contains the logic for determining whether $foo or @foo refers to a lexical or package variable. yylex defers to S_pending_ident if PL_pending_ident is set. The KEY_sub case in yylex is changed to set PL_pending_ident instead of using force_word. For package variables (including our), S_pending_ident returns a WORD token, which is the same thing that force_word produces. So *that* aspect of this change does not affect the grammar. However.... The barestmt rule’s SUB branch begins with ‘SUB startsub subname’. startsub is a null rule that creates a new sub in PL_compcv via start_subparse(). subname is defined in terms of WORD and also checks whether this is a special block, turning on CvSPECIAL(PL_compcv) if it is. That flag has to be visible during compilation of the sub. But for a lexical name, such as ‘our foo’, to be allocated in the right pad, it has to come *before* startsub, i.e., ‘SUB subname startsub’. But subname needs to modify the sub that startsub created, set- ting the flag. So I copied (not moved, because MYSUB still uses it) the name-checking code from the subname rule into the SUB branch of barestmt. Now that uses WORD directly instead of invoking subname. That allows the code there to set everything up in the right order.
Diffstat (limited to 'perly.h')
-rw-r--r--perly.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/perly.h b/perly.h
index daa777be2f..eccc2501fa 100644
--- a/perly.h
+++ b/perly.h
@@ -268,6 +268,6 @@ typedef union YYSTYPE
/* Generated from:
- * 580d1bac82838fb0ae1e092010e776fb247f0d4cb68834a166507fae86707700 perly.y
+ * 3e01d5213d0f6a4dd26b90cfb22baf8eaf3c89d8ae0025fdc9e06ec1f871e826 perly.y
* 4a3ced51fe6585f6ec59e65e1ffd74bc976c498b0e6992eaab337219fee72e51 regen_perly.pl
* ex: set ro: */