if (op == CALL) {
object = cx.stack.pop();
- } else if (object == JSCallable.METHOD) {
- method = cx.stack.pop();
- object = cx.stack.pop();
+ } else {
+ if (object == JSCallable.METHOD) {
+ method = cx.stack.pop();
+ object = cx.stack.pop();
+ } else {
+ cx.stack.pop();
+ cx.stack.pop();
+ }
}
if (object instanceof String || object instanceof Number || object instanceof Boolean) {
Object a2 = numArgs <= 2 ? null : cx.stack.pop();
Object a1 = numArgs <= 1 ? null : cx.stack.pop();
Object a0 = numArgs <= 0 ? null : cx.stack.pop();
- ret = c.callMethod(method, a0, a1, a2, rest, numArgs);
+ ret = method == null ? c.call(a0, a1, a2, rest, numArgs) : c.callMethod(method, a0, a1, a2, rest, numArgs);
} else {
throw new JS.Exn("can't call a " + object.getClass().getName() + " @" + cx.pc + "\n" + cx.f.dump());