# New Ticket Created by  Vasily Chekalkin 
# Please include the string:  [perl #60330]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60330 >


Hello.

During investigation of problems with #60168 if found that "if" doensn't 
call 'prefix:?'.
Simple test case:

<bacek_> perl6: if (Bool::True&Bool::False) { say "foo" } else { say "bar" }
<p6eval> pugs: OUTPUT[bar␤]
  ..elf 22847, rakudo 32323: OUTPUT[foo␤]

Attached patch solve this.

(We probably have to add 'prefix:?' to other statements aswell. E.g. 
"while", etc)

-- 
Bacek
diff --git a/languages/perl6/src/parser/actions.pm b/languages/perl6/src/parser/actions.pm
index 803fbce..055430e 100644
--- a/languages/perl6/src/parser/actions.pm
+++ b/languages/perl6/src/parser/actions.pm
@@ -167,7 +167,13 @@ method if_statement($/) {
     $then.blocktype('immediate');
     declare_implicit_immediate_vars($then);
     my $past := PAST::Op.new(
-        $expr, $then,
+        PAST::Op.new(
+            $expr,
+            :name('prefix:?'),
+            :pasttype('call'),
+            :node( $/ )
+        ),
+        $then,
         :pasttype('if'),
         :node( $/ )
     );
@@ -184,7 +190,13 @@ method if_statement($/) {
         $then.blocktype('immediate');
         declare_implicit_immediate_vars($then);
         $past  := PAST::Op.new(
-            $expr, $then, $past,
+            PAST::Op.new(
+                $expr,
+                :name('prefix:?'),
+                :pasttype('call'),
+                :node( $/ )
+            ),
+            $then, $past,
             :pasttype('if'),
             :node( $/ )
         );

Reply via email to