public virtual Function CreateFunctionObject(Context cx, Scriptable scope, object bytecode, object staticSecurityDomain)
{
Type cl = DefineClass(bytecode, staticSecurityDomain);
NativeFunction f;
try
{
ConstructorInfo<object> ctor = cl.GetConstructors()[0];
object[] initArgs = new object[] { scope, cx, Sharpen.Extensions.ValueOf(0) };
f = (NativeFunction)ctor.NewInstance(initArgs);
}
catch (Exception ex)
{
throw new Exception("Unable to instantiate compiled class:" + ex.ToString());
}
return f;
}