Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Cheapen late-bound method lookup.
  • Loading branch information
jnthn committed Aug 1, 2014
1 parent 6923af7 commit 4b6a4af
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/how/NQPClassHOW.nqp
Expand Up @@ -717,20 +717,24 @@ knowhow NQPClassHOW {
my %meths := $_.HOW.method_table($obj);
if nqp::existskey(%meths, $name) {
my $found := %meths{$name};
return $!trace && !$no_trace && self.should_trace($obj, $name) ??
-> *@pos, *%named {
nqp::say(nqp::x(' ', $!trace_depth) ~ "Calling $name");
$!trace_depth := $!trace_depth + 1;
my $result := $found(|@pos, |%named);
$!trace_depth := $!trace_depth - 1;
$result
} !!
$found;
return $!trace && !$no_trace && self.should_trace($obj, $name)
?? self.make_tracer($name, $found)
!! $found;
}
}
nqp::null()
}

method make_tracer($name, $found) {
-> *@pos, *%named {
nqp::say(nqp::x(' ', $!trace_depth) ~ "Calling $name");
$!trace_depth := $!trace_depth + 1;
my $result := $found(|@pos, |%named);
$!trace_depth := $!trace_depth - 1;
$result
}
}

##
## Cache-related
##
Expand Down

0 comments on commit 4b6a4af

Please sign in to comment.