- public JS callMethod(JS method, JS a0, JS a1, JS a2, JS[] rest, int nargs) throws JSExn {
- #switch(JS.str(method))
- case "parseInt": return parseInt(a0, N(0));
- case "parseFloat": return parseFloat(a0);
- 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");
- case "parseInt": return parseInt(a0, a1);
- #end
- return super.callMethod(method, a0, a1, a2, rest, nargs);
+ public JS call(JS method, JS[] args) throws JSExn {
+ switch(args.length) {
+ case 0: {
+ //#jsswitch(method)
+ case "stringFromCharCode":
+ char buf[] = new char[args.length];
+ for(int i=0; i<args.length; i++) buf[i] = (char)(JSU.toInt(args[i]) & 0xffff);
+ return JSU.S(new String(buf));
+ //#end
+ break;
+ }
+ case 1: {
+ //#jsswitch(method)
+ case "parseInt": return parseInt(args[0], JSU.N(0));
+ case "isNaN": { double d = JSU.toDouble(args[0]); return d == d ? JSU.F : JSU.T; }
+ case "isFinite": { double d = JSU.toDouble(args[0]); return (d==d && !Double.isInfinite(d)) ? JSU.T : JSU.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: {
+ //#jsswitch(method)
+ case "parseInt": return parseInt(args[0], args[1]);
+ //#end
+ break;
+ }
+ }
+ return super.call(method, args);