Skip to content

Commit 395aa0a

Browse files
committed
Start to compile QAST::CompUnit. Set HLL and compile the contained top-level block.
1 parent cfbc76f commit 395aa0a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/QAST/Compiler.nqp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,23 @@ class QAST::Compiler is HLL::Compiler {
163163

164164
proto method as_post(*@args, *%_) { * }
165165

166+
multi method as_post(QAST::CompUnit $cu) {
167+
# Should have a single child which is the outer block.
168+
if +@($cu) != 1 || !nqp::istype($cu[0], QAST::Block) {
169+
nqp::die("QAST::CompUnit should have one child that is a QAST::Block");
170+
}
171+
172+
# Compile the block.
173+
my $block_post := self.as_post($cu[0]);
174+
175+
# Apply HLL if any.
176+
if $cu.hll {
177+
$block_post.hll($cu.hll);
178+
}
179+
180+
$block_post
181+
}
182+
166183
multi method as_post(QAST::Block $node) {
167184
# Build the POST::Sub.
168185
my $sub;

0 commit comments

Comments
 (0)