#1464: NQP-rx doesn't handle bare "return" from nested block correctly.
-----------------------------+----------------------------------------------
 Reporter:  Austin_Hastings  |       Owner:  pmichaud
     Type:  bug              |      Status:  new     
 Priority:  normal           |   Milestone:          
Component:  nqp              |     Version:  2.1.0   
 Severity:  medium           |    Keywords:          
     Lang:                   |       Patch:          
 Platform:                   |  
-----------------------------+----------------------------------------------
 In a nested loop with nested lexicals (requiring a block), a return with
 no argument does not escape the sub.

 {{{
 aus...@andlinux:~/kakapo$ cat test.nqp
 sub test1(@items) {
         for @items {
                 my $temp := $_;

                 if $temp == 2 {
                         return 0;
                 }
         }

         say("Test1 never finishes");
 }

 sub test2(@items) {

         for @items {
                 my $temp := $_;

                 if $temp == 2 {
                         return;
                 }
         }

         say("Test2 never finishes");
 }

 my @items := (1, 2, 3);
 test1(@items);
 test2(@items);
 aus...@andlinux:~/kakapo$ parrot-nqp test.nqp
 Test2 never finishes
 }}}

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/1464>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to