Skip to content

Commit

Permalink
RakuAST: Report filename for unknown symbol exceptions
Browse files Browse the repository at this point in the history
This also fixes warnings when creating the exception message.
  • Loading branch information
niner committed Apr 22, 2024
1 parent 6cf9a5c commit 541a9c7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Raku/ast/resolver.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,14 @@ class RakuAST::Resolver {
my %types;
my %routines;
my @exceptions;
my $filename := nqp::null;
if $!nodes-unresolved-after-check-time {
for $!nodes-unresolved-after-check-time -> $node {
if nqp::isnull($filename) {
$filename := $node.origin
?? $node.origin.source.original-file
!! '<unknown file>';
}
my $problem := $node.undeclared-symbol-details();
if $problem {
$problem.IMPL-REPORT($node, %types, %routines, @exceptions);
Expand All @@ -626,6 +632,7 @@ class RakuAST::Resolver {
}
if %routines || %types {
@exceptions.push: self.build-exception: 'X::Undeclared::Symbols',
:$filename,
:unk_types(nqp::hllizefor(%types, 'Raku')),
:unk_routines(nqp::hllizefor(%routines, 'Raku'));
}
Expand Down

0 comments on commit 541a9c7

Please sign in to comment.