Skip to content

Commit

Permalink
Do not copy $_ upon immediate block inlining
Browse files Browse the repository at this point in the history
Otherwise, in some circumstances, it can lead to lexical accesses
that were meant to read outer $_ reading the lowered stub one. This
addresses the second issue that was reported in #2601.
  • Loading branch information
jnthn committed Jan 15, 2019
1 parent 623450d commit 08d87f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Perl6/Optimizer.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -3002,7 +3002,7 @@ class Perl6::Optimizer {
# a symbol, do nothing (we just need it for "fallback" purposes).
# Otherwise, copy it and register it in the outer.
my $name := $_.name;
unless $name eq '$*DISPATCHER' || $outer.symbol($name) {
unless $name eq '$*DISPATCHER' || $name eq '$_' || $outer.symbol($name) {
@copy_decls.push($_);
$outer.symbol($name, :scope('lexical'));
}
Expand Down

0 comments on commit 08d87f7

Please sign in to comment.