Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Eliminate getprop/setprop usage.
  • Loading branch information
jnthn committed Feb 27, 2013
1 parent 6613df0 commit 9acc219
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/HLL/Compiler.pm
Expand Up @@ -480,6 +480,7 @@ class HLL::Compiler does HLL::Backend::Default {

method compile($source, :$from, *%adverbs) {
my %*COMPILING<%?OPTIONS> := %adverbs;
my $*LINEPOSCACHE;

my $target := nqp::lc(%adverbs<target>);
my $result := $source;
Expand Down Expand Up @@ -656,16 +657,16 @@ class HLL::Compiler does HLL::Backend::Default {
}

method lineof($target, int $pos, int :$cache = 0) {
my $linepos := nqp::null();
my $linepos;
if $cache {
# if we've previously cached c<linepos> for target, we use it.
$linepos := pir::getprop__PPs($target, '!linepos');
$linepos := $*LINEPOSCACHE;
}
if nqp::isnull($linepos) {
unless nqp::defined($linepos) {
# calculate a new linepos array.
$linepos := nqp::list_i();
if $cache {
pir::setprop__0PsP($target, '!linepos', $linepos);
$*LINEPOSCACHE := $linepos;
}
my str $s := ~$target;
my int $eos := nqp::chars($s);
Expand Down

0 comments on commit 9acc219

Please sign in to comment.