Skip to content

Commit

Permalink
Start tracking variable usage a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Dec 17, 2012
1 parent f93e603 commit e960577
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Perl6/Grammar.pm
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,20 @@ role STD {
$var.CURSOR.add_mystery($varast.name, $var.to, 'var');
}
}
else {
my $lex := $*W.cur_lexpad();
my %sym := $lex.symbol($name);
if %sym {
%sym<used> := 1;
}
else {
# Add mention-only record (used to poison outer
# usages and disambiguate hashes/blocks by use of
# $_ when $*IMPLICIT is in force).
$lex<also_uses> := {} unless $lex<also_uses>;
$lex<also_uses>{$name} := 1;
}
}
}
self
}
Expand Down

0 comments on commit e960577

Please sign in to comment.