pausecount++;
switch(f.op[pc]) {
case Tokens.RETURN: case ByteCodes.PUT: get = false; break;
- case ByteCodes.GET: case ByteCodes.CALL: get = true; break;
+ case ByteCodes.GET: case ByteCodes.GET_PRESERVE: case ByteCodes.CALLMETHOD: case ByteCodes.CALL: get = true; break;
default: throw new Error("paused on unexpected bytecode: " + f.op[pc]);
}
}
case BREAK:
case CONTINUE:
while(!stack.empty()) {
- JS o = (JS)stack.pop();
+ Object o = stack.pop();
if (o instanceof CallMarker) je("break or continue not within a loop");
if (o instanceof TryMarker) {
if(((TryMarker)o).finallyLoc < 0) continue; // no finally block, keep going
if (object instanceof JSFunction) {
stack.push(new CallMarker(this));
- stack.push(jsargs);
f = (JSFunction)object;
+ stack.push(new JSArgs(jsargs, f));
scope = f.parentScope;
pc = -1;
break;
public JSArgs(JS[] args, JS callee) { this.args = args; this.callee = callee; }
public JS get(JS key) throws JSExn {
- if(JSU.isInt(key)) return args[JSU.toInt(key)];
+ if(JSU.isInt(key)) {
+ int i = JSU.toInt(key);
+ return i>=args.length ? null : args[i];
+ }
//#switch(JSU.toString(key))
case "callee": return callee;
case "length": return JSU.N(args.length);