Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Things with nested blocks are not inlinable.
There are ways to have nested blocks without a declaration being made;
anonymous subs and thunks are just two examples. This fixes an lvalue
subs regression.
  • Loading branch information
jnthn committed Aug 1, 2014
1 parent 4d347fd commit a8c752b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Perl6/Actions.nqp
Expand Up @@ -2678,14 +2678,20 @@ class Perl6::Actions is HLL::Actions does STDActions {
$arg_num := $arg_num + 1;
}

# Ensure nothing extra is declared.
# Ensure nothing extra is declared and there are no inner blocks.
for @($past[0]) {
if nqp::istype($_, QAST::Var) && $_.scope eq 'lexical' {
my $name := $_.name;
return 0 if $name ne '$*DISPATCHER' && $name ne '$_' &&
$name ne '$/' && $name ne '$!' && $name ne '&?ROUTINE' &&
!nqp::existskey(%arg_placeholders, $name);
}
elsif nqp::istype($_, QAST::Block) {
return 0;
}
elsif nqp::istype($_, QAST::Stmt) && nqp::istype($_[0], QAST::Block) {
return 0;
}
}

# If all is well, we try to build the QAST for inlining. This dies
Expand Down

0 comments on commit a8c752b

Please sign in to comment.