Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add :named so that we can filter on named subs/methods
  • Loading branch information
lizmat committed Oct 6, 2013
1 parent 7b98f86 commit d45e4da
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/Backtrace.pm
Expand Up @@ -71,15 +71,17 @@ my class Backtrace is List {
$new;
}

method next-interesting-index(Backtrace:D: Int $idx is copy = 0) {
method next-interesting-index(Backtrace:D: Int $idx is copy = 0, :$named) {
++$idx;
# NOTE: the < $.end looks like an off-by-one error
# but it turns out that a simple perl6 -e 'die "foo"'
# has two bt frames from the mainline; so it's OK to never
# consider the last one
loop (; $idx < self.end; ++$idx) {
my $cand = self.at_pos($idx);
return $idx unless $cand.is-hidden;
next if $cand.is-hidden; # hidden is never interesting
next if $named && !$cand.subname; # only want named ones
return $idx;
}
Int;
}
Expand Down

0 comments on commit d45e4da

Please sign in to comment.