Skip to content

Commit

Permalink
Implement nqp::p6bindcaptosig.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jun 21, 2013
1 parent dddf4d1 commit e742323
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vm/jvm/runtime/org/perl6/rakudo/Binder.java
Expand Up @@ -465,7 +465,7 @@ else if ((paramFlags & SIG_ELEM_HASH_SIGIL) != 0) {
CallSiteDescriptor.ARG_OBJ | CallSiteDescriptor.ARG_FLAT,
CallSiteDescriptor.ARG_OBJ | CallSiteDescriptor.ARG_FLAT | CallSiteDescriptor.ARG_NAMED
}, null);
private static CallSiteDescriptor explodeCapture(ThreadContext tc, Ops.GlobalExt gcx, SixModelObject capture) {
public static CallSiteDescriptor explodeCapture(ThreadContext tc, Ops.GlobalExt gcx, SixModelObject capture) {
capture = org.perl6.nqp.runtime.Ops.decont(capture, tc);

SixModelObject capType = gcx.Capture;
Expand Down
18 changes: 18 additions & 0 deletions src/vm/jvm/runtime/org/perl6/rakudo/Ops.java
Expand Up @@ -278,6 +278,24 @@ public static CallSiteDescriptor p6bindsig(ThreadContext tc, CallSiteDescriptor
return csd;
}

public static SixModelObject p6bindcaptosig(SixModelObject sig, SixModelObject cap, ThreadContext tc) {
CallFrame cf = tc.curFrame;

GlobalExt gcx = key.getGC(tc);
CallSiteDescriptor csd = Binder.explodeCapture(tc, gcx, cap);
SixModelObject params = sig.get_attribute_boxed(tc, gcx.Signature,
"$!params", HINT_SIG_PARAMS);

String[] error = new String[1];
switch (Binder.bind(tc, gcx, cf, params, csd, tc.flatArgs, false, error)) {
case Binder.BIND_RESULT_FAIL:
case Binder.BIND_RESULT_JUNCTION:
throw ExceptionHandling.dieInternal(tc, error[0]);
default:
return sig;
}
}

public static long p6isbindable(SixModelObject signature, SixModelObject capture, ThreadContext tc) {
/* TODO */
if (DEBUG_MODE)
Expand Down

0 comments on commit e742323

Please sign in to comment.