+
+ static class JSArgs extends JS {
+ private final JS a0;
+ private final JS a1;
+ private final JS a2;
+ private final JS[] rest;
+ private final int nargs;
+ private final JS callee;
+
+ public JSArgs(JS callee) { this(null,null,null,null,0,callee); }
+ public JSArgs(JS a0, JS callee) { this(a0,null,null,null,1,callee); }
+ public JSArgs(JS a0, JS a1, JS a2, JS[] rest, int nargs, JS callee) {
+ this.a0 = a0; this.a1 = a1; this.a2 = a2;
+ this.rest = rest; this.nargs = nargs;
+ this.callee = callee;
+ }
+
+ public JS get(JS key) throws JSExn {
+ if(JS.isInt(key)) {
+ int n = JS.toInt(key);
+ switch(n) {
+ case 0: return a0;
+ case 1: return a1;
+ case 2: return a2;
+ default: return n>= 0 && n < nargs ? rest[n-3] : null;
+ }
+ }
+ //#switch(JS.toString(key))
+ case "callee": return callee;
+ case "length": return JS.N(nargs);
+ //#end
+ return super.get(key);
+ }
+ }