Skip to content

Commit

Permalink
RakuAST: only join if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Sep 12, 2023
1 parent f4c228d commit f67797d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Raku/Actions.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ sub setup-RakuAST-WHO() {
# code, typically resulting in error messages stating a method
# having been called on VMNull.
sub Nodify(*@todo) {
my $parts := nqp::join('::',@todo);

my $res := nqp::atkey($RakuAST-WHO,nqp::shift(@todo));
while @todo && !nqp::isnull($res) {
$res := nqp::atkey($res.WHO,nqp::shift(@todo));
}
nqp::ifnull($res,nqp::die("No such node RakuAST::$parts"))
nqp::ifnull(
$res,
nqp::die('No such node RakuAST::' ~ nqp::join('::',@todo))
)
}

#-------------------------------------------------------------------------------
Expand Down

0 comments on commit f67797d

Please sign in to comment.