summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-08-05 01:05:45 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-08-05 16:02:01 -0700
commitf32c7e864b6210c7dabe6a78f842c37aa73c56c3 (patch)
treeb6a222fda29c83ac85ef9cdd7a423c31907b3578 /cop.h
parentbb02a38febc60a289c616282d720015be97842a4 (diff)
downloadperl-f32c7e864b6210c7dabe6a78f842c37aa73c56c3.tar.gz
Recursive formats and closures in formats.
Formats called recursively were using the same set of lexicals, so the inner call would stomp on the outer calls vars, usually clearing them when exiting. Previous commits prepared a CvDEPTH field for formats. This commit sets it in P(USH|OP)FORMAT and pushes a new pad in enterwrite. This also allows closures to work properly in formats. Formerly they caused assertion failures in cv_clone. Now cv_clone’s assumptions about CvDEPTH on CvOUTSIDE and find_runcv are met when subs are embed- ded in formats.
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/cop.h b/cop.h
index 041420c211..4cf9fe4027 100644
--- a/cop.h
+++ b/cop.h
@@ -627,6 +627,7 @@ struct block_format {
cx->blk_format.gv = gv; \
cx->blk_format.retop = (retop); \
cx->blk_format.dfoutgv = PL_defoutgv; \
+ CvDEPTH(cv)++; \
SvREFCNT_inc_void(cx->blk_format.dfoutgv)
#define POP_SAVEARRAY() \
@@ -679,6 +680,7 @@ struct block_format {
#define POPFORMAT(cx) \
setdefout(cx->blk_format.dfoutgv); \
+ CvDEPTH(cx->blk_format.cv)--; \
SvREFCNT_dec(cx->blk_format.dfoutgv);
/* eval context */