summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2002-12-19 19:00:21 +0000
committerhv <hv@crypt.org>2003-01-03 11:06:40 +0000
commitd9d18af660f47fb8e7eedfe8204daab3270e514f (patch)
tree6848c806a377785585348c08e5b91d127aea32bb /scope.c
parent235cc2e3b03f7c8478aa5ccdbe27e0aaf735bb46 (diff)
downloadperl-d9d18af660f47fb8e7eedfe8204daab3270e514f.tar.gz
new flag SvPADSTALE
Message-ID: <20021219190021.D9530@fdgroup.com> p4raw-id: //depot/perl@18410
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/scope.c b/scope.c
index d3a4c3611a..bfd2969464 100644
--- a/scope.c
+++ b/scope.c
@@ -548,6 +548,7 @@ Perl_save_clearsv(pTHX_ SV **svp)
SSCHECK(2);
SSPUSHLONG((long)(svp-PL_curpad));
SSPUSHINT(SAVEt_CLEARSV);
+ SvPADSTALE_off(*svp); /* mark lexical as active */
}
void
@@ -918,6 +919,7 @@ Perl_leave_scope(pTHX_ I32 base)
(void)SvOOK_off(sv);
break;
}
+ SvPADSTALE_on(sv); /* mark as no longer live */
}
else { /* Someone has a claim on this, so abandon it. */
U32 padflags = SvFLAGS(sv) & (SVs_PADMY|SVs_PADTMP);
@@ -927,7 +929,9 @@ Perl_leave_scope(pTHX_ I32 base)
default: *(SV**)ptr = NEWSV(0,0); break;
}
SvREFCNT_dec(sv); /* Cast current value to the winds. */
- SvFLAGS(*(SV**)ptr) |= padflags; /* preserve pad nature */
+ /* preserve pad nature, but also mark as not live
+ * for any closure capturing */
+ SvFLAGS(*(SV**)ptr) |= padflags & SVs_PADSTALE;
}
break;
case SAVEt_DELETE: