Skip to content

Commit

Permalink
Compile time error for hash variable in regex, where possible
Browse files Browse the repository at this point in the history
Improves on #1367 a bit
  • Loading branch information
moritz committed Jan 6, 2018
1 parent 00797d0 commit 34160bf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Perl6/Actions.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -9990,6 +9990,10 @@ class Perl6::RegexActions is QRegex::P6Regex::Actions does STDActions {
}
}

if $<var><sigil> eq '%' {
$<var>.typed_panic('X::Syntax::Reserved', :reserved('use of hash variables in regexes'))
}

# Otherwise, slow path that checks what we have.
make QAST::Regex.new(QAST::NodeList.new(
QAST::SVal.new( :value('INTERPOLATE') ),
Expand Down

0 comments on commit 34160bf

Please sign in to comment.