X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/73f3e22850d9df38d36bbb15f00ded7dcce63f27..12641c3bc3b66b6b08b7feeca89a7cc24aa0fe9c:/perly.y diff --git a/perly.y b/perly.y index 0b94075..91a7613 100644 --- a/perly.y +++ b/perly.y @@ -84,7 +84,7 @@ %token FUNC0 FUNC1 FUNC UNIOP LSTOP %token RELOP EQOP MULOP ADDOP %token DOLSHARP DO HASHBRACK NOAMP -%token LOCAL MY MYSUB REQUIRE +%token LOCAL MY REQUIRE %token COLONATTR FORMLBRACK FORMRBRACK %type grammar remember mremember @@ -276,15 +276,17 @@ fullstmt: barestmt labfullstmt: LABEL barestmt { - $$ = newSTATEOP(SvUTF8(((SVOP*)$1)->op_sv), - savepv(SvPVX(((SVOP*)$1)->op_sv)), $2); + $$ = newSTATEOP(SVf_UTF8 + * PVAL($1)[strlen(PVAL($1))+1], + PVAL($1), $2); TOKEN_GETMAD($1, $2 ? cLISTOPx($$)->op_first : $$, 'L'); } | LABEL labfullstmt { - $$ = newSTATEOP(SvUTF8(((SVOP*)$1)->op_sv), - savepv(SvPVX(((SVOP*)$1)->op_sv)), $2); + $$ = newSTATEOP(SVf_UTF8 + * PVAL($1)[strlen(PVAL($1))+1], + PVAL($1), $2); TOKEN_GETMAD($1, cLISTOPx($$)->op_first, 'L'); } ; @@ -324,6 +326,15 @@ barestmt: PLUGSTMT || strEQ(name, "UNITCHECK")) CvSPECIAL_on(PL_compcv); } + else + /* State subs inside anonymous subs need to be + clonable themselves. */ + if (CvANON(CvOUTSIDE(PL_compcv)) + || CvCLONE(CvOUTSIDE(PL_compcv)) + || !PadnameIsSTATE(PadlistNAMESARRAY(CvPADLIST( + CvOUTSIDE(PL_compcv) + ))[$2->op_targ])) + CvCLONE_on(PL_compcv); PL_parser->in_my = 0; PL_parser->in_my_stash = NULL; } @@ -355,18 +366,6 @@ barestmt: PLUGSTMT #endif intro_my(); } - | MYSUB startsub subname proto subattrlist subbody - { - /* Unimplemented "my sub foo { }" */ - SvREFCNT_inc_simple_void(PL_compcv); -#ifdef MAD - $$ = newMYSUB($2, $3, $4, $5, $6); - token_getmad($1,$$,'d'); -#else - newMYSUB($2, $3, $4, $5, $6); - $$ = (OP*)NULL; -#endif - } | PACKAGE WORD WORD ';' { #ifdef MAD @@ -1000,7 +999,7 @@ termbinop: term ASSIGNOP term /* $x = $y */ op = (UNOP*)op->op_first; /* get to flip */ op = (UNOP*)op->op_first; /* get to range */ token_getmad($2,(OP*)op,'o'); - }) + }); } | term ANDAND term /* $x && $y */ { $$ = newLOGOP(OP_AND, 0, $1, $3); @@ -1236,7 +1235,7 @@ term : termbinop } token_getmad($2,op,'('); token_getmad($4,op,')'); - }) + }); } | NOAMP subname optlistexpr /* foo(@args) */ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, @@ -1350,7 +1349,7 @@ myattrterm: MY myterm myattrlist token_getmad($1,$$,'d'); append_madprops($3->op_madprop, $$, 'a'); $3->op_madprop = 0; - ) + ); } | MY myterm { $$ = localize($2,IVAL($1));