Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix loop code-gen.
  • Loading branch information
jnthn committed Jul 14, 2012
1 parent f97e527 commit 8700bce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/QPerl6/Actions.pm
Expand Up @@ -746,9 +746,12 @@ class QPerl6::Actions is HLL::Actions {
method statement_control:sym<loop>($/) {
my $block := pblock_immediate($<block>.ast);
my $cond := $<e2> ?? $<e2>[0].ast !! QAST::Var.new(:name<True>, :scope<lexical>);
my $loop := QAST::Op.new( $cond, $block, :op('while'), :node($/) );
my $loop := QAST::Op.new( $cond, :op('while'), :node($/) );
if $<e3> {
$loop.push( $<e3>[0].ast );
$loop.push(QAST::Stmts.new( $block, $<e3>[0].ast ));
}
else {
$loop.push($block);
}
if $<e1> {
$loop := QAST::Stmts.new( $<e1>[0].ast, $loop, :node($/) );
Expand Down

0 comments on commit 8700bce

Please sign in to comment.