Skip to content

Commit

Permalink
clearer error when get PP index wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Dec 17, 2024
1 parent 40ca671 commit b26fd1f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/PDL/PP/PdlParObj.pm
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,12 @@ sub do_indterm { my($this,$pdl,$ind,$subst,$context) = @_;
my $index = delete($subst->{$substname}) //
# No => get the one from the nearest context.
(grep $_ eq $substname, map $_->[1], reverse @$context)[0];
croak "pp_def($this->{Sig}{OpName}): Access Index not found: $pdl, $ind, @{[$this->{IndObjs}[$ind]->name]}
On stack:".(join ' ',map {"($_->[0],$_->[1])"} @$context)."\n"
if !defined $index;
return "(".($this->get_incname($ind,1))."*($index))";
if (!defined $index) {
croak "pp_def($this->{Sig}{OpName}): no value given for ndarray '$pdl' index '$substname'
You supplied (@{[sort keys %$subst]})
On stack: ".(join ' ',map {"($_->[0],$_->[1])"} @$context)."\n"
}
"(".($this->get_incname($ind,1))."*($index))";
}
sub get_xsdatapdecl {
Expand Down

0 comments on commit b26fd1f

Please sign in to comment.