new js api
[org.ibex.core.git] / src / org / ibex / js / JSFunction.java
index 40a550d..020cb11 100644 (file)
@@ -60,7 +60,7 @@ class JSFunction extends JS implements ByteCodes, Tokens, Task {
     }
 
     /** Note: code gets run in an <i>unpauseable</i> context. */
-    public Object call(Object a0, Object a1, Object a2, Object[] rest, int nargs) throws JSExn {
+    public JS call(JS a0, JS a1, JS a2, JS[] rest, int nargs) throws JSExn {
         JSArray args = new JSArray();
         if (nargs > 0) args.addElement(a0);
         if (nargs > 1) args.addElement(a1);
@@ -103,7 +103,8 @@ class JSFunction extends JS implements ByteCodes, Tokens, Task {
 
     // Debugging //////////////////////////////////////////////////////////////////////
 
-    public String toString() { return "JSFunction [" + sourceName + ":" + firstLine + "]"; }
+    // FIXME: Put this back in
+    public String xtoString() { return "JSFunction [" + sourceName + ":" + firstLine + "]"; }
 
     String dump() { return dump(""); }
     private  String dump(String prefix) {
@@ -115,7 +116,7 @@ class JSFunction extends JS implements ByteCodes, Tokens, Task {
             if (op[i] < 0) sb.append(bytecodeToString[-op[i]]);
             else sb.append(codeToString[op[i]]);
             sb.append(" ");
-            sb.append(arg[i] == null ? "(no arg)" : arg[i]);
+            sb.append(arg[i] == null ? "(no arg)" : arg[i] instanceof JS ? JS.debugToString((JS)arg[i]) : arg[i]);
             if((op[i] == JF || op[i] == JT || op[i] == JMP) && arg[i] != null && arg[i] instanceof Number) {
                 sb.append(" jump to ").append(i+((Number) arg[i]).intValue());
             } else  if(op[i] == TRY) {