diff options
author | Chip Salzenberg <chip@atlantic.net> | 1996-12-26 13:07:14 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1996-12-28 06:22:00 +1200 |
commit | 07055b4c536e012d70aa7099a086192fbb14e918 (patch) | |
tree | 3e0a87f4a64a30f336a29f23aba7fd2aac1b1e58 /pp_hot.c | |
parent | 39035d0c756b3e78a63763b830ba26854e6124f8 (diff) | |
download | perl-07055b4c536e012d70aa7099a086192fbb14e918.tar.gz |
Support named closures
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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"); |