Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Auto-gen'd protos don't need special vars.
We will never look at them or use them, so don't waste time/space on
having them.
  • Loading branch information
jnthn committed Apr 1, 2014
1 parent baef318 commit 5bdac8b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Perl6/Actions.nqp
Expand Up @@ -3124,6 +3124,22 @@ class Perl6::Actions is HLL::Actions does STDActions {

method onlystar($/) {
my $BLOCK := $*CURPAD;

# Remove special variables; no need for them in onlystar.
my int $i := 0;
my int $n := nqp::elems($BLOCK[0]);
while $i < $n {
my $consider := $BLOCK[0][$i];
if nqp::istype($consider, QAST::Var) {
my $name := $consider.name;
if $name eq '$_' || $name eq '$/' || $name eq '$!' {
$BLOCK[0][$i] := QAST::Op.new( :op('null') );
}
}
$i++;
}

# Add dispatching code.
$BLOCK.push(QAST::Op.new(
:op('invokewithcapture'),
QAST::Op.new(
Expand Down

0 comments on commit 5bdac8b

Please sign in to comment.