Skip to content

Instantly share code, notes, and snippets.

@MasterDuke17
Created Mar 21, 2022
Embed
What would you like to do?
diff --git src/Perl6/Optimizer.nqp src/Perl6/Optimizer.nqp
index 423329a1b..44fb5f437 100644
--- src/Perl6/Optimizer.nqp
+++ src/Perl6/Optimizer.nqp
@@ -3216,6 +3216,21 @@ class Perl6::Optimizer {
$found := 1;
}
+ if !$!void_context && nqp::existskey(nqp::getenvhash, 'CALL_NO_WANT') {
+ my int $i := 0;
+ while $i < nqp::elems($op) {
+ my $arg := $op[$i];
+ if nqp::istype($arg, QAST::Want)
+ && nqp::elems($arg) == 3
+ && $op[$i].has_compile_time_value
+ && $arg[1] ne 'v'
+ {
+ $op[$i] := $op[$i][2];
+ }
+ $i++;
+ }
+ }
+
if $found {
# Pure operators can be constant folded.
if nqp::can($obj, 'is-pure') {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment