Skip to content

Commit

Permalink
Optimize out return decont check on returning self
Browse files Browse the repository at this point in the history
We know that is always decontainerized already.
  • Loading branch information
jnthn committed Mar 25, 2020
1 parent 1e0474d commit 49d1dcd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Perl6/Optimizer.nqp
Expand Up @@ -1582,6 +1582,9 @@ class Perl6::Optimizer {
$last_stmt.scope('attribute');
return $value;
}
if $scope eq 'lexical' && $last_stmt.name eq 'self' {
return $value; # The invocant is always decontainerized
}
}
elsif nqp::istype($last_stmt, QAST::WVal) {
return $value unless nqp::iscont($last_stmt.value);
Expand Down

0 comments on commit 49d1dcd

Please sign in to comment.