- public Object callMethod(Object method, Object a0, Object a1, Object a2, Object[] rest, int nargs) throws JSExn {
- switch(nargs) {
- case 0: {
- //#switch(method)
- case "stringFromCharCode":
- char buf[] = new char[nargs];
- for(int i=0; i<nargs; i++) buf[i] = (char)(JS.toInt(i==0?a0:i==1?a1:i==2?a2:rest[i-3]) & 0xffff);
- return new String(buf);
- //#end
- break;
- }
- case 1: {
- //#switch(method)
- case "parseInt": return parseInt(a0, N(0));
- case "isNaN": { double d = toDouble(a0); return d == d ? F : T; }
- case "isFinite": { double d = toDouble(a0); return (d == d && !Double.isInfinite(d)) ? T : F; }
- case "decodeURI": throw new JSExn("unimplemented");
- case "decodeURIComponent": throw new JSExn("unimplemented");
- case "encodeURI": throw new JSExn("unimplemented");
- case "encodeURIComponent": throw new JSExn("unimplemented");
- case "escape": throw new JSExn("unimplemented");
- case "unescape": throw new JSExn("unimplemented");
- //#end
- break;
- }
- case 2: {
- //#switch(method)
- case "parseInt": return parseInt(a0, a1);
- //#end
- break;
- }
- }
- return super.callMethod(method, a0, a1, a2, rest, nargs);
+ public JS callMethod(JS method, JS a0, JS a1, JS a2, JS[] rest, int nargs) throws JSExn {
+ //#switch(JS.toString(method))
+ case "parseInt": return parseInt(a0, N(0));
+ case "parseFloat": return parseFloat(a0);
+ case "isJS.NaN": { double d = JS.toDouble(a0); return d == d ? JS.F : JS.T; }
+ case "isFinite": { double d = JS.toDouble(a0); return (d == d && !Double.isInfinite(d)) ? JS.T : JS.F; }
+ case "decodeURI": throw new JSExn("unimplemented");
+ case "decodeURIComponent": throw new JSExn("unimplemented");
+ case "encodeURI": throw new JSExn("unimplemented");
+ case "encodeURIComponent": throw new JSExn("unimplemented");
+ case "escape": throw new JSExn("unimplemented");
+ case "unescape": throw new JSExn("unimplemented");
+ case "parseInt": return parseInt(a0, a1);
+ default: return super.callMethod(method, a0, a1, a2, rest, nargs);
+ //#end
+ return super.callMethod(method,a0,a1,a2,rest,nargs);