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 Object run(Object o) throws JSExn { return call(null); }
+ public Object run(Object o) throws JSExn { return call(null, 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);
return JSU.N(size());
case "splice": return splice(args);
//#end
-
throw new JSExn("arrays have no function: "+JSU.str(method));
}
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; }
}