// Fields and Accessors ///////////////////////////////////////////////
/** the number of formal arguments */
- int numFormalArgs = 0;
+ int numFormalArgs = 20;
/** the source code file that this block was drawn from */
String sourceName;
ret.arg = this.arg;
ret.line = this.line;
ret.size = this.size;
+ ret.numFormalArgs = this.numFormalArgs;
return ret;
}
// Invoking the Bytecode ///////////////////////////////////////////////////////
/** returns false if the thread has been paused */
- static void eval(final JS.Thread cx) throws JS.Exn {
- OUTER: for(; cx.currentCompiledFunction == null || cx.pc<((CompiledFunctionImpl)cx.currentCompiledFunction).size; cx.pc++) {
+ static Object eval(final JS.Thread cx) throws JS.Exn {
+ OUTER: for(;; cx.pc++) {
try {
- if (cx.paused || cx.currentCompiledFunction == null) return;
+ if (cx.paused) return null;
+ cx.bind();
if (cx.tailCallFunction != null) {
cx.stack.pop(); // discard actual return value
cx.pc -= 2;
cx.scope = new FunctionScope("unknown", cx.currentCompiledFunction.parentScope);
cx.pc = 0;
}
+ if (cx.currentCompiledFunction == null) return cx.stack.pop();
+ if (cx.pc >= ((CompiledFunctionImpl)cx.currentCompiledFunction).size) return cx.stack.pop();
String label = null;
int curOP = cx.currentCompiledFunction.op[cx.pc];
Object curArg = cx.currentCompiledFunction.arg[cx.pc];
throw e;
} // end try/catch
} // end for
- // this should never happen, we will ALWAYS have a RETURN at the end of the func
- throw new Error("Just fell out of CompiledFunction::eval() loop.");
}
// Debugging //////////////////////////////////////////////////////////////////////