Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

do not use a nested class for Backtrace::Frame

mostly so that .WHAT gives the full name
  • Loading branch information...
commit 138213ad4c11320b1213716afcfdc05a90141cbe 1 parent 9428315
@moritz moritz authored
Showing with 20 additions and 20 deletions.
  1. +20 −20 src/core/Backtrace.pm
View
40 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;
+ }
-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;
- }
+ multi method Str(Backtrace::Frame:D:) {
+ my $s = self.subtype;
+ $s ~= ' ' if $s.chars;
+ " in {$s}$.subname at {$.file}:$.line\n"
+ }
- multi method Str(Backtrace::Frame:D:) {
- my $s = self.subtype;
- $s ~= ' ' if $s.chars;
- " in {$s}$.subname at {$.file}:$.line\n"
- }
+ 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' }
+}
- 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' }
- }
+my class Backtrace is List {
proto method new(|$) {*}
multi method new(Exception $e, Int $offset = 0) {
Please sign in to comment.
Something went wrong with that request. Please try again.