Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Can lower $/ and self also.
  • Loading branch information
jnthn committed Apr 3, 2014
1 parent d062aa3 commit a83cec1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/NQP/Optimizer.nqp
Expand Up @@ -91,9 +91,11 @@ class NQP::Optimizer {
unless nqp::existskey(%!usages_inner, $name) {
# Lowerable if it's a normal variable.
next if nqp::chars($name) < 2;
my str $sigil := nqp::substr($name, 0, 1);
next unless $sigil eq '$' || $sigil eq '@' || $sigil eq '%';
next unless nqp::iscclass(nqp::const::CCLASS_ALPHABETIC, $name, 1);
if $name ne 'self' && $name ne '$/' {
my str $sigil := nqp::substr($name, 0, 1);
next unless $sigil eq '$' || $sigil eq '@' || $sigil eq '%';
next unless nqp::iscclass(nqp::const::CCLASS_ALPHABETIC, $name, 1);
}

# Seems good; lower it.
my $new_name := $qast.unique('__lowered_lex');
Expand Down Expand Up @@ -271,7 +273,7 @@ class NQP::Optimizer {

method visit_var($var) {
my str $scope := $var.scope;
if $scope eq 'positional' || $scope eq 'associative' {
if $scope eq 'attribute' || $scope eq 'positional' || $scope eq 'associative' {
self.visit_children($var);
} else {
my int $top := nqp::elems(@!block_var_stack) - 1;
Expand Down

0 comments on commit a83cec1

Please sign in to comment.