/** The minimum set of functionality required for objects which are manipulated by JavaScript */
public class JS /*extends org.ibex.util.BalancedTree*/ implements Serializable {
+ public static final long serialVersionUID = 572634985343962922L;
public static boolean checkAssertions = false;
public static final Object METHOD = new Object();
return ((JSFunction)j)._cloneWithNewParentScope(s);
}
+ // HACK
+ public static Vec getFormalArgs(JS j) { return ((JSFunction)j).formalArgs; }
+
+ // HACK
+ public static JSScope getParentScope(JS j) { return ((JSFunction)j).parentScope; }
+
public static Object eval(JS j) throws JSExn {
Interpreter cx = new Interpreter((JSFunction)j, false, new JSArray(), false);
return cx.resume();
int size = 0; ///< the number of instruction/argument pairs
JSScope parentScope; ///< the default scope to use as a parent scope when executing this
-
+ Vec formalArgs = new Vec();
// Public //////////////////////////////////////////////////////////////////////////////
ret.arg = this.arg;
ret.line = this.line;
ret.size = this.size;
+ ret.formalArgs = this.formalArgs;
ret.numFormalArgs = this.numFormalArgs;
return ret;
}
if (peekToken() == NAME) {
consume(NAME); // a named argument
String varName = string;
-
+ b2.formalArgs.push(varName);
b2.add(parserLine, DUP); // dup the args array
b2.add(parserLine, GET, JS.N(numArgs - 1)); // retrieve it from the arguments array
b2.add(parserLine, TOPSCOPE);