remove more Pausable stuff
[org.ibex.js.git] / src / org / ibex / js / JSArray.java
index 8e2fdd2..dd2aecd 100644 (file)
@@ -8,7 +8,7 @@ import java.io.InputStream;
 import org.ibex.util.*; 
 
 /** A JavaScript JSArray */
-class JSArray extends Basket.Array implements JS, Basket.CompareFunc {
+public class JSArray extends Basket.Array implements JS, Basket.CompareFunc {
     private static final JS.Method METHOD = new JS.Method();
     private static final String[] empty = new String[0];
 
@@ -54,20 +54,10 @@ class JSArray extends Basket.Array implements JS, Basket.CompareFunc {
         size(i + 1); while (size() < i) add(null);
         set(i, val);
     }
-    public InputStream getInputStream() { return null; }
 
     public String[] getFormalArgs() { return empty; }
     public String coerceToString() { return "array"; } // FIXME
 
-    public boolean hasKey(JS key) {
-        if (key == null || !(key instanceof JSNumber.I)) return false;
-        int i = ((JSNumber.I)key).toInt();
-        return 0 <= i && i < size();
-    }
-
-    public Object run(Object o) throws JSExn { return call(null); }
-    public void pause() throws NotPausableException { throw new NotPausableException(); }
-    public JS call(JS[] args) throws JSExn { throw new JSExn("can not call an array as a function"); }
     public JS call(JS method, JS[] args) throws JSExn {
         //#switch(JSU.str(method))
         case "pop": return size() == 0 ? null : (JS)remove(size() - 1);
@@ -86,7 +76,6 @@ class JSArray extends Basket.Array implements JS, Basket.CompareFunc {
             return JSU.N(size());
         case "splice": return splice(args);
         //#end
-
         throw new JSExn("arrays have no function: "+JSU.str(method));
     }
 
@@ -188,7 +177,7 @@ class JSArray extends Basket.Array implements JS, Basket.CompareFunc {
     public int compare(Object a, Object b) throws JSExn.Wrapper {
         try {
             sortargs[0] = (JS)a; sortargs[1] = (JS)b;
-            return JSU.toInt(sort.call(sortargs));
+            return JSU.toInt(sort.call(null, sortargs));
         } catch (JSExn e) { throw new JSExn.Wrapper(e);
         } finally { sortargs[0] = null; sortargs[1] = null; }
     }