2003/11/17 05:23:32
[org.ibex.core.git] / src / org / xwt / js / Interpreter.java
index a9ea8a3..c9bcd73 100644 (file)
@@ -241,9 +241,14 @@ class Interpreter implements ByteCodes, Tokens {
 
                 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) {
@@ -269,7 +274,7 @@ class Interpreter implements ByteCodes, Tokens {
                     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());