Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement CallFrame.
Seems line number is off by one, but works otherwise. Unbusts 3 test
files, two of which pass in full, one with one failure.
  • Loading branch information
jnthn committed Jul 3, 2013
1 parent f60a2c1 commit 2208156
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/core/CallFrame.pm
@@ -1,5 +1,4 @@
my class CallFrame {
has Mu $!interp;
has Int $.level;
has %.annotations;
has %.my;
Expand All @@ -8,7 +7,6 @@ my class CallFrame {
my $self := nqp::create(CallFrame);
#?if parrot
my Mu $interp := pir::getinterp__P;
nqp::bindattr($self, CallFrame, '$!interp', pir::getinterp__P);
nqp::bindattr($self, CallFrame, '%!annotations',
Q:PIR {
.local pmc interp, annon
Expand Down Expand Up @@ -39,7 +37,19 @@ my class CallFrame {
nqp::bindattr($self, CallFrame, '%!my', $h);
#?endif
#?if !parrot
die "CallFrame NYI on JVM backend";
my $i = $l;
my Mu $ctx := nqp::ctx();
while $i-- {
$ctx := nqp::ctxcaller($ctx);
}
my $h := nqp::create(EnumMap);
nqp::bindattr($h, EnumMap, '$!storage', $ctx);
nqp::bindattr($self, CallFrame, '%!my', $h);

my $e := nqp::handle(nqp::die(''), 'CATCH', nqp::exception());
my $bt := nqp::backtrace($e);
nqp::bindattr($self, CallFrame, '%!annotations',
nqp::hllize(nqp::atkey(nqp::atpos($bt, $l), 'annotations')));
#?endif

$self;
Expand Down

0 comments on commit 2208156

Please sign in to comment.