Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
allow useless use of &foo and other symbols too
  • Loading branch information
TimToady committed Dec 13, 2015
1 parent c64a401 commit 4b13795
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Perl6/Optimizer.nqp
Expand Up @@ -1751,14 +1751,15 @@ class Perl6::Optimizer {
my str $name := try $!symbols.find_lexical_symbol($var.name)<descriptor>.name;
$name := $var.name unless $name;
my str $sigil := nqp::substr($name, 0, 1);
if $sigil eq '$' || $sigil eq '@' || $sigil eq '%' {
if $name ne "Nil" {
$!problems.add_worry(
$var,
$name eq $sigil
?? "Useless use of unnamed $sigil variable in sink context"
!! "Useless use of variable $name in sink context"
nqp::index(' $@%&', $sigil) < 1
?? "Useless use of $name symbol in sink context"
!! $sigil eq $name
?? "Useless use of unnamed $sigil variable in sink context"
!! "Useless use of $name in sink context"
);
return $NULL unless $!in_declaration; # XXX shouldn't need this
}
}

Expand Down

0 comments on commit 4b13795

Please sign in to comment.