Skip to content

Commit

Permalink
RakuAST: fix handling of L<C<foo>>
Browse files Browse the repository at this point in the history
Aka, a L<> or X<> with a markup code and *no* | or meta info.  This
could be considered a user error, but it should handle this without
dying.
  • Loading branch information
lizmat committed Jul 2, 2023
1 parent 15f9685 commit 1beeb16
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/core.c/RakuAST/Fixups.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,20 @@ augment class RakuAST::Doc::Markup {
# extract any meta information from the last atom
method !extract-meta() {
my @atoms = self.atoms;
my ($str,$meta) = @atoms.tail.split('|', 2);
if $meta {
$str ?? (@atoms[*-1] = $str) !! @atoms.pop;
self.set-atoms(@atoms.List);
$meta
my $last := @atoms.tail;
if nqp::istype($last,Str) {
my ($str,$meta) = @atoms.tail.split('|', 2);
if $meta {
$str ?? ($last = $str) !! @atoms.pop;
self.set-atoms(@atoms.List);
$meta
}
else {
Nil
}
}

# missing | while there *are* atoms
else {
Nil
}
Expand Down

0 comments on commit 1beeb16

Please sign in to comment.