Skip to content

Commit

Permalink
s/// parts should be thunks, not lexical scopes
Browse files Browse the repository at this point in the history
This difference became observable when a placeholder parameter was used
in either the match or the substitution part, and then tried to attach
to the wrong place. Fixes #3358.
  • Loading branch information
jnthn committed Feb 11, 2020
1 parent 8390016 commit 50ca2ed
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Perl6/Grammar.nqp
Expand Up @@ -3516,10 +3516,10 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
<babble($l)>
{ my $B := $<babble><B>.ast; $lang := $B[0]; $start := $B[1]; $stop := $B[2]; }
{ $*SUBST_LHS_BLOCK := $*W.push_lexpad($/) }
{ $*SUBST_LHS_BLOCK := $*W.push_thunk($/) }
$start <left=.nibble($lang)> [ $stop || { self.fail-terminator($/, $start, $stop) } ]
{ $*W.pop_lexpad() }
{ $*SUBST_RHS_BLOCK := $*W.push_lexpad($/) }
{ $*W.pop_thunk() }
{ $*SUBST_RHS_BLOCK := $*W.push_thunk($/) }
[ <?{ $start ne $stop }>
<.ws>
[ <?[ \[ \{ \( \< ]> <.obs('brackets around replacement', 'assignment syntax')> ]?
Expand All @@ -3531,7 +3531,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
{ $lang := self.quote_lang($lang2, $stop, $stop, @lang2tweaks); }
<right=.nibble($lang)> $stop || <.panic("Malformed replacement part; couldn't find final $stop")>
]
{ $*W.pop_lexpad() }
{ $*W.pop_thunk() }
}
token quote:sym<s> {
Expand Down

0 comments on commit 50ca2ed

Please sign in to comment.