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 /embed.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 'embed.h')
-rw-r--r-- | embed.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1183,7 +1183,7 @@ #define nextargv(a) Perl_nextargv(aTHX_ a) #define oopsAV(a) Perl_oopsAV(aTHX_ a) #define oopsHV(a) Perl_oopsHV(aTHX_ a) -#define op_const_sv(a,b) Perl_op_const_sv(aTHX_ a,b) +#define op_const_sv(a) Perl_op_const_sv(aTHX_ a) #define op_unscope(a) Perl_op_unscope(aTHX_ a) #define package_version(a) Perl_package_version(aTHX_ a) #define pad_block_start(a) Perl_pad_block_start(aTHX_ a) |