Skip to content

Commit

Permalink
Some more void context cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Oct 10, 2012
1 parent 00bb439 commit a2cbfa4
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/QAST/Compiler.nqp
Expand Up @@ -369,6 +369,7 @@ class QAST::Compiler is HLL::Compiler {
my @*INNERS := @inners;
my $*HAVE_IMM_ARG := 0;
my $*QAST_BLOCK_NO_CLOSE := 0;
my $*WANT;
my $err;
try {
$stmts := self.compile_all_the_stmts($node.list);
Expand Down Expand Up @@ -588,6 +589,7 @@ class QAST::Compiler is HLL::Compiler {
{
my $*BLOCK := $block;
my $*HLL := 'nqp';
my $*WANT;
$stmts := self.compile_all_the_stmts($node.list);
}

Expand Down Expand Up @@ -633,10 +635,14 @@ class QAST::Compiler is HLL::Compiler {
my $last;
my $ops := PIRT::Ops.new();
$ops.node($node) if $node;
my $i := 0;
my $n := +@stmts;
my int $i := 0;
my int $n := +@stmts;
my $all_void := $*WANT eq 'v';
unless nqp::defined($resultchild) {
$resultchild := $n - 1;
}
for @stmts {
my $void := $i + 1 < $n;
my $void := $all_void || $i != $resultchild;
if $void {
if nqp::istype($_, QAST::Want) {
$_ := want($_, 'v');
Expand All @@ -648,14 +654,11 @@ class QAST::Compiler is HLL::Compiler {
}
$ops.push($last)
unless $void && nqp::istype($_, QAST::Var);
if nqp::defined($resultchild) && $resultchild == $i {
if $resultchild == $i {
$ops.result($last.result);
}
$i := $i + 1;
}
if $last && !nqp::defined($resultchild) {
$ops.result($last.result);
}
$ops
}

Expand Down

0 comments on commit a2cbfa4

Please sign in to comment.