public static final Object METHOD = new Object();
public Object callMethod(Object method, Object a0, Object a1, Object a2, Object[] rest, int nargs) {
- throw new JS.Exn("attempted to call an undefined method");
+ if (method == null) return call(a0, a1, a2, rest, nargs);
+ Class c = this.getClass();
+ String descrip = c.getName();
+ if (c == Internal.JSCallableStub.class) {
+ descrip = ((Internal.JSCallableStub)this).obj.getClass().getName();
+ }
+ throw new JS.Exn("attempted to call an undefined method ("+method+") on a " + descrip);
}
public Object call(Object a0, Object a1, Object a2, Object[] rest, int nargs) {
- throw new JS.Exn("you cannot call this object");
+ Class c = this.getClass();
+ String descrip = c.getName();
+ if (c == Internal.JSCallableStub.class) {
+ descrip = ((Internal.JSCallableStub)this).obj.getClass().getName();
+ }
+ throw new JS.Exn("you cannot call this object (of type " + descrip + ")");
}
}