Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Include class in method not found errors.
  • Loading branch information
jnthn committed Sep 25, 2013
1 parent 82ea40f commit 4280732
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/vm/jvm/runtime/org/perl6/nqp/runtime/IndyBootstrap.java
Expand Up @@ -356,7 +356,8 @@ public static void methcallResolve_noa(Lookup caller, MutableCallSite cs, String
SixModelObject invocant = (SixModelObject)args[0];
SixModelObject invokee = Ops.findmethod(invocant, name, tc);
if (invokee == null)
throw ExceptionHandling.dieInternal(tc, "Method '" + name + "' not found");
throw ExceptionHandling.dieInternal(tc,
"Method '" + name + "' not found for invocant of class '" + Ops.typeName(invocant, tc) + "'");
CodeRef cr;
if (invokee instanceof CodeRef) {
cr = (CodeRef)invokee;
Expand Down Expand Up @@ -460,7 +461,8 @@ public static void indmethcallInvoker_noa(MutableCallSite cs, int csIdx,
SixModelObject invocant = (SixModelObject)args[0];
SixModelObject invokee = Ops.findmethod(invocant, name, tc);
if (invokee == null)
throw ExceptionHandling.dieInternal(tc, "Method '" + name + "' not found");
throw ExceptionHandling.dieInternal(tc,
"Method '" + name + "' not found for invocant of class '" + Ops.typeName(invocant, tc) + "'");
CodeRef cr;
if (invokee instanceof CodeRef) {
cr = (CodeRef)invokee;
Expand Down
10 changes: 9 additions & 1 deletion src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -1778,6 +1778,7 @@ public static long captureposprimspec(SixModelObject obj, long idx, ThreadContex
public static final CallSiteDescriptor storeCallSite = new CallSiteDescriptor(new byte[] { CallSiteDescriptor.ARG_OBJ, CallSiteDescriptor.ARG_OBJ }, null);
public static final CallSiteDescriptor findmethCallSite = new CallSiteDescriptor(new byte[] { CallSiteDescriptor.ARG_OBJ, CallSiteDescriptor.ARG_OBJ, CallSiteDescriptor.ARG_STR }, null);
public static final CallSiteDescriptor typeCheckCallSite = new CallSiteDescriptor(new byte[] { CallSiteDescriptor.ARG_OBJ, CallSiteDescriptor.ARG_OBJ, CallSiteDescriptor.ARG_OBJ }, null);
public static final CallSiteDescriptor howObjCallSite = new CallSiteDescriptor(new byte[] { CallSiteDescriptor.ARG_OBJ, CallSiteDescriptor.ARG_OBJ }, null);
public static void invokeLexotic(SixModelObject invokee, CallSiteDescriptor csd, Object[] args, ThreadContext tc) {
LexoticException throwee = tc.theLexotic;
throwee.target = ((LexoticInstance)invokee).target;
Expand Down Expand Up @@ -2000,7 +2001,8 @@ public static SixModelObject findmethod(ThreadContext tc, SixModelObject invocan

SixModelObject meth = invocant.st.MethodCache.get(name);
if (meth == null)
throw ExceptionHandling.dieInternal(tc, "Method '" + name + "' not found");
throw ExceptionHandling.dieInternal(tc,
"Method '" + name + "' not found for invocant of class '" + typeName(invocant, tc) + "'");
return meth;
}
public static SixModelObject findmethod(SixModelObject invocant, String name, ThreadContext tc) {
Expand All @@ -2026,6 +2028,12 @@ public static SixModelObject findmethod(SixModelObject invocant, String name, Th
new Object[] { how, invocant, name });
return result_o(tc.curFrame);
}
public static String typeName(SixModelObject invocant, ThreadContext tc) {
SixModelObject how = invocant.st.HOW;
SixModelObject nameMeth = findmethod(tc, how, "name");
invokeDirect(tc, nameMeth, howObjCallSite, new Object[] { how, invocant });
return result_s(tc.curFrame);
}
public static long can(SixModelObject invocant, String name, ThreadContext tc) {
return findmethod(invocant, name, tc) == null ? 0 : 1;
}
Expand Down

0 comments on commit 4280732

Please sign in to comment.