Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make invoke handling the invocation protocol.
  • Loading branch information
jnthn committed Feb 1, 2013
1 parent 78376f6 commit cf03bd9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -897,9 +897,19 @@ public static void invoke(ThreadContext tc, SixModelObject invokee, int callsite
}

// Otherwise, get the code ref.
if (!(invokee instanceof CodeRef))
throw new Exception("Can only invoke direct CodeRefs so far");
CodeRef cr = (CodeRef)invokee;
CodeRef cr;
if (invokee instanceof CodeRef) {
cr = (CodeRef)invokee;
}
else {
InvocationSpec is = invokee.st.InvocationSpec;
if (is == null)
throw new Exception("Can not invoke this object");
if (is.ClassHandle != null)
cr = (CodeRef)invokee.get_attribute_boxed(tc, is.ClassHandle, is.AttrName, is.Hint);
else
cr = (CodeRef)is.InvocationHandler;
}
StaticCodeInfo sci = cr.staticInfo;

// Create a new call frame and set caller and callsite.
Expand Down

0 comments on commit cf03bd9

Please sign in to comment.