summaryrefslogtreecommitdiff
path: root/perly.y
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2018-02-22 12:11:26 +0000
committerDavid Mitchell <davem@iabyn.com>2018-03-02 13:36:42 +0000
commit50333c9768fa52a79ec159c7a43b40948291861e (patch)
tree91ea2b71a71fc106a9f7c5751c27c6f830ef59ff /perly.y
parentae09f008e4b03a4215db8e3151cfb0ee5f20f004 (diff)
downloadperl-50333c9768fa52a79ec159c7a43b40948291861e.tar.gz
add Perl_init_named_cv() functiom
This moves a block of code out from perly.y into its own function, because it will shortly be needed in more than one place. Should be no functional changes.
Diffstat (limited to 'perly.y')
-rw-r--r--perly.y18
1 files changed, 1 insertions, 17 deletions
diff --git a/perly.y b/perly.y
index 30d8360994..f10cfbdb11 100644
--- a/perly.y
+++ b/perly.y
@@ -275,23 +275,7 @@ barestmt: PLUGSTMT
}
| SUB subname startsub
{
- if ($2->op_type == OP_CONST) {
- const char *const name =
- SvPV_nolen_const(((SVOP*)$2)->op_sv);
- if (strEQ(name, "BEGIN") || strEQ(name, "END")
- || strEQ(name, "INIT") || strEQ(name, "CHECK")
- || 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);
+ init_named_cv(PL_compcv, $2);
parser->in_my = 0;
parser->in_my_stash = NULL;
}