/** * Constructor for constructors implemented in Java * * @param factory factory instance that is able to create new objects * @param factoryTypeId instance type id, used by the factory * @param prototype the prototype object * @param index the ID of the function call, used in evalNative * @param parCount */ public JsFunction(JsObjectFactory factory, int factoryTypeId, JsObject prototype, int nativeId, int parCount) : this(nativeId, parCount) { this.prototype = prototype; this.factory = factory; this.factoryTypeId = factoryTypeId; }
/** * Creates a new function from the given function literal and context. */ public JsFunction(JsFunction literal, JsObject context) : base(literal.__proto__) { this.byteCode = literal.byteCode; this.context = context; this.functionLiterals = literal.functionLiterals; this.localNames = literal.localNames; this.numberLiterals = literal.numberLiterals; this.expectedParameterCount = literal.expectedParameterCount; this.prototype = literal.prototype; this.stringLiterals = literal.stringLiterals; this.varCount = literal.varCount; this.factory = JsSystem.getInstance(); this.factoryTypeId = JsSystem.FACTORY_ID_OBJECT; this.lineNumbers = literal.lineNumbers; }