Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
First crack at QAST::Stmt and QAST::Stmts.
  • Loading branch information
jnthn committed Apr 22, 2012
1 parent 3dce35c commit 2a08246
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/QAST/Compiler.nqp
Expand Up @@ -66,13 +66,29 @@ class QAST::Compiler is HLL::Compiler {
# DO ALL THE STUFFS
}
multi method as_post(QAST::Stmt $node) {
self.compile_all_the_stmts($node.list)
}
multi method as_post(QAST::Stmt $node) {
my $orig_reg := $*REGALLOC;
{
my $*REGALLOC := RegAlloc.new($orig_reg);
# COMPILE ALL THE NODES
self.compile_all_the_stmts($node.list)
}
}
method compile_all_the_stmts(@stmts) {
my $last;
my $ops := self.post_new('Ops');
for @stmts {
$last := self.as_post($_);
$ops.push($last);
}
if $last {
$ops.result($last.result);
}
$ops
}

multi method as_post(QAST::IVal $node) {
Expand Down

0 comments on commit 2a08246

Please sign in to comment.