Rhino.Optimizer.Codegen.CreateFunctionObject C# (CSharp) Method

CreateFunctionObject() public method

public CreateFunctionObject ( Context cx, Scriptable scope, object bytecode, object staticSecurityDomain ) : System.Function
cx Rhino.Context
scope Scriptable
bytecode object
staticSecurityDomain object
return System.Function
		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;
		}