Skip to content

Commit

Permalink
Deparse ColonPair::Value with strings as :foo<bar>
Browse files Browse the repository at this point in the history
as opposed to :foo('bar'), to make it more match common usage
  • Loading branch information
lizmat committed Jan 7, 2023
1 parent ac5a009 commit 2fb1427
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/core.c/RakuAST/Deparse.pm6
Expand Up @@ -403,11 +403,13 @@ class RakuAST::Deparse {
}

multi method deparse(RakuAST::ColonPair::Value:D $ast --> Str:D) {
':'
~ $ast.named-arg-name
~ $.parens-open
~ self.deparse($ast.value)
~ $.parens-close
my $value := $ast.value;

':' ~ $ast.named-arg-name ~ (
nqp::istype($value,RakuAST::StrLiteral)
?? $.pointy-open ~ $value.value ~ $.pointy-close
!! $.parens-open ~ self.deparse($value) ~ $.parens-close
)
}

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

0 comments on commit 2fb1427

Please sign in to comment.