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 /proto.h | |
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 'proto.h')
-rw-r--r-- | proto.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -3003,7 +3003,7 @@ PERL_CALLCONV void Perl_op_clear(pTHX_ OP* o) #define PERL_ARGS_ASSERT_OP_CLEAR \ assert(o) -PERL_CALLCONV SV* Perl_op_const_sv(pTHX_ const OP* o, CV* cv) +PERL_CALLCONV SV* Perl_op_const_sv(pTHX_ const OP* o) __attribute__warn_unused_result__; PERL_CALLCONV OP* Perl_op_contextualize(pTHX_ OP* o, I32 context) |