Skip to content

Commit

Permalink
RakuAST: fix ::Name.is-empty and add ::Name::Part::Empty.name
Browse files Browse the repository at this point in the history
The latter for convenience really, as handling of ::Name::Part::Empty
and an empty string of one of the parts in ::Name should be the same.
  • Loading branch information
lizmat committed Aug 13, 2023
1 parent 941143d commit 011d2ce
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Raku/ast/name.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class RakuAST::Name
}

method is-empty() {
(!nqp::elems($!parts) || self.is-identifier && $!parts[0].name eq '') ?? True !! False
nqp::elems($!parts) == 0
|| (nqp::elems($!parts) == 1 && $!parts[0].name eq '')
}

method is-simple() {
Expand Down Expand Up @@ -408,4 +409,6 @@ class RakuAST::Name::Part::Empty
method IMPL-QAST-PACKAGE-LOOKUP-PART(RakuAST::IMPL::QASTContext $context, Mu $stash-qast, Int $is-final, str :$sigil, Bool :$global-fallback) {
$stash-qast
}

method name() { "" }
}

0 comments on commit 011d2ce

Please sign in to comment.