Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'ex-hardening' into nom
  • Loading branch information
moritz committed Jun 25, 2012
2 parents 53fc0ae + 50774a3 commit 094e41b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/core/Backtrace.pm
Expand Up @@ -8,7 +8,7 @@ my class Backtrace is List {
has Mu $.code;
has Str $.subname;

method subtype {
method subtype(Frame:D:) {
my $s = $!code.^name.lc.split('+', 2)[0];
$s eq 'mu' ?? '' !! $s;
}
Expand All @@ -19,9 +19,9 @@ my class Backtrace is List {
" in {$s}$.subname at {$.file}:$.line\n"
}

method is-hidden { $!code.?is_hidden_from_backtrace }
method is-routine { $!code ~~ Routine }
method is-setting { $!file eq 'src/gen/CORE.setting' }
method is-hidden(Frame:D:) { $!code.?is_hidden_from_backtrace }
method is-routine(Frame:D:) { $!code ~~ Routine }
method is-setting(Frame:D:) { $!file eq 'src/gen/CORE.setting' }
}
proto method new(|$) {*}

Expand Down Expand Up @@ -61,7 +61,7 @@ my class Backtrace is List {
$new;
}

method next-interesting-index(Int $idx is copy = 0) {
method next-interesting-index(Backtrace:D: Int $idx is copy = 0) {
++$idx;
# NOTE: the < $.end looks like an off-by-one error
# but it turns out that a simple perl6 -e 'die "foo"'
Expand All @@ -74,7 +74,7 @@ my class Backtrace is List {
Int;
}

method outer-caller-idx(Int $startidx is copy) {
method outer-caller-idx(Backtrace:D: Int $startidx is copy) {
my %print;
my $start = self.at_pos($startidx).code;
return $startidx.list unless $start;
Expand All @@ -95,7 +95,7 @@ my class Backtrace is List {
return @outers;
}

method nice(:$oneline) {
method nice(Backtrace:D: :$oneline) {
try {
my @frames;
my Int $i = self.next-interesting-index(-1);
Expand All @@ -104,6 +104,7 @@ my class Backtrace is List {
while $oneline && $i.defined
&& self.at_pos($i).is-setting;

last unless $i.defined;
my $prev = self.at_pos($i);
if $prev.is-routine {
@frames.push: $prev;
Expand All @@ -121,7 +122,7 @@ my class Backtrace is List {
return @frames.join;
CATCH {
default {
return "<Internal error while creating backtrace: $!.message().\n"
return "<Internal error while creating backtrace: $_.message() $_.backtrace.full().\n"
~ "Please report this as a bug (mail to rakudobug@perl.org)\n",
~ "and re-run with the --ll-exception command line option\n"
~ "to get more information about your error>";
Expand Down

0 comments on commit 094e41b

Please sign in to comment.