From 08dc36c8807d07a0b3e9f9fd08902d71564b3ed0 Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Sun, 26 Sep 2010 17:06:09 +0200 Subject: [PATCH] walk up to the first non-setting line when printing warnings --- src/Perl6/BacktracePrinter.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Perl6/BacktracePrinter.pm b/src/Perl6/BacktracePrinter.pm index 760adfdf2ca..11b2faccd9e 100644 --- a/src/Perl6/BacktracePrinter.pm +++ b/src/Perl6/BacktracePrinter.pm @@ -16,8 +16,13 @@ method backtrace_for($exception) { # If it's just a warning, then we want to just append a line and # file to the error and be done. if self.is_warning($exception) { - my $location := @backtrace[0]; - $trace := $trace ~ self.backtrace_line(@backtrace[0], @backtrace[0]); + my $i := 0; + while $i < +@backtrace + && @backtrace[$i] eq 'CORE.setting' { + $i++; + } + + $trace := $trace ~ self.backtrace_line(@backtrace[$i], @backtrace[$i]); return $trace; }