summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorChip Salzenberg <chip@atlantic.net>1996-12-26 13:07:14 +1200
committerChip Salzenberg <chip@atlantic.net>1996-12-28 06:22:00 +1200
commit07055b4c536e012d70aa7099a086192fbb14e918 (patch)
tree3e0a87f4a64a30f336a29f23aba7fd2aac1b1e58 /pp_hot.c
parent39035d0c756b3e78a63763b830ba26854e6124f8 (diff)
downloadperl-07055b4c536e012d70aa7099a086192fbb14e918.tar.gz
Support named closures
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 41ad9f4893..9633d54e88 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1682,7 +1682,8 @@ PP(pp_entersub)
register CV *cv;
register CONTEXT *cx;
I32 gimme;
- I32 hasargs = (op->op_flags & OPf_STACKED) != 0;
+ bool hasargs = (op->op_flags & OPf_STACKED) != 0;
+ bool may_clone = TRUE;
if (!sv)
DIE("Not a CODE reference");
@@ -1702,14 +1703,17 @@ PP(pp_entersub)
break;
}
cv = (CV*)SvRV(sv);
- if (SvTYPE(cv) == SVt_PVCV)
+ if (SvTYPE(cv) == SVt_PVCV) {
+ may_clone = FALSE;
break;
+ }
/* FALL THROUGH */
case SVt_PVHV:
case SVt_PVAV:
DIE("Not a CODE reference");
case SVt_PVCV:
cv = (CV*)sv;
+ may_clone = FALSE;
break;
case SVt_PVGV:
if (!(cv = GvCV((GV*)sv)))
@@ -1720,6 +1724,9 @@ PP(pp_entersub)
ENTER;
SAVETMPS;
+ if (may_clone && cv && CvCLONE(cv))
+ cv = (CV*)sv_2mortal((SV*)cv_clone(cv));
+
retry:
if (!cv)
DIE("Not a CODE reference");