Skip to content

Commit

Permalink
Hopefully fix deparsing of ApplyPostfix
Browse files Browse the repository at this point in the history
Looks like only Methodish things need the '.'
Also make sure there's a space between the Term::Reduce infix op
and the args: [+](1,2,3) would work, but [+]@foo not.
  • Loading branch information
lizmat committed Jan 7, 2023
1 parent d8854eb commit 034ed9a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core.c/RakuAST/Deparse.pm6
Expand Up @@ -27,7 +27,7 @@ class RakuAST::Deparse {

method reduce-open( --> '[') { }
method reduce-triangle(--> '[\\') { }
method reduce-close( --> ']') { }
method reduce-close( --> '] ') { }

method bracket-open( --> '{') { }
method bracket-close(--> '}') { }
Expand Down Expand Up @@ -301,11 +301,11 @@ class RakuAST::Deparse {
}

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

self.deparse($ast.operand)
~ ($postfix.starts-with('(') ?? '' !! '.') # XXX yuck
~ $postfix
~ (nqp::istype($postfix,RakuAST::Call::Methodish) ?? '.' !! '')
~ self.deparse($postfix)
}

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

0 comments on commit 034ed9a

Please sign in to comment.