}
if (type == padtidy_SUB || type == padtidy_FORMAT) {
+ SV * const * const namep = AvARRAY(PL_comppad_name);
PADOFFSET ix;
for (ix = AvFILLp(PL_comppad); ix > 0; ix--) {
if (SvIMMORTAL(PL_curpad[ix]) || IS_PADGV(PL_curpad[ix]) || IS_PADCONST(PL_curpad[ix]))
continue;
- if (!SvPADMY(PL_curpad[ix]))
+ if (!SvPADMY(PL_curpad[ix])) {
SvPADTMP_on(PL_curpad[ix]);
+ } else if (!SvFAKE(namep[ix])) {
+ /* This is a work around for how the current implementation of
+ ?{ } blocks in regexps interacts with lexicals.
+
+ One of our lexicals.
+ Can't do this on all lexicals, otherwise sub baz() won't
+ compile in
+
+ my $foo;
+
+ sub bar { ++$foo; }
+
+ sub baz { ++$foo; }
+
+ because completion of compiling &bar calling pad_tidy()
+ would cause (top level) $foo to be marked as stale, and
+ "no longer available". */
+ SvPADSTALE_on(PL_curpad[ix]);
+ }
}
}
PL_curpad = AvARRAY(PL_comppad);
pad1a[ix] = sv_dup_inc(oldpad[ix], param);
}
else { /* our own lexical */
- if(SvREFCNT(oldpad[ix]) > 1) {
+ if(SvPADSTALE(oldpad[ix]) && SvREFCNT(oldpad[ix]) > 1) {
+ /* This is a work around for how the current
+ implementation of ?{ } blocks in regexps
+ interacts with lexicals. */
pad1a[ix] = sv_dup_inc(oldpad[ix], param);
} else {
SV *sv;
exit 0;
}
- plan(21);
+ plan(22);
}
use strict;
curr_test(curr_test() + 1);
}
+{
+ my $got;
+ sub more_stuff {
+ my $a;
+ $::b = \$a;
+ if (@_) {
+ $a = "More leakage";
+ threads->create(\&more_stuff)->join();
+ } else {
+ is ($a, undef, 'Just special casing lexicals in ?{ ... }');
+ }
+ }
+
+ more_stuff(1);
+
+ curr_test(curr_test() + 1);
+}
+
# EOF