@@ -639,6 +639,10 @@ QAST::Operations.add_core_op('for', :inlinable(1), -> $qastcomp, $op {
639
639
$ ops . push ($ listpost );
640
640
$ ops . push ($ blockpost );
641
641
642
+ # Get the iterator.
643
+ $ ops . push_pirop(' set' , $ res , $ listpost );
644
+ $ ops . push_pirop(' iter' , $ iter , $ listpost );
645
+
642
646
# Set up exception handler.
643
647
my $ handler := 1 ;
644
648
my $ exc_reg ;
@@ -652,17 +656,12 @@ QAST::Operations.add_core_op('for', :inlinable(1), -> $qastcomp, $op {
652
656
$ ops . push_pirop(' push_eh' , $ exc_reg );
653
657
}
654
658
655
- # Get the iterator.
656
- $ ops . push_pirop(' set' , $ res , $ listpost );
657
- $ ops . push_pirop(' iter' , $ iter , $ listpost );
658
-
659
659
# Loop while we still have values.
660
660
my $ lbl_next := PIRT::Label. new (: name(' for_next' ));
661
661
my $ lbl_redo := PIRT::Label. new (: name(' for_redo' ));
662
662
my $ lbl_done := PIRT::Label. new (: name(' for_done' ));
663
663
$ ops . push ($ lbl_next );
664
664
$ ops . push_pirop(' unless' , $ iter , $ lbl_done );
665
- $ ops . push ($ lbl_redo );
666
665
667
666
# Fetch values.
668
667
my @ valreg ;
@@ -675,6 +674,7 @@ QAST::Operations.add_core_op('for', :inlinable(1), -> $qastcomp, $op {
675
674
}
676
675
677
676
# Emit call.
677
+ $ ops . push ($ lbl_redo );
678
678
$ ops . push_pirop(' call' , $ blockpost , | @ valreg , : result($ res ));
679
679
680
680
# Loop.
0 commit comments