Skip to content

Commit

Permalink
Don't allow lowering of self if nextcallee is used
Browse files Browse the repository at this point in the history
Also add support for `$*NEXT-DISPATCHER` alongside with `$*DISPATCHER`.
  • Loading branch information
vrurg committed Mar 5, 2020
1 parent 8f015aa commit c7daf15
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/Perl6/Optimizer.nqp
Expand Up @@ -1305,13 +1305,14 @@ class Perl6::Optimizer {

# Poisonous calls.
my %poison_calls := nqp::hash(
'EVAL', NQPMu, '&EVAL', NQPMu,
'EVALFILE', NQPMu, '&EVALFILE', NQPMu,
'callwith', NQPMu, '&callwith', NQPMu,
'callsame', NQPMu, '&callsame', NQPMu,
'nextwith', NQPMu, '&nextwith', NQPMu,
'nextsame', NQPMu, '&nextsame', NQPMu,
'samewith', NQPMu, '&samewith', NQPMu,
'EVAL', NQPMu, '&EVAL', NQPMu,
'EVALFILE', NQPMu, '&EVALFILE', NQPMu,
'callwith', NQPMu, '&callwith', NQPMu,
'callsame', NQPMu, '&callsame', NQPMu,
'nextcallee', NQPMu, '&nextcallee', NQPMu,
'nextwith', NQPMu, '&nextwith', NQPMu,
'nextsame', NQPMu, '&nextsame', NQPMu,
'samewith', NQPMu, '&samewith', NQPMu,
# This is a hack to compensate for Test.pm6 using unspecified
# behavior. The EVAL form of it should be deprecated and then
# removed, at which point this can go away.
Expand Down Expand Up @@ -3041,13 +3042,13 @@ 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' || $name eq '$_' || $outer.symbol($name) {
unless $name eq '$*DISPATCHER' || $name eq '$*NEXT-DISPATCHER' || $name eq '$_' || $outer.symbol($name) {
@copy_decls.push($_);
$outer.symbol($name, :scope('lexical'));
}
}
elsif nqp::istype($_, QAST::Op) && $_.op eq 'takedispatcher' {
# Don't copy the dispatcher take, since the $*DISPATCHER is
elsif nqp::istype($_, QAST::Op) && ($_.op eq 'takedispatcher' || $_.op eq 'takenextdispatcher') {
# Don't copy the dispatcher take, since the $*DISPATCHER and $*NEXT-DISPATCHER are
# also not copied.
}
else {
Expand Down

0 comments on commit c7daf15

Please sign in to comment.