Skip to content

Commit 16694d7

Browse files
committed
Get hll and namespace bits added.
1 parent 6568e10 commit 16694d7

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

src/QAST/Compiler.nqp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,6 @@ class QAST::Compiler is HLL::Compiler {
215215

216216
# Compile the block.
217217
my $block_post := self.as_post($cu[0]);
218-
219-
# Apply HLL if any.
220-
if $*HLL {
221-
$block_post.hll($*HLL);
222-
}
223218

224219
# If we are in compilation mode, or have pre-deserialization or
225220
# post-deserialization tasks, handle those. Overall, the process
@@ -402,6 +397,13 @@ class QAST::Compiler is HLL::Compiler {
402397
$sub.push($stmts);
403398
$sub.push_pirop(".return (" ~ $stmts.result ~ ")");
404399

400+
# Apply HLL if any.
401+
my $hll := '';
402+
try $hll := $*HLL;
403+
if $hll {
404+
$sub.hll($hll);
405+
}
406+
405407
# Set compilation unit ID, name and, if applicable, outer.
406408
$sub.subid($node.cuid);
407409
if nqp::istype($block.outer, BlockInfo) {

src/QAST/PIRT.nqp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ class PIRT::Sub is PIRT::Node {
112112
has str $!subid;
113113
has str $!pirflags;
114114
has str $!name;
115+
has str $!hll;
116+
has @!namespace;
115117
has @!loadlibs;
116118
117119
has @!nested_blocks;
@@ -159,6 +161,14 @@ class PIRT::Sub is PIRT::Node {
159161
@libs ?? (@!loadlibs := @libs) !! @!loadlibs
160162
}
161163
164+
method hll(*@value) {
165+
@value ?? ($!hll := @value[0]) !! $!hll
166+
}
167+
168+
method namespace(@namespace?) {
169+
@namespace ?? (@!namespace := @namespace) !! @!namespace
170+
}
171+
162172
method result() {
163173
nqp::die("Cannot use a PIRT::Sub in a context expecting a result");
164174
}
@@ -170,6 +180,19 @@ class PIRT::Sub is PIRT::Node {
170180
for @!loadlibs {
171181
nqp::push(@parts, ".loadlib " ~ self.escape($_));
172182
}
183+
if $!hll {
184+
nqp::push(@parts, ".HLL " ~ self.escape($!hll));
185+
}
186+
if @!namespace {
187+
my @ns;
188+
for @!namespace {
189+
nqp::push(@ns, self.escape($_));
190+
}
191+
nqp::push(@parts, '.namespace [' ~ nqp::join(';', @ns) ~ ']');
192+
}
193+
else {
194+
nqp::push(@parts, ".namespace []");
195+
}
173196
my $sub_decl := ".sub " ~ self.escape($!name || '');
174197
if $!subid {
175198
$sub_decl := $sub_decl ~ " :subid(" ~ self.escape($!subid) ~ ")";

0 commit comments

Comments
 (0)