Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement &?BLOCK.
We go with a similar approach to $?FILE/$?LINE, which lets us cheaply
get the closure semantics correct (cheaply as in "only pay if the
symbol is used").
  • Loading branch information
jnthn committed Jul 9, 2015
1 parent 3db9326 commit 3bdd0af
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Perl6/Actions.nqp
Expand Up @@ -1983,6 +1983,15 @@ Compilation unit '$file' contained the following violations:
$past := $*W.add_string_constant($*W.current_file);
}
}
elsif $past.name() eq '&?BLOCK' {
if $*IN_DECL eq 'variable' {
$*W.throw($/, 'X::Syntax::Variable::Twigil',
twigil => '?',
scope => $*SCOPE,
);
}
$past := QAST::Op.new( :op('getcodeobj'), QAST::Op.new( :op('curcode') ) );
}
elsif $past.name() eq '$?RAKUDO_MODULE_DEBUG' {
$past := $*W.add_constant('Int','int',+nqp::ifnull(nqp::atkey(nqp::getenvhash(),'RAKUDO_MODULE_DEBUG'),0));
}
Expand Down

0 comments on commit 3bdd0af

Please sign in to comment.