Skip to content

Commit

Permalink
RakuAST: fix deparsing of (foo,bar).baz
Browse files Browse the repository at this point in the history
It was being deparsed as

    foo,bar.baz

which is *not* the same.
  • Loading branch information
lizmat committed Jun 28, 2023
1 parent dd55ffe commit 0550ae7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/core.c/RakuAST/Deparse.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,18 @@ class RakuAST::Deparse {
}

multi method deparse(RakuAST::ApplyPostfix:D $ast --> Str:D) {
($ast.on-topic ?? "" !! self.deparse($ast.operand).chomp)
~ self.deparse($ast.postfix)
my str $deparsed-postfix = self.deparse($ast.postfix);
if $ast.on-topic {
$deparsed-postfix
}
else {
my $operand := $ast.operand;
my str $deparsed-operand = self.deparse($operand);

nqp::istype($operand,RakuAST::ApplyListInfix)
?? '(' ~ $deparsed-operand ~ ')' ~ $deparsed-postfix
!! $deparsed-operand ~ $deparsed-postfix
}
}

multi method deparse(RakuAST::ApplyPrefix:D $ast --> Str:D) {
Expand Down

0 comments on commit 0550ae7

Please sign in to comment.