Permalink
Browse files

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...
1 parent f60a2c1 commit 2208156056007a0e889e6aa12df1c74db5a2dcbe @jnthn jnthn committed Jul 3, 2013
Showing with 13 additions and 3 deletions.
  1. +13 −3 src/core/CallFrame.pm
View
@@ -1,5 +1,4 @@
my class CallFrame {
- has Mu $!interp;
has Int $.level;
has %.annotations;
has %.my;
@@ -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
@@ -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;

0 comments on commit 2208156

Please sign in to comment.