Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix <-> $_ { } / -> $_ is rw { } pointy blocks.
We accidentally still emitted the code to bind an implicit $_ from the
outer scope, scribbling over the declared parameter $_.
  • Loading branch information
jnthn committed Jun 2, 2014
1 parent f146fec commit bd78aef
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Perl6/Actions.nqp
Expand Up @@ -939,11 +939,19 @@ class Perl6::Actions is HLL::Actions does STDActions {
%sig_info := $<signature>.ast;
@params := %sig_info<parameters>;
if $*IMPLICIT {
$block[0].push(QAST::Op.new(
:op('bind'),
QAST::Var.new( :name('$_'), :scope('lexical') ),
QAST::Op.new( :op('getlexouter'), QAST::SVal.new( :value('$_') ) )
));
my int $declares_topic := 0;
for @params {
if $_<variable_name> eq '$_' {
$declares_topic := 1;
}
}
unless $declares_topic {
$block[0].push(QAST::Op.new(
:op('bind'),
QAST::Var.new( :name('$_'), :scope('lexical') ),
QAST::Op.new( :op('getlexouter'), QAST::SVal.new( :value('$_') ) )
));
}
}
}
else {
Expand Down

0 comments on commit bd78aef

Please sign in to comment.