better JSArray.sort() exception handling
[org.ibex.core.git] / src / org / ibex / js / JS.java
index 96ab988..a81c419 100644 (file)
@@ -28,7 +28,6 @@ public abstract class JS {
         throw new JSExn("method not found (" + JS.debugToString(method) + ")");
     }
     
-    // FIXME: JSArgs objects, pointers into stack frame
     public JS call(JS a0, JS a1, JS a2, JS[] rest, int nargs) throws JSExn {
         throw new JSExn("you cannot call this object (class=" + this.getClass().getName() +")");
     }
@@ -42,6 +41,7 @@ public abstract class JS {
     Trap getTrap(JS key) { return null; }
     void putTrap(JS key, Trap value) throws JSExn { throw new JSExn("traps cannot be placed on this object (class=" + this.getClass().getName() +")"); }
     String coerceToString() throws JSExn { throw new JSExn("can't coerce to a string (class=" + getClass().getName() +")"); }
+    String debugToString() { return "[class=" + getClass().getName() + "]"; }
     boolean jsequals(JS o) { return this == o; }
     
     public static class O extends JS {
@@ -209,7 +209,7 @@ public abstract class JS {
     
     public static String debugToString(JS o) {
         try { return toString(o); }
-        catch(JSExn e) { return "[class=" + o.getClass().getName() + "]"; }
+        catch(JSExn e) { return o.debugToString(); }
     }
     
     public static boolean isInt(JS o) {