super.put(key,val);
}
- public JS callMethod(JS method, JS a0, JS a1, JS a2, JS[] rest, int nargs) throws JSExn {
+ public JS call(JS method, JS[] args) throws JSExn {
if(!Script.isString(method)) return null;
if("print".equals(Script.toString(method))) {
- System.out.println(Script.str(a0));
+ System.out.println(Script.str(args[0]));
return null;
}
- if("clone".equals(Script.toString(method))) return a0 == null ? null : new JS.Clone(a0);
+ if("clone".equals(Script.toString(method)))
+ return args.length < 1 || args[0] == null ? null : new JS.Clone(args[0]);
if("firethis".equals(Script.toString(method))) {
- String action = Script.toString(a0);
- JS target = a1;
- JS key = a2;
- if(action.equals("get")) return a1.getAndTriggerTraps(key);
- else if(action.equals("put")) a1.putAndTriggerTraps(key,Script.S("some value"));
+ String action = Script.toString(args[0]);
+ JS target = args[1];
+ JS key = args[2];
+ if(action.equals("get")) return args[1].getAndTriggerTraps(key);
+ else if(action.equals("put")) args[1].putAndTriggerTraps(key,Script.S("some value"));
else if(action.equals("trigger")) return target.justTriggerTraps(key,Script.S("some trigger value"));
return null;
}