summaryrefslogtreecommitdiff
path: root/perly.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-07-09 06:29:09 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-15 22:45:01 -0700
commite07561e6ac7f381061f112bee32ebc779683a84c (patch)
tree86ad55151c90232dceb0b431f846beafe5434a56 /perly.h
parent20d337866901b1d0118edc4ff2cb2407b27e0275 (diff)
downloadperl-e07561e6ac7f381061f112bee32ebc779683a84c.tar.gz
Clone state subs in anon subs
Since state variables are not shared between closures, but only between invocations of the same closure, state subs should behave the same way. This was a little tricky. When we clone a sub, we now clone inner state subs at the same time. When walking through the pad, cloning items, we cannot simply clone the inner sub when we see it, because it may close over things we haven’t cloned yet: sub { state sub foo; my $x sub foo { $x } } We can’t just delay cloning it and do it afterwards, because they may be multiple subs closing over each other: sub { state sub foo; state sub bar; sub foo { \&bar } sub bar { \&foo } } So *all* the entries in the new pad must be filled before any inner subs can be cloned. So what we do is put a stub in place of the cloned sub. And then in a second pass clone the inner subs, reusing the stubs from the first pass.
Diffstat (limited to 'perly.h')
-rw-r--r--perly.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/perly.h b/perly.h
index 1758c4127e..ae7b1f5aab 100644
--- a/perly.h
+++ b/perly.h
@@ -268,6 +268,6 @@ typedef union YYSTYPE
/* Generated from:
- * 46a0f37bedef614c67088ca538be1a60acad74ce92b27d0244bd16b23eb7fd8d perly.y
+ * 38ce4bf3d0e9f8cfd35795d89907c7d03583b561b55406230d749c80d62d5e06 perly.y
* 4a3ced51fe6585f6ec59e65e1ffd74bc976c498b0e6992eaab337219fee72e51 regen_perly.pl
* ex: set ro: */