diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-06-30 20:26:34 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-07-25 23:48:02 -0700 |
commit | 137da2b05b4b7628115049f343163bdaf2c30dbb (patch) | |
tree | f67f94858229947447c68a9676d49af49c593d4b /mro.c | |
parent | d2440203227a535b62a2078d898d0bd993ceac78 (diff) | |
download | perl-137da2b05b4b7628115049f343163bdaf2c30dbb.tar.gz |
[perl #79908] Stop sub inlining from breaking closures
When a closure closes over a variable, it references the variable
itself, as opposed to taking a snapshot of its value.
This was broken by the constant optimisation added for
constant.pm’s sake:
{
my $x;
sub () { $x }; # takes a snapshot of the current value of $x
}
constant.pm no longer uses that mechanism, except on older perls, so
we can remove this hack, causing code like this this to start work-
ing again:
BEGIN{
my $x = 5;
*foo = sub(){$x};
$x = 6
}
print foo; # now prints 6, not 5
Diffstat (limited to 'mro.c')
0 files changed, 0 insertions, 0 deletions