Skip to content

Commit

Permalink
RakuAST: fixup regex stringification on synthesised ASTs
Browse files Browse the repository at this point in the history
We don't always have a source code to access. Fall back to DEPARSE in
that case.
  • Loading branch information
niner committed Jun 4, 2023
1 parent d320dee commit 4a46ee1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Raku/ast/code.rakumod
Expand Up @@ -2007,7 +2007,7 @@ class RakuAST::RegexThunk
# Create Regex object.
my $regex := nqp::create(Regex);
nqp::bindattr($regex, Code, '$!signature', $signature);
nqp::bindattr_s($regex, Regex, '$!source', self.origin.Str);
nqp::bindattr_s($regex, Regex, '$!source', self.origin ?? self.origin.Str !! self.DEPARSE);
nqp::bindattr($signature, Signature, '$!code', $regex);
$regex
}
Expand Down
4 changes: 2 additions & 2 deletions src/Raku/ast/statementprefixes.rakumod
Expand Up @@ -622,7 +622,7 @@ class RakuAST::StatementPrefix::Phaser::Pre
value => RakuAST::StrLiteral.new(
$condition
?? nqp::hllizefor($condition, 'Raku')
!! $blorst.origin.Str
!! $blorst.origin ?? $blorst.origin.Str !! $blorst.DEPARSE
)
)
)
Expand Down Expand Up @@ -691,7 +691,7 @@ class RakuAST::StatementPrefix::Phaser::Post
value => RakuAST::StrLiteral.new(
$condition
?? nqp::hllizefor($condition, 'Raku')
!! $blorst.origin.Str
!! $blorst.origin ?? $blorst.origin.Str !! $blorst.DEPARSE
)
)
)
Expand Down

0 comments on commit 4a46ee1

Please sign in to comment.