Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix regression in s.m. given/for.
We accidentally relocated blocks occurring in a statement modifier
into the thunk for given and for, rather than just the ones in the
statement. Need an extra bit of state to fix this, as we still want
to do the move when we're doing blorst thunks.
  • Loading branch information
jnthn committed Apr 28, 2015
1 parent feca211 commit 4b39cd5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Perl6/Actions.nqp
Expand Up @@ -6922,7 +6922,9 @@ Compilation unit '$file' contained the following violations:
$block.push($past);
$*W.pop_lexpad();
if nqp::defined($migrate_stmt_id) {
migrate_blocks($*W.cur_lexpad(), $block, -> $b { $b.ann('statement_id') == $migrate_stmt_id });
migrate_blocks($*W.cur_lexpad(), $block, -> $b {
!$b.ann('in_stmt_mod') && $b.ann('statement_id') == $migrate_stmt_id
});
}
($*W.cur_lexpad())[0].push($block);
my $param := hash( :variable_name('$_'), :nominal_type($*W.find_symbol(['Mu'])));
Expand Down
4 changes: 3 additions & 1 deletion src/Perl6/Grammar.nqp
Expand Up @@ -1039,6 +1039,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
:my $*IN_REGEX_ASSERTION := 0;
:my $*IN_PROTO := 0; # are we inside a proto?
:my $*NEXT_STATEMENT_ID := 1; # to give each statement an ID
:my $*IN_STMT_MOD := 0; # are we inside a statement modifier?

# Various interesting scopes we'd like to keep to hand.
:my $*GLOBALish;
Expand Down Expand Up @@ -1366,13 +1367,14 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
:my $*SCOPE := '';
:my $*ACTIONS := %*LANG<MAIN-actions>;
:my $*STATEMENT_ID := $*NEXT_STATEMENT_ID++;
:my $*IN_STMT_MOD := 0;
<!before <[\])}]> | $ >
<!stopper>
<!!{ nqp::rebless($/.CURSOR, %*LANG<MAIN>) }>
[
| <label> <statement($*LABEL)> { $*LABEL := '' if $*LABEL }
| <statement_control>
| <EXPR> :dba('statement end')
| <EXPR> :dba('statement end') { $*IN_STMT_MOD := 1 }
[
|| <?MARKED('endstmt')>
|| :dba('statement modifier') <.ws> <statement_mod_cond> <statement_mod_loop>?
Expand Down
1 change: 1 addition & 0 deletions src/Perl6/World.nqp
Expand Up @@ -250,6 +250,7 @@ class Perl6::World is HLL::World {
$pad.annotate('outer', @!BLOCKS[+@!BLOCKS - 1]);
}
$pad.annotate('statement_id', $*STATEMENT_ID);
$pad.annotate('in_stmt_mod', $*IN_STMT_MOD);
@!BLOCKS[+@!BLOCKS] := $pad;
$pad
}
Expand Down

0 comments on commit 4b39cd5

Please sign in to comment.