return Integer.parseInt(s);
}
- public Object callMethod(Object method, Object a0, Object a1, Object a2, Object[] rest, int nargs) {
+ public Object callMethod(Object method, Object a0, Object a1, Object a2, Object[] rest, int nargs) throws JSExn {
//#switch(method)
case "pop": return vec.pop();
case "reverse": return reverse();
return super.get(key);
}
- public void put(Object key, Object val) {
+ public void put(Object key, Object val) throws JSExn {
if (key.equals("length")) vec.setSize(toNumber(val).intValue());
int i = intVal(key);
if (i == Integer.MIN_VALUE) super.put(key, val);
return JS.toString(a).compareTo(JS.toString(b));
}
};
- private Object sort(Object tmp) {
+ private Object sort(Object tmp) throws JSExn {
if(tmp instanceof JS) {
final JSArray funcArgs = new JSArray(2);
final JS jsFunc = (JS) tmp;
vec.sort(new Vec.CompareFunc() {
public int compare(Object a, Object b) {
- funcArgs.setElementAt(a,0);
- funcArgs.setElementAt(b,1);
- return JS.toInt(jsFunc.call(a, b, null, null, 2));
+ try {
+ funcArgs.setElementAt(a,0);
+ funcArgs.setElementAt(b,1);
+ return JS.toInt(jsFunc.call(a, b, null, null, 2));
+ } catch (Exception e) {
+ // FIXME
+ throw new JSRuntimeExn(e.toString());
+ }
}
});
} else {