Permalink
Browse files

Merge branch 'ex-hardening' into nom

  • Loading branch information...
2 parents 53fc0ae + 50774a3 commit 094e41bed01d6480f28092c1a4323fcc50b2cfb7 @moritz moritz committed Jun 25, 2012
Showing with 9 additions and 8 deletions.
  1. +9 −8 src/core/Backtrace.pm
View
@@ -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;
}
@@ -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(|$) {*}
@@ -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"'
@@ -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;
@@ -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);
@@ -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;
@@ -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>";

0 comments on commit 094e41b

Please sign in to comment.