diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm index 3edf6a43d25..652a0e3daa1 100644 --- a/src/Perl6/Actions.pm +++ b/src/Perl6/Actions.pm @@ -54,16 +54,23 @@ class Perl6::Actions is HLL::Actions { } method throw($/, $ex_type, *%opts) { - my $file := pir::find_caller_lex__ps('$?FILES'); - %opts := HLL::Compiler.lineof($/.orig, $/.from); - %opts := pir::isnull($file) - ?? '' - !! $file; # TODO: provide context my $type_found := 1; - my $ex := try { $*ST.find_symbol($ex_type); CATCH { $type_found := 0 } }; + my $ex := try { + CATCH { $type_found := 0 }; + $*ST.find_symbol($ex_type); + }; if $type_found { $ex.new(|%opts).throw; + my $file := pir::find_caller_lex__ps('$?FILES'); + %opts := nqp::box_i( + HLL::Compiler.lineof($/.orig, $/.from), + $*ST.find_symbol(['Int']) + ); + %opts := nqp::box_s( + pir::isnull($file) ?? '' !! $file, + $*ST.find_symbol(['Str']) + ); } else { my @err := ['Error while compiling, type ', nqp::join('::', $ex_type), "\n"]; for %opts -> $key { @@ -1425,7 +1432,7 @@ class Perl6::Actions is HLL::Actions { # Obtain parameters, create signature object and generate code to # call binder. if $block && $ { - $/.CURSOR.panic('Placeholder variable cannot override existing signature'); + self.throw($/, ['X', 'Signature', 'Placeholder']); } my @params := $ ?? $[0].ast !! diff --git a/src/core/Exceptions.pm b/src/core/Exceptions.pm index 8b2b4e2328e..7307b16b112 100644 --- a/src/core/Exceptions.pm +++ b/src/core/Exceptions.pm @@ -38,12 +38,6 @@ my class X::Buf::AsStr is X::Base { } } -my role X::Comp { - has $.filename; - has $.line; - has $.column; -} - my class X::Signature::Placeholder is X::Base does X::Comp { method message() { 'Placeholder variable cannot override existing signature';