// You may not use this file except in compliance with the License.
package org.ibex.js;
+import org.ibex.util.*;
/** A JavaScript function, compiled into bytecode */
-class JSFunction extends JS.Immutable implements ByteCodes, Tokens {
+class JSFunction extends JS.Immutable implements ByteCodes, Tokens, Pausable {
private static final JS[] emptyArgs = new JS[0];
// Fields and Accessors ///////////////////////////////////////////////
// Public //////////////////////////////////////////////////////////////////////////////
- // FIXME: what needs to be syncrhonized (if anything)?
private Interpreter runner = null;
public Object run(Object o) throws JSExn {
if (runner == null) runner = new Interpreter(this, true, emptyArgs);
return ret;
}
- public JS call(JS[] args) throws JSExn { return (JS)new Interpreter(this, false, args).run(null); }
+ public JS call(JS method, JS[] args) throws JSExn {
+ if (method != null) return super.call(method, args);
+ return (JS)new Interpreter(this, false, args).run(null); }
JSScope getParentScope() { return parentScope; }