Skip to content

Instantly share code, notes, and snippets.

@Xliff
Created February 7, 2023 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xliff/b228b05633ac2c5406d8bad6502c7a06 to your computer and use it in GitHub Desktop.
Save Xliff/b228b05633ac2c5406d8bad6502c7a06 to your computer and use it in GitHub Desktop.
Patch for RakuAST::Deparse for where clause and literal parameters

Does anyone see a problem with this? If so, I will submit the PR.

diff --git a/src/core.c/RakuAST/Deparse.pm6 b/src/core.c/RakuAST/Deparse.pm6
index ef073dbba..62410a414 100644
--- a/src/core.c/RakuAST/Deparse.pm6
+++ b/src/core.c/RakuAST/Deparse.pm6
@@ -619,6 +619,9 @@ class RakuAST::Deparse {
         my $target := $ast.target;
 
         my str @parts;
+       if $ast.value -> $value {
+           return $value.raku;
+       }
         if $ast.type -> $type {
             my str $deparsed = self.deparse($type);
             if $deparsed ne 'Any' {
@@ -673,6 +676,11 @@ class RakuAST::Deparse {
             }
         }
 
+       if $.where {
+           @parts.push(' ');
+           @parts.push( $.where.DEPARSE );
+       }
+
         @parts.join
     }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment