Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert "do not use a nested class for Backtrace::Frame"
This reverts commit 138213a.
On my system it causes S02-literals/autoref.t and
S02-literals/pairs.t to each run for over two minutes
(consuming a fair bit of memory), and halts the rest of
the spectest process.
  • Loading branch information
pmichaud committed Jul 9, 2012
1 parent 138213a commit 33633d8
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/core/Backtrace.pm
@@ -1,28 +1,28 @@
my class Exception { ... }

my class Backtrace::Frame {
has Str $.file;
has Int $.line;
has Mu $.code;
has Str $.subname;

method subtype(Backtrace::Frame:D:) {
my $s = $!code.^name.lc.split('+', 2)[0];
$s eq 'mu' ?? '' !! $s;
}

multi method Str(Backtrace::Frame:D:) {
my $s = self.subtype;
$s ~= ' ' if $s.chars;
" in {$s}$.subname at {$.file}:$.line\n"
}
my class Backtrace is List {
class Frame {
has Str $.file;
has Int $.line;
has Mu $.code;
has Str $.subname;

method subtype(Frame:D:) {
my $s = $!code.^name.lc.split('+', 2)[0];
$s eq 'mu' ?? '' !! $s;
}

method is-hidden(Backtrace::Frame:D:) { $!code.?is_hidden_from_backtrace }
method is-routine(Backtrace::Frame:D:) { $!code ~~ Routine }
method is-setting(Backtrace::Frame:D:) { $!file eq 'src/gen/CORE.setting' }
}
multi method Str(Backtrace::Frame:D:) {
my $s = self.subtype;
$s ~= ' ' if $s.chars;
" in {$s}$.subname at {$.file}:$.line\n"
}

my class Backtrace is List {
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(|$) {*}

multi method new(Exception $e, Int $offset = 0) {
Expand Down

0 comments on commit 33633d8

Please sign in to comment.