We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 17a5ef3 commit 302b444Copy full SHA for 302b444
src/QAST/PIRT.nqp
@@ -217,17 +217,22 @@ class PIRT::Sub is PIRT::Node {
217
}
218
219
method pir() {
220
+ my @parts;
221
+ self.collect_sub_pir_into(@parts);
222
+ nqp::join("\n", @parts)
223
+ }
224
+
225
+ method collect_sub_pir_into(@result) {
226
# If we don't already have the sub body, then close the sub now.
227
unless $!cached_pir {
228
self.close_sub();
229
230
- # Our PIR is ourselve plus the PIR of any nested blocks.
- my @parts := [$!cached_pir];
231
+ # Add our PIR followed by that of any nested blocks.
232
+ @result.push($!cached_pir);
233
for @!nested_blocks {
- nqp::push(@parts, $_.pir());
234
+ $_.collect_sub_pir_into(@result);
235
- nqp::join("\n", @parts)
236
237
238
0 commit comments