File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -369,6 +369,7 @@ class QAST::Compiler is HLL::Compiler {
369
369
my @ * INNERS := @ inners ;
370
370
my $ * HAVE_IMM_ARG := 0 ;
371
371
my $ * QAST_BLOCK_NO_CLOSE := 0 ;
372
+ my $ * WANT ;
372
373
my $ err ;
373
374
try {
374
375
$ stmts := self . compile_all_the_stmts($ node . list);
@@ -588,6 +589,7 @@ class QAST::Compiler is HLL::Compiler {
588
589
{
589
590
my $ * BLOCK := $ block ;
590
591
my $ * HLL := ' nqp' ;
592
+ my $ * WANT ;
591
593
$ stmts := self . compile_all_the_stmts($ node . list);
592
594
}
593
595
@@ -633,10 +635,14 @@ class QAST::Compiler is HLL::Compiler {
633
635
my $ last ;
634
636
my $ ops := PIRT::Ops. new ();
635
637
$ ops . node($ node ) if $ node ;
636
- my $ i := 0 ;
637
- my $ n := + @ stmts ;
638
+ my int $ i := 0 ;
639
+ my int $ n := + @ stmts ;
640
+ my $ all_void := $ * WANT eq ' v' ;
641
+ unless nqp :: defined ($ resultchild ) {
642
+ $ resultchild := $ n - 1 ;
643
+ }
638
644
for @ stmts {
639
- my $ void := $ i + 1 < $ n ;
645
+ my $ void := $ all_void || $ i != $ resultchild ;
640
646
if $ void {
641
647
if nqp ::istype($ _ , QAST ::Want) {
642
648
$ _ := want ($ _ , ' v' );
@@ -648,14 +654,11 @@ class QAST::Compiler is HLL::Compiler {
648
654
}
649
655
$ ops . push ($ last )
650
656
unless $ void && nqp ::istype($ _ , QAST ::Var);
651
- if nqp :: defined ( $ resultchild ) && $ resultchild == $ i {
657
+ if $ resultchild == $ i {
652
658
$ ops . result($ last . result);
653
659
}
654
660
$ i := $ i + 1 ;
655
661
}
656
- if $ last && ! nqp :: defined ($ resultchild ) {
657
- $ ops . result($ last . result);
658
- }
659
662
$ ops
660
663
}
661
664
You can’t perform that action at this time.
0 commit comments