Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement p6getouterctx op.
  • Loading branch information
jnthn committed Jun 30, 2013
1 parent 2fb22ef commit 85a4d9a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/vm/jvm/runtime/org/perl6/rakudo/Ops.java
Expand Up @@ -4,6 +4,7 @@
import java.util.Comparator;
import org.perl6.nqp.runtime.*;
import org.perl6.nqp.sixmodel.*;
import org.perl6.nqp.sixmodel.reprs.ContextRefInstance;
import org.perl6.nqp.sixmodel.reprs.LexoticInstance;
import org.perl6.nqp.sixmodel.reprs.VMArrayInstance;

Expand Down Expand Up @@ -446,6 +447,17 @@ public static SixModelObject p6capturelex(SixModelObject codeObj, ThreadContext
return codeObj;
}

public static SixModelObject p6getouterctx(SixModelObject codeObj, ThreadContext tc) {
GlobalExt gcx = key.getGC(tc);
codeObj = org.perl6.nqp.runtime.Ops.decont(codeObj, tc);
CodeRef closure = (CodeRef)codeObj.get_attribute_boxed(tc,
gcx.Code, "$!do", HINT_CODE_DO);
SixModelObject ContextRef = tc.gc.ContextRef;
SixModelObject wrap = ContextRef.st.REPR.allocate(tc, ContextRef.st);
((ContextRefInstance)wrap).context = closure.outer;
return wrap;
}

public static SixModelObject p6captureouters(SixModelObject capList, ThreadContext tc) {
GlobalExt gcx = key.getGC(tc);
CallFrame cf = tc.curFrame;
Expand Down

0 comments on commit 85a4d9a

Please sign in to comment.