This provides functionality similar to JSObjectMakeFunctionWithCallback() and JSObjectMakeConstructor() in the JSC C API.
Implementing this feature also requires implementing the QScriptContext class (see http://doc.trolltech.com/latest/qscriptcontext.html), which provides the arguments, callee and this-object for a particular invocation of the function.
In QtScript, the same type of callback is used for both normal functions and constructors; QScriptContext::isCalledAsConstructor() can be used to query whether the function was called as a constructor (e.g. as operand to "new").
I'm working on this one, but have no permissions to set the "Assigned To" field.
Following Jedrzej suggestion, I'm going to split this in smaller tasks (bugs), and make them all depend on this bug.
What I want is to split up the QScriptContext parts from the "callback" support (bug 42174), since the former may need some extensions on the JSC C API.
Porting QtScript API over JSC C API will not be continued.