Skip to content

Commit 5202f7d

Browse files
committed
Fix dupe annotation emission.
1 parent eb0c0a3 commit 5202f7d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/QAST/PIRT.nqp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ class PIRT::Sub is PIRT::Node {
210210
211211
# Compile sub contents, collecting any nested blocks.
212212
my @*PIRT_BLOCKS;
213+
my $*SUB_LINE := -1;
213214
nqp::push(@parts, self.children_pir(@!children));
214215
215216
# Sub postlude.
@@ -280,12 +281,15 @@ class PIRT::Ops is PIRT::Node {
280281
}
281282
282283
method pir() {
283-
my $pir := self.children_pir(@!children);
284+
my $ann := '';
284285
if $!node {
285286
my $line := HLL::Compiler.lineof($!node.orig(), $!node.from(), :cache(1));
286-
$pir := ".annotate 'line', $line\n$pir";
287+
if $line != $*SUB_LINE {
288+
$ann := ".annotate 'line', $line\n";
289+
$*SUB_LINE := $line;
290+
}
287291
}
288-
$pir
292+
$ann ~ self.children_pir(@!children);
289293
}
290294
}
291295

0 commit comments

Comments
 (0)