summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-08-04 17:54:32 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-08-04 17:54:32 -0700
commitf91073d438e1f6952add377836e416c47505261f (patch)
treef094e467ae98a680cbbfb1c9759ec571dd5555b7 /pad.c
parentcae5dbbe30ba4a96ff5e570be0d90779f06fee71 (diff)
downloadperl-f91073d438e1f6952add377836e416c47505261f.tar.gz
pad.c:cv_clone: add assertions
The outer sub should always be active and have a pad if it is a sub that is being cloned. Only formats can have an inactive or padless outside. Add assertions to that effect.
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/pad.c b/pad.c
index 1e796e7ab4..8deae8e5f1 100644
--- a/pad.c
+++ b/pad.c
@@ -2010,6 +2010,7 @@ Perl_cv_clone(pTHX_ CV *proto)
outpad = CvPADLIST(outside)
? AvARRAY(AvARRAY(CvPADLIST(outside))[depth])
: NULL;
+ assert(outpad || SvTYPE(cv) == SVt_PVFM);
for (ix = fpad; ix > 0; ix--) {
SV* const namesv = (ix <= fname) ? pname[ix] : NULL;
@@ -2022,6 +2023,7 @@ Perl_cv_clone(pTHX_ CV *proto)
if (!outpad || !(sv = outpad[PARENT_PAD_INDEX(namesv)])
|| ( SvPADSTALE(sv) && !SvPAD_STATE(namesv)
&& !CvDEPTH(outside)) ) {
+ assert(SvTYPE(cv) == SVt_PVFM);
Perl_ck_warner(aTHX_ packWARN(WARN_CLOSURE),
"Variable \"%"SVf"\" is not available", namesv);
sv = NULL;