Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Various fixes to QAST::Block.new(QAST::IVal.new(:value(42))) style th…
…ings now actually compile to runnable code.
  • Loading branch information
jnthn committed Apr 22, 2012
1 parent 6b2e5b2 commit 17cc5c8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/QAST/Compiler.nqp
Expand Up @@ -73,7 +73,7 @@ class QAST::Compiler is HLL::Compiler {
my $sub := self.post_new('Sub');
$sub.push($params);
$sub.push($stmts);
$sub.push(".return (" ~ $stmts.result ~ ")");
$sub.push_pirop(".return (" ~ $stmts.result ~ ")");

$sub
}
Expand Down Expand Up @@ -104,15 +104,17 @@ class QAST::Compiler is HLL::Compiler {
}

multi method as_post(QAST::IVal $node) {
~$node.value
self.post_new('Ops', :result(~$node.value))
}

multi method as_post(QAST::NVal $node) {
~$node.value
my $val := ~$node.value;
$val := $val ~ '.0' unless nqp::index($val, '.', 0) >= 0;
self.post_new('Ops', :result($val))
}

multi method as_post(QAST::SVal $node) {
self.escape($node.value)
self.post_new('Ops', :result(self.escape($node.value)))
}

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

0 comments on commit 17cc5c8

Please sign in to comment.