File tree Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -215,11 +215,6 @@ class QAST::Compiler is HLL::Compiler {
215
215
216
216
# Compile the block.
217
217
my $ block_post := self . as_post($ cu [0 ]);
218
-
219
- # Apply HLL if any.
220
- if $ * HLL {
221
- $ block_post . hll($ * HLL );
222
- }
223
218
224
219
# If we are in compilation mode, or have pre-deserialization or
225
220
# post-deserialization tasks, handle those. Overall, the process
@@ -402,6 +397,13 @@ class QAST::Compiler is HLL::Compiler {
402
397
$ sub . push ($ stmts );
403
398
$ sub . push_pirop(" .return (" ~ $ stmts . result ~ " )" );
404
399
400
+ # Apply HLL if any.
401
+ my $ hll := ' ' ;
402
+ try $ hll := $ * HLL ;
403
+ if $ hll {
404
+ $ sub . hll($ hll );
405
+ }
406
+
405
407
# Set compilation unit ID, name and, if applicable, outer.
406
408
$ sub . subid($ node . cuid);
407
409
if nqp ::istype($ block . outer, BlockInfo) {
Original file line number Diff line number Diff line change @@ -112,6 +112,8 @@ class PIRT::Sub is PIRT::Node {
112
112
has str $ ! subid ;
113
113
has str $ ! pirflags ;
114
114
has str $ ! name ;
115
+ has str $ ! hll ;
116
+ has @ ! namespace ;
115
117
has @ ! loadlibs ;
116
118
117
119
has @ ! nested_blocks ;
@@ -159,6 +161,14 @@ class PIRT::Sub is PIRT::Node {
159
161
@ libs ?? (@ ! loadlibs := @ libs ) !! @ ! loadlibs
160
162
}
161
163
164
+ method hll (* @ value ) {
165
+ @ value ?? ($ ! hll := @ value [0 ]) !! $ ! hll
166
+ }
167
+
168
+ method namespace (@ namespace ? ) {
169
+ @ namespace ?? (@ ! namespace := @ namespace ) !! @ ! namespace
170
+ }
171
+
162
172
method result () {
163
173
nqp ::die(" Cannot use a PIRT::Sub in a context expecting a result" );
164
174
}
@@ -170,6 +180,19 @@ class PIRT::Sub is PIRT::Node {
170
180
for @ ! loadlibs {
171
181
nqp :: push (@ parts , " .loadlib " ~ self . escape($ _ ));
172
182
}
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
+ }
173
196
my $ sub_decl := " .sub " ~ self . escape($ ! name || ' ' );
174
197
if $ ! subid {
175
198
$ sub_decl := $ sub_decl ~ " :subid(" ~ self . escape($ ! subid ) ~ " )" ;
You can’t perform that action at this time.
0 commit comments