Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement accepts_type handling.
This is the primitive that makes things like subset types work.
  • Loading branch information
jnthn committed Jun 23, 2013
1 parent 7fa12e2 commit cf6cfb3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -1830,7 +1830,12 @@ public static long istype(SixModelObject obj, SixModelObject type, ThreadContext

/* If the flag to call .accepts_type on the target value is set, do so. */
if ((typeCheckMode & STable.TYPE_CHECK_NEEDS_ACCEPTS) != 0) {
throw new RuntimeException("Type accepts method fallback NYI");
SixModelObject atMeth = findmethod(type.st.HOW, "accepts_type", tc);
if (atMeth == null)
throw ExceptionHandling.dieInternal(tc,
"Expected accepts_type method, but none found in meta-object");
invokeDirect(tc, atMeth, typeCheckCallSite, new Object[] { obj.st.HOW, type, obj });
return istrue(result_o(tc.curFrame), tc);
}

/* If we get here, type check failed. */
Expand Down

0 comments on commit cf6cfb3

Please sign in to comment.