Skip to content

Commit

Permalink
Fix blorst to genrate well-nested QAST.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jun 28, 2013
1 parent 78374b7 commit 6b4e594
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/Perl6/Actions.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,9 @@ class Perl6::Actions is HLL::Actions does STDActions {
}

method blorst($/) {
make $<block> ?? $<block>.ast !! make_thunk_ref($<statement>.ast, $/);
make $<block>
?? $<block>.ast
!! make_thunk_ref($<statement>.ast, $/, $*BLORST_BLOCK);
}

# Statement modifiers
Expand Down Expand Up @@ -5428,8 +5430,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
return $closure;
}

sub make_thunk_ref($to_thunk, $/) {
my $block := $*W.push_lexpad($/);
sub make_thunk_ref($to_thunk, $/, $block = $*W.push_lexpad($/)) {
$block.push(QAST::Stmts.new(autosink($to_thunk)));
$*W.pop_lexpad();
reference_to_code_object(
Expand Down
7 changes: 6 additions & 1 deletion src/Perl6/Grammar.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,12 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
}

token blorst {
\s <.ws> [ <?[{]> <block> | <![;]> <statement> || <.missing: 'block or statement'> ]
\s <.ws>
[
| <?[{]> <block>
| <![;]> :my $*BLORST_BLOCK := $*W.push_lexpad($/); <statement>
|| <.missing: 'block or statement'>
]
}

## Statement modifiers
Expand Down

0 comments on commit 6b4e594

Please sign in to comment.