summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-09-11 17:59:11 -0700
committerFather Chrysostomos <sprout@cpan.org>2014-09-15 06:19:34 -0700
commit9c98a81fd30898ed03895d1368f4f9f2761b69da (patch)
treedfe35ce9e495fa57b119318981480df9b365639a /scope.c
parent4bc93fb921ea9f73602571ed903edcead3956e66 (diff)
downloadperl-9c98a81fd30898ed03895d1368f4f9f2761b69da.tar.gz
op.c:ck_subr: reify GVs based on call checker
Instead of faking up a GV to pass to the call checker if we have a lexical sub, just get the GV from CvGV (since that will reify the GV, even for lexical subs), unless the call checker has not specifically requested GVs. For now, we assume the default call checker cannot handle non-GV sub names, as indeed it cannot. An imminent commit will rectify that. The code in scope.c was getting the name hek from the proto CV (stowed in magic on the pad name) if the CV in the pad had lost it. Now, the proto CV can lose it at compile time via CvGV, so that does not work anymore. Instead, just get it from the GV.
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/scope.c b/scope.c
index 9c8b040735..8229c1a5c2 100644
--- a/scope.c
+++ b/scope.c
@@ -1030,14 +1030,9 @@ Perl_leave_scope(pTHX_ I32 base)
case SVt_PVCV:
{
HEK *hek =
- CvNAME_HEK((CV *)(
CvNAMED(sv)
- ? sv
- : mg_find(PadlistNAMESARRAY(
- CvPADLIST(find_runcv(NULL))
- )[svp-PL_curpad],
- PERL_MAGIC_proto
- )->mg_obj));
+ ? CvNAME_HEK((CV *)sv)
+ : GvNAME_HEK(CvGV(sv));
assert(hek);
share_hek_hek(hek);
cv_undef((CV *)sv);
@@ -1064,19 +1059,16 @@ Perl_leave_scope(pTHX_ I32 base)
case SVt_PVHV: *svp = MUTABLE_SV(newHV()); break;
case SVt_PVCV:
{
+ HEK * const hek = CvNAMED(sv)
+ ? CvNAME_HEK((CV *)sv)
+ : GvNAME_HEK(CvGV(sv));
+
/* Create a stub */
*svp = newSV_type(SVt_PVCV);
/* Share name */
CvNAME_HEK_set(*svp,
- share_hek_hek(CvNAME_HEK((CV *)(
- CvNAMED(sv)
- ? sv
- : mg_find(PadlistNAMESARRAY(
- CvPADLIST(find_runcv(NULL))
- )[svp-PL_curpad],
- PERL_MAGIC_proto
- )->mg_obj))));
+ share_hek_hek(hek));
CvLEXICAL_on(*svp);
break;
}