Skip to content

Commit

Permalink
RakuAST: fix various issues with ApplyPostfix deparsing
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Nov 5, 2023
1 parent fd99f6d commit 12a13c4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core.c/RakuAST/Deparse.rakumod
Expand Up @@ -550,16 +550,18 @@ CODE
}

multi method deparse(RakuAST::ApplyPostfix:D $ast --> Str:D) {
my str $deparsed-postfix = self.deparse($ast.postfix);
my $postfix := $ast.postfix;
my str $deparsed-postfix = self.deparse($postfix);

if $ast.on-topic {
if $ast.on-topic && nqp::istype($postfix,RakuAST::Call::Method) {
$deparsed-postfix
}
else {
my $operand := $ast.operand;
my str $deparsed-operand = self.deparse($operand);

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

0 comments on commit 12a13c4

Please sign in to comment.